13
13
from msrest import Serializer , Deserializer
14
14
from msrestazure import AzureConfiguration
15
15
from .version import VERSION
16
- from msrest .pipeline import ClientRawResponse
17
- import uuid
18
- from .operations .report_config_operations import ReportConfigOperations
19
- from .operations .billing_account_dimensions_operations import BillingAccountDimensionsOperations
20
- from .operations .subscription_dimensions_operations import SubscriptionDimensionsOperations
21
- from .operations .resource_group_dimensions_operations import ResourceGroupDimensionsOperations
16
+ from .operations .dimensions_operations import DimensionsOperations
17
+ from .operations .query_operations import QueryOperations
18
+ from .operations .forecast_operations import ForecastOperations
19
+ from .operations .cloud_connector_operations import CloudConnectorOperations
20
+ from .operations .external_billing_account_operations import ExternalBillingAccountOperations
21
+ from .operations .external_subscription_operations import ExternalSubscriptionOperations
22
+ from .operations .entities_operations import EntitiesOperations
22
23
from .operations .operations import Operations
23
24
from . import models
24
25
@@ -61,14 +62,20 @@ class CostManagementClient(SDKClient):
61
62
:ivar config: Configuration for client.
62
63
:vartype config: CostManagementClientConfiguration
63
64
64
- :ivar report_config: ReportConfig operations
65
- :vartype report_config: azure.mgmt.costmanagement.operations.ReportConfigOperations
66
- :ivar billing_account_dimensions: BillingAccountDimensions operations
67
- :vartype billing_account_dimensions: azure.mgmt.costmanagement.operations.BillingAccountDimensionsOperations
68
- :ivar subscription_dimensions: SubscriptionDimensions operations
69
- :vartype subscription_dimensions: azure.mgmt.costmanagement.operations.SubscriptionDimensionsOperations
70
- :ivar resource_group_dimensions: ResourceGroupDimensions operations
71
- :vartype resource_group_dimensions: azure.mgmt.costmanagement.operations.ResourceGroupDimensionsOperations
65
+ :ivar dimensions: Dimensions operations
66
+ :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations
67
+ :ivar query: Query operations
68
+ :vartype query: azure.mgmt.costmanagement.operations.QueryOperations
69
+ :ivar forecast: Forecast operations
70
+ :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations
71
+ :ivar cloud_connector: CloudConnector operations
72
+ :vartype cloud_connector: azure.mgmt.costmanagement.operations.CloudConnectorOperations
73
+ :ivar external_billing_account: ExternalBillingAccount operations
74
+ :vartype external_billing_account: azure.mgmt.costmanagement.operations.ExternalBillingAccountOperations
75
+ :ivar external_subscription: ExternalSubscription operations
76
+ :vartype external_subscription: azure.mgmt.costmanagement.operations.ExternalSubscriptionOperations
77
+ :ivar entities: Entities operations
78
+ :vartype entities: azure.mgmt.costmanagement.operations.EntitiesOperations
72
79
:ivar operations: Operations operations
73
80
:vartype operations: azure.mgmt.costmanagement.operations.Operations
74
81
@@ -87,235 +94,23 @@ def __init__(
87
94
super (CostManagementClient , self ).__init__ (self .config .credentials , self .config )
88
95
89
96
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
90
- self .api_version = '2018-05-31 '
97
+ self .api_version = '2019-03-01-preview '
91
98
self ._serialize = Serializer (client_models )
92
99
self ._deserialize = Deserializer (client_models )
93
100
94
- self .report_config = ReportConfigOperations (
101
+ self .dimensions = DimensionsOperations (
95
102
self ._client , self .config , self ._serialize , self ._deserialize )
96
- self .billing_account_dimensions = BillingAccountDimensionsOperations (
103
+ self .query = QueryOperations (
97
104
self ._client , self .config , self ._serialize , self ._deserialize )
98
- self .subscription_dimensions = SubscriptionDimensionsOperations (
105
+ self .forecast = ForecastOperations (
99
106
self ._client , self .config , self ._serialize , self ._deserialize )
100
- self .resource_group_dimensions = ResourceGroupDimensionsOperations (
107
+ self .cloud_connector = CloudConnectorOperations (
108
+ self ._client , self .config , self ._serialize , self ._deserialize )
109
+ self .external_billing_account = ExternalBillingAccountOperations (
110
+ self ._client , self .config , self ._serialize , self ._deserialize )
111
+ self .external_subscription = ExternalSubscriptionOperations (
112
+ self ._client , self .config , self ._serialize , self ._deserialize )
113
+ self .entities = EntitiesOperations (
101
114
self ._client , self .config , self ._serialize , self ._deserialize )
102
115
self .operations = Operations (
103
116
self ._client , self .config , self ._serialize , self ._deserialize )
104
-
105
- def query_subscription (
106
- self , parameters , custom_headers = None , raw = False , ** operation_config ):
107
- """Lists the usage data for subscriptionId.
108
-
109
- :param parameters: Parameters supplied to the CreateOrUpdate Report
110
- Config operation.
111
- :type parameters:
112
- ~azure.mgmt.costmanagement.models.ReportConfigDefinition
113
- :param dict custom_headers: headers that will be added to the request
114
- :param bool raw: returns the direct response alongside the
115
- deserialized response
116
- :param operation_config: :ref:`Operation configuration
117
- overrides<msrest:optionsforoperations>`.
118
- :return: An iterator like instance of Query
119
- :rtype:
120
- ~azure.mgmt.costmanagement.models.QueryPaged[~azure.mgmt.costmanagement.models.Query]
121
- :raises:
122
- :class:`ErrorResponseException<azure.mgmt.costmanagement.models.ErrorResponseException>`
123
- """
124
- def internal_paging (next_link = None , raw = False ):
125
-
126
- if not next_link :
127
- # Construct URL
128
- url = self .query_subscription .metadata ['url' ]
129
- path_format_arguments = {
130
- 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' )
131
- }
132
- url = self ._client .format_url (url , ** path_format_arguments )
133
-
134
- # Construct parameters
135
- query_parameters = {}
136
- query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
137
-
138
- else :
139
- url = next_link
140
- query_parameters = {}
141
-
142
- # Construct headers
143
- header_parameters = {}
144
- header_parameters ['Accept' ] = 'application/json'
145
- header_parameters ['Content-Type' ] = 'application/json; charset=utf-8'
146
- if self .config .generate_client_request_id :
147
- header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
148
- if custom_headers :
149
- header_parameters .update (custom_headers )
150
- if self .config .accept_language is not None :
151
- header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
152
-
153
- # Construct body
154
- body_content = self ._serialize .body (parameters , 'ReportConfigDefinition' )
155
-
156
- # Construct and send request
157
- request = self ._client .post (url , query_parameters , header_parameters , body_content )
158
- response = self ._client .send (request , stream = False , ** operation_config )
159
-
160
- if response .status_code not in [200 ]:
161
- raise models .ErrorResponseException (self ._deserialize , response )
162
-
163
- return response
164
-
165
- # Deserialize response
166
- deserialized = models .QueryPaged (internal_paging , self ._deserialize .dependencies )
167
-
168
- if raw :
169
- header_dict = {}
170
- client_raw_response = models .QueryPaged (internal_paging , self ._deserialize .dependencies , header_dict )
171
- return client_raw_response
172
-
173
- return deserialized
174
- query_subscription .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.CostManagement/Query' }
175
-
176
- def query_resource_group (
177
- self , resource_group_name , parameters , custom_headers = None , raw = False , ** operation_config ):
178
- """Lists the usage data for subscriptionId and resource group.
179
-
180
- :param resource_group_name: Azure Resource Group Name.
181
- :type resource_group_name: str
182
- :param parameters: Parameters supplied to the CreateOrUpdate Report
183
- Config operation.
184
- :type parameters:
185
- ~azure.mgmt.costmanagement.models.ReportConfigDefinition
186
- :param dict custom_headers: headers that will be added to the request
187
- :param bool raw: returns the direct response alongside the
188
- deserialized response
189
- :param operation_config: :ref:`Operation configuration
190
- overrides<msrest:optionsforoperations>`.
191
- :return: An iterator like instance of Query
192
- :rtype:
193
- ~azure.mgmt.costmanagement.models.QueryPaged[~azure.mgmt.costmanagement.models.Query]
194
- :raises:
195
- :class:`ErrorResponseException<azure.mgmt.costmanagement.models.ErrorResponseException>`
196
- """
197
- def internal_paging (next_link = None , raw = False ):
198
-
199
- if not next_link :
200
- # Construct URL
201
- url = self .query_resource_group .metadata ['url' ]
202
- path_format_arguments = {
203
- 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' ),
204
- 'resourceGroupName' : self ._serialize .url ("resource_group_name" , resource_group_name , 'str' )
205
- }
206
- url = self ._client .format_url (url , ** path_format_arguments )
207
-
208
- # Construct parameters
209
- query_parameters = {}
210
- query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
211
-
212
- else :
213
- url = next_link
214
- query_parameters = {}
215
-
216
- # Construct headers
217
- header_parameters = {}
218
- header_parameters ['Accept' ] = 'application/json'
219
- header_parameters ['Content-Type' ] = 'application/json; charset=utf-8'
220
- if self .config .generate_client_request_id :
221
- header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
222
- if custom_headers :
223
- header_parameters .update (custom_headers )
224
- if self .config .accept_language is not None :
225
- header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
226
-
227
- # Construct body
228
- body_content = self ._serialize .body (parameters , 'ReportConfigDefinition' )
229
-
230
- # Construct and send request
231
- request = self ._client .post (url , query_parameters , header_parameters , body_content )
232
- response = self ._client .send (request , stream = False , ** operation_config )
233
-
234
- if response .status_code not in [200 ]:
235
- raise models .ErrorResponseException (self ._deserialize , response )
236
-
237
- return response
238
-
239
- # Deserialize response
240
- deserialized = models .QueryPaged (internal_paging , self ._deserialize .dependencies )
241
-
242
- if raw :
243
- header_dict = {}
244
- client_raw_response = models .QueryPaged (internal_paging , self ._deserialize .dependencies , header_dict )
245
- return client_raw_response
246
-
247
- return deserialized
248
- query_resource_group .metadata = {'url' : '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.CostManagement/Query' }
249
-
250
- def query_billing_account (
251
- self , billing_account_id , parameters , custom_headers = None , raw = False , ** operation_config ):
252
- """Lists the usage data for billing account.
253
-
254
- :param billing_account_id: BillingAccount ID
255
- :type billing_account_id: str
256
- :param parameters: Parameters supplied to the CreateOrUpdate Report
257
- Config operation.
258
- :type parameters:
259
- ~azure.mgmt.costmanagement.models.ReportConfigDefinition
260
- :param dict custom_headers: headers that will be added to the request
261
- :param bool raw: returns the direct response alongside the
262
- deserialized response
263
- :param operation_config: :ref:`Operation configuration
264
- overrides<msrest:optionsforoperations>`.
265
- :return: An iterator like instance of Query
266
- :rtype:
267
- ~azure.mgmt.costmanagement.models.QueryPaged[~azure.mgmt.costmanagement.models.Query]
268
- :raises:
269
- :class:`ErrorResponseException<azure.mgmt.costmanagement.models.ErrorResponseException>`
270
- """
271
- def internal_paging (next_link = None , raw = False ):
272
-
273
- if not next_link :
274
- # Construct URL
275
- url = self .query_billing_account .metadata ['url' ]
276
- path_format_arguments = {
277
- 'billingAccountId' : self ._serialize .url ("billing_account_id" , billing_account_id , 'str' )
278
- }
279
- url = self ._client .format_url (url , ** path_format_arguments )
280
-
281
- # Construct parameters
282
- query_parameters = {}
283
- query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
284
-
285
- else :
286
- url = next_link
287
- query_parameters = {}
288
-
289
- # Construct headers
290
- header_parameters = {}
291
- header_parameters ['Accept' ] = 'application/json'
292
- header_parameters ['Content-Type' ] = 'application/json; charset=utf-8'
293
- if self .config .generate_client_request_id :
294
- header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
295
- if custom_headers :
296
- header_parameters .update (custom_headers )
297
- if self .config .accept_language is not None :
298
- header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
299
-
300
- # Construct body
301
- body_content = self ._serialize .body (parameters , 'ReportConfigDefinition' )
302
-
303
- # Construct and send request
304
- request = self ._client .post (url , query_parameters , header_parameters , body_content )
305
- response = self ._client .send (request , stream = False , ** operation_config )
306
-
307
- if response .status_code not in [200 ]:
308
- raise models .ErrorResponseException (self ._deserialize , response )
309
-
310
- return response
311
-
312
- # Deserialize response
313
- deserialized = models .QueryPaged (internal_paging , self ._deserialize .dependencies )
314
-
315
- if raw :
316
- header_dict = {}
317
- client_raw_response = models .QueryPaged (internal_paging , self ._deserialize .dependencies , header_dict )
318
- return client_raw_response
319
-
320
- return deserialized
321
- query_billing_account .metadata = {'url' : '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/Query' }
0 commit comments