Skip to content

Commit 5bb241f

Browse files
authored
feat(Usage Reports): added subscription_id, created_at, deleted_at to InstanceUsage API response (#285)
Signed-off-by: Sowmya Kelam <[email protected]>
1 parent 10a8f54 commit 5bb241f

File tree

2 files changed

+100
-48
lines changed

2 files changed

+100
-48
lines changed

ibm_platform_services/usage_reports_v4.py

+55-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22

3-
# (C) Copyright IBM Corp. 2024.
3+
# (C) Copyright IBM Corp. 2025.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 3.96.0-d6dec9d7-20241008-212902
17+
# IBM OpenAPI SDK Code Generator Version: 3.102.0-615ec964-20250307-203034
1818

1919
"""
2020
Usage reports for IBM Cloud accounts
@@ -1461,6 +1461,12 @@ class InstanceUsage:
14611461
provisioned and rated.
14621462
:param str pricing_plan_id: (optional) The ID of the pricing plan used to rate
14631463
the usage.
1464+
:param str subscription_id: (optional) The ID of service subscription with
1465+
effective from timestamp.
1466+
:param datetime created_at: (optional) The timestamp in RFC 3339 string format
1467+
at which instance is created.
1468+
:param datetime deleted_at: (optional) The timestamp in RFC 3339 string format
1469+
at which instance is deleted.
14641470
:param str month: The month.
14651471
:param List[Metric] usage: All the resource used in the account.
14661472
:param bool pending: (optional) Pending charge from classic infrastructure.
@@ -1499,6 +1505,9 @@ def __init__(
14991505
parent_resource_instance_id: Optional[str] = None,
15001506
plan_name: Optional[str] = None,
15011507
pricing_plan_id: Optional[str] = None,
1508+
subscription_id: Optional[str] = None,
1509+
created_at: Optional[datetime] = None,
1510+
deleted_at: Optional[datetime] = None,
15021511
pending: Optional[bool] = None,
15031512
currency_rate: Optional[float] = None,
15041513
tags: Optional[List[object]] = None,
@@ -1538,6 +1547,12 @@ def __init__(
15381547
was provisioned and rated.
15391548
:param str pricing_plan_id: (optional) The ID of the pricing plan used to
15401549
rate the usage.
1550+
:param str subscription_id: (optional) The ID of service subscription with
1551+
effective from timestamp.
1552+
:param datetime created_at: (optional) The timestamp in RFC 3339 string
1553+
format at which instance is created.
1554+
:param datetime deleted_at: (optional) The timestamp in RFC 3339 string
1555+
format at which instance is deleted.
15411556
:param bool pending: (optional) Pending charge from classic infrastructure.
15421557
:param float currency_rate: (optional) The value of the account's currency
15431558
in USD.
@@ -1568,6 +1583,9 @@ def __init__(
15681583
self.plan_id = plan_id
15691584
self.plan_name = plan_name
15701585
self.pricing_plan_id = pricing_plan_id
1586+
self.subscription_id = subscription_id
1587+
self.created_at = created_at
1588+
self.deleted_at = deleted_at
15711589
self.month = month
15721590
self.usage = usage
15731591
self.pending = pending
@@ -1637,6 +1655,12 @@ def from_dict(cls, _dict: Dict) -> 'InstanceUsage':
16371655
args['plan_name'] = plan_name
16381656
if (pricing_plan_id := _dict.get('pricing_plan_id')) is not None:
16391657
args['pricing_plan_id'] = pricing_plan_id
1658+
if (subscription_id := _dict.get('subscription_id')) is not None:
1659+
args['subscription_id'] = subscription_id
1660+
if (created_at := _dict.get('created_at')) is not None:
1661+
args['created_at'] = string_to_datetime(created_at)
1662+
if (deleted_at := _dict.get('deleted_at')) is not None:
1663+
args['deleted_at'] = string_to_datetime(deleted_at)
16401664
if (month := _dict.get('month')) is not None:
16411665
args['month'] = month
16421666
else:
@@ -1707,6 +1731,12 @@ def to_dict(self) -> Dict:
17071731
_dict['plan_name'] = self.plan_name
17081732
if hasattr(self, 'pricing_plan_id') and self.pricing_plan_id is not None:
17091733
_dict['pricing_plan_id'] = self.pricing_plan_id
1734+
if hasattr(self, 'subscription_id') and self.subscription_id is not None:
1735+
_dict['subscription_id'] = self.subscription_id
1736+
if hasattr(self, 'created_at') and self.created_at is not None:
1737+
_dict['created_at'] = datetime_to_string(self.created_at)
1738+
if hasattr(self, 'deleted_at') and self.deleted_at is not None:
1739+
_dict['deleted_at'] = datetime_to_string(self.deleted_at)
17101740
if hasattr(self, 'month') and self.month is not None:
17111741
_dict['month'] = self.month
17121742
if hasattr(self, 'usage') and self.usage is not None:
@@ -2514,6 +2544,8 @@ class Plan:
25142544
:param bool billable: Indicates if the plan charges are billed to the customer.
25152545
:param float cost: The total cost incurred by the plan.
25162546
:param float rated_cost: Total pre-discounted cost incurred by the plan.
2547+
:param str subscription_id: (optional) The ID of service subscription with
2548+
effective from timestamp.
25172549
:param List[Metric] usage: All the metrics in the plan.
25182550
:param List[Discount] discounts: All the discounts applicable to the plan.
25192551
:param bool pending: (optional) Pending charge from classic infrastructure.
@@ -2531,6 +2563,7 @@ def __init__(
25312563
plan_name: Optional[str] = None,
25322564
pricing_region: Optional[str] = None,
25332565
pricing_plan_id: Optional[str] = None,
2566+
subscription_id: Optional[str] = None,
25342567
pending: Optional[bool] = None,
25352568
) -> None:
25362569
"""
@@ -2547,6 +2580,8 @@ def __init__(
25472580
:param str pricing_region: (optional) The pricing region for the plan.
25482581
:param str pricing_plan_id: (optional) The ID of the pricing plan used to
25492582
rate the usage.
2583+
:param str subscription_id: (optional) The ID of service subscription with
2584+
effective from timestamp.
25502585
:param bool pending: (optional) Pending charge from classic infrastructure.
25512586
"""
25522587
self.plan_id = plan_id
@@ -2556,6 +2591,7 @@ def __init__(
25562591
self.billable = billable
25572592
self.cost = cost
25582593
self.rated_cost = rated_cost
2594+
self.subscription_id = subscription_id
25592595
self.usage = usage
25602596
self.discounts = discounts
25612597
self.pending = pending
@@ -2586,6 +2622,8 @@ def from_dict(cls, _dict: Dict) -> 'Plan':
25862622
args['rated_cost'] = rated_cost
25872623
else:
25882624
raise ValueError('Required property \'rated_cost\' not present in Plan JSON')
2625+
if (subscription_id := _dict.get('subscription_id')) is not None:
2626+
args['subscription_id'] = subscription_id
25892627
if (usage := _dict.get('usage')) is not None:
25902628
args['usage'] = [Metric.from_dict(v) for v in usage]
25912629
else:
@@ -2620,6 +2658,8 @@ def to_dict(self) -> Dict:
26202658
_dict['cost'] = self.cost
26212659
if hasattr(self, 'rated_cost') and self.rated_cost is not None:
26222660
_dict['rated_cost'] = self.rated_cost
2661+
if hasattr(self, 'subscription_id') and self.subscription_id is not None:
2662+
_dict['subscription_id'] = self.subscription_id
26232663
if hasattr(self, 'usage') and self.usage is not None:
26242664
usage_list = []
26252665
for v in self.usage:
@@ -3025,9 +3065,9 @@ class SnapshotConfigHistoryItem:
30253065
"""
30263066
SnapshotConfigHistoryItem.
30273067
3028-
:param float start_time: (optional) Timestamp in milliseconds when the snapshot
3068+
:param int start_time: (optional) Timestamp in milliseconds when the snapshot
30293069
configuration was created.
3030-
:param float end_time: (optional) Timestamp in milliseconds when the snapshot
3070+
:param int end_time: (optional) Timestamp in milliseconds when the snapshot
30313071
configuration ends.
30323072
:param str updated_by: (optional) Account that updated the billing snapshot
30333073
configuration.
@@ -3057,8 +3097,8 @@ class SnapshotConfigHistoryItem:
30573097
def __init__(
30583098
self,
30593099
*,
3060-
start_time: Optional[float] = None,
3061-
end_time: Optional[float] = None,
3100+
start_time: Optional[int] = None,
3101+
end_time: Optional[int] = None,
30623102
updated_by: Optional[str] = None,
30633103
account_id: Optional[str] = None,
30643104
state: Optional[str] = None,
@@ -3076,10 +3116,10 @@ def __init__(
30763116
"""
30773117
Initialize a SnapshotConfigHistoryItem object.
30783118
3079-
:param float start_time: (optional) Timestamp in milliseconds when the
3119+
:param int start_time: (optional) Timestamp in milliseconds when the
30803120
snapshot configuration was created.
3081-
:param float end_time: (optional) Timestamp in milliseconds when the
3082-
snapshot configuration ends.
3121+
:param int end_time: (optional) Timestamp in milliseconds when the snapshot
3122+
configuration ends.
30833123
:param str updated_by: (optional) Account that updated the billing snapshot
30843124
configuration.
30853125
:param str account_id: (optional) Account ID for which billing report
@@ -3264,7 +3304,7 @@ class SnapshotList:
32643304
"""
32653305
List of billing reports snapshots.
32663306
3267-
:param float count: (optional) Number of total snapshots.
3307+
:param int count: (optional) Number of total snapshots.
32683308
:param SnapshotListFirst first: (optional) Reference to the first page of the
32693309
search query.
32703310
:param SnapshotListNext next: (optional) Reference to the next page of the
@@ -3275,15 +3315,15 @@ class SnapshotList:
32753315
def __init__(
32763316
self,
32773317
*,
3278-
count: Optional[float] = None,
3318+
count: Optional[int] = None,
32793319
first: Optional['SnapshotListFirst'] = None,
32803320
next: Optional['SnapshotListNext'] = None,
32813321
snapshots: Optional[List['SnapshotListSnapshotsItem']] = None,
32823322
) -> None:
32833323
"""
32843324
Initialize a SnapshotList object.
32853325
3286-
:param float count: (optional) Number of total snapshots.
3326+
:param int count: (optional) Number of total snapshots.
32873327
:param SnapshotListFirst first: (optional) Reference to the first page of
32883328
the search query.
32893329
:param SnapshotListNext next: (optional) Reference to the next page of the
@@ -3510,7 +3550,7 @@ class SnapshotListSnapshotsItem:
35103550
List of report types configured for the snapshot.
35113551
:param List[SnapshotListSnapshotsItemFilesItem] files: (optional) List of
35123552
location of reports.
3513-
:param float processed_at: (optional) Timestamp at which snapshot is captured.
3553+
:param int processed_at: (optional) Timestamp at which snapshot is captured.
35143554
"""
35153555

35163556
def __init__(
@@ -3979,9 +4019,9 @@ class SnapshotConfig:
39794019
snapshot of the billing reports.
39804020
:param str cos_location: (optional) Region of the COS instance.
39814021
:param str cos_endpoint: (optional) The endpoint of the COS instance.
3982-
:param float created_at: (optional) Timestamp in milliseconds when the snapshot
4022+
:param int created_at: (optional) Timestamp in milliseconds when the snapshot
39834023
configuration was created.
3984-
:param float last_updated_at: (optional) Timestamp in milliseconds when the
4024+
:param int last_updated_at: (optional) Timestamp in milliseconds when the
39854025
snapshot configuration was last updated.
39864026
:param List[SnapshotConfigHistoryItem] history: (optional) List of previous
39874027
versions of the snapshot configurations.

0 commit comments

Comments
 (0)