ibm-platform-services 0.57.1__py3-none-any.whl → 0.58.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,10 +14,11 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- # IBM OpenAPI SDK Code Generator Version: 3.85.0-75c38f8f-20240206-210220
17
+ # IBM OpenAPI SDK Code Generator Version: 3.96.0-d6dec9d7-20241008-212902
18
18
 
19
19
  """
20
- Billing units for IBM Cloud partners
20
+ The Partner Management APIs enable you to manage the IBM Cloud partner entities and fetch
21
+ multiple reports in different formats.
21
22
 
22
23
  API Version: 1.0.0
23
24
  """
@@ -39,20 +40,20 @@ from .common import get_sdk_headers
39
40
  ##############################################################################
40
41
 
41
42
 
42
- class PartnerBillingUnitsV1(BaseService):
43
- """The Partner Billing Units V1 service."""
43
+ class PartnerManagementV1(BaseService):
44
+ """The Partner Management V1 service."""
44
45
 
45
46
  DEFAULT_SERVICE_URL = 'https://partner.cloud.ibm.com'
46
- DEFAULT_SERVICE_NAME = 'partner_billing_units'
47
+ DEFAULT_SERVICE_NAME = 'partner_management'
47
48
 
48
49
  @classmethod
49
50
  def new_instance(
50
51
  cls,
51
52
  service_name: str = DEFAULT_SERVICE_NAME,
52
- ) -> 'PartnerBillingUnitsV1':
53
+ ) -> 'PartnerManagementV1':
53
54
  """
54
- Return a new client for the Partner Billing Units service using the
55
- specified parameters and external configuration.
55
+ Return a new client for the Partner Management service using the specified
56
+ parameters and external configuration.
56
57
  """
57
58
  authenticator = get_authenticator_from_environment(service_name)
58
59
  service = cls(authenticator)
@@ -64,7 +65,7 @@ class PartnerBillingUnitsV1(BaseService):
64
65
  authenticator: Authenticator = None,
65
66
  ) -> None:
66
67
  """
67
- Construct a new client for the Partner Billing Units service.
68
+ Construct a new client for the Partner Management service.
68
69
 
69
70
  :param Authenticator authenticator: The authenticator specifies the authentication mechanism.
70
71
  Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
@@ -72,6 +73,101 @@ class PartnerBillingUnitsV1(BaseService):
72
73
  """
73
74
  BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
74
75
 
76
+ #########################
77
+ # Usage Reports
78
+ #########################
79
+
80
+ def get_resource_usage_report(
81
+ self,
82
+ partner_id: str,
83
+ *,
84
+ reseller_id: Optional[str] = None,
85
+ customer_id: Optional[str] = None,
86
+ children: Optional[bool] = None,
87
+ month: Optional[str] = None,
88
+ viewpoint: Optional[str] = None,
89
+ recurse: Optional[bool] = None,
90
+ limit: Optional[int] = None,
91
+ offset: Optional[str] = None,
92
+ **kwargs,
93
+ ) -> DetailedResponse:
94
+ """
95
+ Get partner resource usage report.
96
+
97
+ Returns the summary for the partner for a given month. Partner billing managers
98
+ are authorized to access this report.
99
+
100
+ :param str partner_id: Enterprise ID of the distributor or reseller for
101
+ which the report is requested.
102
+ :param str reseller_id: (optional) Enterprise ID of the reseller for which
103
+ the report is requested. This parameter cannot be used along with
104
+ `customer_id` query parameter.
105
+ :param str customer_id: (optional) Account ID/Enterprise ID of the end
106
+ customer for which the report is requested. This parameter cannot be used
107
+ along with `reseller_id` query parameter.
108
+ :param bool children: (optional) Get report rolled-up to the direct
109
+ children of the requested entity. Defaults to false. This parameter cannot
110
+ be used along with `customer_id` query parameter.
111
+ :param str month: (optional) The billing month for which the usage report
112
+ is requested. Format is `yyyy-mm`. Defaults to current month.
113
+ :param str viewpoint: (optional) Enables partner to view the cost of
114
+ provisioned services as applicable at the given level. Defaults to the type
115
+ of the calling partner. The valid values are `DISTRIBUTOR`, `RESELLER` and
116
+ `END_CUSTOMER`.
117
+ :param bool recurse: (optional) Get usage report rolled-up to the end
118
+ customers of the requesting partner. Defaults to false. This parameter
119
+ cannot be used along with `reseller_id` query parameter or `customer_id`
120
+ query parameter.
121
+ :param int limit: (optional) Number of usage records to be returned. The
122
+ default value is 30. Maximum value is 100.
123
+ :param str offset: (optional) An opaque value representing the offset of
124
+ the first item to be returned by a search query. If not specified, then the
125
+ first page of results is returned. To retrieve the next page of search
126
+ results, use the 'offset' query parameter value within the 'next.href' URL
127
+ found within a prior search query response.
128
+ :param dict headers: A `dict` containing the request headers
129
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
130
+ :rtype: DetailedResponse with `dict` result representing a `PartnerUsageReportSummary` object
131
+ """
132
+
133
+ if not partner_id:
134
+ raise ValueError('partner_id must be provided')
135
+ headers = {}
136
+ sdk_headers = get_sdk_headers(
137
+ service_name=self.DEFAULT_SERVICE_NAME,
138
+ service_version='V1',
139
+ operation_id='get_resource_usage_report',
140
+ )
141
+ headers.update(sdk_headers)
142
+
143
+ params = {
144
+ 'partner_id': partner_id,
145
+ 'reseller_id': reseller_id,
146
+ 'customer_id': customer_id,
147
+ 'children': children,
148
+ 'month': month,
149
+ 'viewpoint': viewpoint,
150
+ 'recurse': recurse,
151
+ 'limit': limit,
152
+ 'offset': offset,
153
+ }
154
+
155
+ if 'headers' in kwargs:
156
+ headers.update(kwargs.get('headers'))
157
+ del kwargs['headers']
158
+ headers['Accept'] = 'application/json'
159
+
160
+ url = '/v1/resource-usage-reports'
161
+ request = self.prepare_request(
162
+ method='GET',
163
+ url=url,
164
+ headers=headers,
165
+ params=params,
166
+ )
167
+
168
+ response = self.send(request, **kwargs)
169
+ return response
170
+
75
171
  #########################
76
172
  # Billing Options
77
173
  #########################
@@ -93,14 +189,16 @@ class PartnerBillingUnitsV1(BaseService):
93
189
 
94
190
  :param str partner_id: Enterprise ID of the distributor or reseller for
95
191
  which the report is requested.
96
- :param str customer_id: (optional) Enterprise ID of the customer for which
97
- the report is requested.
192
+ :param str customer_id: (optional) Account ID/Enterprise ID of the end
193
+ customer for which the report is requested. This parameter cannot be used
194
+ along with `reseller_id` query parameter.
98
195
  :param str reseller_id: (optional) Enterprise ID of the reseller for which
99
- the report is requested.
100
- :param str date: (optional) The billing month for which the usage report is
196
+ the report is requested. This parameter cannot be used along with
197
+ `customer_id` query parameter.
198
+ :param str date: (optional) The billing month for which the report is
101
199
  requested. Format is yyyy-mm. Defaults to current month.
102
- :param int limit: (optional) Number of usage records returned. The default
103
- value is 30. Maximum value is 200.
200
+ :param int limit: (optional) Number of billing option reports returned. The
201
+ default value is 200. Maximum value is 200.
104
202
  :param dict headers: A `dict` containing the request headers
105
203
  :return: A `DetailedResponse` containing the result, headers and HTTP status code.
106
204
  :rtype: DetailedResponse with `dict` result representing a `BillingOptionsSummary` object
@@ -121,7 +219,7 @@ class PartnerBillingUnitsV1(BaseService):
121
219
  'customer_id': customer_id,
122
220
  'reseller_id': reseller_id,
123
221
  'date': date,
124
- '_limit': limit,
222
+ 'limit': limit,
125
223
  }
126
224
 
127
225
  if 'headers' in kwargs:
@@ -155,21 +253,23 @@ class PartnerBillingUnitsV1(BaseService):
155
253
  **kwargs,
156
254
  ) -> DetailedResponse:
157
255
  """
158
- Get subscription burn-down report.
256
+ Get credit pools report.
159
257
 
160
258
  Returns the subscription or commitment burn-down reports for the end customers for
161
259
  a given month.
162
260
 
163
261
  :param str partner_id: Enterprise ID of the distributor or reseller for
164
262
  which the report is requested.
165
- :param str customer_id: (optional) Enterprise ID of the customer for which
166
- the report is requested.
263
+ :param str customer_id: (optional) Account ID/Enterprise ID of the end
264
+ customer for which the report is requested. This parameter cannot be used
265
+ along with `reseller_id` query parameter.
167
266
  :param str reseller_id: (optional) Enterprise ID of the reseller for which
168
- the report is requested.
169
- :param str date: (optional) The billing month for which the usage report is
267
+ the report is requested. This parameter cannot be used along with
268
+ `customer_id` query parameter.
269
+ :param str date: (optional) The billing month for which the report is
170
270
  requested. Format is yyyy-mm. Defaults to current month.
171
- :param int limit: (optional) Number of usage records returned. The default
172
- value is 30. Maximum value is 200.
271
+ :param int limit: (optional) Number of billing units fetched to get the
272
+ credit pools report. The default value is 30. Maximum value is 30.
173
273
  :param dict headers: A `dict` containing the request headers
174
274
  :return: A `DetailedResponse` containing the result, headers and HTTP status code.
175
275
  :rtype: DetailedResponse with `dict` result representing a `CreditPoolsReportSummary` object
@@ -190,7 +290,7 @@ class PartnerBillingUnitsV1(BaseService):
190
290
  'customer_id': customer_id,
191
291
  'reseller_id': reseller_id,
192
292
  'date': date,
193
- '_limit': limit,
293
+ 'limit': limit,
194
294
  }
195
295
 
196
296
  if 'headers' in kwargs:
@@ -210,135 +310,26 @@ class PartnerBillingUnitsV1(BaseService):
210
310
  return response
211
311
 
212
312
 
213
- ##############################################################################
214
- # Models
215
- ##############################################################################
216
-
217
-
218
- class BillingOptionsSummaryFirst:
219
- """
220
- The link to the first page of the search query.
221
-
222
- :param str href: (optional) A link to a page of query results.
223
- """
224
-
225
- def __init__(
226
- self,
227
- *,
228
- href: Optional[str] = None,
229
- ) -> None:
230
- """
231
- Initialize a BillingOptionsSummaryFirst object.
232
-
233
- :param str href: (optional) A link to a page of query results.
234
- """
235
- self.href = href
236
-
237
- @classmethod
238
- def from_dict(cls, _dict: Dict) -> 'BillingOptionsSummaryFirst':
239
- """Initialize a BillingOptionsSummaryFirst object from a json dictionary."""
240
- args = {}
241
- if (href := _dict.get('href')) is not None:
242
- args['href'] = href
243
- return cls(**args)
244
-
245
- @classmethod
246
- def _from_dict(cls, _dict):
247
- """Initialize a BillingOptionsSummaryFirst object from a json dictionary."""
248
- return cls.from_dict(_dict)
249
-
250
- def to_dict(self) -> Dict:
251
- """Return a json dictionary representing this model."""
252
- _dict = {}
253
- if hasattr(self, 'href') and self.href is not None:
254
- _dict['href'] = self.href
255
- return _dict
256
-
257
- def _to_dict(self):
258
- """Return a json dictionary representing this model."""
259
- return self.to_dict()
260
-
261
- def __str__(self) -> str:
262
- """Return a `str` version of this BillingOptionsSummaryFirst object."""
263
- return json.dumps(self.to_dict(), indent=2)
264
-
265
- def __eq__(self, other: 'BillingOptionsSummaryFirst') -> bool:
266
- """Return `true` when self and other are equal, false otherwise."""
267
- if not isinstance(other, self.__class__):
268
- return False
269
- return self.__dict__ == other.__dict__
270
-
271
- def __ne__(self, other: 'BillingOptionsSummaryFirst') -> bool:
272
- """Return `true` when self and other are not equal, false otherwise."""
273
- return not self == other
274
-
275
-
276
- class BillingOptionsSummaryNext:
313
+ class GetResourceUsageReportEnums:
277
314
  """
278
- The link to the next page of the search query.
279
-
280
- :param str href: (optional) A link to a page of query results.
281
- :param str offset: (optional) The value of the `_start` query parameter to fetch
282
- the next page.
315
+ Enums for get_resource_usage_report parameters.
283
316
  """
284
317
 
285
- def __init__(
286
- self,
287
- *,
288
- href: Optional[str] = None,
289
- offset: Optional[str] = None,
290
- ) -> None:
318
+ class Viewpoint(str, Enum):
291
319
  """
292
- Initialize a BillingOptionsSummaryNext object.
293
-
294
- :param str href: (optional) A link to a page of query results.
295
- :param str offset: (optional) The value of the `_start` query parameter to
296
- fetch the next page.
320
+ Enables partner to view the cost of provisioned services as applicable at the
321
+ given level. Defaults to the type of the calling partner. The valid values are
322
+ `DISTRIBUTOR`, `RESELLER` and `END_CUSTOMER`.
297
323
  """
298
- self.href = href
299
- self.offset = offset
300
-
301
- @classmethod
302
- def from_dict(cls, _dict: Dict) -> 'BillingOptionsSummaryNext':
303
- """Initialize a BillingOptionsSummaryNext object from a json dictionary."""
304
- args = {}
305
- if (href := _dict.get('href')) is not None:
306
- args['href'] = href
307
- if (offset := _dict.get('offset')) is not None:
308
- args['offset'] = offset
309
- return cls(**args)
310
-
311
- @classmethod
312
- def _from_dict(cls, _dict):
313
- """Initialize a BillingOptionsSummaryNext object from a json dictionary."""
314
- return cls.from_dict(_dict)
315
-
316
- def to_dict(self) -> Dict:
317
- """Return a json dictionary representing this model."""
318
- _dict = {}
319
- if hasattr(self, 'href') and self.href is not None:
320
- _dict['href'] = self.href
321
- if hasattr(self, 'offset') and self.offset is not None:
322
- _dict['offset'] = self.offset
323
- return _dict
324
-
325
- def _to_dict(self):
326
- """Return a json dictionary representing this model."""
327
- return self.to_dict()
328
324
 
329
- def __str__(self) -> str:
330
- """Return a `str` version of this BillingOptionsSummaryNext object."""
331
- return json.dumps(self.to_dict(), indent=2)
325
+ DISTRIBUTOR = 'DISTRIBUTOR'
326
+ RESELLER = 'RESELLER'
327
+ END_CUSTOMER = 'END_CUSTOMER'
332
328
 
333
- def __eq__(self, other: 'BillingOptionsSummaryNext') -> bool:
334
- """Return `true` when self and other are equal, false otherwise."""
335
- if not isinstance(other, self.__class__):
336
- return False
337
- return self.__dict__ == other.__dict__
338
329
 
339
- def __ne__(self, other: 'BillingOptionsSummaryNext') -> bool:
340
- """Return `true` when self and other are not equal, false otherwise."""
341
- return not self == other
330
+ ##############################################################################
331
+ # Models
332
+ ##############################################################################
342
333
 
343
334
 
344
335
  class BillingOption:
@@ -653,11 +644,8 @@ class BillingOptionsSummary:
653
644
  """
654
645
  The billing options report for the customer.
655
646
 
656
- :param int limit: (optional) The max number of reports in the response.
657
- :param BillingOptionsSummaryFirst first: (optional) The link to the first page
658
- of the search query.
659
- :param BillingOptionsSummaryNext next: (optional) The link to the next page of
660
- the search query.
647
+ :param int rows_count: (optional) The max number of reports in the response.
648
+ :param str next_url: (optional) The link to the next page of the search query.
661
649
  :param List[BillingOption] resources: (optional) Aggregated usage report of all
662
650
  requested partners.
663
651
  """
@@ -665,37 +653,32 @@ class BillingOptionsSummary:
665
653
  def __init__(
666
654
  self,
667
655
  *,
668
- limit: Optional[int] = None,
669
- first: Optional['BillingOptionsSummaryFirst'] = None,
670
- next: Optional['BillingOptionsSummaryNext'] = None,
656
+ rows_count: Optional[int] = None,
657
+ next_url: Optional[str] = None,
671
658
  resources: Optional[List['BillingOption']] = None,
672
659
  ) -> None:
673
660
  """
674
661
  Initialize a BillingOptionsSummary object.
675
662
 
676
- :param int limit: (optional) The max number of reports in the response.
677
- :param BillingOptionsSummaryFirst first: (optional) The link to the first
678
- page of the search query.
679
- :param BillingOptionsSummaryNext next: (optional) The link to the next page
680
- of the search query.
663
+ :param int rows_count: (optional) The max number of reports in the
664
+ response.
665
+ :param str next_url: (optional) The link to the next page of the search
666
+ query.
681
667
  :param List[BillingOption] resources: (optional) Aggregated usage report of
682
668
  all requested partners.
683
669
  """
684
- self.limit = limit
685
- self.first = first
686
- self.next = next
670
+ self.rows_count = rows_count
671
+ self.next_url = next_url
687
672
  self.resources = resources
688
673
 
689
674
  @classmethod
690
675
  def from_dict(cls, _dict: Dict) -> 'BillingOptionsSummary':
691
676
  """Initialize a BillingOptionsSummary object from a json dictionary."""
692
677
  args = {}
693
- if (limit := _dict.get('limit')) is not None:
694
- args['limit'] = limit
695
- if (first := _dict.get('first')) is not None:
696
- args['first'] = BillingOptionsSummaryFirst.from_dict(first)
697
- if (next := _dict.get('next')) is not None:
698
- args['next'] = BillingOptionsSummaryNext.from_dict(next)
678
+ if (rows_count := _dict.get('rows_count')) is not None:
679
+ args['rows_count'] = rows_count
680
+ if (next_url := _dict.get('next_url')) is not None:
681
+ args['next_url'] = next_url
699
682
  if (resources := _dict.get('resources')) is not None:
700
683
  args['resources'] = [BillingOption.from_dict(v) for v in resources]
701
684
  return cls(**args)
@@ -708,18 +691,10 @@ class BillingOptionsSummary:
708
691
  def to_dict(self) -> Dict:
709
692
  """Return a json dictionary representing this model."""
710
693
  _dict = {}
711
- if hasattr(self, 'limit') and self.limit is not None:
712
- _dict['limit'] = self.limit
713
- if hasattr(self, 'first') and self.first is not None:
714
- if isinstance(self.first, dict):
715
- _dict['first'] = self.first
716
- else:
717
- _dict['first'] = self.first.to_dict()
718
- if hasattr(self, 'next') and self.next is not None:
719
- if isinstance(self.next, dict):
720
- _dict['next'] = self.next
721
- else:
722
- _dict['next'] = self.next.to_dict()
694
+ if hasattr(self, 'rows_count') and self.rows_count is not None:
695
+ _dict['rows_count'] = self.rows_count
696
+ if hasattr(self, 'next_url') and self.next_url is not None:
697
+ _dict['next_url'] = self.next_url
723
698
  if hasattr(self, 'resources') and self.resources is not None:
724
699
  resources_list = []
725
700
  for v in self.resources:
@@ -749,36 +724,494 @@ class BillingOptionsSummary:
749
724
  return not self == other
750
725
 
751
726
 
752
- class CreditPoolsReportSummaryFirst:
727
+ class CreditPoolsReport:
753
728
  """
754
- The link to the first page of the search query.
729
+ Aggregated subscription burn-down report for the end customers.
755
730
 
756
- :param str href: (optional) A link to a page of query results.
731
+ :param str type: (optional) The category of the billing option. The valid values
732
+ are `PLATFORM`, `SERVICE` and `SUPPORT`.
733
+ :param str billing_unit_id: (optional) The ID of the billing unit that's
734
+ associated with the billing option.
735
+ :param str customer_id: (optional) Account ID of the customer.
736
+ :param str customer_type: (optional) The customer type. The valid values are
737
+ `ENTERPRISE`, `ACCOUNT`, and `ACCOUNT_GROUP`.
738
+ :param str customer_name: (optional) A user-defined name for the customer.
739
+ :param str reseller_id: (optional) ID of the reseller in the heirarchy of the
740
+ requested customer.
741
+ :param str reseller_name: (optional) Name of the reseller in the heirarchy of
742
+ the requested customer.
743
+ :param str month: (optional) The billing month for which the burn-down report is
744
+ requested. Format is yyyy-mm. Defaults to current month.
745
+ :param str currency_code: (optional) The currency code of the billing unit.
746
+ :param List[TermCredits] term_credits: (optional) A list of active subscription
747
+ terms available within a credit.
748
+ :param Overage overage: (optional) Overage that was generated on the credit
749
+ pool.
757
750
  """
758
751
 
759
752
  def __init__(
760
753
  self,
761
754
  *,
762
- href: Optional[str] = None,
755
+ type: Optional[str] = None,
756
+ billing_unit_id: Optional[str] = None,
757
+ customer_id: Optional[str] = None,
758
+ customer_type: Optional[str] = None,
759
+ customer_name: Optional[str] = None,
760
+ reseller_id: Optional[str] = None,
761
+ reseller_name: Optional[str] = None,
762
+ month: Optional[str] = None,
763
+ currency_code: Optional[str] = None,
764
+ term_credits: Optional[List['TermCredits']] = None,
765
+ overage: Optional['Overage'] = None,
763
766
  ) -> None:
764
767
  """
765
- Initialize a CreditPoolsReportSummaryFirst object.
768
+ Initialize a CreditPoolsReport object.
766
769
 
767
- :param str href: (optional) A link to a page of query results.
770
+ :param str type: (optional) The category of the billing option. The valid
771
+ values are `PLATFORM`, `SERVICE` and `SUPPORT`.
772
+ :param str billing_unit_id: (optional) The ID of the billing unit that's
773
+ associated with the billing option.
774
+ :param str customer_id: (optional) Account ID of the customer.
775
+ :param str customer_type: (optional) The customer type. The valid values
776
+ are `ENTERPRISE`, `ACCOUNT`, and `ACCOUNT_GROUP`.
777
+ :param str customer_name: (optional) A user-defined name for the customer.
778
+ :param str reseller_id: (optional) ID of the reseller in the heirarchy of
779
+ the requested customer.
780
+ :param str reseller_name: (optional) Name of the reseller in the heirarchy
781
+ of the requested customer.
782
+ :param str month: (optional) The billing month for which the burn-down
783
+ report is requested. Format is yyyy-mm. Defaults to current month.
784
+ :param str currency_code: (optional) The currency code of the billing unit.
785
+ :param List[TermCredits] term_credits: (optional) A list of active
786
+ subscription terms available within a credit.
787
+ :param Overage overage: (optional) Overage that was generated on the credit
788
+ pool.
768
789
  """
769
- self.href = href
790
+ self.type = type
791
+ self.billing_unit_id = billing_unit_id
792
+ self.customer_id = customer_id
793
+ self.customer_type = customer_type
794
+ self.customer_name = customer_name
795
+ self.reseller_id = reseller_id
796
+ self.reseller_name = reseller_name
797
+ self.month = month
798
+ self.currency_code = currency_code
799
+ self.term_credits = term_credits
800
+ self.overage = overage
770
801
 
771
802
  @classmethod
772
- def from_dict(cls, _dict: Dict) -> 'CreditPoolsReportSummaryFirst':
773
- """Initialize a CreditPoolsReportSummaryFirst object from a json dictionary."""
803
+ def from_dict(cls, _dict: Dict) -> 'CreditPoolsReport':
804
+ """Initialize a CreditPoolsReport object from a json dictionary."""
774
805
  args = {}
775
- if (href := _dict.get('href')) is not None:
776
- args['href'] = href
777
- return cls(**args)
806
+ if (type := _dict.get('type')) is not None:
807
+ args['type'] = type
808
+ if (billing_unit_id := _dict.get('billing_unit_id')) is not None:
809
+ args['billing_unit_id'] = billing_unit_id
810
+ if (customer_id := _dict.get('customer_id')) is not None:
811
+ args['customer_id'] = customer_id
812
+ if (customer_type := _dict.get('customer_type')) is not None:
813
+ args['customer_type'] = customer_type
814
+ if (customer_name := _dict.get('customer_name')) is not None:
815
+ args['customer_name'] = customer_name
816
+ if (reseller_id := _dict.get('reseller_id')) is not None:
817
+ args['reseller_id'] = reseller_id
818
+ if (reseller_name := _dict.get('reseller_name')) is not None:
819
+ args['reseller_name'] = reseller_name
820
+ if (month := _dict.get('month')) is not None:
821
+ args['month'] = month
822
+ if (currency_code := _dict.get('currency_code')) is not None:
823
+ args['currency_code'] = currency_code
824
+ if (term_credits := _dict.get('term_credits')) is not None:
825
+ args['term_credits'] = [TermCredits.from_dict(v) for v in term_credits]
826
+ if (overage := _dict.get('overage')) is not None:
827
+ args['overage'] = Overage.from_dict(overage)
828
+ return cls(**args)
778
829
 
779
830
  @classmethod
780
831
  def _from_dict(cls, _dict):
781
- """Initialize a CreditPoolsReportSummaryFirst object from a json dictionary."""
832
+ """Initialize a CreditPoolsReport object from a json dictionary."""
833
+ return cls.from_dict(_dict)
834
+
835
+ def to_dict(self) -> Dict:
836
+ """Return a json dictionary representing this model."""
837
+ _dict = {}
838
+ if hasattr(self, 'type') and self.type is not None:
839
+ _dict['type'] = self.type
840
+ if hasattr(self, 'billing_unit_id') and self.billing_unit_id is not None:
841
+ _dict['billing_unit_id'] = self.billing_unit_id
842
+ if hasattr(self, 'customer_id') and self.customer_id is not None:
843
+ _dict['customer_id'] = self.customer_id
844
+ if hasattr(self, 'customer_type') and self.customer_type is not None:
845
+ _dict['customer_type'] = self.customer_type
846
+ if hasattr(self, 'customer_name') and self.customer_name is not None:
847
+ _dict['customer_name'] = self.customer_name
848
+ if hasattr(self, 'reseller_id') and self.reseller_id is not None:
849
+ _dict['reseller_id'] = self.reseller_id
850
+ if hasattr(self, 'reseller_name') and self.reseller_name is not None:
851
+ _dict['reseller_name'] = self.reseller_name
852
+ if hasattr(self, 'month') and self.month is not None:
853
+ _dict['month'] = self.month
854
+ if hasattr(self, 'currency_code') and self.currency_code is not None:
855
+ _dict['currency_code'] = self.currency_code
856
+ if hasattr(self, 'term_credits') and self.term_credits is not None:
857
+ term_credits_list = []
858
+ for v in self.term_credits:
859
+ if isinstance(v, dict):
860
+ term_credits_list.append(v)
861
+ else:
862
+ term_credits_list.append(v.to_dict())
863
+ _dict['term_credits'] = term_credits_list
864
+ if hasattr(self, 'overage') and self.overage is not None:
865
+ if isinstance(self.overage, dict):
866
+ _dict['overage'] = self.overage
867
+ else:
868
+ _dict['overage'] = self.overage.to_dict()
869
+ return _dict
870
+
871
+ def _to_dict(self):
872
+ """Return a json dictionary representing this model."""
873
+ return self.to_dict()
874
+
875
+ def __str__(self) -> str:
876
+ """Return a `str` version of this CreditPoolsReport object."""
877
+ return json.dumps(self.to_dict(), indent=2)
878
+
879
+ def __eq__(self, other: 'CreditPoolsReport') -> bool:
880
+ """Return `true` when self and other are equal, false otherwise."""
881
+ if not isinstance(other, self.__class__):
882
+ return False
883
+ return self.__dict__ == other.__dict__
884
+
885
+ def __ne__(self, other: 'CreditPoolsReport') -> bool:
886
+ """Return `true` when self and other are not equal, false otherwise."""
887
+ return not self == other
888
+
889
+ class TypeEnum(str, Enum):
890
+ """
891
+ The category of the billing option. The valid values are `PLATFORM`, `SERVICE` and
892
+ `SUPPORT`.
893
+ """
894
+
895
+ PLATFORM = 'PLATFORM'
896
+ SERVICE = 'SERVICE'
897
+ SUPPORT = 'SUPPORT'
898
+
899
+ class CustomerTypeEnum(str, Enum):
900
+ """
901
+ The customer type. The valid values are `ENTERPRISE`, `ACCOUNT`, and
902
+ `ACCOUNT_GROUP`.
903
+ """
904
+
905
+ ENTERPRISE = 'ENTERPRISE'
906
+ ACCOUNT = 'ACCOUNT'
907
+ ACCOUNT_GROUP = 'ACCOUNT_GROUP'
908
+
909
+
910
+ class CreditPoolsReportSummary:
911
+ """
912
+ The aggregated credit pools report.
913
+
914
+ :param int rows_count: (optional) The max number of reports in the response.
915
+ :param str next_url: (optional) The link to the next page of the search query.
916
+ :param List[CreditPoolsReport] resources: (optional) Aggregated usage report of
917
+ all requested partners.
918
+ """
919
+
920
+ def __init__(
921
+ self,
922
+ *,
923
+ rows_count: Optional[int] = None,
924
+ next_url: Optional[str] = None,
925
+ resources: Optional[List['CreditPoolsReport']] = None,
926
+ ) -> None:
927
+ """
928
+ Initialize a CreditPoolsReportSummary object.
929
+
930
+ :param int rows_count: (optional) The max number of reports in the
931
+ response.
932
+ :param str next_url: (optional) The link to the next page of the search
933
+ query.
934
+ :param List[CreditPoolsReport] resources: (optional) Aggregated usage
935
+ report of all requested partners.
936
+ """
937
+ self.rows_count = rows_count
938
+ self.next_url = next_url
939
+ self.resources = resources
940
+
941
+ @classmethod
942
+ def from_dict(cls, _dict: Dict) -> 'CreditPoolsReportSummary':
943
+ """Initialize a CreditPoolsReportSummary object from a json dictionary."""
944
+ args = {}
945
+ if (rows_count := _dict.get('rows_count')) is not None:
946
+ args['rows_count'] = rows_count
947
+ if (next_url := _dict.get('next_url')) is not None:
948
+ args['next_url'] = next_url
949
+ if (resources := _dict.get('resources')) is not None:
950
+ args['resources'] = [CreditPoolsReport.from_dict(v) for v in resources]
951
+ return cls(**args)
952
+
953
+ @classmethod
954
+ def _from_dict(cls, _dict):
955
+ """Initialize a CreditPoolsReportSummary object from a json dictionary."""
956
+ return cls.from_dict(_dict)
957
+
958
+ def to_dict(self) -> Dict:
959
+ """Return a json dictionary representing this model."""
960
+ _dict = {}
961
+ if hasattr(self, 'rows_count') and self.rows_count is not None:
962
+ _dict['rows_count'] = self.rows_count
963
+ if hasattr(self, 'next_url') and self.next_url is not None:
964
+ _dict['next_url'] = self.next_url
965
+ if hasattr(self, 'resources') and self.resources is not None:
966
+ resources_list = []
967
+ for v in self.resources:
968
+ if isinstance(v, dict):
969
+ resources_list.append(v)
970
+ else:
971
+ resources_list.append(v.to_dict())
972
+ _dict['resources'] = resources_list
973
+ return _dict
974
+
975
+ def _to_dict(self):
976
+ """Return a json dictionary representing this model."""
977
+ return self.to_dict()
978
+
979
+ def __str__(self) -> str:
980
+ """Return a `str` version of this CreditPoolsReportSummary object."""
981
+ return json.dumps(self.to_dict(), indent=2)
982
+
983
+ def __eq__(self, other: 'CreditPoolsReportSummary') -> bool:
984
+ """Return `true` when self and other are equal, false otherwise."""
985
+ if not isinstance(other, self.__class__):
986
+ return False
987
+ return self.__dict__ == other.__dict__
988
+
989
+ def __ne__(self, other: 'CreditPoolsReportSummary') -> bool:
990
+ """Return `true` when self and other are not equal, false otherwise."""
991
+ return not self == other
992
+
993
+
994
+ class MetricUsage:
995
+ """
996
+ An object that represents a metric.
997
+
998
+ :param str metric: The name of the metric.
999
+ :param str unit: A unit to qualify the quantity.
1000
+ :param float quantity: The aggregated value for the metric.
1001
+ :param float rateable_quantity: The quantity that is used for calculating
1002
+ charges.
1003
+ :param float cost: The cost that was incurred by the metric.
1004
+ :param float rated_cost: The pre-discounted cost that was incurred by the
1005
+ metric.
1006
+ :param List[dict] price: (optional) The price with which cost was calculated.
1007
+ """
1008
+
1009
+ def __init__(
1010
+ self,
1011
+ metric: str,
1012
+ unit: str,
1013
+ quantity: float,
1014
+ rateable_quantity: float,
1015
+ cost: float,
1016
+ rated_cost: float,
1017
+ *,
1018
+ price: Optional[List[dict]] = None,
1019
+ ) -> None:
1020
+ """
1021
+ Initialize a MetricUsage object.
1022
+
1023
+ :param str metric: The name of the metric.
1024
+ :param str unit: A unit to qualify the quantity.
1025
+ :param float quantity: The aggregated value for the metric.
1026
+ :param float rateable_quantity: The quantity that is used for calculating
1027
+ charges.
1028
+ :param float cost: The cost that was incurred by the metric.
1029
+ :param float rated_cost: The pre-discounted cost that was incurred by the
1030
+ metric.
1031
+ :param List[dict] price: (optional) The price with which cost was
1032
+ calculated.
1033
+ """
1034
+ self.metric = metric
1035
+ self.unit = unit
1036
+ self.quantity = quantity
1037
+ self.rateable_quantity = rateable_quantity
1038
+ self.cost = cost
1039
+ self.rated_cost = rated_cost
1040
+ self.price = price
1041
+
1042
+ @classmethod
1043
+ def from_dict(cls, _dict: Dict) -> 'MetricUsage':
1044
+ """Initialize a MetricUsage object from a json dictionary."""
1045
+ args = {}
1046
+ if (metric := _dict.get('metric')) is not None:
1047
+ args['metric'] = metric
1048
+ else:
1049
+ raise ValueError('Required property \'metric\' not present in MetricUsage JSON')
1050
+ if (unit := _dict.get('unit')) is not None:
1051
+ args['unit'] = unit
1052
+ else:
1053
+ raise ValueError('Required property \'unit\' not present in MetricUsage JSON')
1054
+ if (quantity := _dict.get('quantity')) is not None:
1055
+ args['quantity'] = quantity
1056
+ else:
1057
+ raise ValueError('Required property \'quantity\' not present in MetricUsage JSON')
1058
+ if (rateable_quantity := _dict.get('rateable_quantity')) is not None:
1059
+ args['rateable_quantity'] = rateable_quantity
1060
+ else:
1061
+ raise ValueError('Required property \'rateable_quantity\' not present in MetricUsage JSON')
1062
+ if (cost := _dict.get('cost')) is not None:
1063
+ args['cost'] = cost
1064
+ else:
1065
+ raise ValueError('Required property \'cost\' not present in MetricUsage JSON')
1066
+ if (rated_cost := _dict.get('rated_cost')) is not None:
1067
+ args['rated_cost'] = rated_cost
1068
+ else:
1069
+ raise ValueError('Required property \'rated_cost\' not present in MetricUsage JSON')
1070
+ if (price := _dict.get('price')) is not None:
1071
+ args['price'] = price
1072
+ return cls(**args)
1073
+
1074
+ @classmethod
1075
+ def _from_dict(cls, _dict):
1076
+ """Initialize a MetricUsage object from a json dictionary."""
1077
+ return cls.from_dict(_dict)
1078
+
1079
+ def to_dict(self) -> Dict:
1080
+ """Return a json dictionary representing this model."""
1081
+ _dict = {}
1082
+ if hasattr(self, 'metric') and self.metric is not None:
1083
+ _dict['metric'] = self.metric
1084
+ if hasattr(self, 'unit') and self.unit is not None:
1085
+ _dict['unit'] = self.unit
1086
+ if hasattr(self, 'quantity') and self.quantity is not None:
1087
+ _dict['quantity'] = self.quantity
1088
+ if hasattr(self, 'rateable_quantity') and self.rateable_quantity is not None:
1089
+ _dict['rateable_quantity'] = self.rateable_quantity
1090
+ if hasattr(self, 'cost') and self.cost is not None:
1091
+ _dict['cost'] = self.cost
1092
+ if hasattr(self, 'rated_cost') and self.rated_cost is not None:
1093
+ _dict['rated_cost'] = self.rated_cost
1094
+ if hasattr(self, 'price') and self.price is not None:
1095
+ _dict['price'] = self.price
1096
+ return _dict
1097
+
1098
+ def _to_dict(self):
1099
+ """Return a json dictionary representing this model."""
1100
+ return self.to_dict()
1101
+
1102
+ def __str__(self) -> str:
1103
+ """Return a `str` version of this MetricUsage object."""
1104
+ return json.dumps(self.to_dict(), indent=2)
1105
+
1106
+ def __eq__(self, other: 'MetricUsage') -> bool:
1107
+ """Return `true` when self and other are equal, false otherwise."""
1108
+ if not isinstance(other, self.__class__):
1109
+ return False
1110
+ return self.__dict__ == other.__dict__
1111
+
1112
+ def __ne__(self, other: 'MetricUsage') -> bool:
1113
+ """Return `true` when self and other are not equal, false otherwise."""
1114
+ return not self == other
1115
+
1116
+
1117
+ class Overage:
1118
+ """
1119
+ Overage that was generated on the credit pool.
1120
+
1121
+ :param float cost: (optional) The number of credits used as overage.
1122
+ :param List[dict] resources: (optional) A list of resources that generated
1123
+ overage.
1124
+ """
1125
+
1126
+ def __init__(
1127
+ self,
1128
+ *,
1129
+ cost: Optional[float] = None,
1130
+ resources: Optional[List[dict]] = None,
1131
+ ) -> None:
1132
+ """
1133
+ Initialize a Overage object.
1134
+
1135
+ :param float cost: (optional) The number of credits used as overage.
1136
+ :param List[dict] resources: (optional) A list of resources that generated
1137
+ overage.
1138
+ """
1139
+ self.cost = cost
1140
+ self.resources = resources
1141
+
1142
+ @classmethod
1143
+ def from_dict(cls, _dict: Dict) -> 'Overage':
1144
+ """Initialize a Overage object from a json dictionary."""
1145
+ args = {}
1146
+ if (cost := _dict.get('cost')) is not None:
1147
+ args['cost'] = cost
1148
+ if (resources := _dict.get('resources')) is not None:
1149
+ args['resources'] = resources
1150
+ return cls(**args)
1151
+
1152
+ @classmethod
1153
+ def _from_dict(cls, _dict):
1154
+ """Initialize a Overage object from a json dictionary."""
1155
+ return cls.from_dict(_dict)
1156
+
1157
+ def to_dict(self) -> Dict:
1158
+ """Return a json dictionary representing this model."""
1159
+ _dict = {}
1160
+ if hasattr(self, 'cost') and self.cost is not None:
1161
+ _dict['cost'] = self.cost
1162
+ if hasattr(self, 'resources') and self.resources is not None:
1163
+ _dict['resources'] = self.resources
1164
+ return _dict
1165
+
1166
+ def _to_dict(self):
1167
+ """Return a json dictionary representing this model."""
1168
+ return self.to_dict()
1169
+
1170
+ def __str__(self) -> str:
1171
+ """Return a `str` version of this Overage object."""
1172
+ return json.dumps(self.to_dict(), indent=2)
1173
+
1174
+ def __eq__(self, other: 'Overage') -> bool:
1175
+ """Return `true` when self and other are equal, false otherwise."""
1176
+ if not isinstance(other, self.__class__):
1177
+ return False
1178
+ return self.__dict__ == other.__dict__
1179
+
1180
+ def __ne__(self, other: 'Overage') -> bool:
1181
+ """Return `true` when self and other are not equal, false otherwise."""
1182
+ return not self == other
1183
+
1184
+
1185
+ class PartnerUsageReportSummaryFirst:
1186
+ """
1187
+ The link to the first page of the search query.
1188
+
1189
+ :param str href: (optional) A link to a page of query results.
1190
+ """
1191
+
1192
+ def __init__(
1193
+ self,
1194
+ *,
1195
+ href: Optional[str] = None,
1196
+ ) -> None:
1197
+ """
1198
+ Initialize a PartnerUsageReportSummaryFirst object.
1199
+
1200
+ :param str href: (optional) A link to a page of query results.
1201
+ """
1202
+ self.href = href
1203
+
1204
+ @classmethod
1205
+ def from_dict(cls, _dict: Dict) -> 'PartnerUsageReportSummaryFirst':
1206
+ """Initialize a PartnerUsageReportSummaryFirst object from a json dictionary."""
1207
+ args = {}
1208
+ if (href := _dict.get('href')) is not None:
1209
+ args['href'] = href
1210
+ return cls(**args)
1211
+
1212
+ @classmethod
1213
+ def _from_dict(cls, _dict):
1214
+ """Initialize a PartnerUsageReportSummaryFirst object from a json dictionary."""
782
1215
  return cls.from_dict(_dict)
783
1216
 
784
1217
  def to_dict(self) -> Dict:
@@ -793,21 +1226,21 @@ class CreditPoolsReportSummaryFirst:
793
1226
  return self.to_dict()
794
1227
 
795
1228
  def __str__(self) -> str:
796
- """Return a `str` version of this CreditPoolsReportSummaryFirst object."""
1229
+ """Return a `str` version of this PartnerUsageReportSummaryFirst object."""
797
1230
  return json.dumps(self.to_dict(), indent=2)
798
1231
 
799
- def __eq__(self, other: 'CreditPoolsReportSummaryFirst') -> bool:
1232
+ def __eq__(self, other: 'PartnerUsageReportSummaryFirst') -> bool:
800
1233
  """Return `true` when self and other are equal, false otherwise."""
801
1234
  if not isinstance(other, self.__class__):
802
1235
  return False
803
1236
  return self.__dict__ == other.__dict__
804
1237
 
805
- def __ne__(self, other: 'CreditPoolsReportSummaryFirst') -> bool:
1238
+ def __ne__(self, other: 'PartnerUsageReportSummaryFirst') -> bool:
806
1239
  """Return `true` when self and other are not equal, false otherwise."""
807
1240
  return not self == other
808
1241
 
809
1242
 
810
- class CreditPoolsReportSummaryNext:
1243
+ class PartnerUsageReportSummaryNext:
811
1244
  """
812
1245
  The link to the next page of the search query.
813
1246
 
@@ -823,7 +1256,7 @@ class CreditPoolsReportSummaryNext:
823
1256
  offset: Optional[str] = None,
824
1257
  ) -> None:
825
1258
  """
826
- Initialize a CreditPoolsReportSummaryNext object.
1259
+ Initialize a PartnerUsageReportSummaryNext object.
827
1260
 
828
1261
  :param str href: (optional) A link to a page of query results.
829
1262
  :param str offset: (optional) The value of the `_start` query parameter to
@@ -833,8 +1266,8 @@ class CreditPoolsReportSummaryNext:
833
1266
  self.offset = offset
834
1267
 
835
1268
  @classmethod
836
- def from_dict(cls, _dict: Dict) -> 'CreditPoolsReportSummaryNext':
837
- """Initialize a CreditPoolsReportSummaryNext object from a json dictionary."""
1269
+ def from_dict(cls, _dict: Dict) -> 'PartnerUsageReportSummaryNext':
1270
+ """Initialize a PartnerUsageReportSummaryNext object from a json dictionary."""
838
1271
  args = {}
839
1272
  if (href := _dict.get('href')) is not None:
840
1273
  args['href'] = href
@@ -844,7 +1277,7 @@ class CreditPoolsReportSummaryNext:
844
1277
 
845
1278
  @classmethod
846
1279
  def _from_dict(cls, _dict):
847
- """Initialize a CreditPoolsReportSummaryNext object from a json dictionary."""
1280
+ """Initialize a PartnerUsageReportSummaryNext object from a json dictionary."""
848
1281
  return cls.from_dict(_dict)
849
1282
 
850
1283
  def to_dict(self) -> Dict:
@@ -861,162 +1294,185 @@ class CreditPoolsReportSummaryNext:
861
1294
  return self.to_dict()
862
1295
 
863
1296
  def __str__(self) -> str:
864
- """Return a `str` version of this CreditPoolsReportSummaryNext object."""
1297
+ """Return a `str` version of this PartnerUsageReportSummaryNext object."""
865
1298
  return json.dumps(self.to_dict(), indent=2)
866
1299
 
867
- def __eq__(self, other: 'CreditPoolsReportSummaryNext') -> bool:
1300
+ def __eq__(self, other: 'PartnerUsageReportSummaryNext') -> bool:
868
1301
  """Return `true` when self and other are equal, false otherwise."""
869
1302
  if not isinstance(other, self.__class__):
870
1303
  return False
871
1304
  return self.__dict__ == other.__dict__
872
1305
 
873
- def __ne__(self, other: 'CreditPoolsReportSummaryNext') -> bool:
1306
+ def __ne__(self, other: 'PartnerUsageReportSummaryNext') -> bool:
874
1307
  """Return `true` when self and other are not equal, false otherwise."""
875
1308
  return not self == other
876
1309
 
877
-
878
- class CreditPoolsReport:
879
- """
880
- Aggregated subscription burn-down report for the end customers.
881
-
882
- :param str type: (optional) The category of the billing option. The valid values
883
- are `PLATFORM`, `SERVICE` and `SUPPORT`.
884
- :param str billing_unit_id: (optional) The ID of the billing unit that's
885
- associated with the billing option.
886
- :param str customer_id: (optional) Account ID of the customer.
887
- :param str customer_type: (optional) The customer type. The valid values are
888
- `ENTERPRISE`, `ACCOUNT`, and `ACCOUNT_GROUP`.
889
- :param str customer_name: (optional) A user-defined name for the customer.
890
- :param str reseller_id: (optional) ID of the reseller in the heirarchy of the
891
- requested customer.
892
- :param str reseller_name: (optional) Name of the reseller in the heirarchy of
893
- the requested customer.
894
- :param str month: (optional) The billing month for which the burn-down report is
895
- requested. Format is yyyy-mm. Defaults to current month.
1310
+
1311
+ class PartnerUsageReport:
1312
+ """
1313
+ Aggregated usage report of a partner.
1314
+
1315
+ :param str entity_id: (optional) The ID of the entity.
1316
+ :param str entity_type: (optional) The entity type.
1317
+ :param str entity_crn: (optional) The Cloud Resource Name (CRN) of the entity
1318
+ towards which the resource usages were rolled up.
1319
+ :param str entity_name: (optional) A user-defined name for the entity, such as
1320
+ the enterprise name or account name.
1321
+ :param str entity_partner_type: (optional) Role of the `entity_id` for which the
1322
+ usage report is fetched.
1323
+ :param str viewpoint: (optional) Enables partner to view the cost of provisioned
1324
+ services as applicable at the given level.
1325
+ :param str month: (optional) The billing month for which the usage report is
1326
+ requested. Format is yyyy-mm.
896
1327
  :param str currency_code: (optional) The currency code of the billing unit.
897
- :param List[TermCredits] term_credits: (optional) A list of active subscription
898
- terms available within a credit.
899
- :param Overage overage: (optional) Overage that was generated on the credit
900
- pool.
1328
+ :param str country_code: (optional) The country code of the billing unit.
1329
+ :param float billable_cost: (optional) Billable charges that are aggregated from
1330
+ all entities in the report.
1331
+ :param float billable_rated_cost: (optional) Aggregated billable charges before
1332
+ discounts.
1333
+ :param float non_billable_cost: (optional) Non-billable charges that are
1334
+ aggregated from all entities in the report.
1335
+ :param float non_billable_rated_cost: (optional) Aggregated non-billable charges
1336
+ before discounts.
1337
+ :param List[ResourceUsage] resources: (optional)
901
1338
  """
902
1339
 
903
1340
  def __init__(
904
1341
  self,
905
1342
  *,
906
- type: Optional[str] = None,
907
- billing_unit_id: Optional[str] = None,
908
- customer_id: Optional[str] = None,
909
- customer_type: Optional[str] = None,
910
- customer_name: Optional[str] = None,
911
- reseller_id: Optional[str] = None,
912
- reseller_name: Optional[str] = None,
1343
+ entity_id: Optional[str] = None,
1344
+ entity_type: Optional[str] = None,
1345
+ entity_crn: Optional[str] = None,
1346
+ entity_name: Optional[str] = None,
1347
+ entity_partner_type: Optional[str] = None,
1348
+ viewpoint: Optional[str] = None,
913
1349
  month: Optional[str] = None,
914
1350
  currency_code: Optional[str] = None,
915
- term_credits: Optional[List['TermCredits']] = None,
916
- overage: Optional['Overage'] = None,
1351
+ country_code: Optional[str] = None,
1352
+ billable_cost: Optional[float] = None,
1353
+ billable_rated_cost: Optional[float] = None,
1354
+ non_billable_cost: Optional[float] = None,
1355
+ non_billable_rated_cost: Optional[float] = None,
1356
+ resources: Optional[List['ResourceUsage']] = None,
917
1357
  ) -> None:
918
1358
  """
919
- Initialize a CreditPoolsReport object.
920
-
921
- :param str type: (optional) The category of the billing option. The valid
922
- values are `PLATFORM`, `SERVICE` and `SUPPORT`.
923
- :param str billing_unit_id: (optional) The ID of the billing unit that's
924
- associated with the billing option.
925
- :param str customer_id: (optional) Account ID of the customer.
926
- :param str customer_type: (optional) The customer type. The valid values
927
- are `ENTERPRISE`, `ACCOUNT`, and `ACCOUNT_GROUP`.
928
- :param str customer_name: (optional) A user-defined name for the customer.
929
- :param str reseller_id: (optional) ID of the reseller in the heirarchy of
930
- the requested customer.
931
- :param str reseller_name: (optional) Name of the reseller in the heirarchy
932
- of the requested customer.
933
- :param str month: (optional) The billing month for which the burn-down
934
- report is requested. Format is yyyy-mm. Defaults to current month.
1359
+ Initialize a PartnerUsageReport object.
1360
+
1361
+ :param str entity_id: (optional) The ID of the entity.
1362
+ :param str entity_type: (optional) The entity type.
1363
+ :param str entity_crn: (optional) The Cloud Resource Name (CRN) of the
1364
+ entity towards which the resource usages were rolled up.
1365
+ :param str entity_name: (optional) A user-defined name for the entity, such
1366
+ as the enterprise name or account name.
1367
+ :param str entity_partner_type: (optional) Role of the `entity_id` for
1368
+ which the usage report is fetched.
1369
+ :param str viewpoint: (optional) Enables partner to view the cost of
1370
+ provisioned services as applicable at the given level.
1371
+ :param str month: (optional) The billing month for which the usage report
1372
+ is requested. Format is yyyy-mm.
935
1373
  :param str currency_code: (optional) The currency code of the billing unit.
936
- :param List[TermCredits] term_credits: (optional) A list of active
937
- subscription terms available within a credit.
938
- :param Overage overage: (optional) Overage that was generated on the credit
939
- pool.
1374
+ :param str country_code: (optional) The country code of the billing unit.
1375
+ :param float billable_cost: (optional) Billable charges that are aggregated
1376
+ from all entities in the report.
1377
+ :param float billable_rated_cost: (optional) Aggregated billable charges
1378
+ before discounts.
1379
+ :param float non_billable_cost: (optional) Non-billable charges that are
1380
+ aggregated from all entities in the report.
1381
+ :param float non_billable_rated_cost: (optional) Aggregated non-billable
1382
+ charges before discounts.
1383
+ :param List[ResourceUsage] resources: (optional)
940
1384
  """
941
- self.type = type
942
- self.billing_unit_id = billing_unit_id
943
- self.customer_id = customer_id
944
- self.customer_type = customer_type
945
- self.customer_name = customer_name
946
- self.reseller_id = reseller_id
947
- self.reseller_name = reseller_name
1385
+ self.entity_id = entity_id
1386
+ self.entity_type = entity_type
1387
+ self.entity_crn = entity_crn
1388
+ self.entity_name = entity_name
1389
+ self.entity_partner_type = entity_partner_type
1390
+ self.viewpoint = viewpoint
948
1391
  self.month = month
949
1392
  self.currency_code = currency_code
950
- self.term_credits = term_credits
951
- self.overage = overage
1393
+ self.country_code = country_code
1394
+ self.billable_cost = billable_cost
1395
+ self.billable_rated_cost = billable_rated_cost
1396
+ self.non_billable_cost = non_billable_cost
1397
+ self.non_billable_rated_cost = non_billable_rated_cost
1398
+ self.resources = resources
952
1399
 
953
1400
  @classmethod
954
- def from_dict(cls, _dict: Dict) -> 'CreditPoolsReport':
955
- """Initialize a CreditPoolsReport object from a json dictionary."""
1401
+ def from_dict(cls, _dict: Dict) -> 'PartnerUsageReport':
1402
+ """Initialize a PartnerUsageReport object from a json dictionary."""
956
1403
  args = {}
957
- if (type := _dict.get('type')) is not None:
958
- args['type'] = type
959
- if (billing_unit_id := _dict.get('billing_unit_id')) is not None:
960
- args['billing_unit_id'] = billing_unit_id
961
- if (customer_id := _dict.get('customer_id')) is not None:
962
- args['customer_id'] = customer_id
963
- if (customer_type := _dict.get('customer_type')) is not None:
964
- args['customer_type'] = customer_type
965
- if (customer_name := _dict.get('customer_name')) is not None:
966
- args['customer_name'] = customer_name
967
- if (reseller_id := _dict.get('reseller_id')) is not None:
968
- args['reseller_id'] = reseller_id
969
- if (reseller_name := _dict.get('reseller_name')) is not None:
970
- args['reseller_name'] = reseller_name
1404
+ if (entity_id := _dict.get('entity_id')) is not None:
1405
+ args['entity_id'] = entity_id
1406
+ if (entity_type := _dict.get('entity_type')) is not None:
1407
+ args['entity_type'] = entity_type
1408
+ if (entity_crn := _dict.get('entity_crn')) is not None:
1409
+ args['entity_crn'] = entity_crn
1410
+ if (entity_name := _dict.get('entity_name')) is not None:
1411
+ args['entity_name'] = entity_name
1412
+ if (entity_partner_type := _dict.get('entity_partner_type')) is not None:
1413
+ args['entity_partner_type'] = entity_partner_type
1414
+ if (viewpoint := _dict.get('viewpoint')) is not None:
1415
+ args['viewpoint'] = viewpoint
971
1416
  if (month := _dict.get('month')) is not None:
972
1417
  args['month'] = month
973
1418
  if (currency_code := _dict.get('currency_code')) is not None:
974
1419
  args['currency_code'] = currency_code
975
- if (term_credits := _dict.get('term_credits')) is not None:
976
- args['term_credits'] = [TermCredits.from_dict(v) for v in term_credits]
977
- if (overage := _dict.get('overage')) is not None:
978
- args['overage'] = Overage.from_dict(overage)
1420
+ if (country_code := _dict.get('country_code')) is not None:
1421
+ args['country_code'] = country_code
1422
+ if (billable_cost := _dict.get('billable_cost')) is not None:
1423
+ args['billable_cost'] = billable_cost
1424
+ if (billable_rated_cost := _dict.get('billable_rated_cost')) is not None:
1425
+ args['billable_rated_cost'] = billable_rated_cost
1426
+ if (non_billable_cost := _dict.get('non_billable_cost')) is not None:
1427
+ args['non_billable_cost'] = non_billable_cost
1428
+ if (non_billable_rated_cost := _dict.get('non_billable_rated_cost')) is not None:
1429
+ args['non_billable_rated_cost'] = non_billable_rated_cost
1430
+ if (resources := _dict.get('resources')) is not None:
1431
+ args['resources'] = [ResourceUsage.from_dict(v) for v in resources]
979
1432
  return cls(**args)
980
1433
 
981
1434
  @classmethod
982
1435
  def _from_dict(cls, _dict):
983
- """Initialize a CreditPoolsReport object from a json dictionary."""
1436
+ """Initialize a PartnerUsageReport object from a json dictionary."""
984
1437
  return cls.from_dict(_dict)
985
1438
 
986
1439
  def to_dict(self) -> Dict:
987
1440
  """Return a json dictionary representing this model."""
988
1441
  _dict = {}
989
- if hasattr(self, 'type') and self.type is not None:
990
- _dict['type'] = self.type
991
- if hasattr(self, 'billing_unit_id') and self.billing_unit_id is not None:
992
- _dict['billing_unit_id'] = self.billing_unit_id
993
- if hasattr(self, 'customer_id') and self.customer_id is not None:
994
- _dict['customer_id'] = self.customer_id
995
- if hasattr(self, 'customer_type') and self.customer_type is not None:
996
- _dict['customer_type'] = self.customer_type
997
- if hasattr(self, 'customer_name') and self.customer_name is not None:
998
- _dict['customer_name'] = self.customer_name
999
- if hasattr(self, 'reseller_id') and self.reseller_id is not None:
1000
- _dict['reseller_id'] = self.reseller_id
1001
- if hasattr(self, 'reseller_name') and self.reseller_name is not None:
1002
- _dict['reseller_name'] = self.reseller_name
1442
+ if hasattr(self, 'entity_id') and self.entity_id is not None:
1443
+ _dict['entity_id'] = self.entity_id
1444
+ if hasattr(self, 'entity_type') and self.entity_type is not None:
1445
+ _dict['entity_type'] = self.entity_type
1446
+ if hasattr(self, 'entity_crn') and self.entity_crn is not None:
1447
+ _dict['entity_crn'] = self.entity_crn
1448
+ if hasattr(self, 'entity_name') and self.entity_name is not None:
1449
+ _dict['entity_name'] = self.entity_name
1450
+ if hasattr(self, 'entity_partner_type') and self.entity_partner_type is not None:
1451
+ _dict['entity_partner_type'] = self.entity_partner_type
1452
+ if hasattr(self, 'viewpoint') and self.viewpoint is not None:
1453
+ _dict['viewpoint'] = self.viewpoint
1003
1454
  if hasattr(self, 'month') and self.month is not None:
1004
1455
  _dict['month'] = self.month
1005
1456
  if hasattr(self, 'currency_code') and self.currency_code is not None:
1006
1457
  _dict['currency_code'] = self.currency_code
1007
- if hasattr(self, 'term_credits') and self.term_credits is not None:
1008
- term_credits_list = []
1009
- for v in self.term_credits:
1458
+ if hasattr(self, 'country_code') and self.country_code is not None:
1459
+ _dict['country_code'] = self.country_code
1460
+ if hasattr(self, 'billable_cost') and self.billable_cost is not None:
1461
+ _dict['billable_cost'] = self.billable_cost
1462
+ if hasattr(self, 'billable_rated_cost') and self.billable_rated_cost is not None:
1463
+ _dict['billable_rated_cost'] = self.billable_rated_cost
1464
+ if hasattr(self, 'non_billable_cost') and self.non_billable_cost is not None:
1465
+ _dict['non_billable_cost'] = self.non_billable_cost
1466
+ if hasattr(self, 'non_billable_rated_cost') and self.non_billable_rated_cost is not None:
1467
+ _dict['non_billable_rated_cost'] = self.non_billable_rated_cost
1468
+ if hasattr(self, 'resources') and self.resources is not None:
1469
+ resources_list = []
1470
+ for v in self.resources:
1010
1471
  if isinstance(v, dict):
1011
- term_credits_list.append(v)
1472
+ resources_list.append(v)
1012
1473
  else:
1013
- term_credits_list.append(v.to_dict())
1014
- _dict['term_credits'] = term_credits_list
1015
- if hasattr(self, 'overage') and self.overage is not None:
1016
- if isinstance(self.overage, dict):
1017
- _dict['overage'] = self.overage
1018
- else:
1019
- _dict['overage'] = self.overage.to_dict()
1474
+ resources_list.append(v.to_dict())
1475
+ _dict['resources'] = resources_list
1020
1476
  return _dict
1021
1477
 
1022
1478
  def _to_dict(self):
@@ -1024,50 +1480,31 @@ class CreditPoolsReport:
1024
1480
  return self.to_dict()
1025
1481
 
1026
1482
  def __str__(self) -> str:
1027
- """Return a `str` version of this CreditPoolsReport object."""
1483
+ """Return a `str` version of this PartnerUsageReport object."""
1028
1484
  return json.dumps(self.to_dict(), indent=2)
1029
1485
 
1030
- def __eq__(self, other: 'CreditPoolsReport') -> bool:
1486
+ def __eq__(self, other: 'PartnerUsageReport') -> bool:
1031
1487
  """Return `true` when self and other are equal, false otherwise."""
1032
1488
  if not isinstance(other, self.__class__):
1033
1489
  return False
1034
1490
  return self.__dict__ == other.__dict__
1035
1491
 
1036
- def __ne__(self, other: 'CreditPoolsReport') -> bool:
1492
+ def __ne__(self, other: 'PartnerUsageReport') -> bool:
1037
1493
  """Return `true` when self and other are not equal, false otherwise."""
1038
1494
  return not self == other
1039
1495
 
1040
- class TypeEnum(str, Enum):
1041
- """
1042
- The category of the billing option. The valid values are `PLATFORM`, `SERVICE` and
1043
- `SUPPORT`.
1044
- """
1045
-
1046
- PLATFORM = 'PLATFORM'
1047
- SERVICE = 'SERVICE'
1048
- SUPPORT = 'SUPPORT'
1049
-
1050
- class CustomerTypeEnum(str, Enum):
1051
- """
1052
- The customer type. The valid values are `ENTERPRISE`, `ACCOUNT`, and
1053
- `ACCOUNT_GROUP`.
1054
- """
1055
-
1056
- ENTERPRISE = 'ENTERPRISE'
1057
- ACCOUNT = 'ACCOUNT'
1058
- ACCOUNT_GROUP = 'ACCOUNT_GROUP'
1059
-
1060
1496
 
1061
- class CreditPoolsReportSummary:
1497
+ class PartnerUsageReportSummary:
1062
1498
  """
1063
- The aggregated credit pools report.
1499
+ The aggregated partner usage report.
1064
1500
 
1065
- :param int limit: (optional) The max number of reports in the response.
1066
- :param CreditPoolsReportSummaryFirst first: (optional) The link to the first
1501
+ :param int limit: (optional) The maximum number of usage records in the
1502
+ response.
1503
+ :param PartnerUsageReportSummaryFirst first: (optional) The link to the first
1067
1504
  page of the search query.
1068
- :param CreditPoolsReportSummaryNext next: (optional) The link to the next page
1505
+ :param PartnerUsageReportSummaryNext next: (optional) The link to the next page
1069
1506
  of the search query.
1070
- :param List[CreditPoolsReport] resources: (optional) Aggregated usage report of
1507
+ :param List[PartnerUsageReport] reports: (optional) Aggregated usage report of
1071
1508
  all requested partners.
1072
1509
  """
1073
1510
 
@@ -1075,43 +1512,44 @@ class CreditPoolsReportSummary:
1075
1512
  self,
1076
1513
  *,
1077
1514
  limit: Optional[int] = None,
1078
- first: Optional['CreditPoolsReportSummaryFirst'] = None,
1079
- next: Optional['CreditPoolsReportSummaryNext'] = None,
1080
- resources: Optional[List['CreditPoolsReport']] = None,
1515
+ first: Optional['PartnerUsageReportSummaryFirst'] = None,
1516
+ next: Optional['PartnerUsageReportSummaryNext'] = None,
1517
+ reports: Optional[List['PartnerUsageReport']] = None,
1081
1518
  ) -> None:
1082
1519
  """
1083
- Initialize a CreditPoolsReportSummary object.
1520
+ Initialize a PartnerUsageReportSummary object.
1084
1521
 
1085
- :param int limit: (optional) The max number of reports in the response.
1086
- :param CreditPoolsReportSummaryFirst first: (optional) The link to the
1522
+ :param int limit: (optional) The maximum number of usage records in the
1523
+ response.
1524
+ :param PartnerUsageReportSummaryFirst first: (optional) The link to the
1087
1525
  first page of the search query.
1088
- :param CreditPoolsReportSummaryNext next: (optional) The link to the next
1526
+ :param PartnerUsageReportSummaryNext next: (optional) The link to the next
1089
1527
  page of the search query.
1090
- :param List[CreditPoolsReport] resources: (optional) Aggregated usage
1091
- report of all requested partners.
1528
+ :param List[PartnerUsageReport] reports: (optional) Aggregated usage report
1529
+ of all requested partners.
1092
1530
  """
1093
1531
  self.limit = limit
1094
1532
  self.first = first
1095
1533
  self.next = next
1096
- self.resources = resources
1534
+ self.reports = reports
1097
1535
 
1098
1536
  @classmethod
1099
- def from_dict(cls, _dict: Dict) -> 'CreditPoolsReportSummary':
1100
- """Initialize a CreditPoolsReportSummary object from a json dictionary."""
1537
+ def from_dict(cls, _dict: Dict) -> 'PartnerUsageReportSummary':
1538
+ """Initialize a PartnerUsageReportSummary object from a json dictionary."""
1101
1539
  args = {}
1102
1540
  if (limit := _dict.get('limit')) is not None:
1103
1541
  args['limit'] = limit
1104
1542
  if (first := _dict.get('first')) is not None:
1105
- args['first'] = CreditPoolsReportSummaryFirst.from_dict(first)
1543
+ args['first'] = PartnerUsageReportSummaryFirst.from_dict(first)
1106
1544
  if (next := _dict.get('next')) is not None:
1107
- args['next'] = CreditPoolsReportSummaryNext.from_dict(next)
1108
- if (resources := _dict.get('resources')) is not None:
1109
- args['resources'] = [CreditPoolsReport.from_dict(v) for v in resources]
1545
+ args['next'] = PartnerUsageReportSummaryNext.from_dict(next)
1546
+ if (reports := _dict.get('reports')) is not None:
1547
+ args['reports'] = [PartnerUsageReport.from_dict(v) for v in reports]
1110
1548
  return cls(**args)
1111
1549
 
1112
1550
  @classmethod
1113
1551
  def _from_dict(cls, _dict):
1114
- """Initialize a CreditPoolsReportSummary object from a json dictionary."""
1552
+ """Initialize a PartnerUsageReportSummary object from a json dictionary."""
1115
1553
  return cls.from_dict(_dict)
1116
1554
 
1117
1555
  def to_dict(self) -> Dict:
@@ -1129,14 +1567,14 @@ class CreditPoolsReportSummary:
1129
1567
  _dict['next'] = self.next
1130
1568
  else:
1131
1569
  _dict['next'] = self.next.to_dict()
1132
- if hasattr(self, 'resources') and self.resources is not None:
1133
- resources_list = []
1134
- for v in self.resources:
1570
+ if hasattr(self, 'reports') and self.reports is not None:
1571
+ reports_list = []
1572
+ for v in self.reports:
1135
1573
  if isinstance(v, dict):
1136
- resources_list.append(v)
1574
+ reports_list.append(v)
1137
1575
  else:
1138
- resources_list.append(v.to_dict())
1139
- _dict['resources'] = resources_list
1576
+ reports_list.append(v.to_dict())
1577
+ _dict['reports'] = reports_list
1140
1578
  return _dict
1141
1579
 
1142
1580
  def _to_dict(self):
@@ -1144,67 +1582,125 @@ class CreditPoolsReportSummary:
1144
1582
  return self.to_dict()
1145
1583
 
1146
1584
  def __str__(self) -> str:
1147
- """Return a `str` version of this CreditPoolsReportSummary object."""
1585
+ """Return a `str` version of this PartnerUsageReportSummary object."""
1148
1586
  return json.dumps(self.to_dict(), indent=2)
1149
1587
 
1150
- def __eq__(self, other: 'CreditPoolsReportSummary') -> bool:
1588
+ def __eq__(self, other: 'PartnerUsageReportSummary') -> bool:
1151
1589
  """Return `true` when self and other are equal, false otherwise."""
1152
1590
  if not isinstance(other, self.__class__):
1153
1591
  return False
1154
1592
  return self.__dict__ == other.__dict__
1155
1593
 
1156
- def __ne__(self, other: 'CreditPoolsReportSummary') -> bool:
1594
+ def __ne__(self, other: 'PartnerUsageReportSummary') -> bool:
1157
1595
  """Return `true` when self and other are not equal, false otherwise."""
1158
1596
  return not self == other
1159
1597
 
1160
1598
 
1161
- class Overage:
1599
+ class PlanUsage:
1162
1600
  """
1163
- Overage that was generated on the credit pool.
1164
-
1165
- :param float cost: (optional) The number of credits used as overage.
1166
- :param List[dict] resources: (optional) A list of resources that generated
1167
- overage.
1601
+ Aggregated values for the plan.
1602
+
1603
+ :param str plan_id: The ID of the plan.
1604
+ :param str pricing_region: (optional) The pricing region for the plan.
1605
+ :param str pricing_plan_id: (optional) The pricing plan with which the usage was
1606
+ rated.
1607
+ :param bool billable: Whether the plan charges are billed to the customer.
1608
+ :param float cost: The total cost that was incurred by the plan.
1609
+ :param float rated_cost: The total pre-discounted cost that was incurred by the
1610
+ plan.
1611
+ :param List[MetricUsage] usage: All of the metrics in the plan.
1168
1612
  """
1169
1613
 
1170
1614
  def __init__(
1171
1615
  self,
1616
+ plan_id: str,
1617
+ billable: bool,
1618
+ cost: float,
1619
+ rated_cost: float,
1620
+ usage: List['MetricUsage'],
1172
1621
  *,
1173
- cost: Optional[float] = None,
1174
- resources: Optional[List[dict]] = None,
1622
+ pricing_region: Optional[str] = None,
1623
+ pricing_plan_id: Optional[str] = None,
1175
1624
  ) -> None:
1176
1625
  """
1177
- Initialize a Overage object.
1178
-
1179
- :param float cost: (optional) The number of credits used as overage.
1180
- :param List[dict] resources: (optional) A list of resources that generated
1181
- overage.
1626
+ Initialize a PlanUsage object.
1627
+
1628
+ :param str plan_id: The ID of the plan.
1629
+ :param bool billable: Whether the plan charges are billed to the customer.
1630
+ :param float cost: The total cost that was incurred by the plan.
1631
+ :param float rated_cost: The total pre-discounted cost that was incurred by
1632
+ the plan.
1633
+ :param List[MetricUsage] usage: All of the metrics in the plan.
1634
+ :param str pricing_region: (optional) The pricing region for the plan.
1635
+ :param str pricing_plan_id: (optional) The pricing plan with which the
1636
+ usage was rated.
1182
1637
  """
1638
+ self.plan_id = plan_id
1639
+ self.pricing_region = pricing_region
1640
+ self.pricing_plan_id = pricing_plan_id
1641
+ self.billable = billable
1183
1642
  self.cost = cost
1184
- self.resources = resources
1643
+ self.rated_cost = rated_cost
1644
+ self.usage = usage
1185
1645
 
1186
1646
  @classmethod
1187
- def from_dict(cls, _dict: Dict) -> 'Overage':
1188
- """Initialize a Overage object from a json dictionary."""
1647
+ def from_dict(cls, _dict: Dict) -> 'PlanUsage':
1648
+ """Initialize a PlanUsage object from a json dictionary."""
1189
1649
  args = {}
1650
+ if (plan_id := _dict.get('plan_id')) is not None:
1651
+ args['plan_id'] = plan_id
1652
+ else:
1653
+ raise ValueError('Required property \'plan_id\' not present in PlanUsage JSON')
1654
+ if (pricing_region := _dict.get('pricing_region')) is not None:
1655
+ args['pricing_region'] = pricing_region
1656
+ if (pricing_plan_id := _dict.get('pricing_plan_id')) is not None:
1657
+ args['pricing_plan_id'] = pricing_plan_id
1658
+ if (billable := _dict.get('billable')) is not None:
1659
+ args['billable'] = billable
1660
+ else:
1661
+ raise ValueError('Required property \'billable\' not present in PlanUsage JSON')
1190
1662
  if (cost := _dict.get('cost')) is not None:
1191
1663
  args['cost'] = cost
1192
- if (resources := _dict.get('resources')) is not None:
1193
- args['resources'] = resources
1664
+ else:
1665
+ raise ValueError('Required property \'cost\' not present in PlanUsage JSON')
1666
+ if (rated_cost := _dict.get('rated_cost')) is not None:
1667
+ args['rated_cost'] = rated_cost
1668
+ else:
1669
+ raise ValueError('Required property \'rated_cost\' not present in PlanUsage JSON')
1670
+ if (usage := _dict.get('usage')) is not None:
1671
+ args['usage'] = [MetricUsage.from_dict(v) for v in usage]
1672
+ else:
1673
+ raise ValueError('Required property \'usage\' not present in PlanUsage JSON')
1194
1674
  return cls(**args)
1195
1675
 
1196
1676
  @classmethod
1197
1677
  def _from_dict(cls, _dict):
1198
- """Initialize a Overage object from a json dictionary."""
1678
+ """Initialize a PlanUsage object from a json dictionary."""
1199
1679
  return cls.from_dict(_dict)
1200
1680
 
1201
1681
  def to_dict(self) -> Dict:
1202
1682
  """Return a json dictionary representing this model."""
1203
1683
  _dict = {}
1684
+ if hasattr(self, 'plan_id') and self.plan_id is not None:
1685
+ _dict['plan_id'] = self.plan_id
1686
+ if hasattr(self, 'pricing_region') and self.pricing_region is not None:
1687
+ _dict['pricing_region'] = self.pricing_region
1688
+ if hasattr(self, 'pricing_plan_id') and self.pricing_plan_id is not None:
1689
+ _dict['pricing_plan_id'] = self.pricing_plan_id
1690
+ if hasattr(self, 'billable') and self.billable is not None:
1691
+ _dict['billable'] = self.billable
1204
1692
  if hasattr(self, 'cost') and self.cost is not None:
1205
1693
  _dict['cost'] = self.cost
1206
- if hasattr(self, 'resources') and self.resources is not None:
1207
- _dict['resources'] = self.resources
1694
+ if hasattr(self, 'rated_cost') and self.rated_cost is not None:
1695
+ _dict['rated_cost'] = self.rated_cost
1696
+ if hasattr(self, 'usage') and self.usage is not None:
1697
+ usage_list = []
1698
+ for v in self.usage:
1699
+ if isinstance(v, dict):
1700
+ usage_list.append(v)
1701
+ else:
1702
+ usage_list.append(v.to_dict())
1703
+ _dict['usage'] = usage_list
1208
1704
  return _dict
1209
1705
 
1210
1706
  def _to_dict(self):
@@ -1212,16 +1708,144 @@ class Overage:
1212
1708
  return self.to_dict()
1213
1709
 
1214
1710
  def __str__(self) -> str:
1215
- """Return a `str` version of this Overage object."""
1711
+ """Return a `str` version of this PlanUsage object."""
1216
1712
  return json.dumps(self.to_dict(), indent=2)
1217
1713
 
1218
- def __eq__(self, other: 'Overage') -> bool:
1714
+ def __eq__(self, other: 'PlanUsage') -> bool:
1219
1715
  """Return `true` when self and other are equal, false otherwise."""
1220
1716
  if not isinstance(other, self.__class__):
1221
1717
  return False
1222
1718
  return self.__dict__ == other.__dict__
1223
1719
 
1224
- def __ne__(self, other: 'Overage') -> bool:
1720
+ def __ne__(self, other: 'PlanUsage') -> bool:
1721
+ """Return `true` when self and other are not equal, false otherwise."""
1722
+ return not self == other
1723
+
1724
+
1725
+ class ResourceUsage:
1726
+ """
1727
+ A container for all the plans in the resource.
1728
+
1729
+ :param str resource_id: The ID of the resource.
1730
+ :param str resource_name: (optional) The name of the resource.
1731
+ :param float billable_cost: The billable charges for the partner.
1732
+ :param float billable_rated_cost: The pre-discounted billable charges for the
1733
+ partner.
1734
+ :param float non_billable_cost: The non-billable charges for the partner.
1735
+ :param float non_billable_rated_cost: The pre-discounted, non-billable charges
1736
+ for the partner.
1737
+ :param List[PlanUsage] plans: All of the plans in the resource.
1738
+ """
1739
+
1740
+ def __init__(
1741
+ self,
1742
+ resource_id: str,
1743
+ billable_cost: float,
1744
+ billable_rated_cost: float,
1745
+ non_billable_cost: float,
1746
+ non_billable_rated_cost: float,
1747
+ plans: List['PlanUsage'],
1748
+ *,
1749
+ resource_name: Optional[str] = None,
1750
+ ) -> None:
1751
+ """
1752
+ Initialize a ResourceUsage object.
1753
+
1754
+ :param str resource_id: The ID of the resource.
1755
+ :param float billable_cost: The billable charges for the partner.
1756
+ :param float billable_rated_cost: The pre-discounted billable charges for
1757
+ the partner.
1758
+ :param float non_billable_cost: The non-billable charges for the partner.
1759
+ :param float non_billable_rated_cost: The pre-discounted, non-billable
1760
+ charges for the partner.
1761
+ :param List[PlanUsage] plans: All of the plans in the resource.
1762
+ :param str resource_name: (optional) The name of the resource.
1763
+ """
1764
+ self.resource_id = resource_id
1765
+ self.resource_name = resource_name
1766
+ self.billable_cost = billable_cost
1767
+ self.billable_rated_cost = billable_rated_cost
1768
+ self.non_billable_cost = non_billable_cost
1769
+ self.non_billable_rated_cost = non_billable_rated_cost
1770
+ self.plans = plans
1771
+
1772
+ @classmethod
1773
+ def from_dict(cls, _dict: Dict) -> 'ResourceUsage':
1774
+ """Initialize a ResourceUsage object from a json dictionary."""
1775
+ args = {}
1776
+ if (resource_id := _dict.get('resource_id')) is not None:
1777
+ args['resource_id'] = resource_id
1778
+ else:
1779
+ raise ValueError('Required property \'resource_id\' not present in ResourceUsage JSON')
1780
+ if (resource_name := _dict.get('resource_name')) is not None:
1781
+ args['resource_name'] = resource_name
1782
+ if (billable_cost := _dict.get('billable_cost')) is not None:
1783
+ args['billable_cost'] = billable_cost
1784
+ else:
1785
+ raise ValueError('Required property \'billable_cost\' not present in ResourceUsage JSON')
1786
+ if (billable_rated_cost := _dict.get('billable_rated_cost')) is not None:
1787
+ args['billable_rated_cost'] = billable_rated_cost
1788
+ else:
1789
+ raise ValueError('Required property \'billable_rated_cost\' not present in ResourceUsage JSON')
1790
+ if (non_billable_cost := _dict.get('non_billable_cost')) is not None:
1791
+ args['non_billable_cost'] = non_billable_cost
1792
+ else:
1793
+ raise ValueError('Required property \'non_billable_cost\' not present in ResourceUsage JSON')
1794
+ if (non_billable_rated_cost := _dict.get('non_billable_rated_cost')) is not None:
1795
+ args['non_billable_rated_cost'] = non_billable_rated_cost
1796
+ else:
1797
+ raise ValueError('Required property \'non_billable_rated_cost\' not present in ResourceUsage JSON')
1798
+ if (plans := _dict.get('plans')) is not None:
1799
+ args['plans'] = [PlanUsage.from_dict(v) for v in plans]
1800
+ else:
1801
+ raise ValueError('Required property \'plans\' not present in ResourceUsage JSON')
1802
+ return cls(**args)
1803
+
1804
+ @classmethod
1805
+ def _from_dict(cls, _dict):
1806
+ """Initialize a ResourceUsage object from a json dictionary."""
1807
+ return cls.from_dict(_dict)
1808
+
1809
+ def to_dict(self) -> Dict:
1810
+ """Return a json dictionary representing this model."""
1811
+ _dict = {}
1812
+ if hasattr(self, 'resource_id') and self.resource_id is not None:
1813
+ _dict['resource_id'] = self.resource_id
1814
+ if hasattr(self, 'resource_name') and self.resource_name is not None:
1815
+ _dict['resource_name'] = self.resource_name
1816
+ if hasattr(self, 'billable_cost') and self.billable_cost is not None:
1817
+ _dict['billable_cost'] = self.billable_cost
1818
+ if hasattr(self, 'billable_rated_cost') and self.billable_rated_cost is not None:
1819
+ _dict['billable_rated_cost'] = self.billable_rated_cost
1820
+ if hasattr(self, 'non_billable_cost') and self.non_billable_cost is not None:
1821
+ _dict['non_billable_cost'] = self.non_billable_cost
1822
+ if hasattr(self, 'non_billable_rated_cost') and self.non_billable_rated_cost is not None:
1823
+ _dict['non_billable_rated_cost'] = self.non_billable_rated_cost
1824
+ if hasattr(self, 'plans') and self.plans is not None:
1825
+ plans_list = []
1826
+ for v in self.plans:
1827
+ if isinstance(v, dict):
1828
+ plans_list.append(v)
1829
+ else:
1830
+ plans_list.append(v.to_dict())
1831
+ _dict['plans'] = plans_list
1832
+ return _dict
1833
+
1834
+ def _to_dict(self):
1835
+ """Return a json dictionary representing this model."""
1836
+ return self.to_dict()
1837
+
1838
+ def __str__(self) -> str:
1839
+ """Return a `str` version of this ResourceUsage object."""
1840
+ return json.dumps(self.to_dict(), indent=2)
1841
+
1842
+ def __eq__(self, other: 'ResourceUsage') -> bool:
1843
+ """Return `true` when self and other are equal, false otherwise."""
1844
+ if not isinstance(other, self.__class__):
1845
+ return False
1846
+ return self.__dict__ == other.__dict__
1847
+
1848
+ def __ne__(self, other: 'ResourceUsage') -> bool:
1225
1849
  """Return `true` when self and other are not equal, false otherwise."""
1226
1850
  return not self == other
1227
1851
 
@@ -1379,3 +2003,115 @@ class TermCredits:
1379
2003
  PLATFORM = 'PLATFORM'
1380
2004
  SERVICE = 'SERVICE'
1381
2005
  SUPPORT = 'SUPPORT'
2006
+
2007
+
2008
+ ##############################################################################
2009
+ # Pagers
2010
+ ##############################################################################
2011
+
2012
+
2013
+ class GetResourceUsageReportPager:
2014
+ """
2015
+ GetResourceUsageReportPager can be used to simplify the use of the "get_resource_usage_report" method.
2016
+ """
2017
+
2018
+ def __init__(
2019
+ self,
2020
+ *,
2021
+ client: PartnerManagementV1,
2022
+ partner_id: str,
2023
+ reseller_id: str = None,
2024
+ customer_id: str = None,
2025
+ children: bool = None,
2026
+ month: str = None,
2027
+ viewpoint: str = None,
2028
+ recurse: bool = None,
2029
+ limit: int = None,
2030
+ ) -> None:
2031
+ """
2032
+ Initialize a GetResourceUsageReportPager object.
2033
+ :param str partner_id: Enterprise ID of the distributor or reseller for
2034
+ which the report is requested.
2035
+ :param str reseller_id: (optional) Enterprise ID of the reseller for which
2036
+ the report is requested. This parameter cannot be used along with
2037
+ `customer_id` query parameter.
2038
+ :param str customer_id: (optional) Account ID/Enterprise ID of the end
2039
+ customer for which the report is requested. This parameter cannot be used
2040
+ along with `reseller_id` query parameter.
2041
+ :param bool children: (optional) Get report rolled-up to the direct
2042
+ children of the requested entity. Defaults to false. This parameter cannot
2043
+ be used along with `customer_id` query parameter.
2044
+ :param str month: (optional) The billing month for which the usage report
2045
+ is requested. Format is `yyyy-mm`. Defaults to current month.
2046
+ :param str viewpoint: (optional) Enables partner to view the cost of
2047
+ provisioned services as applicable at the given level. Defaults to the type
2048
+ of the calling partner. The valid values are `DISTRIBUTOR`, `RESELLER` and
2049
+ `END_CUSTOMER`.
2050
+ :param bool recurse: (optional) Get usage report rolled-up to the end
2051
+ customers of the requesting partner. Defaults to false. This parameter
2052
+ cannot be used along with `reseller_id` query parameter or `customer_id`
2053
+ query parameter.
2054
+ :param int limit: (optional) Number of usage records to be returned. The
2055
+ default value is 30. Maximum value is 100.
2056
+ """
2057
+ self._has_next = True
2058
+ self._client = client
2059
+ self._page_context = {'next': None}
2060
+ self._partner_id = partner_id
2061
+ self._reseller_id = reseller_id
2062
+ self._customer_id = customer_id
2063
+ self._children = children
2064
+ self._month = month
2065
+ self._viewpoint = viewpoint
2066
+ self._recurse = recurse
2067
+ self._limit = limit
2068
+
2069
+ def has_next(self) -> bool:
2070
+ """
2071
+ Returns true if there are potentially more results to be retrieved.
2072
+ """
2073
+ return self._has_next
2074
+
2075
+ def get_next(self) -> List[dict]:
2076
+ """
2077
+ Returns the next page of results.
2078
+ :return: A List[dict], where each element is a dict that represents an instance of PartnerUsageReport.
2079
+ :rtype: List[dict]
2080
+ """
2081
+ if not self.has_next():
2082
+ raise StopIteration(message='No more results available')
2083
+
2084
+ result = self._client.get_resource_usage_report(
2085
+ partner_id=self._partner_id,
2086
+ reseller_id=self._reseller_id,
2087
+ customer_id=self._customer_id,
2088
+ children=self._children,
2089
+ month=self._month,
2090
+ viewpoint=self._viewpoint,
2091
+ recurse=self._recurse,
2092
+ limit=self._limit,
2093
+ offset=self._page_context.get('next'),
2094
+ ).get_result()
2095
+
2096
+ next = None
2097
+ next_page_link = result.get('next')
2098
+ if next_page_link is not None:
2099
+ next = next_page_link.get('offset')
2100
+ self._page_context['next'] = next
2101
+ if next is None:
2102
+ self._has_next = False
2103
+
2104
+ return result.get('reports')
2105
+
2106
+ def get_all(self) -> List[dict]:
2107
+ """
2108
+ Returns all results by invoking get_next() repeatedly
2109
+ until all pages of results have been retrieved.
2110
+ :return: A List[dict], where each element is a dict that represents an instance of PartnerUsageReport.
2111
+ :rtype: List[dict]
2112
+ """
2113
+ results = []
2114
+ while self.has_next():
2115
+ next_page = self.get_next()
2116
+ results.extend(next_page)
2117
+ return results