ibm-platform-services 0.55.3__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.
- ibm_platform_services/__init__.py +43 -0
- ibm_platform_services/case_management_v1.py +2414 -0
- ibm_platform_services/catalog_management_v1.py +10127 -0
- ibm_platform_services/common.py +56 -0
- ibm_platform_services/context_based_restrictions_v1.py +3633 -0
- ibm_platform_services/enterprise_billing_units_v1.py +1324 -0
- ibm_platform_services/enterprise_management_v1.py +2497 -0
- ibm_platform_services/enterprise_usage_reports_v1.py +978 -0
- ibm_platform_services/global_catalog_v1.py +5129 -0
- ibm_platform_services/global_search_v2.py +497 -0
- ibm_platform_services/global_tagging_v1.py +1601 -0
- ibm_platform_services/iam_access_groups_v2.py +7684 -0
- ibm_platform_services/iam_identity_v1.py +11525 -0
- ibm_platform_services/iam_policy_management_v1.py +9016 -0
- ibm_platform_services/ibm_cloud_shell_v1.py +480 -0
- ibm_platform_services/open_service_broker_v1.py +1774 -0
- ibm_platform_services/partner_billing_units_v1.py +1381 -0
- ibm_platform_services/partner_usage_reports_v1.py +1091 -0
- ibm_platform_services/resource_controller_v2.py +4868 -0
- ibm_platform_services/resource_manager_v2.py +986 -0
- ibm_platform_services/usage_metering_v4.py +470 -0
- ibm_platform_services/usage_reports_v4.py +5165 -0
- ibm_platform_services/user_management_v1.py +1639 -0
- ibm_platform_services/version.py +5 -0
- ibm_platform_services-0.55.3.dist-info/LICENSE +201 -0
- ibm_platform_services-0.55.3.dist-info/METADATA +165 -0
- ibm_platform_services-0.55.3.dist-info/RECORD +29 -0
- ibm_platform_services-0.55.3.dist-info/WHEEL +5 -0
- ibm_platform_services-0.55.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# (C) Copyright IBM Corp. 2020.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-d753183b-20201209-163011
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
IBM Cloud Usage Metering is a platform service that enables service providers to submit
|
|
21
|
+
metrics collected for resource instances provisioned by IBM Cloud users. IBM and
|
|
22
|
+
third-party service providers that are delivering an integrated billing service in IBM
|
|
23
|
+
Cloud are required to submit usage for all active service instances every hour. This is
|
|
24
|
+
important because inability to report usage can lead to loss of revenue collection for
|
|
25
|
+
IBM, in turn causing loss of revenue share for the service providers.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from typing import Dict, List
|
|
29
|
+
import json
|
|
30
|
+
|
|
31
|
+
from ibm_cloud_sdk_core import BaseService, DetailedResponse
|
|
32
|
+
from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
|
|
33
|
+
from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
|
|
34
|
+
from ibm_cloud_sdk_core.utils import convert_model
|
|
35
|
+
|
|
36
|
+
from .common import get_sdk_headers
|
|
37
|
+
|
|
38
|
+
##############################################################################
|
|
39
|
+
# Service
|
|
40
|
+
##############################################################################
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class UsageMeteringV4(BaseService):
|
|
44
|
+
"""The usage_metering V4 service."""
|
|
45
|
+
|
|
46
|
+
DEFAULT_SERVICE_URL = 'https://billing.cloud.ibm.com'
|
|
47
|
+
DEFAULT_SERVICE_NAME = 'usage_metering'
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def new_instance(
|
|
51
|
+
cls,
|
|
52
|
+
service_name: str = DEFAULT_SERVICE_NAME,
|
|
53
|
+
) -> 'UsageMeteringV4':
|
|
54
|
+
"""
|
|
55
|
+
Return a new client for the usage_metering service using the specified
|
|
56
|
+
parameters and external configuration.
|
|
57
|
+
"""
|
|
58
|
+
authenticator = get_authenticator_from_environment(service_name)
|
|
59
|
+
service = cls(authenticator)
|
|
60
|
+
service.configure_service(service_name)
|
|
61
|
+
return service
|
|
62
|
+
|
|
63
|
+
def __init__(
|
|
64
|
+
self,
|
|
65
|
+
authenticator: Authenticator = None,
|
|
66
|
+
) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Construct a new client for the usage_metering service.
|
|
69
|
+
|
|
70
|
+
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
|
|
71
|
+
Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md
|
|
72
|
+
about initializing the authenticator of your choice.
|
|
73
|
+
"""
|
|
74
|
+
BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
|
|
75
|
+
|
|
76
|
+
#########################
|
|
77
|
+
# Resource Usage
|
|
78
|
+
#########################
|
|
79
|
+
|
|
80
|
+
def report_resource_usage(
|
|
81
|
+
self, resource_id: str, resource_usage: List['ResourceInstanceUsage'], **kwargs
|
|
82
|
+
) -> DetailedResponse:
|
|
83
|
+
"""
|
|
84
|
+
Report Resource Controller resource usage.
|
|
85
|
+
|
|
86
|
+
Report usage for resource instances that were provisioned through the resource
|
|
87
|
+
controller.
|
|
88
|
+
|
|
89
|
+
:param str resource_id: The resource for which the usage is submitted.
|
|
90
|
+
:param List[ResourceInstanceUsage] resource_usage:
|
|
91
|
+
:param dict headers: A `dict` containing the request headers
|
|
92
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
93
|
+
:rtype: DetailedResponse with `dict` result representing a `ResponseAccepted` object
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
if resource_id is None:
|
|
97
|
+
raise ValueError('resource_id must be provided')
|
|
98
|
+
if resource_usage is None:
|
|
99
|
+
raise ValueError('resource_usage must be provided')
|
|
100
|
+
resource_usage = [convert_model(x) for x in resource_usage]
|
|
101
|
+
headers = {}
|
|
102
|
+
sdk_headers = get_sdk_headers(
|
|
103
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='report_resource_usage'
|
|
104
|
+
)
|
|
105
|
+
headers.update(sdk_headers)
|
|
106
|
+
|
|
107
|
+
data = json.dumps(resource_usage)
|
|
108
|
+
headers['content-type'] = 'application/json'
|
|
109
|
+
|
|
110
|
+
if 'headers' in kwargs:
|
|
111
|
+
headers.update(kwargs.get('headers'))
|
|
112
|
+
headers['Accept'] = 'application/json'
|
|
113
|
+
|
|
114
|
+
path_param_keys = ['resource_id']
|
|
115
|
+
path_param_values = self.encode_path_vars(resource_id)
|
|
116
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
117
|
+
url = '/v4/metering/resources/{resource_id}/usage'.format(**path_param_dict)
|
|
118
|
+
request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
|
|
119
|
+
|
|
120
|
+
response = self.send(request)
|
|
121
|
+
return response
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
##############################################################################
|
|
125
|
+
# Models
|
|
126
|
+
##############################################################################
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class MeasureAndQuantity:
|
|
130
|
+
"""
|
|
131
|
+
A usage measurement.
|
|
132
|
+
|
|
133
|
+
:attr str measure: The name of the measure.
|
|
134
|
+
:attr object quantity: For consumption-based submissions, `quantity` can be a
|
|
135
|
+
double or integer value. For event-based submissions that do not have binary
|
|
136
|
+
states, previous and current values are required, such as `{ "previous": 1,
|
|
137
|
+
"current": 2 }`.
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
def __init__(self, measure: str, quantity: object) -> None:
|
|
141
|
+
"""
|
|
142
|
+
Initialize a MeasureAndQuantity object.
|
|
143
|
+
|
|
144
|
+
:param str measure: The name of the measure.
|
|
145
|
+
:param object quantity: For consumption-based submissions, `quantity` can
|
|
146
|
+
be a double or integer value. For event-based submissions that do not have
|
|
147
|
+
binary states, previous and current values are required, such as `{
|
|
148
|
+
"previous": 1, "current": 2 }`.
|
|
149
|
+
"""
|
|
150
|
+
self.measure = measure
|
|
151
|
+
self.quantity = quantity
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def from_dict(cls, _dict: Dict) -> 'MeasureAndQuantity':
|
|
155
|
+
"""Initialize a MeasureAndQuantity object from a json dictionary."""
|
|
156
|
+
args = {}
|
|
157
|
+
if 'measure' in _dict:
|
|
158
|
+
args['measure'] = _dict.get('measure')
|
|
159
|
+
else:
|
|
160
|
+
raise ValueError('Required property \'measure\' not present in MeasureAndQuantity JSON')
|
|
161
|
+
if 'quantity' in _dict:
|
|
162
|
+
args['quantity'] = _dict.get('quantity')
|
|
163
|
+
else:
|
|
164
|
+
raise ValueError('Required property \'quantity\' not present in MeasureAndQuantity JSON')
|
|
165
|
+
return cls(**args)
|
|
166
|
+
|
|
167
|
+
@classmethod
|
|
168
|
+
def _from_dict(cls, _dict):
|
|
169
|
+
"""Initialize a MeasureAndQuantity object from a json dictionary."""
|
|
170
|
+
return cls.from_dict(_dict)
|
|
171
|
+
|
|
172
|
+
def to_dict(self) -> Dict:
|
|
173
|
+
"""Return a json dictionary representing this model."""
|
|
174
|
+
_dict = {}
|
|
175
|
+
if hasattr(self, 'measure') and self.measure is not None:
|
|
176
|
+
_dict['measure'] = self.measure
|
|
177
|
+
if hasattr(self, 'quantity') and self.quantity is not None:
|
|
178
|
+
_dict['quantity'] = self.quantity
|
|
179
|
+
return _dict
|
|
180
|
+
|
|
181
|
+
def _to_dict(self):
|
|
182
|
+
"""Return a json dictionary representing this model."""
|
|
183
|
+
return self.to_dict()
|
|
184
|
+
|
|
185
|
+
def __str__(self) -> str:
|
|
186
|
+
"""Return a `str` version of this MeasureAndQuantity object."""
|
|
187
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
188
|
+
|
|
189
|
+
def __eq__(self, other: 'MeasureAndQuantity') -> bool:
|
|
190
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
191
|
+
if not isinstance(other, self.__class__):
|
|
192
|
+
return False
|
|
193
|
+
return self.__dict__ == other.__dict__
|
|
194
|
+
|
|
195
|
+
def __ne__(self, other: 'MeasureAndQuantity') -> bool:
|
|
196
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
197
|
+
return not self == other
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class ResourceInstanceUsage:
|
|
201
|
+
"""
|
|
202
|
+
Usage information for a resource instance.
|
|
203
|
+
|
|
204
|
+
:attr str resource_instance_id: The ID of the instance that incurred the usage.
|
|
205
|
+
The ID is a CRN for instances that are provisioned with the resource controller.
|
|
206
|
+
:attr str plan_id: The plan with which the instance's usage should be metered.
|
|
207
|
+
:attr str region: (optional) The pricing region to which the usage must be
|
|
208
|
+
aggregated. This field is required if the ID is not a CRN or if the CRN does not
|
|
209
|
+
have a region.
|
|
210
|
+
:attr int start: The time from which the resource instance was metered in the
|
|
211
|
+
format milliseconds since epoch.
|
|
212
|
+
:attr int end: The time until which the resource instance was metered in the
|
|
213
|
+
format milliseconds since epoch. This value is the same as start value for
|
|
214
|
+
event-based submissions.
|
|
215
|
+
:attr List[MeasureAndQuantity] measured_usage: Usage measurements for the
|
|
216
|
+
resource instance.
|
|
217
|
+
:attr str consumer_id: (optional) If an instance's usage should be aggregated at
|
|
218
|
+
the consumer level, specify the ID of the consumer. Usage is accumulated to the
|
|
219
|
+
instance-consumer combination.
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
def __init__(
|
|
223
|
+
self,
|
|
224
|
+
resource_instance_id: str,
|
|
225
|
+
plan_id: str,
|
|
226
|
+
start: int,
|
|
227
|
+
end: int,
|
|
228
|
+
measured_usage: List['MeasureAndQuantity'],
|
|
229
|
+
*,
|
|
230
|
+
region: str = None,
|
|
231
|
+
consumer_id: str = None,
|
|
232
|
+
) -> None:
|
|
233
|
+
"""
|
|
234
|
+
Initialize a ResourceInstanceUsage object.
|
|
235
|
+
|
|
236
|
+
:param str resource_instance_id: The ID of the instance that incurred the
|
|
237
|
+
usage. The ID is a CRN for instances that are provisioned with the resource
|
|
238
|
+
controller.
|
|
239
|
+
:param str plan_id: The plan with which the instance's usage should be
|
|
240
|
+
metered.
|
|
241
|
+
:param int start: The time from which the resource instance was metered in
|
|
242
|
+
the format milliseconds since epoch.
|
|
243
|
+
:param int end: The time until which the resource instance was metered in
|
|
244
|
+
the format milliseconds since epoch. This value is the same as start value
|
|
245
|
+
for event-based submissions.
|
|
246
|
+
:param List[MeasureAndQuantity] measured_usage: Usage measurements for the
|
|
247
|
+
resource instance.
|
|
248
|
+
:param str region: (optional) The pricing region to which the usage must be
|
|
249
|
+
aggregated. This field is required if the ID is not a CRN or if the CRN
|
|
250
|
+
does not have a region.
|
|
251
|
+
:param str consumer_id: (optional) If an instance's usage should be
|
|
252
|
+
aggregated at the consumer level, specify the ID of the consumer. Usage is
|
|
253
|
+
accumulated to the instance-consumer combination.
|
|
254
|
+
"""
|
|
255
|
+
self.resource_instance_id = resource_instance_id
|
|
256
|
+
self.plan_id = plan_id
|
|
257
|
+
self.region = region
|
|
258
|
+
self.start = start
|
|
259
|
+
self.end = end
|
|
260
|
+
self.measured_usage = measured_usage
|
|
261
|
+
self.consumer_id = consumer_id
|
|
262
|
+
|
|
263
|
+
@classmethod
|
|
264
|
+
def from_dict(cls, _dict: Dict) -> 'ResourceInstanceUsage':
|
|
265
|
+
"""Initialize a ResourceInstanceUsage object from a json dictionary."""
|
|
266
|
+
args = {}
|
|
267
|
+
if 'resource_instance_id' in _dict:
|
|
268
|
+
args['resource_instance_id'] = _dict.get('resource_instance_id')
|
|
269
|
+
else:
|
|
270
|
+
raise ValueError('Required property \'resource_instance_id\' not present in ResourceInstanceUsage JSON')
|
|
271
|
+
if 'plan_id' in _dict:
|
|
272
|
+
args['plan_id'] = _dict.get('plan_id')
|
|
273
|
+
else:
|
|
274
|
+
raise ValueError('Required property \'plan_id\' not present in ResourceInstanceUsage JSON')
|
|
275
|
+
if 'region' in _dict:
|
|
276
|
+
args['region'] = _dict.get('region')
|
|
277
|
+
if 'start' in _dict:
|
|
278
|
+
args['start'] = _dict.get('start')
|
|
279
|
+
else:
|
|
280
|
+
raise ValueError('Required property \'start\' not present in ResourceInstanceUsage JSON')
|
|
281
|
+
if 'end' in _dict:
|
|
282
|
+
args['end'] = _dict.get('end')
|
|
283
|
+
else:
|
|
284
|
+
raise ValueError('Required property \'end\' not present in ResourceInstanceUsage JSON')
|
|
285
|
+
if 'measured_usage' in _dict:
|
|
286
|
+
args['measured_usage'] = [MeasureAndQuantity.from_dict(x) for x in _dict.get('measured_usage')]
|
|
287
|
+
else:
|
|
288
|
+
raise ValueError('Required property \'measured_usage\' not present in ResourceInstanceUsage JSON')
|
|
289
|
+
if 'consumer_id' in _dict:
|
|
290
|
+
args['consumer_id'] = _dict.get('consumer_id')
|
|
291
|
+
return cls(**args)
|
|
292
|
+
|
|
293
|
+
@classmethod
|
|
294
|
+
def _from_dict(cls, _dict):
|
|
295
|
+
"""Initialize a ResourceInstanceUsage object from a json dictionary."""
|
|
296
|
+
return cls.from_dict(_dict)
|
|
297
|
+
|
|
298
|
+
def to_dict(self) -> Dict:
|
|
299
|
+
"""Return a json dictionary representing this model."""
|
|
300
|
+
_dict = {}
|
|
301
|
+
if hasattr(self, 'resource_instance_id') and self.resource_instance_id is not None:
|
|
302
|
+
_dict['resource_instance_id'] = self.resource_instance_id
|
|
303
|
+
if hasattr(self, 'plan_id') and self.plan_id is not None:
|
|
304
|
+
_dict['plan_id'] = self.plan_id
|
|
305
|
+
if hasattr(self, 'region') and self.region is not None:
|
|
306
|
+
_dict['region'] = self.region
|
|
307
|
+
if hasattr(self, 'start') and self.start is not None:
|
|
308
|
+
_dict['start'] = self.start
|
|
309
|
+
if hasattr(self, 'end') and self.end is not None:
|
|
310
|
+
_dict['end'] = self.end
|
|
311
|
+
if hasattr(self, 'measured_usage') and self.measured_usage is not None:
|
|
312
|
+
_dict['measured_usage'] = [x.to_dict() for x in self.measured_usage]
|
|
313
|
+
if hasattr(self, 'consumer_id') and self.consumer_id is not None:
|
|
314
|
+
_dict['consumer_id'] = self.consumer_id
|
|
315
|
+
return _dict
|
|
316
|
+
|
|
317
|
+
def _to_dict(self):
|
|
318
|
+
"""Return a json dictionary representing this model."""
|
|
319
|
+
return self.to_dict()
|
|
320
|
+
|
|
321
|
+
def __str__(self) -> str:
|
|
322
|
+
"""Return a `str` version of this ResourceInstanceUsage object."""
|
|
323
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
324
|
+
|
|
325
|
+
def __eq__(self, other: 'ResourceInstanceUsage') -> bool:
|
|
326
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
327
|
+
if not isinstance(other, self.__class__):
|
|
328
|
+
return False
|
|
329
|
+
return self.__dict__ == other.__dict__
|
|
330
|
+
|
|
331
|
+
def __ne__(self, other: 'ResourceInstanceUsage') -> bool:
|
|
332
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
333
|
+
return not self == other
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class ResourceUsageDetails:
|
|
337
|
+
"""
|
|
338
|
+
Resource usage details.
|
|
339
|
+
|
|
340
|
+
:attr int status: A response code similar to HTTP status codes.
|
|
341
|
+
:attr str location: The location of the usage.
|
|
342
|
+
:attr str code: (optional) The error code that was encountered.
|
|
343
|
+
:attr str message: (optional) A description of the error.
|
|
344
|
+
"""
|
|
345
|
+
|
|
346
|
+
def __init__(self, status: int, location: str, *, code: str = None, message: str = None) -> None:
|
|
347
|
+
"""
|
|
348
|
+
Initialize a ResourceUsageDetails object.
|
|
349
|
+
|
|
350
|
+
:param int status: A response code similar to HTTP status codes.
|
|
351
|
+
:param str location: The location of the usage.
|
|
352
|
+
:param str code: (optional) The error code that was encountered.
|
|
353
|
+
:param str message: (optional) A description of the error.
|
|
354
|
+
"""
|
|
355
|
+
self.status = status
|
|
356
|
+
self.location = location
|
|
357
|
+
self.code = code
|
|
358
|
+
self.message = message
|
|
359
|
+
|
|
360
|
+
@classmethod
|
|
361
|
+
def from_dict(cls, _dict: Dict) -> 'ResourceUsageDetails':
|
|
362
|
+
"""Initialize a ResourceUsageDetails object from a json dictionary."""
|
|
363
|
+
args = {}
|
|
364
|
+
if 'status' in _dict:
|
|
365
|
+
args['status'] = _dict.get('status')
|
|
366
|
+
else:
|
|
367
|
+
raise ValueError('Required property \'status\' not present in ResourceUsageDetails JSON')
|
|
368
|
+
if 'location' in _dict:
|
|
369
|
+
args['location'] = _dict.get('location')
|
|
370
|
+
else:
|
|
371
|
+
raise ValueError('Required property \'location\' not present in ResourceUsageDetails JSON')
|
|
372
|
+
if 'code' in _dict:
|
|
373
|
+
args['code'] = _dict.get('code')
|
|
374
|
+
if 'message' in _dict:
|
|
375
|
+
args['message'] = _dict.get('message')
|
|
376
|
+
return cls(**args)
|
|
377
|
+
|
|
378
|
+
@classmethod
|
|
379
|
+
def _from_dict(cls, _dict):
|
|
380
|
+
"""Initialize a ResourceUsageDetails object from a json dictionary."""
|
|
381
|
+
return cls.from_dict(_dict)
|
|
382
|
+
|
|
383
|
+
def to_dict(self) -> Dict:
|
|
384
|
+
"""Return a json dictionary representing this model."""
|
|
385
|
+
_dict = {}
|
|
386
|
+
if hasattr(self, 'status') and self.status is not None:
|
|
387
|
+
_dict['status'] = self.status
|
|
388
|
+
if hasattr(self, 'location') and self.location is not None:
|
|
389
|
+
_dict['location'] = self.location
|
|
390
|
+
if hasattr(self, 'code') and self.code is not None:
|
|
391
|
+
_dict['code'] = self.code
|
|
392
|
+
if hasattr(self, 'message') and self.message is not None:
|
|
393
|
+
_dict['message'] = self.message
|
|
394
|
+
return _dict
|
|
395
|
+
|
|
396
|
+
def _to_dict(self):
|
|
397
|
+
"""Return a json dictionary representing this model."""
|
|
398
|
+
return self.to_dict()
|
|
399
|
+
|
|
400
|
+
def __str__(self) -> str:
|
|
401
|
+
"""Return a `str` version of this ResourceUsageDetails object."""
|
|
402
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
403
|
+
|
|
404
|
+
def __eq__(self, other: 'ResourceUsageDetails') -> bool:
|
|
405
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
406
|
+
if not isinstance(other, self.__class__):
|
|
407
|
+
return False
|
|
408
|
+
return self.__dict__ == other.__dict__
|
|
409
|
+
|
|
410
|
+
def __ne__(self, other: 'ResourceUsageDetails') -> bool:
|
|
411
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
412
|
+
return not self == other
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
class ResponseAccepted:
|
|
416
|
+
"""
|
|
417
|
+
Response when usage submitted is accepted.
|
|
418
|
+
|
|
419
|
+
:attr List[ResourceUsageDetails] resources: Response body that contains the
|
|
420
|
+
status of each submitted usage record.
|
|
421
|
+
"""
|
|
422
|
+
|
|
423
|
+
def __init__(self, resources: List['ResourceUsageDetails']) -> None:
|
|
424
|
+
"""
|
|
425
|
+
Initialize a ResponseAccepted object.
|
|
426
|
+
|
|
427
|
+
:param List[ResourceUsageDetails] resources: Response body that contains
|
|
428
|
+
the status of each submitted usage record.
|
|
429
|
+
"""
|
|
430
|
+
self.resources = resources
|
|
431
|
+
|
|
432
|
+
@classmethod
|
|
433
|
+
def from_dict(cls, _dict: Dict) -> 'ResponseAccepted':
|
|
434
|
+
"""Initialize a ResponseAccepted object from a json dictionary."""
|
|
435
|
+
args = {}
|
|
436
|
+
if 'resources' in _dict:
|
|
437
|
+
args['resources'] = [ResourceUsageDetails.from_dict(x) for x in _dict.get('resources')]
|
|
438
|
+
else:
|
|
439
|
+
raise ValueError('Required property \'resources\' not present in ResponseAccepted JSON')
|
|
440
|
+
return cls(**args)
|
|
441
|
+
|
|
442
|
+
@classmethod
|
|
443
|
+
def _from_dict(cls, _dict):
|
|
444
|
+
"""Initialize a ResponseAccepted object from a json dictionary."""
|
|
445
|
+
return cls.from_dict(_dict)
|
|
446
|
+
|
|
447
|
+
def to_dict(self) -> Dict:
|
|
448
|
+
"""Return a json dictionary representing this model."""
|
|
449
|
+
_dict = {}
|
|
450
|
+
if hasattr(self, 'resources') and self.resources is not None:
|
|
451
|
+
_dict['resources'] = [x.to_dict() for x in self.resources]
|
|
452
|
+
return _dict
|
|
453
|
+
|
|
454
|
+
def _to_dict(self):
|
|
455
|
+
"""Return a json dictionary representing this model."""
|
|
456
|
+
return self.to_dict()
|
|
457
|
+
|
|
458
|
+
def __str__(self) -> str:
|
|
459
|
+
"""Return a `str` version of this ResponseAccepted object."""
|
|
460
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
461
|
+
|
|
462
|
+
def __eq__(self, other: 'ResponseAccepted') -> bool:
|
|
463
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
464
|
+
if not isinstance(other, self.__class__):
|
|
465
|
+
return False
|
|
466
|
+
return self.__dict__ == other.__dict__
|
|
467
|
+
|
|
468
|
+
def __ne__(self, other: 'ResponseAccepted') -> bool:
|
|
469
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
470
|
+
return not self == other
|