-
Notifications
You must be signed in to change notification settings - Fork 40
/
client.go
100 lines (86 loc) · 4.75 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 v2018_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/postgresql/2018-06-01/advisors"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privateendpointconnections"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/privatelinkresources"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/querytexts"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/recommendedactions"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/recommendedactionsessions"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/resetqueryperformanceinsightdata"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/topquerystatistics"
"github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2018-06-01/waitstatistics"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
Advisors *advisors.AdvisorsClient
PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient
PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient
QueryTexts *querytexts.QueryTextsClient
RecommendedActionSessions *recommendedactionsessions.RecommendedActionSessionsClient
RecommendedActions *recommendedactions.RecommendedActionsClient
ResetQueryPerformanceInsightData *resetqueryperformanceinsightdata.ResetQueryPerformanceInsightDataClient
TopQueryStatistics *topquerystatistics.TopQueryStatisticsClient
WaitStatistics *waitstatistics.WaitStatisticsClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
advisorsClient, err := advisors.NewAdvisorsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Advisors client: %+v", err)
}
configureFunc(advisorsClient.Client)
privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err)
}
configureFunc(privateEndpointConnectionsClient.Client)
privateLinkResourcesClient, err := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateLinkResources client: %+v", err)
}
configureFunc(privateLinkResourcesClient.Client)
queryTextsClient, err := querytexts.NewQueryTextsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building QueryTexts client: %+v", err)
}
configureFunc(queryTextsClient.Client)
recommendedActionSessionsClient, err := recommendedactionsessions.NewRecommendedActionSessionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building RecommendedActionSessions client: %+v", err)
}
configureFunc(recommendedActionSessionsClient.Client)
recommendedActionsClient, err := recommendedactions.NewRecommendedActionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building RecommendedActions client: %+v", err)
}
configureFunc(recommendedActionsClient.Client)
resetQueryPerformanceInsightDataClient, err := resetqueryperformanceinsightdata.NewResetQueryPerformanceInsightDataClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ResetQueryPerformanceInsightData client: %+v", err)
}
configureFunc(resetQueryPerformanceInsightDataClient.Client)
topQueryStatisticsClient, err := topquerystatistics.NewTopQueryStatisticsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building TopQueryStatistics client: %+v", err)
}
configureFunc(topQueryStatisticsClient.Client)
waitStatisticsClient, err := waitstatistics.NewWaitStatisticsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building WaitStatistics client: %+v", err)
}
configureFunc(waitStatisticsClient.Client)
return &Client{
Advisors: advisorsClient,
PrivateEndpointConnections: privateEndpointConnectionsClient,
PrivateLinkResources: privateLinkResourcesClient,
QueryTexts: queryTextsClient,
RecommendedActionSessions: recommendedActionSessionsClient,
RecommendedActions: recommendedActionsClient,
ResetQueryPerformanceInsightData: resetQueryPerformanceInsightDataClient,
TopQueryStatistics: topQueryStatisticsClient,
WaitStatistics: waitStatisticsClient,
}, nil
}