Skip to content

Commit 698441a

Browse files
pyrookapadamstx
andauthored
fix(Resource Controller): update service after recent API changes (#105)
Co-authored-by: Phil Adams <[email protected]>
1 parent e6dcef3 commit 698441a

File tree

4 files changed

+476
-184
lines changed

4 files changed

+476
-184
lines changed

.secrets.baseline

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "package-lock.json|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2021-04-01T17:52:26Z",
6+
"generated_at": "2021-04-20T19:13:07Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -97,7 +97,7 @@
9797
"hashed_secret": "d506bd5213c46bd49e16c634754ad70113408252",
9898
"is_secret": false,
9999
"is_verified": false,
100-
"line_number": 3244,
100+
"line_number": 3327,
101101
"type": "Secret Keyword",
102102
"verified_result": null
103103
}
@@ -271,25 +271,33 @@
271271
}
272272
],
273273
"test/unit/test_resource_controller_v2.py": [
274+
{
275+
"hashed_secret": "0f97a4e707b7424540793cb2078919ee6770e07f",
276+
"is_secret": false,
277+
"is_verified": false,
278+
"line_number": 281,
279+
"type": "Hex High Entropy String",
280+
"verified_result": null
281+
},
274282
{
275283
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
276284
"is_secret": false,
277285
"is_verified": false,
278-
"line_number": 2092,
286+
"line_number": 2215,
279287
"type": "Secret Keyword",
280288
"verified_result": null
281289
},
282290
{
283291
"hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4",
284292
"is_secret": false,
285293
"is_verified": false,
286-
"line_number": 2992,
294+
"line_number": 3115,
287295
"type": "Secret Keyword",
288296
"verified_result": null
289297
}
290298
]
291299
},
292-
"version": "0.13.1+ibm.33.dss",
300+
"version": "0.13.1+ibm.34.dss",
293301
"word_list": {
294302
"file": null,
295303
"hash": null

ibm_platform_services/resource_controller_v2.py

Lines changed: 103 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 3.29.1-b338fb38-20210313-010605
17+
# IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-77b4cbf2-20210420-134305
1818

1919
"""
2020
Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are
@@ -88,7 +88,8 @@ def list_resource_instances(self,
8888
resource_plan_id: str = None,
8989
type: str = None,
9090
sub_type: str = None,
91-
limit: str = None,
91+
limit: int = None,
92+
start: str = None,
9293
state: str = None,
9394
order_direction: str = None,
9495
updated_from: str = None,
@@ -98,7 +99,9 @@ def list_resource_instances(self,
9899
"""
99100
Get a list of all resource instances.
100101
101-
Get a list of all resource instances.
102+
View a list of all available resource instances. Resources is a broad term that
103+
could mean anything from a service instance to a virtual machine associated with
104+
the customer account.
102105
103106
:param str guid: (optional) When you provision a new resource in the
104107
specified location for the selected plan, a GUID (globally unique
@@ -115,7 +118,12 @@ def list_resource_instances(self,
115118
`service_instance`.
116119
:param str sub_type: (optional) The sub-type of instance, for example,
117120
`cfaas`.
118-
:param str limit: (optional) Limit on how many items should be returned.
121+
:param int limit: (optional) Limit on how many items should be returned.
122+
:param str start: (optional) An optional token that indicates the beginning
123+
of the page of results to be returned. Any additional query parameters are
124+
ignored if a page token is present. If omitted, the first page of results
125+
is returned. This value is obtained from the 'next_url' field of the
126+
operation response.
119127
:param str state: (optional) The state of the instance. If not specified,
120128
instances in state `active` and `provisioning` are returned.
121129
:param str order_direction: (optional) Order of results.
@@ -141,6 +149,7 @@ def list_resource_instances(self,
141149
'type': type,
142150
'sub_type': sub_type,
143151
'limit': limit,
152+
'start': start,
144153
'state': state,
145154
'order_direction': order_direction,
146155
'updated_from': updated_from,
@@ -176,7 +185,9 @@ def create_resource_instance(self,
176185
"""
177186
Create (provision) a new resource instance.
178187
179-
Provision a new resource in the specified location for the selected plan.
188+
When you provision a service you get an instance of that service. An instance
189+
represents the resource with which you create, and additionally, represents a
190+
chargeable record of which billing can occur.
180191
181192
:param str name: The name of the instance. Must be 180 characters or less
182193
and cannot include any special characters other than `(space) - . _ :`.
@@ -252,7 +263,8 @@ def get_resource_instance(self,
252263
"""
253264
Get a resource instance.
254265
255-
Retrieve a resource instance by ID.
266+
Retrieve a resource instance by ID. Find more details on a particular instance,
267+
like when it was provisioned and who provisioned it.
256268
257269
:param str id: The short or long ID of the instance.
258270
:param dict headers: A `dict` containing the request headers
@@ -293,7 +305,8 @@ def delete_resource_instance(self,
293305
"""
294306
Delete a resource instance.
295307
296-
Delete a resource instance by ID.
308+
Delete a resource instance by ID. If the resource instance has any resource keys
309+
or aliases associated with it, use the `recursive=true` parameter to delete it.
297310
298311
:param str id: The short or long ID of the instance.
299312
:param bool recursive: (optional) Will delete resource bindings, keys and
@@ -343,7 +356,8 @@ def update_resource_instance(self,
343356
"""
344357
Update a resource instance.
345358
346-
Update a resource instance by ID.
359+
You can use the ID to make updates to the resource instance, like changing the
360+
name or plan.
347361
348362
:param str id: The short or long ID of the instance.
349363
:param str name: (optional) The new name of the instance. Must be 180
@@ -399,14 +413,24 @@ def update_resource_instance(self,
399413

400414
def list_resource_aliases_for_instance(self,
401415
id: str,
416+
*,
417+
limit: int = None,
418+
start: str = None,
402419
**kwargs
403420
) -> DetailedResponse:
404421
"""
405422
Get a list of all resource aliases for the instance.
406423
407-
Get a list of all resource aliases for the instance.
424+
Retrieving a list of all resource aliases can help you find out who's using the
425+
resource instance.
408426
409427
:param str id: The short or long ID of the instance.
428+
:param int limit: (optional) Limit on how many items should be returned.
429+
:param str start: (optional) An optional token that indicates the beginning
430+
of the page of results to be returned. Any additional query parameters are
431+
ignored if a page token is present. If omitted, the first page of results
432+
is returned. This value is obtained from the 'next_url' field of the
433+
operation response.
410434
:param dict headers: A `dict` containing the request headers
411435
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
412436
:rtype: DetailedResponse with `dict` result representing a `ResourceAliasesList` object
@@ -420,6 +444,11 @@ def list_resource_aliases_for_instance(self,
420444
operation_id='list_resource_aliases_for_instance')
421445
headers.update(sdk_headers)
422446

447+
params = {
448+
'limit': limit,
449+
'start': start
450+
}
451+
423452
if 'headers' in kwargs:
424453
headers.update(kwargs.get('headers'))
425454
headers['Accept'] = 'application/json'
@@ -430,22 +459,33 @@ def list_resource_aliases_for_instance(self,
430459
url = '/v2/resource_instances/{id}/resource_aliases'.format(**path_param_dict)
431460
request = self.prepare_request(method='GET',
432461
url=url,
433-
headers=headers)
462+
headers=headers,
463+
params=params)
434464

435465
response = self.send(request)
436466
return response
437467

438468

439469
def list_resource_keys_for_instance(self,
440470
id: str,
471+
*,
472+
limit: int = None,
473+
start: str = None,
441474
**kwargs
442475
) -> DetailedResponse:
443476
"""
444477
Get a list of all the resource keys for the instance.
445478
446-
Get a list of all the resource keys for the instance.
479+
You may have many resource keys for one resource instance. For example, you may
480+
have a different resource key for each user or each role.
447481
448482
:param str id: The short or long ID of the instance.
483+
:param int limit: (optional) Limit on how many items should be returned.
484+
:param str start: (optional) An optional token that indicates the beginning
485+
of the page of results to be returned. Any additional query parameters are
486+
ignored if a page token is present. If omitted, the first page of results
487+
is returned. This value is obtained from the 'next_url' field of the
488+
operation response.
449489
:param dict headers: A `dict` containing the request headers
450490
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
451491
:rtype: DetailedResponse with `dict` result representing a `ResourceKeysList` object
@@ -459,6 +499,11 @@ def list_resource_keys_for_instance(self,
459499
operation_id='list_resource_keys_for_instance')
460500
headers.update(sdk_headers)
461501

502+
params = {
503+
'limit': limit,
504+
'start': start
505+
}
506+
462507
if 'headers' in kwargs:
463508
headers.update(kwargs.get('headers'))
464509
headers['Accept'] = 'application/json'
@@ -469,7 +514,8 @@ def list_resource_keys_for_instance(self,
469514
url = '/v2/resource_instances/{id}/resource_keys'.format(**path_param_dict)
470515
request = self.prepare_request(method='GET',
471516
url=url,
472-
headers=headers)
517+
headers=headers,
518+
params=params)
473519

474520
response = self.send(request)
475521
return response
@@ -523,7 +569,8 @@ def unlock_resource_instance(self,
523569
"""
524570
Unlock a resource instance.
525571
526-
Unlocks a resource instance by ID.
572+
Unlock a resource instance to update or delete it. Unlocking a resource instance
573+
does not affect child resources like aliases, bindings or keys.
527574
528575
:param str id: The short or long ID of the instance.
529576
:param dict headers: A `dict` containing the request headers
@@ -565,7 +612,8 @@ def list_resource_keys(self,
565612
name: str = None,
566613
resource_group_id: str = None,
567614
resource_id: str = None,
568-
limit: str = None,
615+
limit: int = None,
616+
start: str = None,
569617
updated_from: str = None,
570618
updated_to: str = None,
571619
**kwargs
@@ -583,7 +631,12 @@ def list_resource_keys(self,
583631
group.
584632
:param str resource_id: (optional) The unique ID of the offering. This
585633
value is provided by and stored in the global catalog.
586-
:param str limit: (optional) Limit on how many items should be returned.
634+
:param int limit: (optional) Limit on how many items should be returned.
635+
:param str start: (optional) An optional token that indicates the beginning
636+
of the page of results to be returned. Any additional query parameters are
637+
ignored if a page token is present. If omitted, the first page of results
638+
is returned. This value is obtained from the 'next_url' field of the
639+
operation response.
587640
:param str updated_from: (optional) Start date inclusive filter.
588641
:param str updated_to: (optional) End date inclusive filter.
589642
:param dict headers: A `dict` containing the request headers
@@ -603,6 +656,7 @@ def list_resource_keys(self,
603656
'resource_group_id': resource_group_id,
604657
'resource_id': resource_id,
605658
'limit': limit,
659+
'start': start,
606660
'updated_from': updated_from,
607661
'updated_to': updated_to
608662
}
@@ -822,7 +876,8 @@ def list_resource_bindings(self,
822876
resource_group_id: str = None,
823877
resource_id: str = None,
824878
region_binding_id: str = None,
825-
limit: str = None,
879+
limit: int = None,
880+
start: str = None,
826881
updated_from: str = None,
827882
updated_to: str = None,
828883
**kwargs
@@ -840,7 +895,12 @@ def list_resource_bindings(self,
840895
:param str region_binding_id: (optional) Short ID of the binding in the
841896
specific targeted environment, for example, service_binding_id in a given
842897
IBM Cloud environment.
843-
:param str limit: (optional) Limit on how many items should be returned.
898+
:param int limit: (optional) Limit on how many items should be returned.
899+
:param str start: (optional) An optional token that indicates the beginning
900+
of the page of results to be returned. Any additional query parameters are
901+
ignored if a page token is present. If omitted, the first page of results
902+
is returned. This value is obtained from the 'next_url' field of the
903+
operation response.
844904
:param str updated_from: (optional) Start date inclusive filter.
845905
:param str updated_to: (optional) End date inclusive filter.
846906
:param dict headers: A `dict` containing the request headers
@@ -861,6 +921,7 @@ def list_resource_bindings(self,
861921
'resource_id': resource_id,
862922
'region_binding_id': region_binding_id,
863923
'limit': limit,
924+
'start': start,
864925
'updated_from': updated_from,
865926
'updated_to': updated_to
866927
}
@@ -1088,7 +1149,8 @@ def list_resource_aliases(self,
10881149
region_instance_id: str = None,
10891150
resource_id: str = None,
10901151
resource_group_id: str = None,
1091-
limit: str = None,
1152+
limit: int = None,
1153+
start: str = None,
10921154
updated_from: str = None,
10931155
updated_to: str = None,
10941156
**kwargs
@@ -1107,7 +1169,12 @@ def list_resource_aliases(self,
11071169
:param str resource_id: (optional) The unique ID of the offering (service
11081170
name). This value is provided by and stored in the global catalog.
11091171
:param str resource_group_id: (optional) Short ID of Resource group.
1110-
:param str limit: (optional) Limit on how many items should be returned.
1172+
:param int limit: (optional) Limit on how many items should be returned.
1173+
:param str start: (optional) An optional token that indicates the beginning
1174+
of the page of results to be returned. Any additional query parameters are
1175+
ignored if a page token is present. If omitted, the first page of results
1176+
is returned. This value is obtained from the 'next_url' field of the
1177+
operation response.
11111178
:param str updated_from: (optional) Start date inclusive filter.
11121179
:param str updated_to: (optional) End date inclusive filter.
11131180
:param dict headers: A `dict` containing the request headers
@@ -1129,6 +1196,7 @@ def list_resource_aliases(self,
11291196
'resource_id': resource_id,
11301197
'resource_group_id': resource_group_id,
11311198
'limit': limit,
1199+
'start': start,
11321200
'updated_from': updated_from,
11331201
'updated_to': updated_to
11341202
}
@@ -1334,6 +1402,9 @@ def update_resource_alias(self,
13341402

13351403
def list_resource_bindings_for_alias(self,
13361404
id: str,
1405+
*,
1406+
limit: int = None,
1407+
start: str = None,
13371408
**kwargs
13381409
) -> DetailedResponse:
13391410
"""
@@ -1342,6 +1413,12 @@ def list_resource_bindings_for_alias(self,
13421413
Get a list of all resource bindings for the alias.
13431414
13441415
:param str id: The short or long ID of the alias.
1416+
:param int limit: (optional) Limit on how many items should be returned.
1417+
:param str start: (optional) An optional token that indicates the beginning
1418+
of the page of results to be returned. Any additional query parameters are
1419+
ignored if a page token is present. If omitted, the first page of results
1420+
is returned. This value is obtained from the 'next_url' field of the
1421+
operation response.
13451422
:param dict headers: A `dict` containing the request headers
13461423
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
13471424
:rtype: DetailedResponse with `dict` result representing a `ResourceBindingsList` object
@@ -1355,6 +1432,11 @@ def list_resource_bindings_for_alias(self,
13551432
operation_id='list_resource_bindings_for_alias')
13561433
headers.update(sdk_headers)
13571434

1435+
params = {
1436+
'limit': limit,
1437+
'start': start
1438+
}
1439+
13581440
if 'headers' in kwargs:
13591441
headers.update(kwargs.get('headers'))
13601442
headers['Accept'] = 'application/json'
@@ -1365,7 +1447,8 @@ def list_resource_bindings_for_alias(self,
13651447
url = '/v2/resource_aliases/{id}/resource_bindings'.format(**path_param_dict)
13661448
request = self.prepare_request(method='GET',
13671449
url=url,
1368-
headers=headers)
1450+
headers=headers,
1451+
params=params)
13691452

13701453
response = self.send(request)
13711454
return response

0 commit comments

Comments
 (0)