@@ -26,12 +26,12 @@ def __init__(self, *args, **kwargs):
26
26
self .retail_price_map = {}
27
27
28
28
def get_linked_accounts (
29
- self ,
30
- options : dict ,
31
- secret_data : dict ,
32
- schema : str ,
33
- domain_id : str ,
34
- ) -> dict :
29
+ self ,
30
+ options : dict ,
31
+ secret_data : dict ,
32
+ schema : str ,
33
+ domain_id : str ,
34
+ ) -> list :
35
35
self .azure_cm_connector .create_session (options , secret_data , schema )
36
36
billing_account_info = self .azure_cm_connector .get_billing_account ()
37
37
agreement_type = billing_account_info .get ("agreement_type" )
@@ -54,15 +54,15 @@ def get_linked_accounts(
54
54
_LOGGER .debug (
55
55
f"[get_linked_accounts] total accounts count: { len (accounts_info )} , domain_id: { domain_id } "
56
56
)
57
- return { "results" : accounts_info }
57
+ return accounts_info
58
58
59
59
def get_benefit_data (
60
- self ,
61
- options : dict ,
62
- secret_data : dict ,
63
- schema : str ,
64
- task_options : dict ,
65
- domain_id : str ,
60
+ self ,
61
+ options : dict ,
62
+ secret_data : dict ,
63
+ schema : str ,
64
+ task_options : dict ,
65
+ domain_id : str ,
66
66
):
67
67
self .azure_cm_connector .create_session (options , secret_data , schema )
68
68
start : datetime = self ._get_first_date_of_month (task_options ["start" ])
@@ -85,12 +85,12 @@ def get_benefit_data(
85
85
)
86
86
87
87
def _make_benefit_cost_data (
88
- self ,
89
- results : dict ,
90
- end : datetime ,
91
- options : dict ,
92
- tenant_id : str = None ,
93
- agreement_type : str = None ,
88
+ self ,
89
+ results : dict ,
90
+ end : datetime ,
91
+ options : dict ,
92
+ tenant_id : str = None ,
93
+ agreement_type : str = None ,
94
94
) -> list :
95
95
benefit_costs_data = []
96
96
try :
@@ -143,12 +143,12 @@ def _make_benefit_cost_info(self, result: dict, billed_at: str) -> dict:
143
143
return data
144
144
145
145
def get_data (
146
- self ,
147
- options : dict ,
148
- secret_data : dict ,
149
- schema : str ,
150
- task_options : dict ,
151
- domain_id : str ,
146
+ self ,
147
+ options : dict ,
148
+ secret_data : dict ,
149
+ schema : str ,
150
+ task_options : dict ,
151
+ domain_id : str ,
152
152
) -> list :
153
153
self .azure_cm_connector .create_session (options , secret_data , schema )
154
154
self ._check_task_options (task_options )
@@ -202,12 +202,12 @@ def get_data(
202
202
yield []
203
203
204
204
def _make_cost_data (
205
- self ,
206
- results : list ,
207
- end : datetime ,
208
- options : dict ,
209
- tenant_id : str = None ,
210
- agreement_type : str = None ,
205
+ self ,
206
+ results : list ,
207
+ end : datetime ,
208
+ options : dict ,
209
+ tenant_id : str = None ,
210
+ agreement_type : str = None ,
211
211
) -> list :
212
212
"""Source Data Model"""
213
213
@@ -248,14 +248,14 @@ def _make_transaction_cost_data(self, tenant_id: str, end: datetime) -> list:
248
248
249
249
try :
250
250
for (
251
- reservation_transaction
251
+ reservation_transaction
252
252
) in self .azure_cm_connector .list_reservation_transactions_by_billing_profile_id (
253
253
query_filter
254
254
):
255
255
256
256
if (
257
- reservation_transaction .invoice_section_id .split ("/" )[- 1 ]
258
- == invoice_section_id
257
+ reservation_transaction .invoice_section_id .split ("/" )[- 1 ]
258
+ == invoice_section_id
259
259
):
260
260
reservation_transaction_info = (
261
261
self .azure_cm_connector .convert_nested_dictionary (
@@ -312,12 +312,12 @@ def _make_transaction_cost_data(self, tenant_id: str, end: datetime) -> list:
312
312
return transaction_cost_data
313
313
314
314
def _make_data_info (
315
- self ,
316
- result : dict ,
317
- billed_date : str ,
318
- options : dict ,
319
- tenant_id : str = None ,
320
- agreement_type : str = None ,
315
+ self ,
316
+ result : dict ,
317
+ billed_date : str ,
318
+ options : dict ,
319
+ tenant_id : str = None ,
320
+ agreement_type : str = None ,
321
321
):
322
322
additional_info : dict = self ._get_additional_info (result , options , tenant_id )
323
323
cost : float = self ._get_cost_from_result_with_options (result , options )
@@ -391,8 +391,8 @@ def _get_additional_info(self, result: dict, options: dict, tenant_id: str = Non
391
391
additional_info ["Benefit Name" ] = benefit_name
392
392
393
393
if (
394
- result .get ("pricingmodel" ) == "Reservation"
395
- and result ["metercategory" ] == ""
394
+ result .get ("pricingmodel" ) == "Reservation"
395
+ and result ["metercategory" ] == ""
396
396
):
397
397
result ["metercategory" ] = self ._set_product_from_benefit_name (
398
398
benefit_name
@@ -404,14 +404,14 @@ def _get_additional_info(self, result: dict, options: dict, tenant_id: str = Non
404
404
if result .get ("metersubcategory" ) != "" and result .get ("metersubcategory" ):
405
405
additional_info ["Meter SubCategory" ] = result .get ("metersubcategory" )
406
406
if (
407
- result .get ("pricingmodel" ) == "OnDemand"
408
- and result .get ("metercategory" ) == ""
407
+ result .get ("pricingmodel" ) == "OnDemand"
408
+ and result .get ("metercategory" ) == ""
409
409
):
410
410
result ["metercategory" ] = result .get ("metercategory" )
411
411
412
412
if result .get ("customername" ) is None :
413
413
if result .get ("invoicesectionname" ) != "" and result .get (
414
- "invoicesectionname"
414
+ "invoicesectionname"
415
415
):
416
416
additional_info ["Department Name" ] = result .get ("invoicesectionname" )
417
417
elif result .get ("departmentname" ) != "" and result .get ("departmentname" ):
@@ -420,7 +420,7 @@ def _get_additional_info(self, result: dict, options: dict, tenant_id: str = Non
420
420
if result .get ("accountname" ) != "" and result .get ("accountname" ):
421
421
additional_info ["Enrollment Account Name" ] = result ["accountname" ]
422
422
elif result .get ("enrollmentaccountname" ) != "" and result .get (
423
- "enrollmentaccountname"
423
+ "enrollmentaccountname"
424
424
):
425
425
additional_info ["Enrollment Account Name" ] = result ["enrollmentaccountname" ]
426
426
@@ -429,9 +429,9 @@ def _get_additional_info(self, result: dict, options: dict, tenant_id: str = Non
429
429
430
430
collect_resource_id = options .get ("collect_resource_id" , False )
431
431
if (
432
- collect_resource_id
433
- and result .get ("resourceid" ) != ""
434
- and result .get ("resourceid" )
432
+ collect_resource_id
433
+ and result .get ("resourceid" ) != ""
434
+ and result .get ("resourceid" )
435
435
):
436
436
additional_info ["Resource Id" ] = result ["resourceid" ]
437
437
additional_info ["Resource Name" ] = result ["resourceid" ].split ("/" )[- 1 ]
@@ -569,10 +569,10 @@ def _get_tenant_ids(task_options: dict, collect_scope: str) -> list:
569
569
570
570
@staticmethod
571
571
def _make_scope (
572
- secret_data : dict ,
573
- task_options : dict ,
574
- collect_scope : str ,
575
- customer_tenant_id : str = None ,
572
+ secret_data : dict ,
573
+ task_options : dict ,
574
+ collect_scope : str ,
575
+ customer_tenant_id : str = None ,
576
576
):
577
577
if collect_scope == "subscription_id" :
578
578
subscription_id = task_options ["subscription_id" ]
@@ -673,7 +673,7 @@ def _convert_date_format_to_utc(date_format: str) -> datetime:
673
673
return datetime .strptime (date_format , "%Y-%m-%d" ).replace (tzinfo = timezone .utc )
674
674
675
675
def _make_monthly_time_period (
676
- self , start_date : datetime , end_date : datetime
676
+ self , start_date : datetime , end_date : datetime
677
677
) -> list :
678
678
monthly_time_period = []
679
679
current_date = end_date
@@ -703,7 +703,7 @@ def _make_monthly_time_period(
703
703
704
704
@staticmethod
705
705
def _get_linked_customer_tenants (
706
- secret_data : dict , billing_accounts_info : list
706
+ secret_data : dict , billing_accounts_info : list
707
707
) -> list :
708
708
customer_tenants = secret_data .get ("customer_tenants" , [])
709
709
if not customer_tenants :
@@ -716,7 +716,7 @@ def _get_linked_customer_tenants(
716
716
717
717
@staticmethod
718
718
def _make_accounts_info_from_customer_tenants (
719
- billing_accounts_info : list , customer_tenants : list
719
+ billing_accounts_info : list , customer_tenants : list
720
720
) -> list :
721
721
accounts_info = []
722
722
for billing_account_info in billing_accounts_info :
@@ -754,7 +754,7 @@ def _exclude_cost_data_with_options(result: dict, options: dict) -> bool:
754
754
755
755
@staticmethod
756
756
def _set_network_traffic_cost (
757
- additional_info : dict , product : str , usage_type : str
757
+ additional_info : dict , product : str , usage_type : str
758
758
) -> dict :
759
759
if product in ["Bandwidth" , "Content Delivery Network" ]:
760
760
additional_info ["Usage Type Details" ] = usage_type
0 commit comments