36
36
class ResourceManagerV2 (BaseService ):
37
37
"""The Resource Manager V2 service."""
38
38
39
- DEFAULT_SERVICE_URL = 'https://resource-controller.cloud.ibm.com'
39
+ DEFAULT_SERVICE_URL = 'https://resource-controller.cloud.ibm.com/v2 '
40
40
DEFAULT_SERVICE_NAME = 'resource_manager'
41
41
42
42
@classmethod
@@ -70,84 +70,14 @@ def __init__(self,
70
70
71
71
72
72
#########################
73
- # quotaDefinition
74
- #########################
75
-
76
-
77
- def list_quota_definitions (self ,
78
- ** kwargs
79
- ) -> DetailedResponse :
80
- """
81
- Get a list of all quota definitions.
82
-
83
- Get a list of all quota definitions.
84
-
85
- :param dict headers: A `dict` containing the request headers
86
- :return: A `DetailedResponse` containing the result, headers and HTTP status code.
87
- :rtype: DetailedResponse with `dict` result representing a `QuotaDefinitionList` object
88
- """
89
-
90
- headers = {}
91
- sdk_headers = get_sdk_headers (service_name = self .DEFAULT_SERVICE_NAME ,
92
- service_version = 'V2' ,
93
- operation_id = 'list_quota_definitions' )
94
- headers .update (sdk_headers )
95
-
96
- if 'headers' in kwargs :
97
- headers .update (kwargs .get ('headers' ))
98
-
99
- url = '/quota_definitions'
100
- request = self .prepare_request (method = 'GET' ,
101
- url = url ,
102
- headers = headers )
103
-
104
- response = self .send (request )
105
- return response
106
-
107
-
108
- def get_quota_definition (self ,
109
- id : str ,
110
- ** kwargs
111
- ) -> DetailedResponse :
112
- """
113
- Get a quota definition.
114
-
115
- Get a quota definition.
116
-
117
- :param str id: The id of the quota.
118
- :param dict headers: A `dict` containing the request headers
119
- :return: A `DetailedResponse` containing the result, headers and HTTP status code.
120
- :rtype: DetailedResponse with `dict` result representing a `QuotaDefinition` object
121
- """
122
-
123
- if id is None :
124
- raise ValueError ('id must be provided' )
125
- headers = {}
126
- sdk_headers = get_sdk_headers (service_name = self .DEFAULT_SERVICE_NAME ,
127
- service_version = 'V2' ,
128
- operation_id = 'get_quota_definition' )
129
- headers .update (sdk_headers )
130
-
131
- if 'headers' in kwargs :
132
- headers .update (kwargs .get ('headers' ))
133
-
134
- url = '/quota_definitions/{0}' .format (
135
- * self .encode_path_vars (id ))
136
- request = self .prepare_request (method = 'GET' ,
137
- url = url ,
138
- headers = headers )
139
-
140
- response = self .send (request )
141
- return response
142
-
143
- #########################
144
- # resourceGroup
73
+ # Resource Group
145
74
#########################
146
75
147
76
148
77
def list_resource_groups (self ,
149
78
* ,
150
79
account_id : str = None ,
80
+ date : str = None ,
151
81
** kwargs
152
82
) -> DetailedResponse :
153
83
"""
@@ -157,6 +87,8 @@ def list_resource_groups(self,
157
87
158
88
:param str account_id: (optional) The ID of the account that contains the
159
89
resource groups that you want to get.
90
+ :param str date: (optional) The date would be in a format of YYYY-MM which
91
+ returns resource groups exclude the deleted ones before this month.
160
92
:param dict headers: A `dict` containing the request headers
161
93
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
162
94
:rtype: DetailedResponse with `dict` result representing a `ResourceGroupList` object
@@ -169,7 +101,8 @@ def list_resource_groups(self,
169
101
headers .update (sdk_headers )
170
102
171
103
params = {
172
- 'account_id' : account_id
104
+ 'account_id' : account_id ,
105
+ 'date' : date
173
106
}
174
107
175
108
if 'headers' in kwargs :
@@ -351,6 +284,77 @@ def delete_resource_group(self,
351
284
response = self .send (request )
352
285
return response
353
286
287
+ #########################
288
+ # Quota Definition
289
+ #########################
290
+
291
+
292
+ def list_quota_definitions (self ,
293
+ ** kwargs
294
+ ) -> DetailedResponse :
295
+ """
296
+ List quota definitions.
297
+
298
+ Get a list of all quota definitions.
299
+
300
+ :param dict headers: A `dict` containing the request headers
301
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
302
+ :rtype: DetailedResponse with `dict` result representing a `QuotaDefinitionList` object
303
+ """
304
+
305
+ headers = {}
306
+ sdk_headers = get_sdk_headers (service_name = self .DEFAULT_SERVICE_NAME ,
307
+ service_version = 'V2' ,
308
+ operation_id = 'list_quota_definitions' )
309
+ headers .update (sdk_headers )
310
+
311
+ if 'headers' in kwargs :
312
+ headers .update (kwargs .get ('headers' ))
313
+
314
+ url = '/quota_definitions'
315
+ request = self .prepare_request (method = 'GET' ,
316
+ url = url ,
317
+ headers = headers )
318
+
319
+ response = self .send (request )
320
+ return response
321
+
322
+
323
+ def get_quota_definition (self ,
324
+ id : str ,
325
+ ** kwargs
326
+ ) -> DetailedResponse :
327
+ """
328
+ Get a quota definition.
329
+
330
+ Get a a quota definition.
331
+
332
+ :param str id: The id of the quota.
333
+ :param dict headers: A `dict` containing the request headers
334
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
335
+ :rtype: DetailedResponse with `dict` result representing a `QuotaDefinition` object
336
+ """
337
+
338
+ if id is None :
339
+ raise ValueError ('id must be provided' )
340
+ headers = {}
341
+ sdk_headers = get_sdk_headers (service_name = self .DEFAULT_SERVICE_NAME ,
342
+ service_version = 'V2' ,
343
+ operation_id = 'get_quota_definition' )
344
+ headers .update (sdk_headers )
345
+
346
+ if 'headers' in kwargs :
347
+ headers .update (kwargs .get ('headers' ))
348
+
349
+ url = '/quota_definitions/{0}' .format (
350
+ * self .encode_path_vars (id ))
351
+ request = self .prepare_request (method = 'GET' ,
352
+ url = url ,
353
+ headers = headers )
354
+
355
+ response = self .send (request )
356
+ return response
357
+
354
358
355
359
##############################################################################
356
360
# Models
@@ -373,7 +377,8 @@ class QuotaDefinition():
373
377
:attr str instance_memory: (optional) The total memory of app instance.
374
378
:attr str total_app_memory: (optional) The total app memory capacity.
375
379
:attr float vsi_limit: (optional) The VSI limit.
376
- :attr ResourceQuota resource_quotas: (optional) A resource quota.
380
+ :attr List[ResourceQuota] resource_quotas: (optional) The resource quotas
381
+ associated with a quota definition.
377
382
:attr datetime created_at: (optional) The date when the quota was initially
378
383
created.
379
384
:attr datetime updated_at: (optional) The date when the quota was last updated.
@@ -391,7 +396,7 @@ def __init__(self,
391
396
instance_memory : str = None ,
392
397
total_app_memory : str = None ,
393
398
vsi_limit : float = None ,
394
- resource_quotas : 'ResourceQuota' = None ,
399
+ resource_quotas : List [ 'ResourceQuota' ] = None ,
395
400
created_at : datetime = None ,
396
401
updated_at : datetime = None ) -> None :
397
402
"""
@@ -410,7 +415,8 @@ def __init__(self,
410
415
:param str instance_memory: (optional) The total memory of app instance.
411
416
:param str total_app_memory: (optional) The total app memory capacity.
412
417
:param float vsi_limit: (optional) The VSI limit.
413
- :param ResourceQuota resource_quotas: (optional) A resource quota.
418
+ :param List[ResourceQuota] resource_quotas: (optional) The resource quotas
419
+ associated with a quota definition.
414
420
:param datetime created_at: (optional) The date when the quota was
415
421
initially created.
416
422
:param datetime updated_at: (optional) The date when the quota was last
@@ -455,7 +461,7 @@ def from_dict(cls, _dict: Dict) -> 'QuotaDefinition':
455
461
if 'vsi_limit' in _dict :
456
462
args ['vsi_limit' ] = _dict .get ('vsi_limit' )
457
463
if 'resource_quotas' in _dict :
458
- args ['resource_quotas' ] = ResourceQuota .from_dict (_dict .get ('resource_quotas' ))
464
+ args ['resource_quotas' ] = [ ResourceQuota .from_dict (x ) for x in _dict .get ('resource_quotas' )]
459
465
if 'created_at' in _dict :
460
466
args ['created_at' ] = string_to_datetime (_dict .get ('created_at' ))
461
467
if 'updated_at' in _dict :
@@ -491,7 +497,7 @@ def to_dict(self) -> Dict:
491
497
if hasattr (self , 'vsi_limit' ) and self .vsi_limit is not None :
492
498
_dict ['vsi_limit' ] = self .vsi_limit
493
499
if hasattr (self , 'resource_quotas' ) and self .resource_quotas is not None :
494
- _dict ['resource_quotas' ] = self . resource_quotas . to_dict ()
500
+ _dict ['resource_quotas' ] = [ x . to_dict () for x in self . resource_quotas ]
495
501
if hasattr (self , 'created_at' ) and self .created_at is not None :
496
502
_dict ['created_at' ] = datetime_to_string (self .created_at )
497
503
if hasattr (self , 'updated_at' ) and self .updated_at is not None :
0 commit comments