Skip to content

Commit 7f3a461

Browse files
authored
feat(Usage Reports): Update Account Summary (#205)
Signed-off-by: Jonathan Date-chong <[email protected]>
1 parent 9f7a1de commit 7f3a461

File tree

2 files changed

+96
-12
lines changed

2 files changed

+96
-12
lines changed

ibm_platform_services/usage_reports_v4.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ class AccountSummary:
570570
A summary of charges and credits for an account.
571571
572572
:attr str account_id: The ID of the account.
573+
:attr List[Resource] account_resources: (optional) The list of account resources
574+
for the month.
573575
:attr str month: The month in which usages were incurred. Represented in yyyy-mm
574576
format.
575577
:attr str billing_country_code: Country.
@@ -578,6 +580,8 @@ class AccountSummary:
578580
:attr List[Offer] offers: The list of offers applicable for the account for the
579581
month.
580582
:attr List[SupportSummary] support: Support-related charges.
583+
:attr List[object] support_resources: (optional) The list of support resources
584+
for the month.
581585
:attr SubscriptionSummary subscription: A summary of charges and credits related
582586
to a subscription.
583587
"""
@@ -592,6 +596,9 @@ def __init__(
592596
offers: List['Offer'],
593597
support: List['SupportSummary'],
594598
subscription: 'SubscriptionSummary',
599+
*,
600+
account_resources: List['Resource'] = None,
601+
support_resources: List[object] = None,
595602
) -> None:
596603
"""
597604
Initialize a AccountSummary object.
@@ -608,14 +615,20 @@ def __init__(
608615
:param List[SupportSummary] support: Support-related charges.
609616
:param SubscriptionSummary subscription: A summary of charges and credits
610617
related to a subscription.
618+
:param List[Resource] account_resources: (optional) The list of account
619+
resources for the month.
620+
:param List[object] support_resources: (optional) The list of support
621+
resources for the month.
611622
"""
612623
self.account_id = account_id
624+
self.account_resources = account_resources
613625
self.month = month
614626
self.billing_country_code = billing_country_code
615627
self.billing_currency_code = billing_currency_code
616628
self.resources = resources
617629
self.offers = offers
618630
self.support = support
631+
self.support_resources = support_resources
619632
self.subscription = subscription
620633

621634
@classmethod
@@ -626,6 +639,8 @@ def from_dict(cls, _dict: Dict) -> 'AccountSummary':
626639
args['account_id'] = _dict.get('account_id')
627640
else:
628641
raise ValueError('Required property \'account_id\' not present in AccountSummary JSON')
642+
if 'account_resources' in _dict:
643+
args['account_resources'] = [Resource.from_dict(v) for v in _dict.get('account_resources')]
629644
if 'month' in _dict:
630645
args['month'] = _dict.get('month')
631646
else:
@@ -650,6 +665,8 @@ def from_dict(cls, _dict: Dict) -> 'AccountSummary':
650665
args['support'] = [SupportSummary.from_dict(v) for v in _dict.get('support')]
651666
else:
652667
raise ValueError('Required property \'support\' not present in AccountSummary JSON')
668+
if 'support_resources' in _dict:
669+
args['support_resources'] = _dict.get('support_resources')
653670
if 'subscription' in _dict:
654671
args['subscription'] = SubscriptionSummary.from_dict(_dict.get('subscription'))
655672
else:
@@ -666,6 +683,14 @@ def to_dict(self) -> Dict:
666683
_dict = {}
667684
if hasattr(self, 'account_id') and self.account_id is not None:
668685
_dict['account_id'] = self.account_id
686+
if hasattr(self, 'account_resources') and self.account_resources is not None:
687+
account_resources_list = []
688+
for v in self.account_resources:
689+
if isinstance(v, dict):
690+
account_resources_list.append(v)
691+
else:
692+
account_resources_list.append(v.to_dict())
693+
_dict['account_resources'] = account_resources_list
669694
if hasattr(self, 'month') and self.month is not None:
670695
_dict['month'] = self.month
671696
if hasattr(self, 'billing_country_code') and self.billing_country_code is not None:
@@ -693,6 +718,8 @@ def to_dict(self) -> Dict:
693718
else:
694719
support_list.append(v.to_dict())
695720
_dict['support'] = support_list
721+
if hasattr(self, 'support_resources') and self.support_resources is not None:
722+
_dict['support_resources'] = self.support_resources
696723
if hasattr(self, 'subscription') and self.subscription is not None:
697724
if isinstance(self.subscription, dict):
698725
_dict['subscription'] = self.subscription
@@ -1903,6 +1930,7 @@ class Plan:
19031930
:attr str plan_id: The ID of the plan.
19041931
:attr str plan_name: (optional) The name of the plan.
19051932
:attr str pricing_region: (optional) The pricing region for the plan.
1933+
:attr str pricing_plan_id: (optional)
19061934
:attr bool billable: Indicates if the plan charges are billed to the customer.
19071935
:attr float cost: The total cost incurred by the plan.
19081936
:attr float rated_cost: Total pre-discounted cost incurred by the plan.
@@ -1922,6 +1950,7 @@ def __init__(
19221950
*,
19231951
plan_name: str = None,
19241952
pricing_region: str = None,
1953+
pricing_plan_id: str = None,
19251954
pending: bool = None,
19261955
) -> None:
19271956
"""
@@ -1936,11 +1965,13 @@ def __init__(
19361965
:param List[Discount] discounts: All the discounts applicable to the plan.
19371966
:param str plan_name: (optional) The name of the plan.
19381967
:param str pricing_region: (optional) The pricing region for the plan.
1968+
:param str pricing_plan_id: (optional)
19391969
:param bool pending: (optional) Pending charge from classic infrastructure.
19401970
"""
19411971
self.plan_id = plan_id
19421972
self.plan_name = plan_name
19431973
self.pricing_region = pricing_region
1974+
self.pricing_plan_id = pricing_plan_id
19441975
self.billable = billable
19451976
self.cost = cost
19461977
self.rated_cost = rated_cost
@@ -1960,6 +1991,8 @@ def from_dict(cls, _dict: Dict) -> 'Plan':
19601991
args['plan_name'] = _dict.get('plan_name')
19611992
if 'pricing_region' in _dict:
19621993
args['pricing_region'] = _dict.get('pricing_region')
1994+
if 'pricing_plan_id' in _dict:
1995+
args['pricing_plan_id'] = _dict.get('pricing_plan_id')
19631996
if 'billable' in _dict:
19641997
args['billable'] = _dict.get('billable')
19651998
else:
@@ -1998,6 +2031,8 @@ def to_dict(self) -> Dict:
19982031
_dict['plan_name'] = self.plan_name
19992032
if hasattr(self, 'pricing_region') and self.pricing_region is not None:
20002033
_dict['pricing_region'] = self.pricing_region
2034+
if hasattr(self, 'pricing_plan_id') and self.pricing_plan_id is not None:
2035+
_dict['pricing_plan_id'] = self.pricing_plan_id
20012036
if hasattr(self, 'billable') and self.billable is not None:
20022037
_dict['billable'] = self.billable
20032038
if hasattr(self, 'cost') and self.cost is not None:

0 commit comments

Comments
 (0)