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.
Files changed (29) hide show
  1. ibm_platform_services/__init__.py +43 -0
  2. ibm_platform_services/case_management_v1.py +2414 -0
  3. ibm_platform_services/catalog_management_v1.py +10127 -0
  4. ibm_platform_services/common.py +56 -0
  5. ibm_platform_services/context_based_restrictions_v1.py +3633 -0
  6. ibm_platform_services/enterprise_billing_units_v1.py +1324 -0
  7. ibm_platform_services/enterprise_management_v1.py +2497 -0
  8. ibm_platform_services/enterprise_usage_reports_v1.py +978 -0
  9. ibm_platform_services/global_catalog_v1.py +5129 -0
  10. ibm_platform_services/global_search_v2.py +497 -0
  11. ibm_platform_services/global_tagging_v1.py +1601 -0
  12. ibm_platform_services/iam_access_groups_v2.py +7684 -0
  13. ibm_platform_services/iam_identity_v1.py +11525 -0
  14. ibm_platform_services/iam_policy_management_v1.py +9016 -0
  15. ibm_platform_services/ibm_cloud_shell_v1.py +480 -0
  16. ibm_platform_services/open_service_broker_v1.py +1774 -0
  17. ibm_platform_services/partner_billing_units_v1.py +1381 -0
  18. ibm_platform_services/partner_usage_reports_v1.py +1091 -0
  19. ibm_platform_services/resource_controller_v2.py +4868 -0
  20. ibm_platform_services/resource_manager_v2.py +986 -0
  21. ibm_platform_services/usage_metering_v4.py +470 -0
  22. ibm_platform_services/usage_reports_v4.py +5165 -0
  23. ibm_platform_services/user_management_v1.py +1639 -0
  24. ibm_platform_services/version.py +5 -0
  25. ibm_platform_services-0.55.3.dist-info/LICENSE +201 -0
  26. ibm_platform_services-0.55.3.dist-info/METADATA +165 -0
  27. ibm_platform_services-0.55.3.dist-info/RECORD +29 -0
  28. ibm_platform_services-0.55.3.dist-info/WHEEL +5 -0
  29. ibm_platform_services-0.55.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,986 @@
1
+ # coding: utf-8
2
+
3
+ # (C) Copyright IBM Corp. 2021.
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: 3.41.0-f1ef0102-20211018-193503
18
+
19
+ """
20
+ Manage lifecycle of your Cloud resource groups using Resource Manager APIs.
21
+
22
+ API Version: 2.0
23
+ """
24
+
25
+ from datetime import datetime
26
+ from typing import Dict, List
27
+ import json
28
+
29
+ from ibm_cloud_sdk_core import BaseService, DetailedResponse
30
+ from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
31
+ from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
32
+ from ibm_cloud_sdk_core.utils import datetime_to_string, string_to_datetime
33
+
34
+ from .common import get_sdk_headers
35
+
36
+ ##############################################################################
37
+ # Service
38
+ ##############################################################################
39
+
40
+
41
+ class ResourceManagerV2(BaseService):
42
+ """The Resource Manager V2 service."""
43
+
44
+ DEFAULT_SERVICE_URL = 'https://resource-controller.cloud.ibm.com'
45
+ DEFAULT_SERVICE_NAME = 'resource_manager'
46
+
47
+ @classmethod
48
+ def new_instance(
49
+ cls,
50
+ service_name: str = DEFAULT_SERVICE_NAME,
51
+ ) -> 'ResourceManagerV2':
52
+ """
53
+ Return a new client for the Resource Manager service using the specified
54
+ parameters and external configuration.
55
+ """
56
+ authenticator = get_authenticator_from_environment(service_name)
57
+ service = cls(authenticator)
58
+ service.configure_service(service_name)
59
+ return service
60
+
61
+ def __init__(
62
+ self,
63
+ authenticator: Authenticator = None,
64
+ ) -> None:
65
+ """
66
+ Construct a new client for the Resource Manager service.
67
+
68
+ :param Authenticator authenticator: The authenticator specifies the authentication mechanism.
69
+ Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
70
+ about initializing the authenticator of your choice.
71
+ """
72
+ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
73
+
74
+ #########################
75
+ # Resource Group
76
+ #########################
77
+
78
+ def list_resource_groups(
79
+ self,
80
+ *,
81
+ account_id: str = None,
82
+ date: str = None,
83
+ name: str = None,
84
+ default: bool = None,
85
+ include_deleted: bool = None,
86
+ **kwargs,
87
+ ) -> DetailedResponse:
88
+ """
89
+ Get a list of all resource groups.
90
+
91
+ Call this method to retrieve information about all resource groups and associated
92
+ quotas in an account. The `id` returned in the response can be used to [create a
93
+ resource instance
94
+ later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance).
95
+ The response can be filtered based on queryParams such as `account_id`, `name`,
96
+ `default`, and more to narrow your search.Users need to be assigned IAM policies
97
+ with the Viewer role or higher on the targeted resource groups.
98
+
99
+ :param str account_id: (optional) The ID of the account that contains the
100
+ resource groups that you want to get.
101
+ :param str date: (optional) The date in the format of YYYY-MM which returns
102
+ resource groups. Deleted resource groups will be excluded before this
103
+ month.
104
+ :param str name: (optional) The name of the resource group.
105
+ :param bool default: (optional) Boolean value to specify whether or not to
106
+ list default resource groups.
107
+ :param bool include_deleted: (optional) Boolean value to specify whether or
108
+ not to list default resource groups.
109
+ :param dict headers: A `dict` containing the request headers
110
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
111
+ :rtype: DetailedResponse with `dict` result representing a `ResourceGroupList` object
112
+ """
113
+
114
+ headers = {}
115
+ sdk_headers = get_sdk_headers(
116
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_groups'
117
+ )
118
+ headers.update(sdk_headers)
119
+
120
+ params = {
121
+ 'account_id': account_id,
122
+ 'date': date,
123
+ 'name': name,
124
+ 'default': default,
125
+ 'include_deleted': include_deleted,
126
+ }
127
+
128
+ if 'headers' in kwargs:
129
+ headers.update(kwargs.get('headers'))
130
+ headers['Accept'] = 'application/json'
131
+
132
+ url = '/v2/resource_groups'
133
+ request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
134
+
135
+ response = self.send(request, **kwargs)
136
+ return response
137
+
138
+ def create_resource_group(self, *, name: str = None, account_id: str = None, **kwargs) -> DetailedResponse:
139
+ """
140
+ Create a resource group.
141
+
142
+ Create a resource group in an account to organize your account resources in
143
+ customizable groupings so that you can quickly assign users access to more than
144
+ one resource at a time. To learn what makes a good resource group strategy, see
145
+ [Best practices for organizing
146
+ resources](https://cloud.ibm.com/docs/account?topic=account-account_setup). A
147
+ default resource group is created when an account is created. If you have a Lite
148
+ account or 30-day trial, you cannot create extra resource groups, but you can
149
+ rename your default resource group. If you have a Pay-As-You-Go or Subscription
150
+ account, you can create multiple resource groups. You must be assigned an IAM
151
+ policy with the Administrator role on All Account Management services to create
152
+ extra resource groups.
153
+
154
+ :param str name: (optional) The new name of the resource group.
155
+ :param str account_id: (optional) The account id of the resource group.
156
+ :param dict headers: A `dict` containing the request headers
157
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
158
+ :rtype: DetailedResponse with `dict` result representing a `ResCreateResourceGroup` object
159
+ """
160
+
161
+ headers = {}
162
+ sdk_headers = get_sdk_headers(
163
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_group'
164
+ )
165
+ headers.update(sdk_headers)
166
+
167
+ data = {'name': name, 'account_id': account_id}
168
+ data = {k: v for (k, v) in data.items() if v is not None}
169
+ data = json.dumps(data)
170
+ headers['content-type'] = 'application/json'
171
+
172
+ if 'headers' in kwargs:
173
+ headers.update(kwargs.get('headers'))
174
+ headers['Accept'] = 'application/json'
175
+
176
+ url = '/v2/resource_groups'
177
+ request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
178
+
179
+ response = self.send(request, **kwargs)
180
+ return response
181
+
182
+ def get_resource_group(self, id: str, **kwargs) -> DetailedResponse:
183
+ """
184
+ Get a resource group.
185
+
186
+ Retrieve a resource group by alias ID. Call this method to get details about a
187
+ particular resource group, like the name of the resource group, associated quotas,
188
+ whether the state is active, the resource group ID and the CRN. The `id` returned
189
+ in the response can be used to [create a resource instance
190
+ later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance).
191
+ Users need to be assigned an IAM policy with the Viewer role or higher on the
192
+ targeted resource group.
193
+
194
+ :param str id: The short or long ID of the alias.
195
+ :param dict headers: A `dict` containing the request headers
196
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
197
+ :rtype: DetailedResponse with `dict` result representing a `ResourceGroup` object
198
+ """
199
+
200
+ if id is None:
201
+ raise ValueError('id must be provided')
202
+ headers = {}
203
+ sdk_headers = get_sdk_headers(
204
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_group'
205
+ )
206
+ headers.update(sdk_headers)
207
+
208
+ if 'headers' in kwargs:
209
+ headers.update(kwargs.get('headers'))
210
+ headers['Accept'] = 'application/json'
211
+
212
+ path_param_keys = ['id']
213
+ path_param_values = self.encode_path_vars(id)
214
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
215
+ url = '/v2/resource_groups/{id}'.format(**path_param_dict)
216
+ request = self.prepare_request(method='GET', url=url, headers=headers)
217
+
218
+ response = self.send(request, **kwargs)
219
+ return response
220
+
221
+ def update_resource_group(self, id: str, *, name: str = None, state: str = None, **kwargs) -> DetailedResponse:
222
+ """
223
+ Update a resource group.
224
+
225
+ Update a resource group by the alias ID. Call this method to update information
226
+ about an existing resource group. You can rename a resource group and activate or
227
+ suspend a particular resource group. To update a resource group, users need to be
228
+ assigned with IAM policies with the Editor role or higher.
229
+
230
+ :param str id: The short or long ID of the alias.
231
+ :param str name: (optional) The new name of the resource group.
232
+ :param str state: (optional) The state of the resource group.
233
+ :param dict headers: A `dict` containing the request headers
234
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
235
+ :rtype: DetailedResponse with `dict` result representing a `ResourceGroup` object
236
+ """
237
+
238
+ if id is None:
239
+ raise ValueError('id must be provided')
240
+ headers = {}
241
+ sdk_headers = get_sdk_headers(
242
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_group'
243
+ )
244
+ headers.update(sdk_headers)
245
+
246
+ data = {'name': name, 'state': state}
247
+ data = {k: v for (k, v) in data.items() if v is not None}
248
+ data = json.dumps(data)
249
+ headers['content-type'] = 'application/json'
250
+
251
+ if 'headers' in kwargs:
252
+ headers.update(kwargs.get('headers'))
253
+ headers['Accept'] = 'application/json'
254
+
255
+ path_param_keys = ['id']
256
+ path_param_values = self.encode_path_vars(id)
257
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
258
+ url = '/v2/resource_groups/{id}'.format(**path_param_dict)
259
+ request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data)
260
+
261
+ response = self.send(request, **kwargs)
262
+ return response
263
+
264
+ def delete_resource_group(self, id: str, **kwargs) -> DetailedResponse:
265
+ """
266
+ Delete a resource group.
267
+
268
+ Delete a resource group by the alias ID. You can delete a resource group only if
269
+ the targeted resource group does not contain any resources or if it is not a
270
+ default resource group. When a user creates an account, a default resource group
271
+ is created in the account. If you want to delete a resource group that contains
272
+ resources, first [delete the resource
273
+ instances](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#delete-resource-instance).
274
+ Then, delete the resource group when all resource instances in the group are
275
+ deleted. Users need to be assigned an IAM policy with the Editor role or higher on
276
+ the targeted resource group.
277
+
278
+ :param str id: The short or long ID of the alias.
279
+ :param dict headers: A `dict` containing the request headers
280
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
281
+ :rtype: DetailedResponse
282
+ """
283
+
284
+ if id is None:
285
+ raise ValueError('id must be provided')
286
+ headers = {}
287
+ sdk_headers = get_sdk_headers(
288
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_group'
289
+ )
290
+ headers.update(sdk_headers)
291
+
292
+ if 'headers' in kwargs:
293
+ headers.update(kwargs.get('headers'))
294
+
295
+ path_param_keys = ['id']
296
+ path_param_values = self.encode_path_vars(id)
297
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
298
+ url = '/v2/resource_groups/{id}'.format(**path_param_dict)
299
+ request = self.prepare_request(method='DELETE', url=url, headers=headers)
300
+
301
+ response = self.send(request, **kwargs)
302
+ return response
303
+
304
+ #########################
305
+ # Quota Definition
306
+ #########################
307
+
308
+ def list_quota_definitions(self, **kwargs) -> DetailedResponse:
309
+ """
310
+ List quota definitions.
311
+
312
+ Get a list of all quota definitions. Quotas for a resource group limit the number
313
+ of apps, instances, and memory allowed for that specific resource group. Each
314
+ resource group that you have on your account has a specific set of quotas.
315
+ Standard quotas are for resource groups that are created by users with a Lite
316
+ account, and Pay-As-You-Go quotas are for resource groups that are created with a
317
+ Pay-As-You-Go account. This method provides list of all available quota
318
+ definitions. No specific IAM policy needed.
319
+
320
+ :param dict headers: A `dict` containing the request headers
321
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
322
+ :rtype: DetailedResponse with `dict` result representing a `QuotaDefinitionList` object
323
+ """
324
+
325
+ headers = {}
326
+ sdk_headers = get_sdk_headers(
327
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_quota_definitions'
328
+ )
329
+ headers.update(sdk_headers)
330
+
331
+ if 'headers' in kwargs:
332
+ headers.update(kwargs.get('headers'))
333
+ headers['Accept'] = 'application/json'
334
+
335
+ url = '/v2/quota_definitions'
336
+ request = self.prepare_request(method='GET', url=url, headers=headers)
337
+
338
+ response = self.send(request, **kwargs)
339
+ return response
340
+
341
+ def get_quota_definition(self, id: str, **kwargs) -> DetailedResponse:
342
+ """
343
+ Get a quota definition.
344
+
345
+ Call this method to retrieve information about a particular quota by passing the
346
+ quota ID. The response can be used to identify the quota type, Standard or Paid.
347
+ Information about available resources, such as number of apps, number of service
348
+ instances, and memory, are returned in the response. Quotas for a resource group
349
+ limit the number of apps, instances, and memory allowed for that specific resource
350
+ group. Each resource group that you have on your account has a specific set of
351
+ quotas. Standard quotas are for resource groups that are created by users with a
352
+ Lite account, and Pay-As-You-Go quotas are for resource groups that are created
353
+ with a Pay-As-You-Go account. No specific IAM policy needed.
354
+
355
+ :param str id: The id of the quota.
356
+ :param dict headers: A `dict` containing the request headers
357
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
358
+ :rtype: DetailedResponse with `dict` result representing a `QuotaDefinition` object
359
+ """
360
+
361
+ if id is None:
362
+ raise ValueError('id must be provided')
363
+ headers = {}
364
+ sdk_headers = get_sdk_headers(
365
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_quota_definition'
366
+ )
367
+ headers.update(sdk_headers)
368
+
369
+ if 'headers' in kwargs:
370
+ headers.update(kwargs.get('headers'))
371
+ headers['Accept'] = 'application/json'
372
+
373
+ path_param_keys = ['id']
374
+ path_param_values = self.encode_path_vars(id)
375
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
376
+ url = '/v2/quota_definitions/{id}'.format(**path_param_dict)
377
+ request = self.prepare_request(method='GET', url=url, headers=headers)
378
+
379
+ response = self.send(request, **kwargs)
380
+ return response
381
+
382
+
383
+ ##############################################################################
384
+ # Models
385
+ ##############################################################################
386
+
387
+
388
+ class QuotaDefinition:
389
+ """
390
+ A returned quota definition.
391
+
392
+ :attr str id: (optional) An alpha-numeric value identifying the quota.
393
+ :attr str name: (optional) The human-readable name of the quota.
394
+ :attr str type: (optional) The type of the quota.
395
+ :attr float number_of_apps: (optional) The total app limit.
396
+ :attr float number_of_service_instances: (optional) The total service instances
397
+ limit per app.
398
+ :attr float default_number_of_instances_per_lite_plan: (optional) Default number
399
+ of instances per lite plan.
400
+ :attr float instances_per_app: (optional) The total instances limit per app.
401
+ :attr str instance_memory: (optional) The total memory of app instance.
402
+ :attr str total_app_memory: (optional) The total app memory capacity.
403
+ :attr float vsi_limit: (optional) The VSI limit.
404
+ :attr List[ResourceQuota] resource_quotas: (optional) The resource quotas
405
+ associated with a quota definition.
406
+ :attr datetime created_at: (optional) The date when the quota was initially
407
+ created.
408
+ :attr datetime updated_at: (optional) The date when the quota was last updated.
409
+ """
410
+
411
+ def __init__(
412
+ self,
413
+ *,
414
+ id: str = None,
415
+ name: str = None,
416
+ type: str = None,
417
+ number_of_apps: float = None,
418
+ number_of_service_instances: float = None,
419
+ default_number_of_instances_per_lite_plan: float = None,
420
+ instances_per_app: float = None,
421
+ instance_memory: str = None,
422
+ total_app_memory: str = None,
423
+ vsi_limit: float = None,
424
+ resource_quotas: List['ResourceQuota'] = None,
425
+ created_at: datetime = None,
426
+ updated_at: datetime = None,
427
+ ) -> None:
428
+ """
429
+ Initialize a QuotaDefinition object.
430
+
431
+ :param str id: (optional) An alpha-numeric value identifying the quota.
432
+ :param str name: (optional) The human-readable name of the quota.
433
+ :param str type: (optional) The type of the quota.
434
+ :param float number_of_apps: (optional) The total app limit.
435
+ :param float number_of_service_instances: (optional) The total service
436
+ instances limit per app.
437
+ :param float default_number_of_instances_per_lite_plan: (optional) Default
438
+ number of instances per lite plan.
439
+ :param float instances_per_app: (optional) The total instances limit per
440
+ app.
441
+ :param str instance_memory: (optional) The total memory of app instance.
442
+ :param str total_app_memory: (optional) The total app memory capacity.
443
+ :param float vsi_limit: (optional) The VSI limit.
444
+ :param List[ResourceQuota] resource_quotas: (optional) The resource quotas
445
+ associated with a quota definition.
446
+ :param datetime created_at: (optional) The date when the quota was
447
+ initially created.
448
+ :param datetime updated_at: (optional) The date when the quota was last
449
+ updated.
450
+ """
451
+ self.id = id
452
+ self.name = name
453
+ self.type = type
454
+ self.number_of_apps = number_of_apps
455
+ self.number_of_service_instances = number_of_service_instances
456
+ self.default_number_of_instances_per_lite_plan = default_number_of_instances_per_lite_plan
457
+ self.instances_per_app = instances_per_app
458
+ self.instance_memory = instance_memory
459
+ self.total_app_memory = total_app_memory
460
+ self.vsi_limit = vsi_limit
461
+ self.resource_quotas = resource_quotas
462
+ self.created_at = created_at
463
+ self.updated_at = updated_at
464
+
465
+ @classmethod
466
+ def from_dict(cls, _dict: Dict) -> 'QuotaDefinition':
467
+ """Initialize a QuotaDefinition object from a json dictionary."""
468
+ args = {}
469
+ if 'id' in _dict:
470
+ args['id'] = _dict.get('id')
471
+ if 'name' in _dict:
472
+ args['name'] = _dict.get('name')
473
+ if 'type' in _dict:
474
+ args['type'] = _dict.get('type')
475
+ if 'number_of_apps' in _dict:
476
+ args['number_of_apps'] = _dict.get('number_of_apps')
477
+ if 'number_of_service_instances' in _dict:
478
+ args['number_of_service_instances'] = _dict.get('number_of_service_instances')
479
+ if 'default_number_of_instances_per_lite_plan' in _dict:
480
+ args['default_number_of_instances_per_lite_plan'] = _dict.get('default_number_of_instances_per_lite_plan')
481
+ if 'instances_per_app' in _dict:
482
+ args['instances_per_app'] = _dict.get('instances_per_app')
483
+ if 'instance_memory' in _dict:
484
+ args['instance_memory'] = _dict.get('instance_memory')
485
+ if 'total_app_memory' in _dict:
486
+ args['total_app_memory'] = _dict.get('total_app_memory')
487
+ if 'vsi_limit' in _dict:
488
+ args['vsi_limit'] = _dict.get('vsi_limit')
489
+ if 'resource_quotas' in _dict:
490
+ args['resource_quotas'] = [ResourceQuota.from_dict(x) for x in _dict.get('resource_quotas')]
491
+ if 'created_at' in _dict:
492
+ args['created_at'] = string_to_datetime(_dict.get('created_at'))
493
+ if 'updated_at' in _dict:
494
+ args['updated_at'] = string_to_datetime(_dict.get('updated_at'))
495
+ return cls(**args)
496
+
497
+ @classmethod
498
+ def _from_dict(cls, _dict):
499
+ """Initialize a QuotaDefinition object from a json dictionary."""
500
+ return cls.from_dict(_dict)
501
+
502
+ def to_dict(self) -> Dict:
503
+ """Return a json dictionary representing this model."""
504
+ _dict = {}
505
+ if hasattr(self, 'id') and self.id is not None:
506
+ _dict['id'] = self.id
507
+ if hasattr(self, 'name') and self.name is not None:
508
+ _dict['name'] = self.name
509
+ if hasattr(self, 'type') and self.type is not None:
510
+ _dict['type'] = self.type
511
+ if hasattr(self, 'number_of_apps') and self.number_of_apps is not None:
512
+ _dict['number_of_apps'] = self.number_of_apps
513
+ if hasattr(self, 'number_of_service_instances') and self.number_of_service_instances is not None:
514
+ _dict['number_of_service_instances'] = self.number_of_service_instances
515
+ if (
516
+ hasattr(self, 'default_number_of_instances_per_lite_plan')
517
+ and self.default_number_of_instances_per_lite_plan is not None
518
+ ):
519
+ _dict['default_number_of_instances_per_lite_plan'] = self.default_number_of_instances_per_lite_plan
520
+ if hasattr(self, 'instances_per_app') and self.instances_per_app is not None:
521
+ _dict['instances_per_app'] = self.instances_per_app
522
+ if hasattr(self, 'instance_memory') and self.instance_memory is not None:
523
+ _dict['instance_memory'] = self.instance_memory
524
+ if hasattr(self, 'total_app_memory') and self.total_app_memory is not None:
525
+ _dict['total_app_memory'] = self.total_app_memory
526
+ if hasattr(self, 'vsi_limit') and self.vsi_limit is not None:
527
+ _dict['vsi_limit'] = self.vsi_limit
528
+ if hasattr(self, 'resource_quotas') and self.resource_quotas is not None:
529
+ _dict['resource_quotas'] = [x.to_dict() for x in self.resource_quotas]
530
+ if hasattr(self, 'created_at') and self.created_at is not None:
531
+ _dict['created_at'] = datetime_to_string(self.created_at)
532
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
533
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
534
+ return _dict
535
+
536
+ def _to_dict(self):
537
+ """Return a json dictionary representing this model."""
538
+ return self.to_dict()
539
+
540
+ def __str__(self) -> str:
541
+ """Return a `str` version of this QuotaDefinition object."""
542
+ return json.dumps(self.to_dict(), indent=2)
543
+
544
+ def __eq__(self, other: 'QuotaDefinition') -> bool:
545
+ """Return `true` when self and other are equal, false otherwise."""
546
+ if not isinstance(other, self.__class__):
547
+ return False
548
+ return self.__dict__ == other.__dict__
549
+
550
+ def __ne__(self, other: 'QuotaDefinition') -> bool:
551
+ """Return `true` when self and other are not equal, false otherwise."""
552
+ return not self == other
553
+
554
+
555
+ class QuotaDefinitionList:
556
+ """
557
+ A list of quota definitions.
558
+
559
+ :attr List[QuotaDefinition] resources: The list of quota definitions.
560
+ """
561
+
562
+ def __init__(self, resources: List['QuotaDefinition']) -> None:
563
+ """
564
+ Initialize a QuotaDefinitionList object.
565
+
566
+ :param List[QuotaDefinition] resources: The list of quota definitions.
567
+ """
568
+ self.resources = resources
569
+
570
+ @classmethod
571
+ def from_dict(cls, _dict: Dict) -> 'QuotaDefinitionList':
572
+ """Initialize a QuotaDefinitionList object from a json dictionary."""
573
+ args = {}
574
+ if 'resources' in _dict:
575
+ args['resources'] = [QuotaDefinition.from_dict(x) for x in _dict.get('resources')]
576
+ else:
577
+ raise ValueError('Required property \'resources\' not present in QuotaDefinitionList JSON')
578
+ return cls(**args)
579
+
580
+ @classmethod
581
+ def _from_dict(cls, _dict):
582
+ """Initialize a QuotaDefinitionList object from a json dictionary."""
583
+ return cls.from_dict(_dict)
584
+
585
+ def to_dict(self) -> Dict:
586
+ """Return a json dictionary representing this model."""
587
+ _dict = {}
588
+ if hasattr(self, 'resources') and self.resources is not None:
589
+ _dict['resources'] = [x.to_dict() for x in self.resources]
590
+ return _dict
591
+
592
+ def _to_dict(self):
593
+ """Return a json dictionary representing this model."""
594
+ return self.to_dict()
595
+
596
+ def __str__(self) -> str:
597
+ """Return a `str` version of this QuotaDefinitionList object."""
598
+ return json.dumps(self.to_dict(), indent=2)
599
+
600
+ def __eq__(self, other: 'QuotaDefinitionList') -> bool:
601
+ """Return `true` when self and other are equal, false otherwise."""
602
+ if not isinstance(other, self.__class__):
603
+ return False
604
+ return self.__dict__ == other.__dict__
605
+
606
+ def __ne__(self, other: 'QuotaDefinitionList') -> bool:
607
+ """Return `true` when self and other are not equal, false otherwise."""
608
+ return not self == other
609
+
610
+
611
+ class ResCreateResourceGroup:
612
+ """
613
+ A newly-created resource group.
614
+
615
+ :attr str id: (optional) An alpha-numeric value identifying the resource group.
616
+ :attr str crn: (optional) The full CRN (cloud resource name) associated with the
617
+ resource group. For more on this format, see [Cloud Resource
618
+ Names](https://cloud.ibm.com/docs/account?topic=account-crn).
619
+ """
620
+
621
+ def __init__(self, *, id: str = None, crn: str = None) -> None:
622
+ """
623
+ Initialize a ResCreateResourceGroup object.
624
+
625
+ :param str id: (optional) An alpha-numeric value identifying the resource
626
+ group.
627
+ :param str crn: (optional) The full CRN (cloud resource name) associated
628
+ with the resource group. For more on this format, see [Cloud Resource
629
+ Names](https://cloud.ibm.com/docs/account?topic=account-crn).
630
+ """
631
+ self.id = id
632
+ self.crn = crn
633
+
634
+ @classmethod
635
+ def from_dict(cls, _dict: Dict) -> 'ResCreateResourceGroup':
636
+ """Initialize a ResCreateResourceGroup object from a json dictionary."""
637
+ args = {}
638
+ if 'id' in _dict:
639
+ args['id'] = _dict.get('id')
640
+ if 'crn' in _dict:
641
+ args['crn'] = _dict.get('crn')
642
+ return cls(**args)
643
+
644
+ @classmethod
645
+ def _from_dict(cls, _dict):
646
+ """Initialize a ResCreateResourceGroup object from a json dictionary."""
647
+ return cls.from_dict(_dict)
648
+
649
+ def to_dict(self) -> Dict:
650
+ """Return a json dictionary representing this model."""
651
+ _dict = {}
652
+ if hasattr(self, 'id') and self.id is not None:
653
+ _dict['id'] = self.id
654
+ if hasattr(self, 'crn') and self.crn is not None:
655
+ _dict['crn'] = self.crn
656
+ return _dict
657
+
658
+ def _to_dict(self):
659
+ """Return a json dictionary representing this model."""
660
+ return self.to_dict()
661
+
662
+ def __str__(self) -> str:
663
+ """Return a `str` version of this ResCreateResourceGroup object."""
664
+ return json.dumps(self.to_dict(), indent=2)
665
+
666
+ def __eq__(self, other: 'ResCreateResourceGroup') -> bool:
667
+ """Return `true` when self and other are equal, false otherwise."""
668
+ if not isinstance(other, self.__class__):
669
+ return False
670
+ return self.__dict__ == other.__dict__
671
+
672
+ def __ne__(self, other: 'ResCreateResourceGroup') -> bool:
673
+ """Return `true` when self and other are not equal, false otherwise."""
674
+ return not self == other
675
+
676
+
677
+ class ResourceGroup:
678
+ """
679
+ A resource group.
680
+
681
+ :attr str id: (optional) An alpha-numeric value identifying the resource group.
682
+ :attr str crn: (optional) The full CRN (cloud resource name) associated with the
683
+ resource group. For more on this format, see [Cloud Resource
684
+ Names](https://cloud.ibm.com/docs/account?topic=account-crn).
685
+ :attr str account_id: (optional) An alpha-numeric value identifying the account
686
+ ID.
687
+ :attr str name: (optional) The human-readable name of the resource group.
688
+ :attr str state: (optional) The state of the resource group.
689
+ :attr bool default: (optional) Identify if this resource group is default of the
690
+ account or not.
691
+ :attr str quota_id: (optional) An alpha-numeric value identifying the quota ID
692
+ associated with the resource group.
693
+ :attr str quota_url: (optional) The URL to access the quota details that
694
+ associated with the resource group.
695
+ :attr str payment_methods_url: (optional) The URL to access the payment methods
696
+ details that associated with the resource group.
697
+ :attr List[object] resource_linkages: (optional) An array of the resources that
698
+ linked to the resource group.
699
+ :attr str teams_url: (optional) The URL to access the team details that
700
+ associated with the resource group.
701
+ :attr datetime created_at: (optional) The date when the resource group was
702
+ initially created.
703
+ :attr datetime updated_at: (optional) The date when the resource group was last
704
+ updated.
705
+ """
706
+
707
+ def __init__(
708
+ self,
709
+ *,
710
+ id: str = None,
711
+ crn: str = None,
712
+ account_id: str = None,
713
+ name: str = None,
714
+ state: str = None,
715
+ default: bool = None,
716
+ quota_id: str = None,
717
+ quota_url: str = None,
718
+ payment_methods_url: str = None,
719
+ resource_linkages: List[object] = None,
720
+ teams_url: str = None,
721
+ created_at: datetime = None,
722
+ updated_at: datetime = None,
723
+ ) -> None:
724
+ """
725
+ Initialize a ResourceGroup object.
726
+
727
+ :param str id: (optional) An alpha-numeric value identifying the resource
728
+ group.
729
+ :param str crn: (optional) The full CRN (cloud resource name) associated
730
+ with the resource group. For more on this format, see [Cloud Resource
731
+ Names](https://cloud.ibm.com/docs/account?topic=account-crn).
732
+ :param str account_id: (optional) An alpha-numeric value identifying the
733
+ account ID.
734
+ :param str name: (optional) The human-readable name of the resource group.
735
+ :param str state: (optional) The state of the resource group.
736
+ :param bool default: (optional) Identify if this resource group is default
737
+ of the account or not.
738
+ :param str quota_id: (optional) An alpha-numeric value identifying the
739
+ quota ID associated with the resource group.
740
+ :param str quota_url: (optional) The URL to access the quota details that
741
+ associated with the resource group.
742
+ :param str payment_methods_url: (optional) The URL to access the payment
743
+ methods details that associated with the resource group.
744
+ :param List[object] resource_linkages: (optional) An array of the resources
745
+ that linked to the resource group.
746
+ :param str teams_url: (optional) The URL to access the team details that
747
+ associated with the resource group.
748
+ :param datetime created_at: (optional) The date when the resource group was
749
+ initially created.
750
+ :param datetime updated_at: (optional) The date when the resource group was
751
+ last updated.
752
+ """
753
+ self.id = id
754
+ self.crn = crn
755
+ self.account_id = account_id
756
+ self.name = name
757
+ self.state = state
758
+ self.default = default
759
+ self.quota_id = quota_id
760
+ self.quota_url = quota_url
761
+ self.payment_methods_url = payment_methods_url
762
+ self.resource_linkages = resource_linkages
763
+ self.teams_url = teams_url
764
+ self.created_at = created_at
765
+ self.updated_at = updated_at
766
+
767
+ @classmethod
768
+ def from_dict(cls, _dict: Dict) -> 'ResourceGroup':
769
+ """Initialize a ResourceGroup object from a json dictionary."""
770
+ args = {}
771
+ if 'id' in _dict:
772
+ args['id'] = _dict.get('id')
773
+ if 'crn' in _dict:
774
+ args['crn'] = _dict.get('crn')
775
+ if 'account_id' in _dict:
776
+ args['account_id'] = _dict.get('account_id')
777
+ if 'name' in _dict:
778
+ args['name'] = _dict.get('name')
779
+ if 'state' in _dict:
780
+ args['state'] = _dict.get('state')
781
+ if 'default' in _dict:
782
+ args['default'] = _dict.get('default')
783
+ if 'quota_id' in _dict:
784
+ args['quota_id'] = _dict.get('quota_id')
785
+ if 'quota_url' in _dict:
786
+ args['quota_url'] = _dict.get('quota_url')
787
+ if 'payment_methods_url' in _dict:
788
+ args['payment_methods_url'] = _dict.get('payment_methods_url')
789
+ if 'resource_linkages' in _dict:
790
+ args['resource_linkages'] = _dict.get('resource_linkages')
791
+ if 'teams_url' in _dict:
792
+ args['teams_url'] = _dict.get('teams_url')
793
+ if 'created_at' in _dict:
794
+ args['created_at'] = string_to_datetime(_dict.get('created_at'))
795
+ if 'updated_at' in _dict:
796
+ args['updated_at'] = string_to_datetime(_dict.get('updated_at'))
797
+ return cls(**args)
798
+
799
+ @classmethod
800
+ def _from_dict(cls, _dict):
801
+ """Initialize a ResourceGroup object from a json dictionary."""
802
+ return cls.from_dict(_dict)
803
+
804
+ def to_dict(self) -> Dict:
805
+ """Return a json dictionary representing this model."""
806
+ _dict = {}
807
+ if hasattr(self, 'id') and self.id is not None:
808
+ _dict['id'] = self.id
809
+ if hasattr(self, 'crn') and self.crn is not None:
810
+ _dict['crn'] = self.crn
811
+ if hasattr(self, 'account_id') and self.account_id is not None:
812
+ _dict['account_id'] = self.account_id
813
+ if hasattr(self, 'name') and self.name is not None:
814
+ _dict['name'] = self.name
815
+ if hasattr(self, 'state') and self.state is not None:
816
+ _dict['state'] = self.state
817
+ if hasattr(self, 'default') and self.default is not None:
818
+ _dict['default'] = self.default
819
+ if hasattr(self, 'quota_id') and self.quota_id is not None:
820
+ _dict['quota_id'] = self.quota_id
821
+ if hasattr(self, 'quota_url') and self.quota_url is not None:
822
+ _dict['quota_url'] = self.quota_url
823
+ if hasattr(self, 'payment_methods_url') and self.payment_methods_url is not None:
824
+ _dict['payment_methods_url'] = self.payment_methods_url
825
+ if hasattr(self, 'resource_linkages') and self.resource_linkages is not None:
826
+ _dict['resource_linkages'] = self.resource_linkages
827
+ if hasattr(self, 'teams_url') and self.teams_url is not None:
828
+ _dict['teams_url'] = self.teams_url
829
+ if hasattr(self, 'created_at') and self.created_at is not None:
830
+ _dict['created_at'] = datetime_to_string(self.created_at)
831
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
832
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
833
+ return _dict
834
+
835
+ def _to_dict(self):
836
+ """Return a json dictionary representing this model."""
837
+ return self.to_dict()
838
+
839
+ def __str__(self) -> str:
840
+ """Return a `str` version of this ResourceGroup object."""
841
+ return json.dumps(self.to_dict(), indent=2)
842
+
843
+ def __eq__(self, other: 'ResourceGroup') -> bool:
844
+ """Return `true` when self and other are equal, false otherwise."""
845
+ if not isinstance(other, self.__class__):
846
+ return False
847
+ return self.__dict__ == other.__dict__
848
+
849
+ def __ne__(self, other: 'ResourceGroup') -> bool:
850
+ """Return `true` when self and other are not equal, false otherwise."""
851
+ return not self == other
852
+
853
+
854
+ class ResourceGroupList:
855
+ """
856
+ A list of resource groups.
857
+
858
+ :attr List[ResourceGroup] resources: The list of resource groups.
859
+ """
860
+
861
+ def __init__(self, resources: List['ResourceGroup']) -> None:
862
+ """
863
+ Initialize a ResourceGroupList object.
864
+
865
+ :param List[ResourceGroup] resources: The list of resource groups.
866
+ """
867
+ self.resources = resources
868
+
869
+ @classmethod
870
+ def from_dict(cls, _dict: Dict) -> 'ResourceGroupList':
871
+ """Initialize a ResourceGroupList object from a json dictionary."""
872
+ args = {}
873
+ if 'resources' in _dict:
874
+ args['resources'] = [ResourceGroup.from_dict(x) for x in _dict.get('resources')]
875
+ else:
876
+ raise ValueError('Required property \'resources\' not present in ResourceGroupList JSON')
877
+ return cls(**args)
878
+
879
+ @classmethod
880
+ def _from_dict(cls, _dict):
881
+ """Initialize a ResourceGroupList object from a json dictionary."""
882
+ return cls.from_dict(_dict)
883
+
884
+ def to_dict(self) -> Dict:
885
+ """Return a json dictionary representing this model."""
886
+ _dict = {}
887
+ if hasattr(self, 'resources') and self.resources is not None:
888
+ _dict['resources'] = [x.to_dict() for x in self.resources]
889
+ return _dict
890
+
891
+ def _to_dict(self):
892
+ """Return a json dictionary representing this model."""
893
+ return self.to_dict()
894
+
895
+ def __str__(self) -> str:
896
+ """Return a `str` version of this ResourceGroupList object."""
897
+ return json.dumps(self.to_dict(), indent=2)
898
+
899
+ def __eq__(self, other: 'ResourceGroupList') -> bool:
900
+ """Return `true` when self and other are equal, false otherwise."""
901
+ if not isinstance(other, self.__class__):
902
+ return False
903
+ return self.__dict__ == other.__dict__
904
+
905
+ def __ne__(self, other: 'ResourceGroupList') -> bool:
906
+ """Return `true` when self and other are not equal, false otherwise."""
907
+ return not self == other
908
+
909
+
910
+ class ResourceQuota:
911
+ """
912
+ A resource quota.
913
+
914
+ :attr str id: (optional) An alpha-numeric value identifying the quota.
915
+ :attr str resource_id: (optional) The human-readable name of the quota.
916
+ :attr str crn: (optional) The full CRN (cloud resource name) associated with the
917
+ quota. For more on this format, see
918
+ https://cloud.ibm.com/docs/account?topic=account-crn.
919
+ :attr float limit: (optional) The limit number of this resource.
920
+ """
921
+
922
+ def __init__(self, *, id: str = None, resource_id: str = None, crn: str = None, limit: float = None) -> None:
923
+ """
924
+ Initialize a ResourceQuota object.
925
+
926
+ :param str id: (optional) An alpha-numeric value identifying the quota.
927
+ :param str resource_id: (optional) The human-readable name of the quota.
928
+ :param str crn: (optional) The full CRN (cloud resource name) associated
929
+ with the quota. For more on this format, see
930
+ https://cloud.ibm.com/docs/account?topic=account-crn.
931
+ :param float limit: (optional) The limit number of this resource.
932
+ """
933
+ self.id = id
934
+ self.resource_id = resource_id
935
+ self.crn = crn
936
+ self.limit = limit
937
+
938
+ @classmethod
939
+ def from_dict(cls, _dict: Dict) -> 'ResourceQuota':
940
+ """Initialize a ResourceQuota object from a json dictionary."""
941
+ args = {}
942
+ if '_id' in _dict:
943
+ args['id'] = _dict.get('_id')
944
+ if 'resource_id' in _dict:
945
+ args['resource_id'] = _dict.get('resource_id')
946
+ if 'crn' in _dict:
947
+ args['crn'] = _dict.get('crn')
948
+ if 'limit' in _dict:
949
+ args['limit'] = _dict.get('limit')
950
+ return cls(**args)
951
+
952
+ @classmethod
953
+ def _from_dict(cls, _dict):
954
+ """Initialize a ResourceQuota object from a json dictionary."""
955
+ return cls.from_dict(_dict)
956
+
957
+ def to_dict(self) -> Dict:
958
+ """Return a json dictionary representing this model."""
959
+ _dict = {}
960
+ if hasattr(self, 'id') and self.id is not None:
961
+ _dict['_id'] = self.id
962
+ if hasattr(self, 'resource_id') and self.resource_id is not None:
963
+ _dict['resource_id'] = self.resource_id
964
+ if hasattr(self, 'crn') and self.crn is not None:
965
+ _dict['crn'] = self.crn
966
+ if hasattr(self, 'limit') and self.limit is not None:
967
+ _dict['limit'] = self.limit
968
+ return _dict
969
+
970
+ def _to_dict(self):
971
+ """Return a json dictionary representing this model."""
972
+ return self.to_dict()
973
+
974
+ def __str__(self) -> str:
975
+ """Return a `str` version of this ResourceQuota object."""
976
+ return json.dumps(self.to_dict(), indent=2)
977
+
978
+ def __eq__(self, other: 'ResourceQuota') -> bool:
979
+ """Return `true` when self and other are equal, false otherwise."""
980
+ if not isinstance(other, self.__class__):
981
+ return False
982
+ return self.__dict__ == other.__dict__
983
+
984
+ def __ne__(self, other: 'ResourceQuota') -> bool:
985
+ """Return `true` when self and other are not equal, false otherwise."""
986
+ return not self == other