@@ -131,7 +131,7 @@ def check_reservation_transaction(self) -> bool:
131
131
return True
132
132
133
133
def list_reservation_transactions_by_billing_profile_id (
134
- self , query_filter : str
134
+ self , query_filter : str
135
135
) -> list :
136
136
transactions = []
137
137
try :
@@ -166,12 +166,12 @@ def list_billing_accounts(self) -> list:
166
166
return billing_accounts_info
167
167
168
168
def query_usage_http (
169
- self ,
170
- secret_data : dict ,
171
- start : datetime ,
172
- end : datetime ,
173
- account_agreement_type : str ,
174
- options = None ,
169
+ self ,
170
+ secret_data : dict ,
171
+ start : datetime ,
172
+ end : datetime ,
173
+ account_agreement_type : str ,
174
+ options = None ,
175
175
):
176
176
try :
177
177
billing_account_id = secret_data ["billing_account_id" ]
@@ -190,11 +190,17 @@ def query_usage_http(
190
190
},
191
191
}
192
192
if account_agreement_type == "MicrosoftPartnerAgreement" :
193
- parameters ["dataset" ]["grouping" ].extend (BENEFIT_GROUPING_MPA )
193
+ parameters ["dataset" ]["grouping" ] = (
194
+ BENEFIT_GROUPING + BENEFIT_GROUPING_MPA
195
+ )
194
196
elif account_agreement_type == "EnterpriseAgreement" :
195
- parameters ["dataset" ]["grouping" ].extend (BENEFIT_GROUPING_EA )
197
+ parameters ["dataset" ]["grouping" ] = (
198
+ BENEFIT_GROUPING + BENEFIT_GROUPING_EA
199
+ )
196
200
else :
197
- parameters ["dataset" ]["grouping" ].extend (BENEFIT_GROUPING_MCA )
201
+ parameters ["dataset" ]["grouping" ] = (
202
+ BENEFIT_GROUPING + BENEFIT_GROUPING_MCA
203
+ )
198
204
199
205
_LOGGER .debug (f"[query_usage] parameters: { parameters } " )
200
206
@@ -300,13 +306,13 @@ def _make_request_headers(self, client_type=None):
300
306
def convert_nested_dictionary (self , cloud_svc_object ):
301
307
cloud_svc_dict = {}
302
308
if hasattr (
303
- cloud_svc_object , "__dict__"
309
+ cloud_svc_object , "__dict__"
304
310
): # if cloud_svc_object is not a dictionary type but has dict method
305
311
cloud_svc_dict = cloud_svc_object .__dict__
306
312
elif isinstance (cloud_svc_object , dict ):
307
313
cloud_svc_dict = cloud_svc_object
308
314
elif not isinstance (
309
- cloud_svc_object , list
315
+ cloud_svc_object , list
310
316
): # if cloud_svc_object is one of type like int, float, char, ...
311
317
return cloud_svc_object
312
318
@@ -394,8 +400,8 @@ def _get_access_token():
394
400
@staticmethod
395
401
def _check_secret_data (secret_data ):
396
402
if (
397
- "billing_account_id" not in secret_data
398
- and "subscription_id" not in secret_data
403
+ "billing_account_id" not in secret_data
404
+ and "subscription_id" not in secret_data
399
405
):
400
406
raise ERROR_REQUIRED_PARAMETER (
401
407
key = "secret_data.billing_account_id or secret_data.subscription_id"
0 commit comments