-
Notifications
You must be signed in to change notification settings - Fork 40
/
client.go
100 lines (86 loc) · 4.01 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
package v2022_06_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/datadog/2022-06-01/agreements"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/apikey"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/hosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/linkedresources"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/monitoredresources"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/monitorsresource"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/refreshsetpasswordlink"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/rules"
"github.com/hashicorp/go-azure-sdk/resource-manager/datadog/2022-06-01/singlesignon"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
Agreements *agreements.AgreementsClient
ApiKey *apikey.ApiKeyClient
Hosts *hosts.HostsClient
LinkedResources *linkedresources.LinkedResourcesClient
MonitoredResources *monitoredresources.MonitoredResourcesClient
MonitorsResource *monitorsresource.MonitorsResourceClient
RefreshSetPasswordLink *refreshsetpasswordlink.RefreshSetPasswordLinkClient
Rules *rules.RulesClient
SingleSignOn *singlesignon.SingleSignOnClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
agreementsClient, err := agreements.NewAgreementsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Agreements client: %+v", err)
}
configureFunc(agreementsClient.Client)
apiKeyClient, err := apikey.NewApiKeyClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ApiKey client: %+v", err)
}
configureFunc(apiKeyClient.Client)
hostsClient, err := hosts.NewHostsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Hosts client: %+v", err)
}
configureFunc(hostsClient.Client)
linkedResourcesClient, err := linkedresources.NewLinkedResourcesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building LinkedResources client: %+v", err)
}
configureFunc(linkedResourcesClient.Client)
monitoredResourcesClient, err := monitoredresources.NewMonitoredResourcesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building MonitoredResources client: %+v", err)
}
configureFunc(monitoredResourcesClient.Client)
monitorsResourceClient, err := monitorsresource.NewMonitorsResourceClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building MonitorsResource client: %+v", err)
}
configureFunc(monitorsResourceClient.Client)
refreshSetPasswordLinkClient, err := refreshsetpasswordlink.NewRefreshSetPasswordLinkClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building RefreshSetPasswordLink client: %+v", err)
}
configureFunc(refreshSetPasswordLinkClient.Client)
rulesClient, err := rules.NewRulesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Rules client: %+v", err)
}
configureFunc(rulesClient.Client)
singleSignOnClient, err := singlesignon.NewSingleSignOnClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building SingleSignOn client: %+v", err)
}
configureFunc(singleSignOnClient.Client)
return &Client{
Agreements: agreementsClient,
ApiKey: apiKeyClient,
Hosts: hostsClient,
LinkedResources: linkedResourcesClient,
MonitoredResources: monitoredResourcesClient,
MonitorsResource: monitorsResourceClient,
RefreshSetPasswordLink: refreshSetPasswordLinkClient,
Rules: rulesClient,
SingleSignOn: singleSignOnClient,
}, nil
}