-
Notifications
You must be signed in to change notification settings - Fork 40
/
client.go
163 lines (142 loc) · 7.32 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package v2019_10_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/consumption/2019-10-01/aggregatedcost"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/balances"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/budgets"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/charges"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/credits"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/events"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/forecasts"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/lots"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/marketplaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/pricesheet"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/reservationdetails"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/reservationrecommendationdetails"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/reservationrecommendations"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/reservationsummaries"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/reservationtransactions"
"github.com/hashicorp/go-azure-sdk/resource-manager/consumption/2019-10-01/usagedetails"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
AggregatedCost *aggregatedcost.AggregatedCostClient
Balances *balances.BalancesClient
Budgets *budgets.BudgetsClient
Charges *charges.ChargesClient
Credits *credits.CreditsClient
Events *events.EventsClient
Forecasts *forecasts.ForecastsClient
Lots *lots.LotsClient
Marketplaces *marketplaces.MarketplacesClient
PriceSheet *pricesheet.PriceSheetClient
ReservationDetails *reservationdetails.ReservationDetailsClient
ReservationRecommendationDetails *reservationrecommendationdetails.ReservationRecommendationDetailsClient
ReservationRecommendations *reservationrecommendations.ReservationRecommendationsClient
ReservationSummaries *reservationsummaries.ReservationSummariesClient
ReservationTransactions *reservationtransactions.ReservationTransactionsClient
UsageDetails *usagedetails.UsageDetailsClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
aggregatedCostClient, err := aggregatedcost.NewAggregatedCostClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building AggregatedCost client: %+v", err)
}
configureFunc(aggregatedCostClient.Client)
balancesClient, err := balances.NewBalancesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Balances client: %+v", err)
}
configureFunc(balancesClient.Client)
budgetsClient, err := budgets.NewBudgetsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Budgets client: %+v", err)
}
configureFunc(budgetsClient.Client)
chargesClient, err := charges.NewChargesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Charges client: %+v", err)
}
configureFunc(chargesClient.Client)
creditsClient, err := credits.NewCreditsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Credits client: %+v", err)
}
configureFunc(creditsClient.Client)
eventsClient, err := events.NewEventsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Events client: %+v", err)
}
configureFunc(eventsClient.Client)
forecastsClient, err := forecasts.NewForecastsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Forecasts client: %+v", err)
}
configureFunc(forecastsClient.Client)
lotsClient, err := lots.NewLotsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Lots client: %+v", err)
}
configureFunc(lotsClient.Client)
marketplacesClient, err := marketplaces.NewMarketplacesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Marketplaces client: %+v", err)
}
configureFunc(marketplacesClient.Client)
priceSheetClient, err := pricesheet.NewPriceSheetClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PriceSheet client: %+v", err)
}
configureFunc(priceSheetClient.Client)
reservationDetailsClient, err := reservationdetails.NewReservationDetailsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ReservationDetails client: %+v", err)
}
configureFunc(reservationDetailsClient.Client)
reservationRecommendationDetailsClient, err := reservationrecommendationdetails.NewReservationRecommendationDetailsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ReservationRecommendationDetails client: %+v", err)
}
configureFunc(reservationRecommendationDetailsClient.Client)
reservationRecommendationsClient, err := reservationrecommendations.NewReservationRecommendationsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ReservationRecommendations client: %+v", err)
}
configureFunc(reservationRecommendationsClient.Client)
reservationSummariesClient, err := reservationsummaries.NewReservationSummariesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ReservationSummaries client: %+v", err)
}
configureFunc(reservationSummariesClient.Client)
reservationTransactionsClient, err := reservationtransactions.NewReservationTransactionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ReservationTransactions client: %+v", err)
}
configureFunc(reservationTransactionsClient.Client)
usageDetailsClient, err := usagedetails.NewUsageDetailsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building UsageDetails client: %+v", err)
}
configureFunc(usageDetailsClient.Client)
return &Client{
AggregatedCost: aggregatedCostClient,
Balances: balancesClient,
Budgets: budgetsClient,
Charges: chargesClient,
Credits: creditsClient,
Events: eventsClient,
Forecasts: forecastsClient,
Lots: lotsClient,
Marketplaces: marketplacesClient,
PriceSheet: priceSheetClient,
ReservationDetails: reservationDetailsClient,
ReservationRecommendationDetails: reservationRecommendationDetailsClient,
ReservationRecommendations: reservationRecommendationsClient,
ReservationSummaries: reservationSummariesClient,
ReservationTransactions: reservationTransactionsClient,
UsageDetails: usageDetailsClient,
}, nil
}