-
Notifications
You must be signed in to change notification settings - Fork 43
/
client.go
127 lines (110 loc) · 6.29 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package v2021_06_01_preview
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
import (
"fmt"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/migrationconfigs"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics"
"github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
DisasterRecoveryConfigs *disasterrecoveryconfigs.DisasterRecoveryConfigsClient
MigrationConfigs *migrationconfigs.MigrationConfigsClient
Namespaces *namespaces.NamespacesClient
NamespacesAuthorizationRule *namespacesauthorizationrule.NamespacesAuthorizationRuleClient
NamespacesPrivateEndpointConnections *namespacesprivateendpointconnections.NamespacesPrivateEndpointConnectionsClient
NamespacesPrivateLinkResources *namespacesprivatelinkresources.NamespacesPrivateLinkResourcesClient
Queues *queues.QueuesClient
QueuesAuthorizationRule *queuesauthorizationrule.QueuesAuthorizationRuleClient
Rules *rules.RulesClient
Subscriptions *subscriptions.SubscriptionsClient
Topics *topics.TopicsClient
TopicsAuthorizationRule *topicsauthorizationrule.TopicsAuthorizationRuleClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
disasterRecoveryConfigsClient, err := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building DisasterRecoveryConfigs client: %+v", err)
}
configureFunc(disasterRecoveryConfigsClient.Client)
migrationConfigsClient, err := migrationconfigs.NewMigrationConfigsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building MigrationConfigs client: %+v", err)
}
configureFunc(migrationConfigsClient.Client)
namespacesAuthorizationRuleClient, err := namespacesauthorizationrule.NewNamespacesAuthorizationRuleClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NamespacesAuthorizationRule client: %+v", err)
}
configureFunc(namespacesAuthorizationRuleClient.Client)
namespacesClient, err := namespaces.NewNamespacesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Namespaces client: %+v", err)
}
configureFunc(namespacesClient.Client)
namespacesPrivateEndpointConnectionsClient, err := namespacesprivateendpointconnections.NewNamespacesPrivateEndpointConnectionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NamespacesPrivateEndpointConnections client: %+v", err)
}
configureFunc(namespacesPrivateEndpointConnectionsClient.Client)
namespacesPrivateLinkResourcesClient, err := namespacesprivatelinkresources.NewNamespacesPrivateLinkResourcesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NamespacesPrivateLinkResources client: %+v", err)
}
configureFunc(namespacesPrivateLinkResourcesClient.Client)
queuesAuthorizationRuleClient, err := queuesauthorizationrule.NewQueuesAuthorizationRuleClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building QueuesAuthorizationRule client: %+v", err)
}
configureFunc(queuesAuthorizationRuleClient.Client)
queuesClient, err := queues.NewQueuesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Queues client: %+v", err)
}
configureFunc(queuesClient.Client)
rulesClient, err := rules.NewRulesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Rules client: %+v", err)
}
configureFunc(rulesClient.Client)
subscriptionsClient, err := subscriptions.NewSubscriptionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Subscriptions client: %+v", err)
}
configureFunc(subscriptionsClient.Client)
topicsAuthorizationRuleClient, err := topicsauthorizationrule.NewTopicsAuthorizationRuleClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building TopicsAuthorizationRule client: %+v", err)
}
configureFunc(topicsAuthorizationRuleClient.Client)
topicsClient, err := topics.NewTopicsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Topics client: %+v", err)
}
configureFunc(topicsClient.Client)
return &Client{
DisasterRecoveryConfigs: disasterRecoveryConfigsClient,
MigrationConfigs: migrationConfigsClient,
Namespaces: namespacesClient,
NamespacesAuthorizationRule: namespacesAuthorizationRuleClient,
NamespacesPrivateEndpointConnections: namespacesPrivateEndpointConnectionsClient,
NamespacesPrivateLinkResources: namespacesPrivateLinkResourcesClient,
Queues: queuesClient,
QueuesAuthorizationRule: queuesAuthorizationRuleClient,
Rules: rulesClient,
Subscriptions: subscriptionsClient,
Topics: topicsClient,
TopicsAuthorizationRule: topicsAuthorizationRuleClient,
}, nil
}