-
Notifications
You must be signed in to change notification settings - Fork 40
/
client.go
64 lines (54 loc) · 2.58 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
package v2021_07_01
// 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/purview/2021-07-01/account"
"github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/defaultaccount"
"github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privateendpointconnection"
"github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/privatelinkresource"
"github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/provider"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
Account *account.AccountClient
DefaultAccount *defaultaccount.DefaultAccountClient
PrivateEndpointConnection *privateendpointconnection.PrivateEndpointConnectionClient
PrivateLinkResource *privatelinkresource.PrivateLinkResourceClient
Provider *provider.ProviderClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
accountClient, err := account.NewAccountClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Account client: %+v", err)
}
configureFunc(accountClient.Client)
defaultAccountClient, err := defaultaccount.NewDefaultAccountClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building DefaultAccount client: %+v", err)
}
configureFunc(defaultAccountClient.Client)
privateEndpointConnectionClient, err := privateendpointconnection.NewPrivateEndpointConnectionClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateEndpointConnection client: %+v", err)
}
configureFunc(privateEndpointConnectionClient.Client)
privateLinkResourceClient, err := privatelinkresource.NewPrivateLinkResourceClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateLinkResource client: %+v", err)
}
configureFunc(privateLinkResourceClient.Client)
providerClient, err := provider.NewProviderClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Provider client: %+v", err)
}
configureFunc(providerClient.Client)
return &Client{
Account: accountClient,
DefaultAccount: defaultAccountClient,
PrivateEndpointConnection: privateEndpointConnectionClient,
PrivateLinkResource: privateLinkResourceClient,
Provider: providerClient,
}, nil
}