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,4868 @@
1
+ # coding: utf-8
2
+
3
+ # (C) Copyright IBM Corp. 2024.
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.92.1-44330004-20240620-143510
18
+
19
+ """
20
+ Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are
21
+ provisioned globally in an account scope. Supports asynchronous provisioning of resources.
22
+ Enables consumption of a global resource through a Cloud Foundry space in any region.
23
+
24
+ API Version: 2.0
25
+ """
26
+
27
+ from datetime import datetime
28
+ from enum import Enum
29
+ from typing import Dict, List, Optional
30
+ import json
31
+
32
+ from ibm_cloud_sdk_core import BaseService, DetailedResponse, get_query_param
33
+ from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
34
+ from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
35
+ from ibm_cloud_sdk_core.utils import convert_model, datetime_to_string, string_to_datetime
36
+
37
+ from .common import get_sdk_headers
38
+
39
+ ##############################################################################
40
+ # Service
41
+ ##############################################################################
42
+
43
+
44
+ class ResourceControllerV2(BaseService):
45
+ """The resource_controller V2 service."""
46
+
47
+ DEFAULT_SERVICE_URL = 'https://resource-controller.cloud.ibm.com'
48
+ DEFAULT_SERVICE_NAME = 'resource_controller'
49
+
50
+ @classmethod
51
+ def new_instance(
52
+ cls,
53
+ service_name: str = DEFAULT_SERVICE_NAME,
54
+ ) -> 'ResourceControllerV2':
55
+ """
56
+ Return a new client for the resource_controller service using the specified
57
+ parameters and external configuration.
58
+ """
59
+ authenticator = get_authenticator_from_environment(service_name)
60
+ service = cls(authenticator)
61
+ service.configure_service(service_name)
62
+ return service
63
+
64
+ def __init__(
65
+ self,
66
+ authenticator: Authenticator = None,
67
+ ) -> None:
68
+ """
69
+ Construct a new client for the resource_controller service.
70
+
71
+ :param Authenticator authenticator: The authenticator specifies the authentication mechanism.
72
+ Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
73
+ about initializing the authenticator of your choice.
74
+ """
75
+ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
76
+
77
+ #########################
78
+ # Resource Instances
79
+ #########################
80
+
81
+ def list_resource_instances(
82
+ self,
83
+ *,
84
+ guid: Optional[str] = None,
85
+ name: Optional[str] = None,
86
+ resource_group_id: Optional[str] = None,
87
+ resource_id: Optional[str] = None,
88
+ resource_plan_id: Optional[str] = None,
89
+ type: Optional[str] = None,
90
+ sub_type: Optional[str] = None,
91
+ limit: Optional[int] = None,
92
+ start: Optional[str] = None,
93
+ state: Optional[str] = None,
94
+ updated_from: Optional[str] = None,
95
+ updated_to: Optional[str] = None,
96
+ **kwargs,
97
+ ) -> DetailedResponse:
98
+ """
99
+ Get a list of all resource instances.
100
+
101
+ View a list of all available resource instances. Resources is a broad term that
102
+ could mean anything from a service instance to a virtual machine associated with
103
+ the customer account.
104
+
105
+ :param str guid: (optional) The GUID of the instance.
106
+ :param str name: (optional) The human-readable name of the instance.
107
+ :param str resource_group_id: (optional) The ID of the resource group.
108
+ :param str resource_id: (optional) The unique ID of the offering. This
109
+ value is provided by and stored in the global catalog.
110
+ :param str resource_plan_id: (optional) The unique ID of the plan
111
+ associated with the offering. This value is provided by and stored in the
112
+ global catalog.
113
+ :param str type: (optional) The type of the instance, for example,
114
+ `service_instance`.
115
+ :param str sub_type: (optional) The sub-type of instance, for example,
116
+ `kms`.
117
+ :param int limit: (optional) Limit on how many items should be returned.
118
+ :param str start: (optional) An optional token that indicates the beginning
119
+ of the page of results to be returned. Any additional query parameters are
120
+ ignored if a page token is present. If omitted, the first page of results
121
+ is returned. This value is obtained from the 'start' query parameter in the
122
+ 'next_url' field of the operation response.
123
+ :param str state: (optional) The state of the instance. If not specified,
124
+ instances in state `active` and `provisioning` are returned.
125
+ :param str updated_from: (optional) Start date inclusive filter.
126
+ :param str updated_to: (optional) End date inclusive filter.
127
+ :param dict headers: A `dict` containing the request headers
128
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
129
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstancesList` object
130
+ """
131
+
132
+ headers = {}
133
+ sdk_headers = get_sdk_headers(
134
+ service_name=self.DEFAULT_SERVICE_NAME,
135
+ service_version='V2',
136
+ operation_id='list_resource_instances',
137
+ )
138
+ headers.update(sdk_headers)
139
+
140
+ params = {
141
+ 'guid': guid,
142
+ 'name': name,
143
+ 'resource_group_id': resource_group_id,
144
+ 'resource_id': resource_id,
145
+ 'resource_plan_id': resource_plan_id,
146
+ 'type': type,
147
+ 'sub_type': sub_type,
148
+ 'limit': limit,
149
+ 'start': start,
150
+ 'state': state,
151
+ 'updated_from': updated_from,
152
+ 'updated_to': updated_to,
153
+ }
154
+
155
+ if 'headers' in kwargs:
156
+ headers.update(kwargs.get('headers'))
157
+ del kwargs['headers']
158
+ headers['Accept'] = 'application/json'
159
+
160
+ url = '/v2/resource_instances'
161
+ request = self.prepare_request(
162
+ method='GET',
163
+ url=url,
164
+ headers=headers,
165
+ params=params,
166
+ )
167
+
168
+ response = self.send(request, **kwargs)
169
+ return response
170
+
171
+ def create_resource_instance(
172
+ self,
173
+ name: str,
174
+ target: str,
175
+ resource_group: str,
176
+ resource_plan_id: str,
177
+ *,
178
+ tags: Optional[List[str]] = None,
179
+ allow_cleanup: Optional[bool] = None,
180
+ parameters: Optional[dict] = None,
181
+ entity_lock: Optional[bool] = None,
182
+ **kwargs,
183
+ ) -> DetailedResponse:
184
+ """
185
+ Create (provision) a new resource instance.
186
+
187
+ When you provision a service you get an instance of that service. An instance
188
+ represents the resource with which you create, and additionally, represents a
189
+ chargeable record of which billing can occur.
190
+
191
+ :param str name: The name of the instance. Must be 180 characters or less
192
+ and cannot include any special characters other than `(space) - . _ :`.
193
+ :param str target: The deployment location where the instance should be
194
+ hosted.
195
+ :param str resource_group: The ID of the resource group.
196
+ :param str resource_plan_id: The unique ID of the plan associated with the
197
+ offering. This value is provided by and stored in the global catalog.
198
+ :param List[str] tags: (optional) Tags that are attached to the instance
199
+ after provisioning. These tags can be searched and managed through the
200
+ Tagging API in IBM Cloud.
201
+ :param bool allow_cleanup: (optional) A boolean that dictates if the
202
+ resource instance should be deleted (cleaned up) during the processing of a
203
+ region instance delete call.
204
+ :param dict parameters: (optional) Configuration options represented as
205
+ key-value pairs that are passed through to the target resource brokers. Set
206
+ the `onetime_credentials` property to specify whether newly created
207
+ resource key credentials can be retrieved by using get resource key or get
208
+ a list of all of the resource keys requests.
209
+ :param bool entity_lock: (optional) Indicates if the resource instance is
210
+ locked for further update or delete operations. It does not affect actions
211
+ performed on child resources like aliases, bindings or keys. False by
212
+ default.
213
+ :param dict headers: A `dict` containing the request headers
214
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
215
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstance` object
216
+ """
217
+
218
+ if name is None:
219
+ raise ValueError('name must be provided')
220
+ if target is None:
221
+ raise ValueError('target must be provided')
222
+ if resource_group is None:
223
+ raise ValueError('resource_group must be provided')
224
+ if resource_plan_id is None:
225
+ raise ValueError('resource_plan_id must be provided')
226
+ headers = {
227
+ 'Entity-Lock': entity_lock,
228
+ }
229
+ sdk_headers = get_sdk_headers(
230
+ service_name=self.DEFAULT_SERVICE_NAME,
231
+ service_version='V2',
232
+ operation_id='create_resource_instance',
233
+ )
234
+ headers.update(sdk_headers)
235
+
236
+ data = {
237
+ 'name': name,
238
+ 'target': target,
239
+ 'resource_group': resource_group,
240
+ 'resource_plan_id': resource_plan_id,
241
+ 'tags': tags,
242
+ 'allow_cleanup': allow_cleanup,
243
+ 'parameters': parameters,
244
+ }
245
+ data = {k: v for (k, v) in data.items() if v is not None}
246
+ data = json.dumps(data)
247
+ headers['content-type'] = 'application/json'
248
+
249
+ if 'headers' in kwargs:
250
+ headers.update(kwargs.get('headers'))
251
+ del kwargs['headers']
252
+ headers['Accept'] = 'application/json'
253
+
254
+ url = '/v2/resource_instances'
255
+ request = self.prepare_request(
256
+ method='POST',
257
+ url=url,
258
+ headers=headers,
259
+ data=data,
260
+ )
261
+
262
+ response = self.send(request, **kwargs)
263
+ return response
264
+
265
+ def get_resource_instance(
266
+ self,
267
+ id: str,
268
+ **kwargs,
269
+ ) -> DetailedResponse:
270
+ """
271
+ Get a resource instance.
272
+
273
+ Retrieve a resource instance by URL-encoded CRN or GUID. Find more details on a
274
+ particular instance, like when it was provisioned and who provisioned it.
275
+
276
+ :param str id: The resource instance URL-encoded CRN or GUID.
277
+ :param dict headers: A `dict` containing the request headers
278
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
279
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstance` object
280
+ """
281
+
282
+ if not id:
283
+ raise ValueError('id must be provided')
284
+ headers = {}
285
+ sdk_headers = get_sdk_headers(
286
+ service_name=self.DEFAULT_SERVICE_NAME,
287
+ service_version='V2',
288
+ operation_id='get_resource_instance',
289
+ )
290
+ headers.update(sdk_headers)
291
+
292
+ if 'headers' in kwargs:
293
+ headers.update(kwargs.get('headers'))
294
+ del kwargs['headers']
295
+ headers['Accept'] = 'application/json'
296
+
297
+ path_param_keys = ['id']
298
+ path_param_values = self.encode_path_vars(id)
299
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
300
+ url = '/v2/resource_instances/{id}'.format(**path_param_dict)
301
+ request = self.prepare_request(
302
+ method='GET',
303
+ url=url,
304
+ headers=headers,
305
+ )
306
+
307
+ response = self.send(request, **kwargs)
308
+ return response
309
+
310
+ def delete_resource_instance(
311
+ self,
312
+ id: str,
313
+ *,
314
+ recursive: Optional[bool] = None,
315
+ **kwargs,
316
+ ) -> DetailedResponse:
317
+ """
318
+ Delete a resource instance.
319
+
320
+ Delete a resource instance by URL-encoded CRN or GUID. If the resource instance
321
+ has any resource keys or aliases associated with it, use the `recursive=true`
322
+ parameter to delete it.
323
+
324
+ :param str id: The resource instance URL-encoded CRN or GUID.
325
+ :param bool recursive: (optional) Will delete resource bindings, keys and
326
+ aliases associated with the instance.
327
+ :param dict headers: A `dict` containing the request headers
328
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
329
+ :rtype: DetailedResponse
330
+ """
331
+
332
+ if not id:
333
+ raise ValueError('id must be provided')
334
+ headers = {}
335
+ sdk_headers = get_sdk_headers(
336
+ service_name=self.DEFAULT_SERVICE_NAME,
337
+ service_version='V2',
338
+ operation_id='delete_resource_instance',
339
+ )
340
+ headers.update(sdk_headers)
341
+
342
+ params = {
343
+ 'recursive': recursive,
344
+ }
345
+
346
+ if 'headers' in kwargs:
347
+ headers.update(kwargs.get('headers'))
348
+ del kwargs['headers']
349
+
350
+ path_param_keys = ['id']
351
+ path_param_values = self.encode_path_vars(id)
352
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
353
+ url = '/v2/resource_instances/{id}'.format(**path_param_dict)
354
+ request = self.prepare_request(
355
+ method='DELETE',
356
+ url=url,
357
+ headers=headers,
358
+ params=params,
359
+ )
360
+
361
+ response = self.send(request, **kwargs)
362
+ return response
363
+
364
+ def update_resource_instance(
365
+ self,
366
+ id: str,
367
+ *,
368
+ name: Optional[str] = None,
369
+ parameters: Optional[dict] = None,
370
+ resource_plan_id: Optional[str] = None,
371
+ allow_cleanup: Optional[bool] = None,
372
+ **kwargs,
373
+ ) -> DetailedResponse:
374
+ """
375
+ Update a resource instance.
376
+
377
+ Use the resource instance URL-encoded CRN or GUID to make updates to the resource
378
+ instance, like changing the name or plan.
379
+
380
+ :param str id: The resource instance URL-encoded CRN or GUID.
381
+ :param str name: (optional) The new name of the instance. Must be 180
382
+ characters or less and cannot include any special characters other than
383
+ `(space) - . _ :`.
384
+ :param dict parameters: (optional) The new configuration options for the
385
+ instance. Set the `onetime_credentials` property to specify whether newly
386
+ created resource key credentials can be retrieved by using get resource key
387
+ or get a list of all of the resource keys requests.
388
+ :param str resource_plan_id: (optional) The unique ID of the plan
389
+ associated with the offering. This value is provided by and stored in the
390
+ global catalog.
391
+ :param bool allow_cleanup: (optional) A boolean that dictates if the
392
+ resource instance should be deleted (cleaned up) during the processing of a
393
+ region instance delete call.
394
+ :param dict headers: A `dict` containing the request headers
395
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
396
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstance` object
397
+ """
398
+
399
+ if not id:
400
+ raise ValueError('id must be provided')
401
+ headers = {}
402
+ sdk_headers = get_sdk_headers(
403
+ service_name=self.DEFAULT_SERVICE_NAME,
404
+ service_version='V2',
405
+ operation_id='update_resource_instance',
406
+ )
407
+ headers.update(sdk_headers)
408
+
409
+ data = {
410
+ 'name': name,
411
+ 'parameters': parameters,
412
+ 'resource_plan_id': resource_plan_id,
413
+ 'allow_cleanup': allow_cleanup,
414
+ }
415
+ data = {k: v for (k, v) in data.items() if v is not None}
416
+ data = json.dumps(data)
417
+ headers['content-type'] = 'application/json'
418
+
419
+ if 'headers' in kwargs:
420
+ headers.update(kwargs.get('headers'))
421
+ del kwargs['headers']
422
+ headers['Accept'] = 'application/json'
423
+
424
+ path_param_keys = ['id']
425
+ path_param_values = self.encode_path_vars(id)
426
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
427
+ url = '/v2/resource_instances/{id}'.format(**path_param_dict)
428
+ request = self.prepare_request(
429
+ method='PATCH',
430
+ url=url,
431
+ headers=headers,
432
+ data=data,
433
+ )
434
+
435
+ response = self.send(request, **kwargs)
436
+ return response
437
+
438
+ def list_resource_aliases_for_instance(
439
+ self,
440
+ id: str,
441
+ *,
442
+ limit: Optional[int] = None,
443
+ start: Optional[str] = None,
444
+ **kwargs,
445
+ ) -> DetailedResponse:
446
+ """
447
+ Get a list of all resource aliases for the instance.
448
+
449
+ Retrieving a list of all resource aliases can help you find out who's using the
450
+ resource instance.
451
+
452
+ :param str id: The resource instance URL-encoded CRN or GUID.
453
+ :param int limit: (optional) Limit on how many items should be returned.
454
+ :param str start: (optional) An optional token that indicates the beginning
455
+ of the page of results to be returned. Any additional query parameters are
456
+ ignored if a page token is present. If omitted, the first page of results
457
+ is returned. This value is obtained from the 'start' query parameter in the
458
+ 'next_url' field of the operation response.
459
+ :param dict headers: A `dict` containing the request headers
460
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
461
+ :rtype: DetailedResponse with `dict` result representing a `ResourceAliasesList` object
462
+ """
463
+
464
+ if not id:
465
+ raise ValueError('id must be provided')
466
+ headers = {}
467
+ sdk_headers = get_sdk_headers(
468
+ service_name=self.DEFAULT_SERVICE_NAME,
469
+ service_version='V2',
470
+ operation_id='list_resource_aliases_for_instance',
471
+ )
472
+ headers.update(sdk_headers)
473
+
474
+ params = {
475
+ 'limit': limit,
476
+ 'start': start,
477
+ }
478
+
479
+ if 'headers' in kwargs:
480
+ headers.update(kwargs.get('headers'))
481
+ del kwargs['headers']
482
+ headers['Accept'] = 'application/json'
483
+
484
+ path_param_keys = ['id']
485
+ path_param_values = self.encode_path_vars(id)
486
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
487
+ url = '/v2/resource_instances/{id}/resource_aliases'.format(**path_param_dict)
488
+ request = self.prepare_request(
489
+ method='GET',
490
+ url=url,
491
+ headers=headers,
492
+ params=params,
493
+ )
494
+
495
+ response = self.send(request, **kwargs)
496
+ return response
497
+
498
+ def list_resource_keys_for_instance(
499
+ self,
500
+ id: str,
501
+ *,
502
+ limit: Optional[int] = None,
503
+ start: Optional[str] = None,
504
+ **kwargs,
505
+ ) -> DetailedResponse:
506
+ """
507
+ Get a list of all the resource keys for the instance.
508
+
509
+ You may have many resource keys for one resource instance. For example, you may
510
+ have a different resource key for each user or each role.
511
+
512
+ :param str id: The resource instance URL-encoded CRN or GUID.
513
+ :param int limit: (optional) Limit on how many items should be returned.
514
+ :param str start: (optional) An optional token that indicates the beginning
515
+ of the page of results to be returned. Any additional query parameters are
516
+ ignored if a page token is present. If omitted, the first page of results
517
+ is returned. This value is obtained from the 'start' query parameter in the
518
+ 'next_url' field of the operation response.
519
+ :param dict headers: A `dict` containing the request headers
520
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
521
+ :rtype: DetailedResponse with `dict` result representing a `ResourceKeysList` object
522
+ """
523
+
524
+ if not id:
525
+ raise ValueError('id must be provided')
526
+ headers = {}
527
+ sdk_headers = get_sdk_headers(
528
+ service_name=self.DEFAULT_SERVICE_NAME,
529
+ service_version='V2',
530
+ operation_id='list_resource_keys_for_instance',
531
+ )
532
+ headers.update(sdk_headers)
533
+
534
+ params = {
535
+ 'limit': limit,
536
+ 'start': start,
537
+ }
538
+
539
+ if 'headers' in kwargs:
540
+ headers.update(kwargs.get('headers'))
541
+ del kwargs['headers']
542
+ headers['Accept'] = 'application/json'
543
+
544
+ path_param_keys = ['id']
545
+ path_param_values = self.encode_path_vars(id)
546
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
547
+ url = '/v2/resource_instances/{id}/resource_keys'.format(**path_param_dict)
548
+ request = self.prepare_request(
549
+ method='GET',
550
+ url=url,
551
+ headers=headers,
552
+ params=params,
553
+ )
554
+
555
+ response = self.send(request, **kwargs)
556
+ return response
557
+
558
+ def lock_resource_instance(
559
+ self,
560
+ id: str,
561
+ **kwargs,
562
+ ) -> DetailedResponse:
563
+ """
564
+ Lock a resource instance.
565
+
566
+ Locks a resource instance. A locked instance can not be updated or deleted. It
567
+ does not affect actions performed on child resources like aliases, bindings, or
568
+ keys.
569
+
570
+ :param str id: The resource instance URL-encoded CRN or GUID.
571
+ :param dict headers: A `dict` containing the request headers
572
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
573
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstance` object
574
+ """
575
+
576
+ if not id:
577
+ raise ValueError('id must be provided')
578
+ headers = {}
579
+ sdk_headers = get_sdk_headers(
580
+ service_name=self.DEFAULT_SERVICE_NAME,
581
+ service_version='V2',
582
+ operation_id='lock_resource_instance',
583
+ )
584
+ headers.update(sdk_headers)
585
+
586
+ if 'headers' in kwargs:
587
+ headers.update(kwargs.get('headers'))
588
+ del kwargs['headers']
589
+ headers['Accept'] = 'application/json'
590
+
591
+ path_param_keys = ['id']
592
+ path_param_values = self.encode_path_vars(id)
593
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
594
+ url = '/v2/resource_instances/{id}/lock'.format(**path_param_dict)
595
+ request = self.prepare_request(
596
+ method='POST',
597
+ url=url,
598
+ headers=headers,
599
+ )
600
+
601
+ response = self.send(request, **kwargs)
602
+ return response
603
+
604
+ def unlock_resource_instance(
605
+ self,
606
+ id: str,
607
+ **kwargs,
608
+ ) -> DetailedResponse:
609
+ """
610
+ Unlock a resource instance.
611
+
612
+ Unlock a resource instance to update or delete it. Unlocking a resource instance
613
+ does not affect child resources like aliases, bindings or keys.
614
+
615
+ :param str id: The resource instance URL-encoded CRN or GUID.
616
+ :param dict headers: A `dict` containing the request headers
617
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
618
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstance` object
619
+ """
620
+
621
+ if not id:
622
+ raise ValueError('id must be provided')
623
+ headers = {}
624
+ sdk_headers = get_sdk_headers(
625
+ service_name=self.DEFAULT_SERVICE_NAME,
626
+ service_version='V2',
627
+ operation_id='unlock_resource_instance',
628
+ )
629
+ headers.update(sdk_headers)
630
+
631
+ if 'headers' in kwargs:
632
+ headers.update(kwargs.get('headers'))
633
+ del kwargs['headers']
634
+ headers['Accept'] = 'application/json'
635
+
636
+ path_param_keys = ['id']
637
+ path_param_values = self.encode_path_vars(id)
638
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
639
+ url = '/v2/resource_instances/{id}/lock'.format(**path_param_dict)
640
+ request = self.prepare_request(
641
+ method='DELETE',
642
+ url=url,
643
+ headers=headers,
644
+ )
645
+
646
+ response = self.send(request, **kwargs)
647
+ return response
648
+
649
+ def cancel_lastop_resource_instance(
650
+ self,
651
+ id: str,
652
+ **kwargs,
653
+ ) -> DetailedResponse:
654
+ """
655
+ Cancel the in progress last operation of the resource instance.
656
+
657
+ Cancel the in progress last operation of the resource instance. After successful
658
+ cancellation, the resource instance is removed.
659
+
660
+ :param str id: The resource instance URL-encoded CRN or GUID.
661
+ :param dict headers: A `dict` containing the request headers
662
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
663
+ :rtype: DetailedResponse with `dict` result representing a `ResourceInstance` object
664
+ """
665
+
666
+ if not id:
667
+ raise ValueError('id must be provided')
668
+ headers = {}
669
+ sdk_headers = get_sdk_headers(
670
+ service_name=self.DEFAULT_SERVICE_NAME,
671
+ service_version='V2',
672
+ operation_id='cancel_lastop_resource_instance',
673
+ )
674
+ headers.update(sdk_headers)
675
+
676
+ if 'headers' in kwargs:
677
+ headers.update(kwargs.get('headers'))
678
+ del kwargs['headers']
679
+ headers['Accept'] = 'application/json'
680
+
681
+ path_param_keys = ['id']
682
+ path_param_values = self.encode_path_vars(id)
683
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
684
+ url = '/v2/resource_instances/{id}/last_operation'.format(**path_param_dict)
685
+ request = self.prepare_request(
686
+ method='DELETE',
687
+ url=url,
688
+ headers=headers,
689
+ )
690
+
691
+ response = self.send(request, **kwargs)
692
+ return response
693
+
694
+ #########################
695
+ # Resource Keys
696
+ #########################
697
+
698
+ def list_resource_keys(
699
+ self,
700
+ *,
701
+ guid: Optional[str] = None,
702
+ name: Optional[str] = None,
703
+ resource_group_id: Optional[str] = None,
704
+ resource_id: Optional[str] = None,
705
+ limit: Optional[int] = None,
706
+ start: Optional[str] = None,
707
+ updated_from: Optional[str] = None,
708
+ updated_to: Optional[str] = None,
709
+ **kwargs,
710
+ ) -> DetailedResponse:
711
+ """
712
+ Get a list of all of the resource keys.
713
+
714
+ View all of the resource keys that exist for all of your resource instances.
715
+
716
+ :param str guid: (optional) The GUID of the key.
717
+ :param str name: (optional) The human-readable name of the key.
718
+ :param str resource_group_id: (optional) The ID of the resource group.
719
+ :param str resource_id: (optional) The unique ID of the offering. This
720
+ value is provided by and stored in the global catalog.
721
+ :param int limit: (optional) Limit on how many items should be returned.
722
+ :param str start: (optional) An optional token that indicates the beginning
723
+ of the page of results to be returned. Any additional query parameters are
724
+ ignored if a page token is present. If omitted, the first page of results
725
+ is returned. This value is obtained from the 'start' query parameter in the
726
+ 'next_url' field of the operation response.
727
+ :param str updated_from: (optional) Start date inclusive filter.
728
+ :param str updated_to: (optional) End date inclusive filter.
729
+ :param dict headers: A `dict` containing the request headers
730
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
731
+ :rtype: DetailedResponse with `dict` result representing a `ResourceKeysList` object
732
+ """
733
+
734
+ headers = {}
735
+ sdk_headers = get_sdk_headers(
736
+ service_name=self.DEFAULT_SERVICE_NAME,
737
+ service_version='V2',
738
+ operation_id='list_resource_keys',
739
+ )
740
+ headers.update(sdk_headers)
741
+
742
+ params = {
743
+ 'guid': guid,
744
+ 'name': name,
745
+ 'resource_group_id': resource_group_id,
746
+ 'resource_id': resource_id,
747
+ 'limit': limit,
748
+ 'start': start,
749
+ 'updated_from': updated_from,
750
+ 'updated_to': updated_to,
751
+ }
752
+
753
+ if 'headers' in kwargs:
754
+ headers.update(kwargs.get('headers'))
755
+ del kwargs['headers']
756
+ headers['Accept'] = 'application/json'
757
+
758
+ url = '/v2/resource_keys'
759
+ request = self.prepare_request(
760
+ method='GET',
761
+ url=url,
762
+ headers=headers,
763
+ params=params,
764
+ )
765
+
766
+ response = self.send(request, **kwargs)
767
+ return response
768
+
769
+ def create_resource_key(
770
+ self,
771
+ name: str,
772
+ source: str,
773
+ *,
774
+ parameters: Optional['ResourceKeyPostParameters'] = None,
775
+ role: Optional[str] = None,
776
+ **kwargs,
777
+ ) -> DetailedResponse:
778
+ """
779
+ Create a new resource key.
780
+
781
+ A resource key is a saved credential you can use to authenticate with a resource
782
+ instance.
783
+
784
+ :param str name: The name of the key.
785
+ :param str source: The ID of resource instance or alias.
786
+ :param ResourceKeyPostParameters parameters: (optional) Configuration
787
+ options represented as key-value pairs. Service defined options are passed
788
+ through to the target resource brokers, whereas platform defined options
789
+ are not.
790
+ :param str role: (optional) The base IAM service role name (Reader, Writer,
791
+ or Manager), or the service or custom role CRN. Refer to service’s
792
+ documentation for supported roles.
793
+ :param dict headers: A `dict` containing the request headers
794
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
795
+ :rtype: DetailedResponse with `dict` result representing a `ResourceKey` object
796
+ """
797
+
798
+ if name is None:
799
+ raise ValueError('name must be provided')
800
+ if source is None:
801
+ raise ValueError('source must be provided')
802
+ if parameters is not None:
803
+ parameters = convert_model(parameters)
804
+ headers = {}
805
+ sdk_headers = get_sdk_headers(
806
+ service_name=self.DEFAULT_SERVICE_NAME,
807
+ service_version='V2',
808
+ operation_id='create_resource_key',
809
+ )
810
+ headers.update(sdk_headers)
811
+
812
+ data = {
813
+ 'name': name,
814
+ 'source': source,
815
+ 'parameters': parameters,
816
+ 'role': role,
817
+ }
818
+ data = {k: v for (k, v) in data.items() if v is not None}
819
+ data = json.dumps(data)
820
+ headers['content-type'] = 'application/json'
821
+
822
+ if 'headers' in kwargs:
823
+ headers.update(kwargs.get('headers'))
824
+ del kwargs['headers']
825
+ headers['Accept'] = 'application/json'
826
+
827
+ url = '/v2/resource_keys'
828
+ request = self.prepare_request(
829
+ method='POST',
830
+ url=url,
831
+ headers=headers,
832
+ data=data,
833
+ )
834
+
835
+ response = self.send(request, **kwargs)
836
+ return response
837
+
838
+ def get_resource_key(
839
+ self,
840
+ id: str,
841
+ **kwargs,
842
+ ) -> DetailedResponse:
843
+ """
844
+ Get resource key.
845
+
846
+ View the details of a resource key by URL-encoded CRN or GUID, like the
847
+ credentials for the key and who created it.
848
+
849
+ :param str id: The resource key URL-encoded CRN or GUID.
850
+ :param dict headers: A `dict` containing the request headers
851
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
852
+ :rtype: DetailedResponse with `dict` result representing a `ResourceKey` object
853
+ """
854
+
855
+ if not id:
856
+ raise ValueError('id must be provided')
857
+ headers = {}
858
+ sdk_headers = get_sdk_headers(
859
+ service_name=self.DEFAULT_SERVICE_NAME,
860
+ service_version='V2',
861
+ operation_id='get_resource_key',
862
+ )
863
+ headers.update(sdk_headers)
864
+
865
+ if 'headers' in kwargs:
866
+ headers.update(kwargs.get('headers'))
867
+ del kwargs['headers']
868
+ headers['Accept'] = 'application/json'
869
+
870
+ path_param_keys = ['id']
871
+ path_param_values = self.encode_path_vars(id)
872
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
873
+ url = '/v2/resource_keys/{id}'.format(**path_param_dict)
874
+ request = self.prepare_request(
875
+ method='GET',
876
+ url=url,
877
+ headers=headers,
878
+ )
879
+
880
+ response = self.send(request, **kwargs)
881
+ return response
882
+
883
+ def delete_resource_key(
884
+ self,
885
+ id: str,
886
+ **kwargs,
887
+ ) -> DetailedResponse:
888
+ """
889
+ Delete a resource key.
890
+
891
+ Deleting a resource key does not affect any resource instance or resource alias
892
+ associated with the key.
893
+
894
+ :param str id: The resource key URL-encoded CRN or GUID.
895
+ :param dict headers: A `dict` containing the request headers
896
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
897
+ :rtype: DetailedResponse
898
+ """
899
+
900
+ if not id:
901
+ raise ValueError('id must be provided')
902
+ headers = {}
903
+ sdk_headers = get_sdk_headers(
904
+ service_name=self.DEFAULT_SERVICE_NAME,
905
+ service_version='V2',
906
+ operation_id='delete_resource_key',
907
+ )
908
+ headers.update(sdk_headers)
909
+
910
+ if 'headers' in kwargs:
911
+ headers.update(kwargs.get('headers'))
912
+ del kwargs['headers']
913
+
914
+ path_param_keys = ['id']
915
+ path_param_values = self.encode_path_vars(id)
916
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
917
+ url = '/v2/resource_keys/{id}'.format(**path_param_dict)
918
+ request = self.prepare_request(
919
+ method='DELETE',
920
+ url=url,
921
+ headers=headers,
922
+ )
923
+
924
+ response = self.send(request, **kwargs)
925
+ return response
926
+
927
+ def update_resource_key(
928
+ self,
929
+ id: str,
930
+ name: str,
931
+ **kwargs,
932
+ ) -> DetailedResponse:
933
+ """
934
+ Update a resource key.
935
+
936
+ Use the resource key URL-encoded CRN or GUID to update the resource key.
937
+
938
+ :param str id: The resource key URL-encoded CRN or GUID.
939
+ :param str name: The new name of the key. Must be 180 characters or less
940
+ and cannot include any special characters other than `(space) - . _ :`.
941
+ :param dict headers: A `dict` containing the request headers
942
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
943
+ :rtype: DetailedResponse with `dict` result representing a `ResourceKey` object
944
+ """
945
+
946
+ if not id:
947
+ raise ValueError('id must be provided')
948
+ if name is None:
949
+ raise ValueError('name must be provided')
950
+ headers = {}
951
+ sdk_headers = get_sdk_headers(
952
+ service_name=self.DEFAULT_SERVICE_NAME,
953
+ service_version='V2',
954
+ operation_id='update_resource_key',
955
+ )
956
+ headers.update(sdk_headers)
957
+
958
+ data = {
959
+ 'name': name,
960
+ }
961
+ data = {k: v for (k, v) in data.items() if v is not None}
962
+ data = json.dumps(data)
963
+ headers['content-type'] = 'application/json'
964
+
965
+ if 'headers' in kwargs:
966
+ headers.update(kwargs.get('headers'))
967
+ del kwargs['headers']
968
+ headers['Accept'] = 'application/json'
969
+
970
+ path_param_keys = ['id']
971
+ path_param_values = self.encode_path_vars(id)
972
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
973
+ url = '/v2/resource_keys/{id}'.format(**path_param_dict)
974
+ request = self.prepare_request(
975
+ method='PATCH',
976
+ url=url,
977
+ headers=headers,
978
+ data=data,
979
+ )
980
+
981
+ response = self.send(request, **kwargs)
982
+ return response
983
+
984
+ #########################
985
+ # Resource Bindings
986
+ #########################
987
+
988
+ def list_resource_bindings(
989
+ self,
990
+ *,
991
+ guid: Optional[str] = None,
992
+ name: Optional[str] = None,
993
+ resource_group_id: Optional[str] = None,
994
+ resource_id: Optional[str] = None,
995
+ region_binding_id: Optional[str] = None,
996
+ limit: Optional[int] = None,
997
+ start: Optional[str] = None,
998
+ updated_from: Optional[str] = None,
999
+ updated_to: Optional[str] = None,
1000
+ **kwargs,
1001
+ ) -> DetailedResponse:
1002
+ """
1003
+ Get a list of all resource bindings.
1004
+
1005
+ View all of the resource bindings that exist for all of your resource aliases.
1006
+
1007
+ :param str guid: (optional) The GUID of the binding.
1008
+ :param str name: (optional) The human-readable name of the binding.
1009
+ :param str resource_group_id: (optional) The ID of the resource group.
1010
+ :param str resource_id: (optional) The unique ID of the offering (service
1011
+ name). This value is provided by and stored in the global catalog.
1012
+ :param str region_binding_id: (optional) The ID of the binding in the
1013
+ target environment. For example, `service_binding_id` in a given IBM Cloud
1014
+ environment.
1015
+ :param int limit: (optional) Limit on how many items should be returned.
1016
+ :param str start: (optional) An optional token that indicates the beginning
1017
+ of the page of results to be returned. Any additional query parameters are
1018
+ ignored if a page token is present. If omitted, the first page of results
1019
+ is returned. This value is obtained from the 'start' query parameter in the
1020
+ 'next_url' field of the operation response.
1021
+ :param str updated_from: (optional) Start date inclusive filter.
1022
+ :param str updated_to: (optional) End date inclusive filter.
1023
+ :param dict headers: A `dict` containing the request headers
1024
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1025
+ :rtype: DetailedResponse with `dict` result representing a `ResourceBindingsList` object
1026
+ """
1027
+
1028
+ headers = {}
1029
+ sdk_headers = get_sdk_headers(
1030
+ service_name=self.DEFAULT_SERVICE_NAME,
1031
+ service_version='V2',
1032
+ operation_id='list_resource_bindings',
1033
+ )
1034
+ headers.update(sdk_headers)
1035
+
1036
+ params = {
1037
+ 'guid': guid,
1038
+ 'name': name,
1039
+ 'resource_group_id': resource_group_id,
1040
+ 'resource_id': resource_id,
1041
+ 'region_binding_id': region_binding_id,
1042
+ 'limit': limit,
1043
+ 'start': start,
1044
+ 'updated_from': updated_from,
1045
+ 'updated_to': updated_to,
1046
+ }
1047
+
1048
+ if 'headers' in kwargs:
1049
+ headers.update(kwargs.get('headers'))
1050
+ del kwargs['headers']
1051
+ headers['Accept'] = 'application/json'
1052
+
1053
+ url = '/v2/resource_bindings'
1054
+ request = self.prepare_request(
1055
+ method='GET',
1056
+ url=url,
1057
+ headers=headers,
1058
+ params=params,
1059
+ )
1060
+
1061
+ response = self.send(request, **kwargs)
1062
+ return response
1063
+
1064
+ def create_resource_binding(
1065
+ self,
1066
+ source: str,
1067
+ target: str,
1068
+ *,
1069
+ name: Optional[str] = None,
1070
+ parameters: Optional['ResourceBindingPostParameters'] = None,
1071
+ role: Optional[str] = None,
1072
+ **kwargs,
1073
+ ) -> DetailedResponse:
1074
+ """
1075
+ Create a new resource binding.
1076
+
1077
+ A resource binding connects credentials to a resource alias. The credentials are
1078
+ in the form of a resource key.
1079
+
1080
+ :param str source: The ID of resource alias.
1081
+ :param str target: The CRN of application to bind to in a specific
1082
+ environment, for example, Dallas YP, CFEE instance.
1083
+ :param str name: (optional) The name of the binding. Must be 180 characters
1084
+ or less and cannot include any special characters other than `(space) - . _
1085
+ :`.
1086
+ :param ResourceBindingPostParameters parameters: (optional) Configuration
1087
+ options represented as key-value pairs. Service defined options are passed
1088
+ through to the target resource brokers, whereas platform defined options
1089
+ are not.
1090
+ :param str role: (optional) The base IAM service role name (Reader, Writer,
1091
+ or Manager), or the service or custom role CRN. Refer to service’s
1092
+ documentation for supported roles.
1093
+ :param dict headers: A `dict` containing the request headers
1094
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1095
+ :rtype: DetailedResponse with `dict` result representing a `ResourceBinding` object
1096
+ """
1097
+
1098
+ if source is None:
1099
+ raise ValueError('source must be provided')
1100
+ if target is None:
1101
+ raise ValueError('target must be provided')
1102
+ if parameters is not None:
1103
+ parameters = convert_model(parameters)
1104
+ headers = {}
1105
+ sdk_headers = get_sdk_headers(
1106
+ service_name=self.DEFAULT_SERVICE_NAME,
1107
+ service_version='V2',
1108
+ operation_id='create_resource_binding',
1109
+ )
1110
+ headers.update(sdk_headers)
1111
+
1112
+ data = {
1113
+ 'source': source,
1114
+ 'target': target,
1115
+ 'name': name,
1116
+ 'parameters': parameters,
1117
+ 'role': role,
1118
+ }
1119
+ data = {k: v for (k, v) in data.items() if v is not None}
1120
+ data = json.dumps(data)
1121
+ headers['content-type'] = 'application/json'
1122
+
1123
+ if 'headers' in kwargs:
1124
+ headers.update(kwargs.get('headers'))
1125
+ del kwargs['headers']
1126
+ headers['Accept'] = 'application/json'
1127
+
1128
+ url = '/v2/resource_bindings'
1129
+ request = self.prepare_request(
1130
+ method='POST',
1131
+ url=url,
1132
+ headers=headers,
1133
+ data=data,
1134
+ )
1135
+
1136
+ response = self.send(request, **kwargs)
1137
+ return response
1138
+
1139
+ def get_resource_binding(
1140
+ self,
1141
+ id: str,
1142
+ **kwargs,
1143
+ ) -> DetailedResponse:
1144
+ """
1145
+ Get a resource binding.
1146
+
1147
+ View a resource binding and all of its details, like who created it, the
1148
+ credential, and the resource alias that the binding is associated with.
1149
+
1150
+ :param str id: The resource binding URL-encoded CRN or GUID.
1151
+ :param dict headers: A `dict` containing the request headers
1152
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1153
+ :rtype: DetailedResponse with `dict` result representing a `ResourceBinding` object
1154
+ """
1155
+
1156
+ if not id:
1157
+ raise ValueError('id must be provided')
1158
+ headers = {}
1159
+ sdk_headers = get_sdk_headers(
1160
+ service_name=self.DEFAULT_SERVICE_NAME,
1161
+ service_version='V2',
1162
+ operation_id='get_resource_binding',
1163
+ )
1164
+ headers.update(sdk_headers)
1165
+
1166
+ if 'headers' in kwargs:
1167
+ headers.update(kwargs.get('headers'))
1168
+ del kwargs['headers']
1169
+ headers['Accept'] = 'application/json'
1170
+
1171
+ path_param_keys = ['id']
1172
+ path_param_values = self.encode_path_vars(id)
1173
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1174
+ url = '/v2/resource_bindings/{id}'.format(**path_param_dict)
1175
+ request = self.prepare_request(
1176
+ method='GET',
1177
+ url=url,
1178
+ headers=headers,
1179
+ )
1180
+
1181
+ response = self.send(request, **kwargs)
1182
+ return response
1183
+
1184
+ def delete_resource_binding(
1185
+ self,
1186
+ id: str,
1187
+ **kwargs,
1188
+ ) -> DetailedResponse:
1189
+ """
1190
+ Delete a resource binding.
1191
+
1192
+ Deleting a resource binding does not affect the resource alias that the binding is
1193
+ associated with.
1194
+
1195
+ :param str id: The resource binding URL-encoded CRN or GUID.
1196
+ :param dict headers: A `dict` containing the request headers
1197
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1198
+ :rtype: DetailedResponse
1199
+ """
1200
+
1201
+ if not id:
1202
+ raise ValueError('id must be provided')
1203
+ headers = {}
1204
+ sdk_headers = get_sdk_headers(
1205
+ service_name=self.DEFAULT_SERVICE_NAME,
1206
+ service_version='V2',
1207
+ operation_id='delete_resource_binding',
1208
+ )
1209
+ headers.update(sdk_headers)
1210
+
1211
+ if 'headers' in kwargs:
1212
+ headers.update(kwargs.get('headers'))
1213
+ del kwargs['headers']
1214
+
1215
+ path_param_keys = ['id']
1216
+ path_param_values = self.encode_path_vars(id)
1217
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1218
+ url = '/v2/resource_bindings/{id}'.format(**path_param_dict)
1219
+ request = self.prepare_request(
1220
+ method='DELETE',
1221
+ url=url,
1222
+ headers=headers,
1223
+ )
1224
+
1225
+ response = self.send(request, **kwargs)
1226
+ return response
1227
+
1228
+ def update_resource_binding(
1229
+ self,
1230
+ id: str,
1231
+ name: str,
1232
+ **kwargs,
1233
+ ) -> DetailedResponse:
1234
+ """
1235
+ Update a resource binding.
1236
+
1237
+ Use the resource binding URL-encoded CRN or GUID to update the resource binding.
1238
+
1239
+ :param str id: The resource binding URL-encoded CRN or GUID.
1240
+ :param str name: The new name of the binding. Must be 180 characters or
1241
+ less and cannot include any special characters other than `(space) - . _
1242
+ :`.
1243
+ :param dict headers: A `dict` containing the request headers
1244
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1245
+ :rtype: DetailedResponse with `dict` result representing a `ResourceBinding` object
1246
+ """
1247
+
1248
+ if not id:
1249
+ raise ValueError('id must be provided')
1250
+ if name is None:
1251
+ raise ValueError('name must be provided')
1252
+ headers = {}
1253
+ sdk_headers = get_sdk_headers(
1254
+ service_name=self.DEFAULT_SERVICE_NAME,
1255
+ service_version='V2',
1256
+ operation_id='update_resource_binding',
1257
+ )
1258
+ headers.update(sdk_headers)
1259
+
1260
+ data = {
1261
+ 'name': name,
1262
+ }
1263
+ data = {k: v for (k, v) in data.items() if v is not None}
1264
+ data = json.dumps(data)
1265
+ headers['content-type'] = 'application/json'
1266
+
1267
+ if 'headers' in kwargs:
1268
+ headers.update(kwargs.get('headers'))
1269
+ del kwargs['headers']
1270
+ headers['Accept'] = 'application/json'
1271
+
1272
+ path_param_keys = ['id']
1273
+ path_param_values = self.encode_path_vars(id)
1274
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1275
+ url = '/v2/resource_bindings/{id}'.format(**path_param_dict)
1276
+ request = self.prepare_request(
1277
+ method='PATCH',
1278
+ url=url,
1279
+ headers=headers,
1280
+ data=data,
1281
+ )
1282
+
1283
+ response = self.send(request, **kwargs)
1284
+ return response
1285
+
1286
+ #########################
1287
+ # Resource Aliases
1288
+ #########################
1289
+
1290
+ def list_resource_aliases(
1291
+ self,
1292
+ *,
1293
+ guid: Optional[str] = None,
1294
+ name: Optional[str] = None,
1295
+ resource_instance_id: Optional[str] = None,
1296
+ region_instance_id: Optional[str] = None,
1297
+ resource_id: Optional[str] = None,
1298
+ resource_group_id: Optional[str] = None,
1299
+ limit: Optional[int] = None,
1300
+ start: Optional[str] = None,
1301
+ updated_from: Optional[str] = None,
1302
+ updated_to: Optional[str] = None,
1303
+ **kwargs,
1304
+ ) -> DetailedResponse:
1305
+ """
1306
+ Get a list of all resource aliases.
1307
+
1308
+ View all of the resource aliases that exist for every resource instance.
1309
+
1310
+ :param str guid: (optional) The GUID of the alias.
1311
+ :param str name: (optional) The human-readable name of the alias.
1312
+ :param str resource_instance_id: (optional) The ID of the resource
1313
+ instance.
1314
+ :param str region_instance_id: (optional) The ID of the instance in the
1315
+ target environment. For example, `service_instance_id` in a given IBM Cloud
1316
+ environment.
1317
+ :param str resource_id: (optional) The unique ID of the offering (service
1318
+ name). This value is provided by and stored in the global catalog.
1319
+ :param str resource_group_id: (optional) The ID of the resource group.
1320
+ :param int limit: (optional) Limit on how many items should be returned.
1321
+ :param str start: (optional) An optional token that indicates the beginning
1322
+ of the page of results to be returned. Any additional query parameters are
1323
+ ignored if a page token is present. If omitted, the first page of results
1324
+ is returned. This value is obtained from the 'start' query parameter in the
1325
+ 'next_url' field of the operation response.
1326
+ :param str updated_from: (optional) Start date inclusive filter.
1327
+ :param str updated_to: (optional) End date inclusive filter.
1328
+ :param dict headers: A `dict` containing the request headers
1329
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1330
+ :rtype: DetailedResponse with `dict` result representing a `ResourceAliasesList` object
1331
+ """
1332
+
1333
+ headers = {}
1334
+ sdk_headers = get_sdk_headers(
1335
+ service_name=self.DEFAULT_SERVICE_NAME,
1336
+ service_version='V2',
1337
+ operation_id='list_resource_aliases',
1338
+ )
1339
+ headers.update(sdk_headers)
1340
+
1341
+ params = {
1342
+ 'guid': guid,
1343
+ 'name': name,
1344
+ 'resource_instance_id': resource_instance_id,
1345
+ 'region_instance_id': region_instance_id,
1346
+ 'resource_id': resource_id,
1347
+ 'resource_group_id': resource_group_id,
1348
+ 'limit': limit,
1349
+ 'start': start,
1350
+ 'updated_from': updated_from,
1351
+ 'updated_to': updated_to,
1352
+ }
1353
+
1354
+ if 'headers' in kwargs:
1355
+ headers.update(kwargs.get('headers'))
1356
+ del kwargs['headers']
1357
+ headers['Accept'] = 'application/json'
1358
+
1359
+ url = '/v2/resource_aliases'
1360
+ request = self.prepare_request(
1361
+ method='GET',
1362
+ url=url,
1363
+ headers=headers,
1364
+ params=params,
1365
+ )
1366
+
1367
+ response = self.send(request, **kwargs)
1368
+ return response
1369
+
1370
+ def create_resource_alias(
1371
+ self,
1372
+ name: str,
1373
+ source: str,
1374
+ target: str,
1375
+ **kwargs,
1376
+ ) -> DetailedResponse:
1377
+ """
1378
+ Create a new resource alias.
1379
+
1380
+ Alias a resource instance into a targeted environment's (name)space.
1381
+
1382
+ :param str name: The name of the alias. Must be 180 characters or less and
1383
+ cannot include any special characters other than `(space) - . _ :`.
1384
+ :param str source: The ID of resource instance.
1385
+ :param str target: The CRN of target name(space) in a specific environment,
1386
+ for example, space in Dallas YP, CFEE instance etc.
1387
+ :param dict headers: A `dict` containing the request headers
1388
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1389
+ :rtype: DetailedResponse with `dict` result representing a `ResourceAlias` object
1390
+ """
1391
+
1392
+ if name is None:
1393
+ raise ValueError('name must be provided')
1394
+ if source is None:
1395
+ raise ValueError('source must be provided')
1396
+ if target is None:
1397
+ raise ValueError('target must be provided')
1398
+ headers = {}
1399
+ sdk_headers = get_sdk_headers(
1400
+ service_name=self.DEFAULT_SERVICE_NAME,
1401
+ service_version='V2',
1402
+ operation_id='create_resource_alias',
1403
+ )
1404
+ headers.update(sdk_headers)
1405
+
1406
+ data = {
1407
+ 'name': name,
1408
+ 'source': source,
1409
+ 'target': target,
1410
+ }
1411
+ data = {k: v for (k, v) in data.items() if v is not None}
1412
+ data = json.dumps(data)
1413
+ headers['content-type'] = 'application/json'
1414
+
1415
+ if 'headers' in kwargs:
1416
+ headers.update(kwargs.get('headers'))
1417
+ del kwargs['headers']
1418
+ headers['Accept'] = 'application/json'
1419
+
1420
+ url = '/v2/resource_aliases'
1421
+ request = self.prepare_request(
1422
+ method='POST',
1423
+ url=url,
1424
+ headers=headers,
1425
+ data=data,
1426
+ )
1427
+
1428
+ response = self.send(request, **kwargs)
1429
+ return response
1430
+
1431
+ def get_resource_alias(
1432
+ self,
1433
+ id: str,
1434
+ **kwargs,
1435
+ ) -> DetailedResponse:
1436
+ """
1437
+ Get a resource alias.
1438
+
1439
+ View a resource alias and all of its details, like who created it and the resource
1440
+ instance that it's associated with.
1441
+
1442
+ :param str id: The resource alias URL-encoded CRN or GUID.
1443
+ :param dict headers: A `dict` containing the request headers
1444
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1445
+ :rtype: DetailedResponse with `dict` result representing a `ResourceAlias` object
1446
+ """
1447
+
1448
+ if not id:
1449
+ raise ValueError('id must be provided')
1450
+ headers = {}
1451
+ sdk_headers = get_sdk_headers(
1452
+ service_name=self.DEFAULT_SERVICE_NAME,
1453
+ service_version='V2',
1454
+ operation_id='get_resource_alias',
1455
+ )
1456
+ headers.update(sdk_headers)
1457
+
1458
+ if 'headers' in kwargs:
1459
+ headers.update(kwargs.get('headers'))
1460
+ del kwargs['headers']
1461
+ headers['Accept'] = 'application/json'
1462
+
1463
+ path_param_keys = ['id']
1464
+ path_param_values = self.encode_path_vars(id)
1465
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1466
+ url = '/v2/resource_aliases/{id}'.format(**path_param_dict)
1467
+ request = self.prepare_request(
1468
+ method='GET',
1469
+ url=url,
1470
+ headers=headers,
1471
+ )
1472
+
1473
+ response = self.send(request, **kwargs)
1474
+ return response
1475
+
1476
+ def delete_resource_alias(
1477
+ self,
1478
+ id: str,
1479
+ *,
1480
+ recursive: Optional[bool] = None,
1481
+ **kwargs,
1482
+ ) -> DetailedResponse:
1483
+ """
1484
+ Delete a resource alias.
1485
+
1486
+ Delete a resource alias by URL-encoded CRN or GUID. If the resource alias has any
1487
+ resource keys or bindings associated with it, use the `recursive=true` parameter
1488
+ to delete it.
1489
+
1490
+ :param str id: The resource alias URL-encoded CRN or GUID.
1491
+ :param bool recursive: (optional) Deletes the resource bindings and keys
1492
+ associated with the alias.
1493
+ :param dict headers: A `dict` containing the request headers
1494
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1495
+ :rtype: DetailedResponse
1496
+ """
1497
+
1498
+ if not id:
1499
+ raise ValueError('id must be provided')
1500
+ headers = {}
1501
+ sdk_headers = get_sdk_headers(
1502
+ service_name=self.DEFAULT_SERVICE_NAME,
1503
+ service_version='V2',
1504
+ operation_id='delete_resource_alias',
1505
+ )
1506
+ headers.update(sdk_headers)
1507
+
1508
+ params = {
1509
+ 'recursive': recursive,
1510
+ }
1511
+
1512
+ if 'headers' in kwargs:
1513
+ headers.update(kwargs.get('headers'))
1514
+ del kwargs['headers']
1515
+
1516
+ path_param_keys = ['id']
1517
+ path_param_values = self.encode_path_vars(id)
1518
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1519
+ url = '/v2/resource_aliases/{id}'.format(**path_param_dict)
1520
+ request = self.prepare_request(
1521
+ method='DELETE',
1522
+ url=url,
1523
+ headers=headers,
1524
+ params=params,
1525
+ )
1526
+
1527
+ response = self.send(request, **kwargs)
1528
+ return response
1529
+
1530
+ def update_resource_alias(
1531
+ self,
1532
+ id: str,
1533
+ name: str,
1534
+ **kwargs,
1535
+ ) -> DetailedResponse:
1536
+ """
1537
+ Update a resource alias.
1538
+
1539
+ Use the resource alias URL-encoded CRN or GUID to update the resource alias.
1540
+
1541
+ :param str id: The resource alias URL-encoded CRN or GUID.
1542
+ :param str name: The new name of the alias. Must be 180 characters or less
1543
+ and cannot include any special characters other than `(space) - . _ :`.
1544
+ :param dict headers: A `dict` containing the request headers
1545
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1546
+ :rtype: DetailedResponse with `dict` result representing a `ResourceAlias` object
1547
+ """
1548
+
1549
+ if not id:
1550
+ raise ValueError('id must be provided')
1551
+ if name is None:
1552
+ raise ValueError('name must be provided')
1553
+ headers = {}
1554
+ sdk_headers = get_sdk_headers(
1555
+ service_name=self.DEFAULT_SERVICE_NAME,
1556
+ service_version='V2',
1557
+ operation_id='update_resource_alias',
1558
+ )
1559
+ headers.update(sdk_headers)
1560
+
1561
+ data = {
1562
+ 'name': name,
1563
+ }
1564
+ data = {k: v for (k, v) in data.items() if v is not None}
1565
+ data = json.dumps(data)
1566
+ headers['content-type'] = 'application/json'
1567
+
1568
+ if 'headers' in kwargs:
1569
+ headers.update(kwargs.get('headers'))
1570
+ del kwargs['headers']
1571
+ headers['Accept'] = 'application/json'
1572
+
1573
+ path_param_keys = ['id']
1574
+ path_param_values = self.encode_path_vars(id)
1575
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1576
+ url = '/v2/resource_aliases/{id}'.format(**path_param_dict)
1577
+ request = self.prepare_request(
1578
+ method='PATCH',
1579
+ url=url,
1580
+ headers=headers,
1581
+ data=data,
1582
+ )
1583
+
1584
+ response = self.send(request, **kwargs)
1585
+ return response
1586
+
1587
+ def list_resource_bindings_for_alias(
1588
+ self,
1589
+ id: str,
1590
+ *,
1591
+ limit: Optional[int] = None,
1592
+ start: Optional[str] = None,
1593
+ **kwargs,
1594
+ ) -> DetailedResponse:
1595
+ """
1596
+ Get a list of all resource bindings for the alias.
1597
+
1598
+ View all of the resource bindings associated with a specific resource alias.
1599
+
1600
+ :param str id: The resource alias URL-encoded CRN or GUID.
1601
+ :param int limit: (optional) Limit on how many items should be returned.
1602
+ :param str start: (optional) An optional token that indicates the beginning
1603
+ of the page of results to be returned. Any additional query parameters are
1604
+ ignored if a page token is present. If omitted, the first page of results
1605
+ is returned. This value is obtained from the 'start' query parameter in the
1606
+ 'next_url' field of the operation response.
1607
+ :param dict headers: A `dict` containing the request headers
1608
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1609
+ :rtype: DetailedResponse with `dict` result representing a `ResourceBindingsList` object
1610
+ """
1611
+
1612
+ if not id:
1613
+ raise ValueError('id must be provided')
1614
+ headers = {}
1615
+ sdk_headers = get_sdk_headers(
1616
+ service_name=self.DEFAULT_SERVICE_NAME,
1617
+ service_version='V2',
1618
+ operation_id='list_resource_bindings_for_alias',
1619
+ )
1620
+ headers.update(sdk_headers)
1621
+
1622
+ params = {
1623
+ 'limit': limit,
1624
+ 'start': start,
1625
+ }
1626
+
1627
+ if 'headers' in kwargs:
1628
+ headers.update(kwargs.get('headers'))
1629
+ del kwargs['headers']
1630
+ headers['Accept'] = 'application/json'
1631
+
1632
+ path_param_keys = ['id']
1633
+ path_param_values = self.encode_path_vars(id)
1634
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1635
+ url = '/v2/resource_aliases/{id}/resource_bindings'.format(**path_param_dict)
1636
+ request = self.prepare_request(
1637
+ method='GET',
1638
+ url=url,
1639
+ headers=headers,
1640
+ params=params,
1641
+ )
1642
+
1643
+ response = self.send(request, **kwargs)
1644
+ return response
1645
+
1646
+ #########################
1647
+ # Resource Reclamations
1648
+ #########################
1649
+
1650
+ def list_reclamations(
1651
+ self,
1652
+ *,
1653
+ account_id: Optional[str] = None,
1654
+ resource_instance_id: Optional[str] = None,
1655
+ resource_group_id: Optional[str] = None,
1656
+ **kwargs,
1657
+ ) -> DetailedResponse:
1658
+ """
1659
+ Get a list of all reclamations.
1660
+
1661
+ View all of the resource reclamations that exist for every resource instance.
1662
+
1663
+ :param str account_id: (optional) An alpha-numeric value identifying the
1664
+ account ID.
1665
+ :param str resource_instance_id: (optional) The GUID of the resource
1666
+ instance.
1667
+ :param str resource_group_id: (optional) The ID of the resource group.
1668
+ :param dict headers: A `dict` containing the request headers
1669
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1670
+ :rtype: DetailedResponse with `dict` result representing a `ReclamationsList` object
1671
+ """
1672
+
1673
+ headers = {}
1674
+ sdk_headers = get_sdk_headers(
1675
+ service_name=self.DEFAULT_SERVICE_NAME,
1676
+ service_version='V2',
1677
+ operation_id='list_reclamations',
1678
+ )
1679
+ headers.update(sdk_headers)
1680
+
1681
+ params = {
1682
+ 'account_id': account_id,
1683
+ 'resource_instance_id': resource_instance_id,
1684
+ 'resource_group_id': resource_group_id,
1685
+ }
1686
+
1687
+ if 'headers' in kwargs:
1688
+ headers.update(kwargs.get('headers'))
1689
+ del kwargs['headers']
1690
+ headers['Accept'] = 'application/json'
1691
+
1692
+ url = '/v1/reclamations'
1693
+ request = self.prepare_request(
1694
+ method='GET',
1695
+ url=url,
1696
+ headers=headers,
1697
+ params=params,
1698
+ )
1699
+
1700
+ response = self.send(request, **kwargs)
1701
+ return response
1702
+
1703
+ def run_reclamation_action(
1704
+ self,
1705
+ id: str,
1706
+ action_name: str,
1707
+ *,
1708
+ request_by: Optional[str] = None,
1709
+ comment: Optional[str] = None,
1710
+ **kwargs,
1711
+ ) -> DetailedResponse:
1712
+ """
1713
+ Perform a reclamation action.
1714
+
1715
+ Reclaim a resource instance so that it can no longer be used, or restore the
1716
+ resource instance so that it's usable again.
1717
+
1718
+ :param str id: The ID associated with the reclamation.
1719
+ :param str action_name: The reclamation action name. Specify `reclaim` to
1720
+ delete a resource, or `restore` to restore a resource.
1721
+ :param str request_by: (optional) The request initiator, if different from
1722
+ the request token.
1723
+ :param str comment: (optional) A comment to describe the action.
1724
+ :param dict headers: A `dict` containing the request headers
1725
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
1726
+ :rtype: DetailedResponse with `dict` result representing a `Reclamation` object
1727
+ """
1728
+
1729
+ if not id:
1730
+ raise ValueError('id must be provided')
1731
+ if not action_name:
1732
+ raise ValueError('action_name must be provided')
1733
+ headers = {}
1734
+ sdk_headers = get_sdk_headers(
1735
+ service_name=self.DEFAULT_SERVICE_NAME,
1736
+ service_version='V2',
1737
+ operation_id='run_reclamation_action',
1738
+ )
1739
+ headers.update(sdk_headers)
1740
+
1741
+ data = {
1742
+ 'request_by': request_by,
1743
+ 'comment': comment,
1744
+ }
1745
+ data = {k: v for (k, v) in data.items() if v is not None}
1746
+ data = json.dumps(data)
1747
+ headers['content-type'] = 'application/json'
1748
+
1749
+ if 'headers' in kwargs:
1750
+ headers.update(kwargs.get('headers'))
1751
+ del kwargs['headers']
1752
+ headers['Accept'] = 'application/json'
1753
+
1754
+ path_param_keys = ['id', 'action_name']
1755
+ path_param_values = self.encode_path_vars(id, action_name)
1756
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
1757
+ url = '/v1/reclamations/{id}/actions/{action_name}'.format(**path_param_dict)
1758
+ request = self.prepare_request(
1759
+ method='POST',
1760
+ url=url,
1761
+ headers=headers,
1762
+ data=data,
1763
+ )
1764
+
1765
+ response = self.send(request, **kwargs)
1766
+ return response
1767
+
1768
+
1769
+ class ListResourceInstancesEnums:
1770
+ """
1771
+ Enums for list_resource_instances parameters.
1772
+ """
1773
+
1774
+ class State(str, Enum):
1775
+ """
1776
+ The state of the instance. If not specified, instances in state `active` and
1777
+ `provisioning` are returned.
1778
+ """
1779
+
1780
+ ACTIVE = 'active'
1781
+ INACTIVE = 'inactive'
1782
+ FAILED = 'failed'
1783
+ PENDING_RECLAMATION = 'pending_reclamation'
1784
+ PROVISIONING = 'provisioning'
1785
+ PRE_PROVISIONING = 'pre_provisioning'
1786
+ REMOVED = 'removed'
1787
+
1788
+
1789
+ ##############################################################################
1790
+ # Models
1791
+ ##############################################################################
1792
+
1793
+
1794
+ class Credentials:
1795
+ """
1796
+ The credentials for a resource.
1797
+
1798
+ :param str redacted: (optional) If present, the user doesn't have the correct
1799
+ access to view the credentials and the details are redacted. The string value
1800
+ identifies the level of access that's required to view the credential. For
1801
+ additional information, see [viewing a
1802
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui).
1803
+ :param str apikey: (optional) The API key for the credentials.
1804
+ :param str iam_apikey_description: (optional) The optional description of the
1805
+ API key.
1806
+ :param str iam_apikey_name: (optional) The name of the API key.
1807
+ :param str iam_role_crn: (optional) The Cloud Resource Name for the role of the
1808
+ credentials.
1809
+ :param str iam_serviceid_crn: (optional) The Cloud Resource Name for the service
1810
+ ID of the credentials.
1811
+ """
1812
+
1813
+ # The set of defined properties for the class
1814
+ _properties = frozenset(
1815
+ [
1816
+ 'redacted',
1817
+ 'REDACTED',
1818
+ 'apikey',
1819
+ 'iam_apikey_description',
1820
+ 'iam_apikey_name',
1821
+ 'iam_role_crn',
1822
+ 'iam_serviceid_crn',
1823
+ ]
1824
+ )
1825
+
1826
+ def __init__(
1827
+ self,
1828
+ *,
1829
+ redacted: Optional[str] = None,
1830
+ apikey: Optional[str] = None,
1831
+ iam_apikey_description: Optional[str] = None,
1832
+ iam_apikey_name: Optional[str] = None,
1833
+ iam_role_crn: Optional[str] = None,
1834
+ iam_serviceid_crn: Optional[str] = None,
1835
+ **kwargs,
1836
+ ) -> None:
1837
+ """
1838
+ Initialize a Credentials object.
1839
+
1840
+ :param str redacted: (optional) If present, the user doesn't have the
1841
+ correct access to view the credentials and the details are redacted. The
1842
+ string value identifies the level of access that's required to view the
1843
+ credential. For additional information, see [viewing a
1844
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui).
1845
+ :param str apikey: (optional) The API key for the credentials.
1846
+ :param str iam_apikey_description: (optional) The optional description of
1847
+ the API key.
1848
+ :param str iam_apikey_name: (optional) The name of the API key.
1849
+ :param str iam_role_crn: (optional) The Cloud Resource Name for the role of
1850
+ the credentials.
1851
+ :param str iam_serviceid_crn: (optional) The Cloud Resource Name for the
1852
+ service ID of the credentials.
1853
+ :param **kwargs: (optional) Any additional properties.
1854
+ """
1855
+ self.redacted = redacted
1856
+ self.apikey = apikey
1857
+ self.iam_apikey_description = iam_apikey_description
1858
+ self.iam_apikey_name = iam_apikey_name
1859
+ self.iam_role_crn = iam_role_crn
1860
+ self.iam_serviceid_crn = iam_serviceid_crn
1861
+ for _key, _value in kwargs.items():
1862
+ setattr(self, _key, _value)
1863
+
1864
+ @classmethod
1865
+ def from_dict(cls, _dict: Dict) -> 'Credentials':
1866
+ """Initialize a Credentials object from a json dictionary."""
1867
+ args = {}
1868
+ if (redacted := _dict.get('REDACTED')) is not None:
1869
+ args['redacted'] = redacted
1870
+ if (apikey := _dict.get('apikey')) is not None:
1871
+ args['apikey'] = apikey
1872
+ if (iam_apikey_description := _dict.get('iam_apikey_description')) is not None:
1873
+ args['iam_apikey_description'] = iam_apikey_description
1874
+ if (iam_apikey_name := _dict.get('iam_apikey_name')) is not None:
1875
+ args['iam_apikey_name'] = iam_apikey_name
1876
+ if (iam_role_crn := _dict.get('iam_role_crn')) is not None:
1877
+ args['iam_role_crn'] = iam_role_crn
1878
+ if (iam_serviceid_crn := _dict.get('iam_serviceid_crn')) is not None:
1879
+ args['iam_serviceid_crn'] = iam_serviceid_crn
1880
+ args.update({k: v for (k, v) in _dict.items() if k not in cls._properties})
1881
+ return cls(**args)
1882
+
1883
+ @classmethod
1884
+ def _from_dict(cls, _dict):
1885
+ """Initialize a Credentials object from a json dictionary."""
1886
+ return cls.from_dict(_dict)
1887
+
1888
+ def to_dict(self) -> Dict:
1889
+ """Return a json dictionary representing this model."""
1890
+ _dict = {}
1891
+ if hasattr(self, 'redacted') and self.redacted is not None:
1892
+ _dict['REDACTED'] = self.redacted
1893
+ if hasattr(self, 'apikey') and self.apikey is not None:
1894
+ _dict['apikey'] = self.apikey
1895
+ if hasattr(self, 'iam_apikey_description') and self.iam_apikey_description is not None:
1896
+ _dict['iam_apikey_description'] = self.iam_apikey_description
1897
+ if hasattr(self, 'iam_apikey_name') and self.iam_apikey_name is not None:
1898
+ _dict['iam_apikey_name'] = self.iam_apikey_name
1899
+ if hasattr(self, 'iam_role_crn') and self.iam_role_crn is not None:
1900
+ _dict['iam_role_crn'] = self.iam_role_crn
1901
+ if hasattr(self, 'iam_serviceid_crn') and self.iam_serviceid_crn is not None:
1902
+ _dict['iam_serviceid_crn'] = self.iam_serviceid_crn
1903
+ for _key in [k for k in vars(self).keys() if k not in Credentials._properties]:
1904
+ _dict[_key] = getattr(self, _key)
1905
+ return _dict
1906
+
1907
+ def _to_dict(self):
1908
+ """Return a json dictionary representing this model."""
1909
+ return self.to_dict()
1910
+
1911
+ def get_properties(self) -> Dict:
1912
+ """Return a dictionary of arbitrary properties from this instance of Credentials"""
1913
+ _dict = {}
1914
+
1915
+ for _key in [k for k in vars(self).keys() if k not in Credentials._properties]:
1916
+ _dict[_key] = getattr(self, _key)
1917
+ return _dict
1918
+
1919
+ def set_properties(self, _dict: dict):
1920
+ """Set a dictionary of arbitrary properties to this instance of Credentials"""
1921
+ for _key in [k for k in vars(self).keys() if k not in Credentials._properties]:
1922
+ delattr(self, _key)
1923
+
1924
+ for _key, _value in _dict.items():
1925
+ if _key not in Credentials._properties:
1926
+ setattr(self, _key, _value)
1927
+
1928
+ def __str__(self) -> str:
1929
+ """Return a `str` version of this Credentials object."""
1930
+ return json.dumps(self.to_dict(), indent=2)
1931
+
1932
+ def __eq__(self, other: 'Credentials') -> bool:
1933
+ """Return `true` when self and other are equal, false otherwise."""
1934
+ if not isinstance(other, self.__class__):
1935
+ return False
1936
+ return self.__dict__ == other.__dict__
1937
+
1938
+ def __ne__(self, other: 'Credentials') -> bool:
1939
+ """Return `true` when self and other are not equal, false otherwise."""
1940
+ return not self == other
1941
+
1942
+ class RedactedEnum(str, Enum):
1943
+ """
1944
+ If present, the user doesn't have the correct access to view the credentials and
1945
+ the details are redacted. The string value identifies the level of access that's
1946
+ required to view the credential. For additional information, see [viewing a
1947
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui).
1948
+ """
1949
+
1950
+ REDACTED = 'REDACTED'
1951
+ REDACTED_EXPLICIT = 'REDACTED_EXPLICIT'
1952
+
1953
+
1954
+ class PlanHistoryItem:
1955
+ """
1956
+ An element of the plan history of the instance.
1957
+
1958
+ :param str resource_plan_id: The unique ID of the plan associated with the
1959
+ offering. This value is provided by and stored in the global catalog.
1960
+ :param datetime start_date: The date on which the plan was changed.
1961
+ :param str requestor_id: (optional) The subject who made the plan change.
1962
+ """
1963
+
1964
+ def __init__(
1965
+ self,
1966
+ resource_plan_id: str,
1967
+ start_date: datetime,
1968
+ *,
1969
+ requestor_id: Optional[str] = None,
1970
+ ) -> None:
1971
+ """
1972
+ Initialize a PlanHistoryItem object.
1973
+
1974
+ :param str resource_plan_id: The unique ID of the plan associated with the
1975
+ offering. This value is provided by and stored in the global catalog.
1976
+ :param datetime start_date: The date on which the plan was changed.
1977
+ :param str requestor_id: (optional) The subject who made the plan change.
1978
+ """
1979
+ self.resource_plan_id = resource_plan_id
1980
+ self.start_date = start_date
1981
+ self.requestor_id = requestor_id
1982
+
1983
+ @classmethod
1984
+ def from_dict(cls, _dict: Dict) -> 'PlanHistoryItem':
1985
+ """Initialize a PlanHistoryItem object from a json dictionary."""
1986
+ args = {}
1987
+ if (resource_plan_id := _dict.get('resource_plan_id')) is not None:
1988
+ args['resource_plan_id'] = resource_plan_id
1989
+ else:
1990
+ raise ValueError('Required property \'resource_plan_id\' not present in PlanHistoryItem JSON')
1991
+ if (start_date := _dict.get('start_date')) is not None:
1992
+ args['start_date'] = string_to_datetime(start_date)
1993
+ else:
1994
+ raise ValueError('Required property \'start_date\' not present in PlanHistoryItem JSON')
1995
+ if (requestor_id := _dict.get('requestor_id')) is not None:
1996
+ args['requestor_id'] = requestor_id
1997
+ return cls(**args)
1998
+
1999
+ @classmethod
2000
+ def _from_dict(cls, _dict):
2001
+ """Initialize a PlanHistoryItem object from a json dictionary."""
2002
+ return cls.from_dict(_dict)
2003
+
2004
+ def to_dict(self) -> Dict:
2005
+ """Return a json dictionary representing this model."""
2006
+ _dict = {}
2007
+ if hasattr(self, 'resource_plan_id') and self.resource_plan_id is not None:
2008
+ _dict['resource_plan_id'] = self.resource_plan_id
2009
+ if hasattr(self, 'start_date') and self.start_date is not None:
2010
+ _dict['start_date'] = datetime_to_string(self.start_date)
2011
+ if hasattr(self, 'requestor_id') and self.requestor_id is not None:
2012
+ _dict['requestor_id'] = self.requestor_id
2013
+ return _dict
2014
+
2015
+ def _to_dict(self):
2016
+ """Return a json dictionary representing this model."""
2017
+ return self.to_dict()
2018
+
2019
+ def __str__(self) -> str:
2020
+ """Return a `str` version of this PlanHistoryItem object."""
2021
+ return json.dumps(self.to_dict(), indent=2)
2022
+
2023
+ def __eq__(self, other: 'PlanHistoryItem') -> bool:
2024
+ """Return `true` when self and other are equal, false otherwise."""
2025
+ if not isinstance(other, self.__class__):
2026
+ return False
2027
+ return self.__dict__ == other.__dict__
2028
+
2029
+ def __ne__(self, other: 'PlanHistoryItem') -> bool:
2030
+ """Return `true` when self and other are not equal, false otherwise."""
2031
+ return not self == other
2032
+
2033
+
2034
+ class Reclamation:
2035
+ """
2036
+ A reclamation.
2037
+
2038
+ :param str id: (optional) The ID associated with the reclamation.
2039
+ :param str entity_id: (optional) The ID of the entity for the reclamation.
2040
+ :param str entity_type_id: (optional) The ID of the entity type for the
2041
+ reclamation.
2042
+ :param str entity_crn: (optional) The full Cloud Resource Name (CRN) associated
2043
+ with the binding. For more information about this format, see [Cloud Resource
2044
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
2045
+ :param str resource_instance_id: (optional) The ID of the resource instance.
2046
+ :param str resource_group_id: (optional) The ID of the resource group.
2047
+ :param str account_id: (optional) An alpha-numeric value identifying the account
2048
+ ID.
2049
+ :param str policy_id: (optional) The ID of policy for the reclamation.
2050
+ :param str state: (optional) The state of the reclamation.
2051
+ :param str target_time: (optional) The target time that the reclamation
2052
+ retention period end.
2053
+ :param dict custom_properties: (optional) The custom properties of the
2054
+ reclamation.
2055
+ :param datetime created_at: (optional) The date when the reclamation was
2056
+ created.
2057
+ :param str created_by: (optional) The subject who created the reclamation.
2058
+ :param datetime updated_at: (optional) The date when the reclamation was last
2059
+ updated.
2060
+ :param str updated_by: (optional) The subject who updated the reclamation.
2061
+ """
2062
+
2063
+ def __init__(
2064
+ self,
2065
+ *,
2066
+ id: Optional[str] = None,
2067
+ entity_id: Optional[str] = None,
2068
+ entity_type_id: Optional[str] = None,
2069
+ entity_crn: Optional[str] = None,
2070
+ resource_instance_id: Optional[str] = None,
2071
+ resource_group_id: Optional[str] = None,
2072
+ account_id: Optional[str] = None,
2073
+ policy_id: Optional[str] = None,
2074
+ state: Optional[str] = None,
2075
+ target_time: Optional[str] = None,
2076
+ custom_properties: Optional[dict] = None,
2077
+ created_at: Optional[datetime] = None,
2078
+ created_by: Optional[str] = None,
2079
+ updated_at: Optional[datetime] = None,
2080
+ updated_by: Optional[str] = None,
2081
+ ) -> None:
2082
+ """
2083
+ Initialize a Reclamation object.
2084
+
2085
+ :param str id: (optional) The ID associated with the reclamation.
2086
+ :param str entity_id: (optional) The ID of the entity for the reclamation.
2087
+ :param str entity_type_id: (optional) The ID of the entity type for the
2088
+ reclamation.
2089
+ :param str entity_crn: (optional) The full Cloud Resource Name (CRN)
2090
+ associated with the binding. For more information about this format, see
2091
+ [Cloud Resource
2092
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
2093
+ :param str resource_instance_id: (optional) The ID of the resource
2094
+ instance.
2095
+ :param str resource_group_id: (optional) The ID of the resource group.
2096
+ :param str account_id: (optional) An alpha-numeric value identifying the
2097
+ account ID.
2098
+ :param str policy_id: (optional) The ID of policy for the reclamation.
2099
+ :param str state: (optional) The state of the reclamation.
2100
+ :param str target_time: (optional) The target time that the reclamation
2101
+ retention period end.
2102
+ :param dict custom_properties: (optional) The custom properties of the
2103
+ reclamation.
2104
+ :param datetime created_at: (optional) The date when the reclamation was
2105
+ created.
2106
+ :param str created_by: (optional) The subject who created the reclamation.
2107
+ :param datetime updated_at: (optional) The date when the reclamation was
2108
+ last updated.
2109
+ :param str updated_by: (optional) The subject who updated the reclamation.
2110
+ """
2111
+ self.id = id
2112
+ self.entity_id = entity_id
2113
+ self.entity_type_id = entity_type_id
2114
+ self.entity_crn = entity_crn
2115
+ self.resource_instance_id = resource_instance_id
2116
+ self.resource_group_id = resource_group_id
2117
+ self.account_id = account_id
2118
+ self.policy_id = policy_id
2119
+ self.state = state
2120
+ self.target_time = target_time
2121
+ self.custom_properties = custom_properties
2122
+ self.created_at = created_at
2123
+ self.created_by = created_by
2124
+ self.updated_at = updated_at
2125
+ self.updated_by = updated_by
2126
+
2127
+ @classmethod
2128
+ def from_dict(cls, _dict: Dict) -> 'Reclamation':
2129
+ """Initialize a Reclamation object from a json dictionary."""
2130
+ args = {}
2131
+ if (id := _dict.get('id')) is not None:
2132
+ args['id'] = id
2133
+ if (entity_id := _dict.get('entity_id')) is not None:
2134
+ args['entity_id'] = entity_id
2135
+ if (entity_type_id := _dict.get('entity_type_id')) is not None:
2136
+ args['entity_type_id'] = entity_type_id
2137
+ if (entity_crn := _dict.get('entity_crn')) is not None:
2138
+ args['entity_crn'] = entity_crn
2139
+ if (resource_instance_id := _dict.get('resource_instance_id')) is not None:
2140
+ args['resource_instance_id'] = resource_instance_id
2141
+ if (resource_group_id := _dict.get('resource_group_id')) is not None:
2142
+ args['resource_group_id'] = resource_group_id
2143
+ if (account_id := _dict.get('account_id')) is not None:
2144
+ args['account_id'] = account_id
2145
+ if (policy_id := _dict.get('policy_id')) is not None:
2146
+ args['policy_id'] = policy_id
2147
+ if (state := _dict.get('state')) is not None:
2148
+ args['state'] = state
2149
+ if (target_time := _dict.get('target_time')) is not None:
2150
+ args['target_time'] = target_time
2151
+ if (custom_properties := _dict.get('custom_properties')) is not None:
2152
+ args['custom_properties'] = custom_properties
2153
+ if (created_at := _dict.get('created_at')) is not None:
2154
+ args['created_at'] = string_to_datetime(created_at)
2155
+ if (created_by := _dict.get('created_by')) is not None:
2156
+ args['created_by'] = created_by
2157
+ if (updated_at := _dict.get('updated_at')) is not None:
2158
+ args['updated_at'] = string_to_datetime(updated_at)
2159
+ if (updated_by := _dict.get('updated_by')) is not None:
2160
+ args['updated_by'] = updated_by
2161
+ return cls(**args)
2162
+
2163
+ @classmethod
2164
+ def _from_dict(cls, _dict):
2165
+ """Initialize a Reclamation object from a json dictionary."""
2166
+ return cls.from_dict(_dict)
2167
+
2168
+ def to_dict(self) -> Dict:
2169
+ """Return a json dictionary representing this model."""
2170
+ _dict = {}
2171
+ if hasattr(self, 'id') and self.id is not None:
2172
+ _dict['id'] = self.id
2173
+ if hasattr(self, 'entity_id') and self.entity_id is not None:
2174
+ _dict['entity_id'] = self.entity_id
2175
+ if hasattr(self, 'entity_type_id') and self.entity_type_id is not None:
2176
+ _dict['entity_type_id'] = self.entity_type_id
2177
+ if hasattr(self, 'entity_crn') and self.entity_crn is not None:
2178
+ _dict['entity_crn'] = self.entity_crn
2179
+ if hasattr(self, 'resource_instance_id') and self.resource_instance_id is not None:
2180
+ _dict['resource_instance_id'] = self.resource_instance_id
2181
+ if hasattr(self, 'resource_group_id') and self.resource_group_id is not None:
2182
+ _dict['resource_group_id'] = self.resource_group_id
2183
+ if hasattr(self, 'account_id') and self.account_id is not None:
2184
+ _dict['account_id'] = self.account_id
2185
+ if hasattr(self, 'policy_id') and self.policy_id is not None:
2186
+ _dict['policy_id'] = self.policy_id
2187
+ if hasattr(self, 'state') and self.state is not None:
2188
+ _dict['state'] = self.state
2189
+ if hasattr(self, 'target_time') and self.target_time is not None:
2190
+ _dict['target_time'] = self.target_time
2191
+ if hasattr(self, 'custom_properties') and self.custom_properties is not None:
2192
+ _dict['custom_properties'] = self.custom_properties
2193
+ if hasattr(self, 'created_at') and self.created_at is not None:
2194
+ _dict['created_at'] = datetime_to_string(self.created_at)
2195
+ if hasattr(self, 'created_by') and self.created_by is not None:
2196
+ _dict['created_by'] = self.created_by
2197
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
2198
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
2199
+ if hasattr(self, 'updated_by') and self.updated_by is not None:
2200
+ _dict['updated_by'] = self.updated_by
2201
+ return _dict
2202
+
2203
+ def _to_dict(self):
2204
+ """Return a json dictionary representing this model."""
2205
+ return self.to_dict()
2206
+
2207
+ def __str__(self) -> str:
2208
+ """Return a `str` version of this Reclamation object."""
2209
+ return json.dumps(self.to_dict(), indent=2)
2210
+
2211
+ def __eq__(self, other: 'Reclamation') -> bool:
2212
+ """Return `true` when self and other are equal, false otherwise."""
2213
+ if not isinstance(other, self.__class__):
2214
+ return False
2215
+ return self.__dict__ == other.__dict__
2216
+
2217
+ def __ne__(self, other: 'Reclamation') -> bool:
2218
+ """Return `true` when self and other are not equal, false otherwise."""
2219
+ return not self == other
2220
+
2221
+
2222
+ class ReclamationsList:
2223
+ """
2224
+ A list of reclamations.
2225
+
2226
+ :param List[Reclamation] resources: (optional) A list of reclamations.
2227
+ """
2228
+
2229
+ def __init__(
2230
+ self,
2231
+ *,
2232
+ resources: Optional[List['Reclamation']] = None,
2233
+ ) -> None:
2234
+ """
2235
+ Initialize a ReclamationsList object.
2236
+
2237
+ :param List[Reclamation] resources: (optional) A list of reclamations.
2238
+ """
2239
+ self.resources = resources
2240
+
2241
+ @classmethod
2242
+ def from_dict(cls, _dict: Dict) -> 'ReclamationsList':
2243
+ """Initialize a ReclamationsList object from a json dictionary."""
2244
+ args = {}
2245
+ if (resources := _dict.get('resources')) is not None:
2246
+ args['resources'] = [Reclamation.from_dict(v) for v in resources]
2247
+ return cls(**args)
2248
+
2249
+ @classmethod
2250
+ def _from_dict(cls, _dict):
2251
+ """Initialize a ReclamationsList object from a json dictionary."""
2252
+ return cls.from_dict(_dict)
2253
+
2254
+ def to_dict(self) -> Dict:
2255
+ """Return a json dictionary representing this model."""
2256
+ _dict = {}
2257
+ if hasattr(self, 'resources') and self.resources is not None:
2258
+ resources_list = []
2259
+ for v in self.resources:
2260
+ if isinstance(v, dict):
2261
+ resources_list.append(v)
2262
+ else:
2263
+ resources_list.append(v.to_dict())
2264
+ _dict['resources'] = resources_list
2265
+ return _dict
2266
+
2267
+ def _to_dict(self):
2268
+ """Return a json dictionary representing this model."""
2269
+ return self.to_dict()
2270
+
2271
+ def __str__(self) -> str:
2272
+ """Return a `str` version of this ReclamationsList object."""
2273
+ return json.dumps(self.to_dict(), indent=2)
2274
+
2275
+ def __eq__(self, other: 'ReclamationsList') -> bool:
2276
+ """Return `true` when self and other are equal, false otherwise."""
2277
+ if not isinstance(other, self.__class__):
2278
+ return False
2279
+ return self.__dict__ == other.__dict__
2280
+
2281
+ def __ne__(self, other: 'ReclamationsList') -> bool:
2282
+ """Return `true` when self and other are not equal, false otherwise."""
2283
+ return not self == other
2284
+
2285
+
2286
+ class ResourceAlias:
2287
+ """
2288
+ A resource alias.
2289
+
2290
+ :param str id: (optional) The ID associated with the alias.
2291
+ :param str guid: (optional) The GUID of the alias.
2292
+ :param str url: (optional) When you created a new alias, a relative URL path is
2293
+ created identifying the location of the alias.
2294
+ :param datetime created_at: (optional) The date when the alias was created.
2295
+ :param datetime updated_at: (optional) The date when the alias was last updated.
2296
+ :param datetime deleted_at: (optional) The date when the alias was deleted.
2297
+ :param str created_by: (optional) The subject who created the alias.
2298
+ :param str updated_by: (optional) The subject who updated the alias.
2299
+ :param str deleted_by: (optional) The subject who deleted the alias.
2300
+ :param str name: (optional) The human-readable name of the alias.
2301
+ :param str resource_instance_id: (optional) The ID of the resource instance that
2302
+ is being aliased.
2303
+ :param str target_crn: (optional) The CRN of the target namespace in the
2304
+ specific environment.
2305
+ :param str account_id: (optional) An alpha-numeric value identifying the account
2306
+ ID.
2307
+ :param str resource_id: (optional) The unique ID of the offering. This value is
2308
+ provided by and stored in the global catalog.
2309
+ :param str resource_group_id: (optional) The ID of the resource group.
2310
+ :param str crn: (optional) The CRN of the alias. For more information about this
2311
+ format, see [Cloud Resource
2312
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
2313
+ :param str region_instance_id: (optional) The ID of the instance in the target
2314
+ environment. For example, `service_instance_id` in a given IBM Cloud
2315
+ environment.
2316
+ :param str region_instance_crn: (optional) The CRN of the instance in the target
2317
+ environment.
2318
+ :param str state: (optional) The state of the alias.
2319
+ :param bool migrated: (optional) A boolean that dictates if the alias was
2320
+ migrated from a previous CF instance.
2321
+ :param str resource_instance_url: (optional) The relative path to the resource
2322
+ instance.
2323
+ :param str resource_bindings_url: (optional) The relative path to the resource
2324
+ bindings for the alias.
2325
+ :param str resource_keys_url: (optional) The relative path to the resource keys
2326
+ for the alias.
2327
+ """
2328
+
2329
+ def __init__(
2330
+ self,
2331
+ *,
2332
+ id: Optional[str] = None,
2333
+ guid: Optional[str] = None,
2334
+ url: Optional[str] = None,
2335
+ created_at: Optional[datetime] = None,
2336
+ updated_at: Optional[datetime] = None,
2337
+ deleted_at: Optional[datetime] = None,
2338
+ created_by: Optional[str] = None,
2339
+ updated_by: Optional[str] = None,
2340
+ deleted_by: Optional[str] = None,
2341
+ name: Optional[str] = None,
2342
+ resource_instance_id: Optional[str] = None,
2343
+ target_crn: Optional[str] = None,
2344
+ account_id: Optional[str] = None,
2345
+ resource_id: Optional[str] = None,
2346
+ resource_group_id: Optional[str] = None,
2347
+ crn: Optional[str] = None,
2348
+ region_instance_id: Optional[str] = None,
2349
+ region_instance_crn: Optional[str] = None,
2350
+ state: Optional[str] = None,
2351
+ migrated: Optional[bool] = None,
2352
+ resource_instance_url: Optional[str] = None,
2353
+ resource_bindings_url: Optional[str] = None,
2354
+ resource_keys_url: Optional[str] = None,
2355
+ ) -> None:
2356
+ """
2357
+ Initialize a ResourceAlias object.
2358
+
2359
+ :param str id: (optional) The ID associated with the alias.
2360
+ :param str guid: (optional) The GUID of the alias.
2361
+ :param str url: (optional) When you created a new alias, a relative URL
2362
+ path is created identifying the location of the alias.
2363
+ :param datetime created_at: (optional) The date when the alias was created.
2364
+ :param datetime updated_at: (optional) The date when the alias was last
2365
+ updated.
2366
+ :param datetime deleted_at: (optional) The date when the alias was deleted.
2367
+ :param str created_by: (optional) The subject who created the alias.
2368
+ :param str updated_by: (optional) The subject who updated the alias.
2369
+ :param str deleted_by: (optional) The subject who deleted the alias.
2370
+ :param str name: (optional) The human-readable name of the alias.
2371
+ :param str resource_instance_id: (optional) The ID of the resource instance
2372
+ that is being aliased.
2373
+ :param str target_crn: (optional) The CRN of the target namespace in the
2374
+ specific environment.
2375
+ :param str account_id: (optional) An alpha-numeric value identifying the
2376
+ account ID.
2377
+ :param str resource_id: (optional) The unique ID of the offering. This
2378
+ value is provided by and stored in the global catalog.
2379
+ :param str resource_group_id: (optional) The ID of the resource group.
2380
+ :param str crn: (optional) The CRN of the alias. For more information about
2381
+ this format, see [Cloud Resource
2382
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
2383
+ :param str region_instance_id: (optional) The ID of the instance in the
2384
+ target environment. For example, `service_instance_id` in a given IBM Cloud
2385
+ environment.
2386
+ :param str region_instance_crn: (optional) The CRN of the instance in the
2387
+ target environment.
2388
+ :param str state: (optional) The state of the alias.
2389
+ :param bool migrated: (optional) A boolean that dictates if the alias was
2390
+ migrated from a previous CF instance.
2391
+ :param str resource_instance_url: (optional) The relative path to the
2392
+ resource instance.
2393
+ :param str resource_bindings_url: (optional) The relative path to the
2394
+ resource bindings for the alias.
2395
+ :param str resource_keys_url: (optional) The relative path to the resource
2396
+ keys for the alias.
2397
+ """
2398
+ self.id = id
2399
+ self.guid = guid
2400
+ self.url = url
2401
+ self.created_at = created_at
2402
+ self.updated_at = updated_at
2403
+ self.deleted_at = deleted_at
2404
+ self.created_by = created_by
2405
+ self.updated_by = updated_by
2406
+ self.deleted_by = deleted_by
2407
+ self.name = name
2408
+ self.resource_instance_id = resource_instance_id
2409
+ self.target_crn = target_crn
2410
+ self.account_id = account_id
2411
+ self.resource_id = resource_id
2412
+ self.resource_group_id = resource_group_id
2413
+ self.crn = crn
2414
+ self.region_instance_id = region_instance_id
2415
+ self.region_instance_crn = region_instance_crn
2416
+ self.state = state
2417
+ self.migrated = migrated
2418
+ self.resource_instance_url = resource_instance_url
2419
+ self.resource_bindings_url = resource_bindings_url
2420
+ self.resource_keys_url = resource_keys_url
2421
+
2422
+ @classmethod
2423
+ def from_dict(cls, _dict: Dict) -> 'ResourceAlias':
2424
+ """Initialize a ResourceAlias object from a json dictionary."""
2425
+ args = {}
2426
+ if (id := _dict.get('id')) is not None:
2427
+ args['id'] = id
2428
+ if (guid := _dict.get('guid')) is not None:
2429
+ args['guid'] = guid
2430
+ if (url := _dict.get('url')) is not None:
2431
+ args['url'] = url
2432
+ if (created_at := _dict.get('created_at')) is not None:
2433
+ args['created_at'] = string_to_datetime(created_at)
2434
+ if (updated_at := _dict.get('updated_at')) is not None:
2435
+ args['updated_at'] = string_to_datetime(updated_at)
2436
+ if (deleted_at := _dict.get('deleted_at')) is not None:
2437
+ args['deleted_at'] = string_to_datetime(deleted_at)
2438
+ if (created_by := _dict.get('created_by')) is not None:
2439
+ args['created_by'] = created_by
2440
+ if (updated_by := _dict.get('updated_by')) is not None:
2441
+ args['updated_by'] = updated_by
2442
+ if (deleted_by := _dict.get('deleted_by')) is not None:
2443
+ args['deleted_by'] = deleted_by
2444
+ if (name := _dict.get('name')) is not None:
2445
+ args['name'] = name
2446
+ if (resource_instance_id := _dict.get('resource_instance_id')) is not None:
2447
+ args['resource_instance_id'] = resource_instance_id
2448
+ if (target_crn := _dict.get('target_crn')) is not None:
2449
+ args['target_crn'] = target_crn
2450
+ if (account_id := _dict.get('account_id')) is not None:
2451
+ args['account_id'] = account_id
2452
+ if (resource_id := _dict.get('resource_id')) is not None:
2453
+ args['resource_id'] = resource_id
2454
+ if (resource_group_id := _dict.get('resource_group_id')) is not None:
2455
+ args['resource_group_id'] = resource_group_id
2456
+ if (crn := _dict.get('crn')) is not None:
2457
+ args['crn'] = crn
2458
+ if (region_instance_id := _dict.get('region_instance_id')) is not None:
2459
+ args['region_instance_id'] = region_instance_id
2460
+ if (region_instance_crn := _dict.get('region_instance_crn')) is not None:
2461
+ args['region_instance_crn'] = region_instance_crn
2462
+ if (state := _dict.get('state')) is not None:
2463
+ args['state'] = state
2464
+ if (migrated := _dict.get('migrated')) is not None:
2465
+ args['migrated'] = migrated
2466
+ if (resource_instance_url := _dict.get('resource_instance_url')) is not None:
2467
+ args['resource_instance_url'] = resource_instance_url
2468
+ if (resource_bindings_url := _dict.get('resource_bindings_url')) is not None:
2469
+ args['resource_bindings_url'] = resource_bindings_url
2470
+ if (resource_keys_url := _dict.get('resource_keys_url')) is not None:
2471
+ args['resource_keys_url'] = resource_keys_url
2472
+ return cls(**args)
2473
+
2474
+ @classmethod
2475
+ def _from_dict(cls, _dict):
2476
+ """Initialize a ResourceAlias object from a json dictionary."""
2477
+ return cls.from_dict(_dict)
2478
+
2479
+ def to_dict(self) -> Dict:
2480
+ """Return a json dictionary representing this model."""
2481
+ _dict = {}
2482
+ if hasattr(self, 'id') and self.id is not None:
2483
+ _dict['id'] = self.id
2484
+ if hasattr(self, 'guid') and self.guid is not None:
2485
+ _dict['guid'] = self.guid
2486
+ if hasattr(self, 'url') and self.url is not None:
2487
+ _dict['url'] = self.url
2488
+ if hasattr(self, 'created_at') and self.created_at is not None:
2489
+ _dict['created_at'] = datetime_to_string(self.created_at)
2490
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
2491
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
2492
+ if hasattr(self, 'deleted_at') and self.deleted_at is not None:
2493
+ _dict['deleted_at'] = datetime_to_string(self.deleted_at)
2494
+ if hasattr(self, 'created_by') and self.created_by is not None:
2495
+ _dict['created_by'] = self.created_by
2496
+ if hasattr(self, 'updated_by') and self.updated_by is not None:
2497
+ _dict['updated_by'] = self.updated_by
2498
+ if hasattr(self, 'deleted_by') and self.deleted_by is not None:
2499
+ _dict['deleted_by'] = self.deleted_by
2500
+ if hasattr(self, 'name') and self.name is not None:
2501
+ _dict['name'] = self.name
2502
+ if hasattr(self, 'resource_instance_id') and self.resource_instance_id is not None:
2503
+ _dict['resource_instance_id'] = self.resource_instance_id
2504
+ if hasattr(self, 'target_crn') and self.target_crn is not None:
2505
+ _dict['target_crn'] = self.target_crn
2506
+ if hasattr(self, 'account_id') and self.account_id is not None:
2507
+ _dict['account_id'] = self.account_id
2508
+ if hasattr(self, 'resource_id') and self.resource_id is not None:
2509
+ _dict['resource_id'] = self.resource_id
2510
+ if hasattr(self, 'resource_group_id') and self.resource_group_id is not None:
2511
+ _dict['resource_group_id'] = self.resource_group_id
2512
+ if hasattr(self, 'crn') and self.crn is not None:
2513
+ _dict['crn'] = self.crn
2514
+ if hasattr(self, 'region_instance_id') and self.region_instance_id is not None:
2515
+ _dict['region_instance_id'] = self.region_instance_id
2516
+ if hasattr(self, 'region_instance_crn') and self.region_instance_crn is not None:
2517
+ _dict['region_instance_crn'] = self.region_instance_crn
2518
+ if hasattr(self, 'state') and self.state is not None:
2519
+ _dict['state'] = self.state
2520
+ if hasattr(self, 'migrated') and self.migrated is not None:
2521
+ _dict['migrated'] = self.migrated
2522
+ if hasattr(self, 'resource_instance_url') and self.resource_instance_url is not None:
2523
+ _dict['resource_instance_url'] = self.resource_instance_url
2524
+ if hasattr(self, 'resource_bindings_url') and self.resource_bindings_url is not None:
2525
+ _dict['resource_bindings_url'] = self.resource_bindings_url
2526
+ if hasattr(self, 'resource_keys_url') and self.resource_keys_url is not None:
2527
+ _dict['resource_keys_url'] = self.resource_keys_url
2528
+ return _dict
2529
+
2530
+ def _to_dict(self):
2531
+ """Return a json dictionary representing this model."""
2532
+ return self.to_dict()
2533
+
2534
+ def __str__(self) -> str:
2535
+ """Return a `str` version of this ResourceAlias object."""
2536
+ return json.dumps(self.to_dict(), indent=2)
2537
+
2538
+ def __eq__(self, other: 'ResourceAlias') -> bool:
2539
+ """Return `true` when self and other are equal, false otherwise."""
2540
+ if not isinstance(other, self.__class__):
2541
+ return False
2542
+ return self.__dict__ == other.__dict__
2543
+
2544
+ def __ne__(self, other: 'ResourceAlias') -> bool:
2545
+ """Return `true` when self and other are not equal, false otherwise."""
2546
+ return not self == other
2547
+
2548
+
2549
+ class ResourceAliasesList:
2550
+ """
2551
+ A list of resource aliases.
2552
+
2553
+ :param int rows_count: The number of resource aliases in `resources`.
2554
+ :param str next_url: The URL for requesting the next page of results.
2555
+ :param List[ResourceAlias] resources: A list of resource aliases.
2556
+ """
2557
+
2558
+ def __init__(
2559
+ self,
2560
+ rows_count: int,
2561
+ next_url: str,
2562
+ resources: List['ResourceAlias'],
2563
+ ) -> None:
2564
+ """
2565
+ Initialize a ResourceAliasesList object.
2566
+
2567
+ :param int rows_count: The number of resource aliases in `resources`.
2568
+ :param str next_url: The URL for requesting the next page of results.
2569
+ :param List[ResourceAlias] resources: A list of resource aliases.
2570
+ """
2571
+ self.rows_count = rows_count
2572
+ self.next_url = next_url
2573
+ self.resources = resources
2574
+
2575
+ @classmethod
2576
+ def from_dict(cls, _dict: Dict) -> 'ResourceAliasesList':
2577
+ """Initialize a ResourceAliasesList object from a json dictionary."""
2578
+ args = {}
2579
+ if (rows_count := _dict.get('rows_count')) is not None:
2580
+ args['rows_count'] = rows_count
2581
+ else:
2582
+ raise ValueError('Required property \'rows_count\' not present in ResourceAliasesList JSON')
2583
+ if (next_url := _dict.get('next_url')) is not None:
2584
+ args['next_url'] = next_url
2585
+ else:
2586
+ raise ValueError('Required property \'next_url\' not present in ResourceAliasesList JSON')
2587
+ if (resources := _dict.get('resources')) is not None:
2588
+ args['resources'] = [ResourceAlias.from_dict(v) for v in resources]
2589
+ else:
2590
+ raise ValueError('Required property \'resources\' not present in ResourceAliasesList JSON')
2591
+ return cls(**args)
2592
+
2593
+ @classmethod
2594
+ def _from_dict(cls, _dict):
2595
+ """Initialize a ResourceAliasesList object from a json dictionary."""
2596
+ return cls.from_dict(_dict)
2597
+
2598
+ def to_dict(self) -> Dict:
2599
+ """Return a json dictionary representing this model."""
2600
+ _dict = {}
2601
+ if hasattr(self, 'rows_count') and self.rows_count is not None:
2602
+ _dict['rows_count'] = self.rows_count
2603
+ if hasattr(self, 'next_url') and self.next_url is not None:
2604
+ _dict['next_url'] = self.next_url
2605
+ if hasattr(self, 'resources') and self.resources is not None:
2606
+ resources_list = []
2607
+ for v in self.resources:
2608
+ if isinstance(v, dict):
2609
+ resources_list.append(v)
2610
+ else:
2611
+ resources_list.append(v.to_dict())
2612
+ _dict['resources'] = resources_list
2613
+ return _dict
2614
+
2615
+ def _to_dict(self):
2616
+ """Return a json dictionary representing this model."""
2617
+ return self.to_dict()
2618
+
2619
+ def __str__(self) -> str:
2620
+ """Return a `str` version of this ResourceAliasesList object."""
2621
+ return json.dumps(self.to_dict(), indent=2)
2622
+
2623
+ def __eq__(self, other: 'ResourceAliasesList') -> bool:
2624
+ """Return `true` when self and other are equal, false otherwise."""
2625
+ if not isinstance(other, self.__class__):
2626
+ return False
2627
+ return self.__dict__ == other.__dict__
2628
+
2629
+ def __ne__(self, other: 'ResourceAliasesList') -> bool:
2630
+ """Return `true` when self and other are not equal, false otherwise."""
2631
+ return not self == other
2632
+
2633
+
2634
+ class ResourceBinding:
2635
+ """
2636
+ A resource binding.
2637
+
2638
+ :param str id: (optional) The ID associated with the binding.
2639
+ :param str guid: (optional) The GUID of the binding.
2640
+ :param str url: (optional) When you provision a new binding, a relative URL path
2641
+ is created identifying the location of the binding.
2642
+ :param datetime created_at: (optional) The date when the binding was created.
2643
+ :param datetime updated_at: (optional) The date when the binding was last
2644
+ updated.
2645
+ :param datetime deleted_at: (optional) The date when the binding was deleted.
2646
+ :param str created_by: (optional) The subject who created the binding.
2647
+ :param str updated_by: (optional) The subject who updated the binding.
2648
+ :param str deleted_by: (optional) The subject who deleted the binding.
2649
+ :param str source_crn: (optional) The CRN of resource alias associated to the
2650
+ binding.
2651
+ :param str target_crn: (optional) The CRN of target resource, for example,
2652
+ application, in a specific environment.
2653
+ :param str crn: (optional) The full Cloud Resource Name (CRN) associated with
2654
+ the binding. For more information about this format, see [Cloud Resource
2655
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
2656
+ :param str region_binding_id: (optional) The ID of the binding in the target
2657
+ environment. For example, `service_binding_id` in a given IBM Cloud environment.
2658
+ :param str region_binding_crn: (optional) The CRN of the binding in the target
2659
+ environment.
2660
+ :param str name: (optional) The human-readable name of the binding.
2661
+ :param str account_id: (optional) An alpha-numeric value identifying the account
2662
+ ID.
2663
+ :param str resource_group_id: (optional) The ID of the resource group.
2664
+ :param str state: (optional) The state of the binding.
2665
+ :param Credentials credentials: (optional) The credentials for the binding.
2666
+ Additional key-value pairs are passed through from the resource brokers. After a
2667
+ credential is created for a service, it can be viewed at any time for users that
2668
+ need the API key value. However, all users must have the correct level of access
2669
+ to see the details of a credential that includes the API key value. For
2670
+ additional details, see [viewing a
2671
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui)
2672
+ or the service’s documentation.
2673
+ :param bool iam_compatible: (optional) Specifies whether the binding’s
2674
+ credentials support IAM.
2675
+ :param str resource_id: (optional) The unique ID of the offering. This value is
2676
+ provided by and stored in the global catalog.
2677
+ :param bool migrated: (optional) A boolean that dictates if the alias was
2678
+ migrated from a previous CF instance.
2679
+ :param str resource_alias_url: (optional) The relative path to the resource
2680
+ alias that this binding is associated with.
2681
+ """
2682
+
2683
+ def __init__(
2684
+ self,
2685
+ *,
2686
+ id: Optional[str] = None,
2687
+ guid: Optional[str] = None,
2688
+ url: Optional[str] = None,
2689
+ created_at: Optional[datetime] = None,
2690
+ updated_at: Optional[datetime] = None,
2691
+ deleted_at: Optional[datetime] = None,
2692
+ created_by: Optional[str] = None,
2693
+ updated_by: Optional[str] = None,
2694
+ deleted_by: Optional[str] = None,
2695
+ source_crn: Optional[str] = None,
2696
+ target_crn: Optional[str] = None,
2697
+ crn: Optional[str] = None,
2698
+ region_binding_id: Optional[str] = None,
2699
+ region_binding_crn: Optional[str] = None,
2700
+ name: Optional[str] = None,
2701
+ account_id: Optional[str] = None,
2702
+ resource_group_id: Optional[str] = None,
2703
+ state: Optional[str] = None,
2704
+ credentials: Optional['Credentials'] = None,
2705
+ iam_compatible: Optional[bool] = None,
2706
+ resource_id: Optional[str] = None,
2707
+ migrated: Optional[bool] = None,
2708
+ resource_alias_url: Optional[str] = None,
2709
+ ) -> None:
2710
+ """
2711
+ Initialize a ResourceBinding object.
2712
+
2713
+ :param str id: (optional) The ID associated with the binding.
2714
+ :param str guid: (optional) The GUID of the binding.
2715
+ :param str url: (optional) When you provision a new binding, a relative URL
2716
+ path is created identifying the location of the binding.
2717
+ :param datetime created_at: (optional) The date when the binding was
2718
+ created.
2719
+ :param datetime updated_at: (optional) The date when the binding was last
2720
+ updated.
2721
+ :param datetime deleted_at: (optional) The date when the binding was
2722
+ deleted.
2723
+ :param str created_by: (optional) The subject who created the binding.
2724
+ :param str updated_by: (optional) The subject who updated the binding.
2725
+ :param str deleted_by: (optional) The subject who deleted the binding.
2726
+ :param str source_crn: (optional) The CRN of resource alias associated to
2727
+ the binding.
2728
+ :param str target_crn: (optional) The CRN of target resource, for example,
2729
+ application, in a specific environment.
2730
+ :param str crn: (optional) The full Cloud Resource Name (CRN) associated
2731
+ with the binding. For more information about this format, see [Cloud
2732
+ Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
2733
+ :param str region_binding_id: (optional) The ID of the binding in the
2734
+ target environment. For example, `service_binding_id` in a given IBM Cloud
2735
+ environment.
2736
+ :param str region_binding_crn: (optional) The CRN of the binding in the
2737
+ target environment.
2738
+ :param str name: (optional) The human-readable name of the binding.
2739
+ :param str account_id: (optional) An alpha-numeric value identifying the
2740
+ account ID.
2741
+ :param str resource_group_id: (optional) The ID of the resource group.
2742
+ :param str state: (optional) The state of the binding.
2743
+ :param Credentials credentials: (optional) The credentials for the binding.
2744
+ Additional key-value pairs are passed through from the resource brokers.
2745
+ After a credential is created for a service, it can be viewed at any time
2746
+ for users that need the API key value. However, all users must have the
2747
+ correct level of access to see the details of a credential that includes
2748
+ the API key value. For additional details, see [viewing a
2749
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui)
2750
+ or the service’s documentation.
2751
+ :param bool iam_compatible: (optional) Specifies whether the binding’s
2752
+ credentials support IAM.
2753
+ :param str resource_id: (optional) The unique ID of the offering. This
2754
+ value is provided by and stored in the global catalog.
2755
+ :param bool migrated: (optional) A boolean that dictates if the alias was
2756
+ migrated from a previous CF instance.
2757
+ :param str resource_alias_url: (optional) The relative path to the resource
2758
+ alias that this binding is associated with.
2759
+ """
2760
+ self.id = id
2761
+ self.guid = guid
2762
+ self.url = url
2763
+ self.created_at = created_at
2764
+ self.updated_at = updated_at
2765
+ self.deleted_at = deleted_at
2766
+ self.created_by = created_by
2767
+ self.updated_by = updated_by
2768
+ self.deleted_by = deleted_by
2769
+ self.source_crn = source_crn
2770
+ self.target_crn = target_crn
2771
+ self.crn = crn
2772
+ self.region_binding_id = region_binding_id
2773
+ self.region_binding_crn = region_binding_crn
2774
+ self.name = name
2775
+ self.account_id = account_id
2776
+ self.resource_group_id = resource_group_id
2777
+ self.state = state
2778
+ self.credentials = credentials
2779
+ self.iam_compatible = iam_compatible
2780
+ self.resource_id = resource_id
2781
+ self.migrated = migrated
2782
+ self.resource_alias_url = resource_alias_url
2783
+
2784
+ @classmethod
2785
+ def from_dict(cls, _dict: Dict) -> 'ResourceBinding':
2786
+ """Initialize a ResourceBinding object from a json dictionary."""
2787
+ args = {}
2788
+ if (id := _dict.get('id')) is not None:
2789
+ args['id'] = id
2790
+ if (guid := _dict.get('guid')) is not None:
2791
+ args['guid'] = guid
2792
+ if (url := _dict.get('url')) is not None:
2793
+ args['url'] = url
2794
+ if (created_at := _dict.get('created_at')) is not None:
2795
+ args['created_at'] = string_to_datetime(created_at)
2796
+ if (updated_at := _dict.get('updated_at')) is not None:
2797
+ args['updated_at'] = string_to_datetime(updated_at)
2798
+ if (deleted_at := _dict.get('deleted_at')) is not None:
2799
+ args['deleted_at'] = string_to_datetime(deleted_at)
2800
+ if (created_by := _dict.get('created_by')) is not None:
2801
+ args['created_by'] = created_by
2802
+ if (updated_by := _dict.get('updated_by')) is not None:
2803
+ args['updated_by'] = updated_by
2804
+ if (deleted_by := _dict.get('deleted_by')) is not None:
2805
+ args['deleted_by'] = deleted_by
2806
+ if (source_crn := _dict.get('source_crn')) is not None:
2807
+ args['source_crn'] = source_crn
2808
+ if (target_crn := _dict.get('target_crn')) is not None:
2809
+ args['target_crn'] = target_crn
2810
+ if (crn := _dict.get('crn')) is not None:
2811
+ args['crn'] = crn
2812
+ if (region_binding_id := _dict.get('region_binding_id')) is not None:
2813
+ args['region_binding_id'] = region_binding_id
2814
+ if (region_binding_crn := _dict.get('region_binding_crn')) is not None:
2815
+ args['region_binding_crn'] = region_binding_crn
2816
+ if (name := _dict.get('name')) is not None:
2817
+ args['name'] = name
2818
+ if (account_id := _dict.get('account_id')) is not None:
2819
+ args['account_id'] = account_id
2820
+ if (resource_group_id := _dict.get('resource_group_id')) is not None:
2821
+ args['resource_group_id'] = resource_group_id
2822
+ if (state := _dict.get('state')) is not None:
2823
+ args['state'] = state
2824
+ if (credentials := _dict.get('credentials')) is not None:
2825
+ args['credentials'] = Credentials.from_dict(credentials)
2826
+ if (iam_compatible := _dict.get('iam_compatible')) is not None:
2827
+ args['iam_compatible'] = iam_compatible
2828
+ if (resource_id := _dict.get('resource_id')) is not None:
2829
+ args['resource_id'] = resource_id
2830
+ if (migrated := _dict.get('migrated')) is not None:
2831
+ args['migrated'] = migrated
2832
+ if (resource_alias_url := _dict.get('resource_alias_url')) is not None:
2833
+ args['resource_alias_url'] = resource_alias_url
2834
+ return cls(**args)
2835
+
2836
+ @classmethod
2837
+ def _from_dict(cls, _dict):
2838
+ """Initialize a ResourceBinding object from a json dictionary."""
2839
+ return cls.from_dict(_dict)
2840
+
2841
+ def to_dict(self) -> Dict:
2842
+ """Return a json dictionary representing this model."""
2843
+ _dict = {}
2844
+ if hasattr(self, 'id') and self.id is not None:
2845
+ _dict['id'] = self.id
2846
+ if hasattr(self, 'guid') and self.guid is not None:
2847
+ _dict['guid'] = self.guid
2848
+ if hasattr(self, 'url') and self.url is not None:
2849
+ _dict['url'] = self.url
2850
+ if hasattr(self, 'created_at') and self.created_at is not None:
2851
+ _dict['created_at'] = datetime_to_string(self.created_at)
2852
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
2853
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
2854
+ if hasattr(self, 'deleted_at') and self.deleted_at is not None:
2855
+ _dict['deleted_at'] = datetime_to_string(self.deleted_at)
2856
+ if hasattr(self, 'created_by') and self.created_by is not None:
2857
+ _dict['created_by'] = self.created_by
2858
+ if hasattr(self, 'updated_by') and self.updated_by is not None:
2859
+ _dict['updated_by'] = self.updated_by
2860
+ if hasattr(self, 'deleted_by') and self.deleted_by is not None:
2861
+ _dict['deleted_by'] = self.deleted_by
2862
+ if hasattr(self, 'source_crn') and self.source_crn is not None:
2863
+ _dict['source_crn'] = self.source_crn
2864
+ if hasattr(self, 'target_crn') and self.target_crn is not None:
2865
+ _dict['target_crn'] = self.target_crn
2866
+ if hasattr(self, 'crn') and self.crn is not None:
2867
+ _dict['crn'] = self.crn
2868
+ if hasattr(self, 'region_binding_id') and self.region_binding_id is not None:
2869
+ _dict['region_binding_id'] = self.region_binding_id
2870
+ if hasattr(self, 'region_binding_crn') and self.region_binding_crn is not None:
2871
+ _dict['region_binding_crn'] = self.region_binding_crn
2872
+ if hasattr(self, 'name') and self.name is not None:
2873
+ _dict['name'] = self.name
2874
+ if hasattr(self, 'account_id') and self.account_id is not None:
2875
+ _dict['account_id'] = self.account_id
2876
+ if hasattr(self, 'resource_group_id') and self.resource_group_id is not None:
2877
+ _dict['resource_group_id'] = self.resource_group_id
2878
+ if hasattr(self, 'state') and self.state is not None:
2879
+ _dict['state'] = self.state
2880
+ if hasattr(self, 'credentials') and self.credentials is not None:
2881
+ if isinstance(self.credentials, dict):
2882
+ _dict['credentials'] = self.credentials
2883
+ else:
2884
+ _dict['credentials'] = self.credentials.to_dict()
2885
+ if hasattr(self, 'iam_compatible') and self.iam_compatible is not None:
2886
+ _dict['iam_compatible'] = self.iam_compatible
2887
+ if hasattr(self, 'resource_id') and self.resource_id is not None:
2888
+ _dict['resource_id'] = self.resource_id
2889
+ if hasattr(self, 'migrated') and self.migrated is not None:
2890
+ _dict['migrated'] = self.migrated
2891
+ if hasattr(self, 'resource_alias_url') and self.resource_alias_url is not None:
2892
+ _dict['resource_alias_url'] = self.resource_alias_url
2893
+ return _dict
2894
+
2895
+ def _to_dict(self):
2896
+ """Return a json dictionary representing this model."""
2897
+ return self.to_dict()
2898
+
2899
+ def __str__(self) -> str:
2900
+ """Return a `str` version of this ResourceBinding object."""
2901
+ return json.dumps(self.to_dict(), indent=2)
2902
+
2903
+ def __eq__(self, other: 'ResourceBinding') -> bool:
2904
+ """Return `true` when self and other are equal, false otherwise."""
2905
+ if not isinstance(other, self.__class__):
2906
+ return False
2907
+ return self.__dict__ == other.__dict__
2908
+
2909
+ def __ne__(self, other: 'ResourceBinding') -> bool:
2910
+ """Return `true` when self and other are not equal, false otherwise."""
2911
+ return not self == other
2912
+
2913
+
2914
+ class ResourceBindingPostParameters:
2915
+ """
2916
+ Configuration options represented as key-value pairs. Service defined options are
2917
+ passed through to the target resource brokers, whereas platform defined options are
2918
+ not.
2919
+
2920
+ :param str serviceid_crn: (optional) An optional platform defined option to
2921
+ reuse an existing IAM serviceId for the role assignment.
2922
+ """
2923
+
2924
+ # The set of defined properties for the class
2925
+ _properties = frozenset(['serviceid_crn'])
2926
+
2927
+ def __init__(
2928
+ self,
2929
+ *,
2930
+ serviceid_crn: Optional[str] = None,
2931
+ **kwargs,
2932
+ ) -> None:
2933
+ """
2934
+ Initialize a ResourceBindingPostParameters object.
2935
+
2936
+ :param str serviceid_crn: (optional) An optional platform defined option to
2937
+ reuse an existing IAM serviceId for the role assignment.
2938
+ :param **kwargs: (optional) Any additional properties.
2939
+ """
2940
+ self.serviceid_crn = serviceid_crn
2941
+ for _key, _value in kwargs.items():
2942
+ setattr(self, _key, _value)
2943
+
2944
+ @classmethod
2945
+ def from_dict(cls, _dict: Dict) -> 'ResourceBindingPostParameters':
2946
+ """Initialize a ResourceBindingPostParameters object from a json dictionary."""
2947
+ args = {}
2948
+ if (serviceid_crn := _dict.get('serviceid_crn')) is not None:
2949
+ args['serviceid_crn'] = serviceid_crn
2950
+ args.update({k: v for (k, v) in _dict.items() if k not in cls._properties})
2951
+ return cls(**args)
2952
+
2953
+ @classmethod
2954
+ def _from_dict(cls, _dict):
2955
+ """Initialize a ResourceBindingPostParameters object from a json dictionary."""
2956
+ return cls.from_dict(_dict)
2957
+
2958
+ def to_dict(self) -> Dict:
2959
+ """Return a json dictionary representing this model."""
2960
+ _dict = {}
2961
+ if hasattr(self, 'serviceid_crn') and self.serviceid_crn is not None:
2962
+ _dict['serviceid_crn'] = self.serviceid_crn
2963
+ for _key in [k for k in vars(self).keys() if k not in ResourceBindingPostParameters._properties]:
2964
+ _dict[_key] = getattr(self, _key)
2965
+ return _dict
2966
+
2967
+ def _to_dict(self):
2968
+ """Return a json dictionary representing this model."""
2969
+ return self.to_dict()
2970
+
2971
+ def get_properties(self) -> Dict:
2972
+ """Return a dictionary of arbitrary properties from this instance of ResourceBindingPostParameters"""
2973
+ _dict = {}
2974
+
2975
+ for _key in [k for k in vars(self).keys() if k not in ResourceBindingPostParameters._properties]:
2976
+ _dict[_key] = getattr(self, _key)
2977
+ return _dict
2978
+
2979
+ def set_properties(self, _dict: dict):
2980
+ """Set a dictionary of arbitrary properties to this instance of ResourceBindingPostParameters"""
2981
+ for _key in [k for k in vars(self).keys() if k not in ResourceBindingPostParameters._properties]:
2982
+ delattr(self, _key)
2983
+
2984
+ for _key, _value in _dict.items():
2985
+ if _key not in ResourceBindingPostParameters._properties:
2986
+ setattr(self, _key, _value)
2987
+
2988
+ def __str__(self) -> str:
2989
+ """Return a `str` version of this ResourceBindingPostParameters object."""
2990
+ return json.dumps(self.to_dict(), indent=2)
2991
+
2992
+ def __eq__(self, other: 'ResourceBindingPostParameters') -> bool:
2993
+ """Return `true` when self and other are equal, false otherwise."""
2994
+ if not isinstance(other, self.__class__):
2995
+ return False
2996
+ return self.__dict__ == other.__dict__
2997
+
2998
+ def __ne__(self, other: 'ResourceBindingPostParameters') -> bool:
2999
+ """Return `true` when self and other are not equal, false otherwise."""
3000
+ return not self == other
3001
+
3002
+
3003
+ class ResourceBindingsList:
3004
+ """
3005
+ A list of resource bindings.
3006
+
3007
+ :param int rows_count: The number of resource bindings in `resources`.
3008
+ :param str next_url: The URL for requesting the next page of results.
3009
+ :param List[ResourceBinding] resources: A list of resource bindings.
3010
+ """
3011
+
3012
+ def __init__(
3013
+ self,
3014
+ rows_count: int,
3015
+ next_url: str,
3016
+ resources: List['ResourceBinding'],
3017
+ ) -> None:
3018
+ """
3019
+ Initialize a ResourceBindingsList object.
3020
+
3021
+ :param int rows_count: The number of resource bindings in `resources`.
3022
+ :param str next_url: The URL for requesting the next page of results.
3023
+ :param List[ResourceBinding] resources: A list of resource bindings.
3024
+ """
3025
+ self.rows_count = rows_count
3026
+ self.next_url = next_url
3027
+ self.resources = resources
3028
+
3029
+ @classmethod
3030
+ def from_dict(cls, _dict: Dict) -> 'ResourceBindingsList':
3031
+ """Initialize a ResourceBindingsList object from a json dictionary."""
3032
+ args = {}
3033
+ if (rows_count := _dict.get('rows_count')) is not None:
3034
+ args['rows_count'] = rows_count
3035
+ else:
3036
+ raise ValueError('Required property \'rows_count\' not present in ResourceBindingsList JSON')
3037
+ if (next_url := _dict.get('next_url')) is not None:
3038
+ args['next_url'] = next_url
3039
+ else:
3040
+ raise ValueError('Required property \'next_url\' not present in ResourceBindingsList JSON')
3041
+ if (resources := _dict.get('resources')) is not None:
3042
+ args['resources'] = [ResourceBinding.from_dict(v) for v in resources]
3043
+ else:
3044
+ raise ValueError('Required property \'resources\' not present in ResourceBindingsList JSON')
3045
+ return cls(**args)
3046
+
3047
+ @classmethod
3048
+ def _from_dict(cls, _dict):
3049
+ """Initialize a ResourceBindingsList object from a json dictionary."""
3050
+ return cls.from_dict(_dict)
3051
+
3052
+ def to_dict(self) -> Dict:
3053
+ """Return a json dictionary representing this model."""
3054
+ _dict = {}
3055
+ if hasattr(self, 'rows_count') and self.rows_count is not None:
3056
+ _dict['rows_count'] = self.rows_count
3057
+ if hasattr(self, 'next_url') and self.next_url is not None:
3058
+ _dict['next_url'] = self.next_url
3059
+ if hasattr(self, 'resources') and self.resources is not None:
3060
+ resources_list = []
3061
+ for v in self.resources:
3062
+ if isinstance(v, dict):
3063
+ resources_list.append(v)
3064
+ else:
3065
+ resources_list.append(v.to_dict())
3066
+ _dict['resources'] = resources_list
3067
+ return _dict
3068
+
3069
+ def _to_dict(self):
3070
+ """Return a json dictionary representing this model."""
3071
+ return self.to_dict()
3072
+
3073
+ def __str__(self) -> str:
3074
+ """Return a `str` version of this ResourceBindingsList object."""
3075
+ return json.dumps(self.to_dict(), indent=2)
3076
+
3077
+ def __eq__(self, other: 'ResourceBindingsList') -> bool:
3078
+ """Return `true` when self and other are equal, false otherwise."""
3079
+ if not isinstance(other, self.__class__):
3080
+ return False
3081
+ return self.__dict__ == other.__dict__
3082
+
3083
+ def __ne__(self, other: 'ResourceBindingsList') -> bool:
3084
+ """Return `true` when self and other are not equal, false otherwise."""
3085
+ return not self == other
3086
+
3087
+
3088
+ class ResourceInstance:
3089
+ """
3090
+ A resource instance.
3091
+
3092
+ :param str id: (optional) The ID associated with the instance.
3093
+ :param str guid: (optional) The GUID of the instance.
3094
+ :param str url: (optional) When you provision a new resource, a relative URL
3095
+ path is created identifying the location of the instance.
3096
+ :param datetime created_at: (optional) The date when the instance was created.
3097
+ :param datetime updated_at: (optional) The date when the instance was last
3098
+ updated.
3099
+ :param datetime deleted_at: (optional) The date when the instance was deleted.
3100
+ :param str created_by: (optional) The subject who created the instance.
3101
+ :param str updated_by: (optional) The subject who updated the instance.
3102
+ :param str deleted_by: (optional) The subject who deleted the instance.
3103
+ :param datetime scheduled_reclaim_at: (optional) The date when the instance was
3104
+ scheduled for reclamation.
3105
+ :param datetime restored_at: (optional) The date when the instance under
3106
+ reclamation was restored.
3107
+ :param str restored_by: (optional) The subject who restored the instance back
3108
+ from reclamation.
3109
+ :param str scheduled_reclaim_by: (optional) The subject who initiated the
3110
+ instance reclamation.
3111
+ :param str name: (optional) The human-readable name of the instance.
3112
+ :param str region_id: (optional) The deployment location where the instance was
3113
+ provisioned.
3114
+ :param str account_id: (optional) An alpha-numeric value identifying the account
3115
+ ID.
3116
+ :param str reseller_channel_id: (optional) The unique ID of the reseller channel
3117
+ where the instance was provisioned from.
3118
+ :param str resource_plan_id: (optional) The unique ID of the plan associated
3119
+ with the offering. This value is provided by and stored in the global catalog.
3120
+ :param str resource_group_id: (optional) The ID of the resource group.
3121
+ :param str resource_group_crn: (optional) The CRN of the resource group.
3122
+ :param str target_crn: (optional) The deployment CRN as defined in the global
3123
+ catalog. The Cloud Resource Name (CRN) of the deployment location where the
3124
+ instance is provisioned.
3125
+ :param bool onetime_credentials: (optional) Whether newly created resource key
3126
+ credentials can be retrieved by using get resource key or get a list of all of
3127
+ the resource keys requests.
3128
+ :param dict parameters: (optional) The current configuration parameters of the
3129
+ instance.
3130
+ :param bool allow_cleanup: (optional) A boolean that dictates if the resource
3131
+ instance should be deleted (cleaned up) during the processing of a region
3132
+ instance delete call.
3133
+ :param str crn: (optional) The full Cloud Resource Name (CRN) associated with
3134
+ the instance. For more information about this format, see [Cloud Resource
3135
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
3136
+ :param str state: (optional) The current state of the instance. For example, if
3137
+ the instance is deleted, it will return removed.
3138
+ :param str type: (optional) The type of the instance, for example,
3139
+ `service_instance`.
3140
+ :param str sub_type: (optional) The sub-type of instance, for example, `cfaas`.
3141
+ :param str resource_id: (optional) The unique ID of the offering. This value is
3142
+ provided by and stored in the global catalog.
3143
+ :param str dashboard_url: (optional) The resource-broker-provided URL to access
3144
+ administrative features of the instance.
3145
+ :param ResourceInstanceLastOperation last_operation: (optional) The status of
3146
+ the last operation requested on the instance.
3147
+ :param str resource_aliases_url: (optional) The relative path to the resource
3148
+ aliases for the instance.
3149
+ :param str resource_bindings_url: (optional) The relative path to the resource
3150
+ bindings for the instance.
3151
+ :param str resource_keys_url: (optional) The relative path to the resource keys
3152
+ for the instance.
3153
+ :param List[PlanHistoryItem] plan_history: (optional) The plan history of the
3154
+ instance.
3155
+ :param bool migrated: (optional) A boolean that dictates if the resource
3156
+ instance was migrated from a previous CF instance.
3157
+ :param dict extensions: (optional) Additional instance properties, contributed
3158
+ by the service and/or platform, are represented as key-value pairs.
3159
+ :param str controlled_by: (optional) The CRN of the resource that has control of
3160
+ the instance.
3161
+ :param bool locked: (optional) A boolean that dictates if the resource instance
3162
+ is locked or not.
3163
+ """
3164
+
3165
+ def __init__(
3166
+ self,
3167
+ *,
3168
+ id: Optional[str] = None,
3169
+ guid: Optional[str] = None,
3170
+ url: Optional[str] = None,
3171
+ created_at: Optional[datetime] = None,
3172
+ updated_at: Optional[datetime] = None,
3173
+ deleted_at: Optional[datetime] = None,
3174
+ created_by: Optional[str] = None,
3175
+ updated_by: Optional[str] = None,
3176
+ deleted_by: Optional[str] = None,
3177
+ scheduled_reclaim_at: Optional[datetime] = None,
3178
+ restored_at: Optional[datetime] = None,
3179
+ restored_by: Optional[str] = None,
3180
+ scheduled_reclaim_by: Optional[str] = None,
3181
+ name: Optional[str] = None,
3182
+ region_id: Optional[str] = None,
3183
+ account_id: Optional[str] = None,
3184
+ reseller_channel_id: Optional[str] = None,
3185
+ resource_plan_id: Optional[str] = None,
3186
+ resource_group_id: Optional[str] = None,
3187
+ resource_group_crn: Optional[str] = None,
3188
+ target_crn: Optional[str] = None,
3189
+ onetime_credentials: Optional[bool] = None,
3190
+ parameters: Optional[dict] = None,
3191
+ allow_cleanup: Optional[bool] = None,
3192
+ crn: Optional[str] = None,
3193
+ state: Optional[str] = None,
3194
+ type: Optional[str] = None,
3195
+ sub_type: Optional[str] = None,
3196
+ resource_id: Optional[str] = None,
3197
+ dashboard_url: Optional[str] = None,
3198
+ last_operation: Optional['ResourceInstanceLastOperation'] = None,
3199
+ resource_aliases_url: Optional[str] = None,
3200
+ resource_bindings_url: Optional[str] = None,
3201
+ resource_keys_url: Optional[str] = None,
3202
+ plan_history: Optional[List['PlanHistoryItem']] = None,
3203
+ migrated: Optional[bool] = None,
3204
+ extensions: Optional[dict] = None,
3205
+ controlled_by: Optional[str] = None,
3206
+ locked: Optional[bool] = None,
3207
+ ) -> None:
3208
+ """
3209
+ Initialize a ResourceInstance object.
3210
+
3211
+ :param str id: (optional) The ID associated with the instance.
3212
+ :param str guid: (optional) The GUID of the instance.
3213
+ :param str url: (optional) When you provision a new resource, a relative
3214
+ URL path is created identifying the location of the instance.
3215
+ :param datetime created_at: (optional) The date when the instance was
3216
+ created.
3217
+ :param datetime updated_at: (optional) The date when the instance was last
3218
+ updated.
3219
+ :param datetime deleted_at: (optional) The date when the instance was
3220
+ deleted.
3221
+ :param str created_by: (optional) The subject who created the instance.
3222
+ :param str updated_by: (optional) The subject who updated the instance.
3223
+ :param str deleted_by: (optional) The subject who deleted the instance.
3224
+ :param datetime scheduled_reclaim_at: (optional) The date when the instance
3225
+ was scheduled for reclamation.
3226
+ :param datetime restored_at: (optional) The date when the instance under
3227
+ reclamation was restored.
3228
+ :param str restored_by: (optional) The subject who restored the instance
3229
+ back from reclamation.
3230
+ :param str scheduled_reclaim_by: (optional) The subject who initiated the
3231
+ instance reclamation.
3232
+ :param str name: (optional) The human-readable name of the instance.
3233
+ :param str region_id: (optional) The deployment location where the instance
3234
+ was provisioned.
3235
+ :param str account_id: (optional) An alpha-numeric value identifying the
3236
+ account ID.
3237
+ :param str reseller_channel_id: (optional) The unique ID of the reseller
3238
+ channel where the instance was provisioned from.
3239
+ :param str resource_plan_id: (optional) The unique ID of the plan
3240
+ associated with the offering. This value is provided by and stored in the
3241
+ global catalog.
3242
+ :param str resource_group_id: (optional) The ID of the resource group.
3243
+ :param str resource_group_crn: (optional) The CRN of the resource group.
3244
+ :param str target_crn: (optional) The deployment CRN as defined in the
3245
+ global catalog. The Cloud Resource Name (CRN) of the deployment location
3246
+ where the instance is provisioned.
3247
+ :param bool onetime_credentials: (optional) Whether newly created resource
3248
+ key credentials can be retrieved by using get resource key or get a list of
3249
+ all of the resource keys requests.
3250
+ :param dict parameters: (optional) The current configuration parameters of
3251
+ the instance.
3252
+ :param bool allow_cleanup: (optional) A boolean that dictates if the
3253
+ resource instance should be deleted (cleaned up) during the processing of a
3254
+ region instance delete call.
3255
+ :param str crn: (optional) The full Cloud Resource Name (CRN) associated
3256
+ with the instance. For more information about this format, see [Cloud
3257
+ Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
3258
+ :param str state: (optional) The current state of the instance. For
3259
+ example, if the instance is deleted, it will return removed.
3260
+ :param str type: (optional) The type of the instance, for example,
3261
+ `service_instance`.
3262
+ :param str sub_type: (optional) The sub-type of instance, for example,
3263
+ `cfaas`.
3264
+ :param str resource_id: (optional) The unique ID of the offering. This
3265
+ value is provided by and stored in the global catalog.
3266
+ :param str dashboard_url: (optional) The resource-broker-provided URL to
3267
+ access administrative features of the instance.
3268
+ :param ResourceInstanceLastOperation last_operation: (optional) The status
3269
+ of the last operation requested on the instance.
3270
+ :param str resource_aliases_url: (optional) The relative path to the
3271
+ resource aliases for the instance.
3272
+ :param str resource_bindings_url: (optional) The relative path to the
3273
+ resource bindings for the instance.
3274
+ :param str resource_keys_url: (optional) The relative path to the resource
3275
+ keys for the instance.
3276
+ :param List[PlanHistoryItem] plan_history: (optional) The plan history of
3277
+ the instance.
3278
+ :param bool migrated: (optional) A boolean that dictates if the resource
3279
+ instance was migrated from a previous CF instance.
3280
+ :param dict extensions: (optional) Additional instance properties,
3281
+ contributed by the service and/or platform, are represented as key-value
3282
+ pairs.
3283
+ :param str controlled_by: (optional) The CRN of the resource that has
3284
+ control of the instance.
3285
+ :param bool locked: (optional) A boolean that dictates if the resource
3286
+ instance is locked or not.
3287
+ """
3288
+ self.id = id
3289
+ self.guid = guid
3290
+ self.url = url
3291
+ self.created_at = created_at
3292
+ self.updated_at = updated_at
3293
+ self.deleted_at = deleted_at
3294
+ self.created_by = created_by
3295
+ self.updated_by = updated_by
3296
+ self.deleted_by = deleted_by
3297
+ self.scheduled_reclaim_at = scheduled_reclaim_at
3298
+ self.restored_at = restored_at
3299
+ self.restored_by = restored_by
3300
+ self.scheduled_reclaim_by = scheduled_reclaim_by
3301
+ self.name = name
3302
+ self.region_id = region_id
3303
+ self.account_id = account_id
3304
+ self.reseller_channel_id = reseller_channel_id
3305
+ self.resource_plan_id = resource_plan_id
3306
+ self.resource_group_id = resource_group_id
3307
+ self.resource_group_crn = resource_group_crn
3308
+ self.target_crn = target_crn
3309
+ self.onetime_credentials = onetime_credentials
3310
+ self.parameters = parameters
3311
+ self.allow_cleanup = allow_cleanup
3312
+ self.crn = crn
3313
+ self.state = state
3314
+ self.type = type
3315
+ self.sub_type = sub_type
3316
+ self.resource_id = resource_id
3317
+ self.dashboard_url = dashboard_url
3318
+ self.last_operation = last_operation
3319
+ self.resource_aliases_url = resource_aliases_url
3320
+ self.resource_bindings_url = resource_bindings_url
3321
+ self.resource_keys_url = resource_keys_url
3322
+ self.plan_history = plan_history
3323
+ self.migrated = migrated
3324
+ self.extensions = extensions
3325
+ self.controlled_by = controlled_by
3326
+ self.locked = locked
3327
+
3328
+ @classmethod
3329
+ def from_dict(cls, _dict: Dict) -> 'ResourceInstance':
3330
+ """Initialize a ResourceInstance object from a json dictionary."""
3331
+ args = {}
3332
+ if (id := _dict.get('id')) is not None:
3333
+ args['id'] = id
3334
+ if (guid := _dict.get('guid')) is not None:
3335
+ args['guid'] = guid
3336
+ if (url := _dict.get('url')) is not None:
3337
+ args['url'] = url
3338
+ if (created_at := _dict.get('created_at')) is not None:
3339
+ args['created_at'] = string_to_datetime(created_at)
3340
+ if (updated_at := _dict.get('updated_at')) is not None:
3341
+ args['updated_at'] = string_to_datetime(updated_at)
3342
+ if (deleted_at := _dict.get('deleted_at')) is not None:
3343
+ args['deleted_at'] = string_to_datetime(deleted_at)
3344
+ if (created_by := _dict.get('created_by')) is not None:
3345
+ args['created_by'] = created_by
3346
+ if (updated_by := _dict.get('updated_by')) is not None:
3347
+ args['updated_by'] = updated_by
3348
+ if (deleted_by := _dict.get('deleted_by')) is not None:
3349
+ args['deleted_by'] = deleted_by
3350
+ if (scheduled_reclaim_at := _dict.get('scheduled_reclaim_at')) is not None:
3351
+ args['scheduled_reclaim_at'] = string_to_datetime(scheduled_reclaim_at)
3352
+ if (restored_at := _dict.get('restored_at')) is not None:
3353
+ args['restored_at'] = string_to_datetime(restored_at)
3354
+ if (restored_by := _dict.get('restored_by')) is not None:
3355
+ args['restored_by'] = restored_by
3356
+ if (scheduled_reclaim_by := _dict.get('scheduled_reclaim_by')) is not None:
3357
+ args['scheduled_reclaim_by'] = scheduled_reclaim_by
3358
+ if (name := _dict.get('name')) is not None:
3359
+ args['name'] = name
3360
+ if (region_id := _dict.get('region_id')) is not None:
3361
+ args['region_id'] = region_id
3362
+ if (account_id := _dict.get('account_id')) is not None:
3363
+ args['account_id'] = account_id
3364
+ if (reseller_channel_id := _dict.get('reseller_channel_id')) is not None:
3365
+ args['reseller_channel_id'] = reseller_channel_id
3366
+ if (resource_plan_id := _dict.get('resource_plan_id')) is not None:
3367
+ args['resource_plan_id'] = resource_plan_id
3368
+ if (resource_group_id := _dict.get('resource_group_id')) is not None:
3369
+ args['resource_group_id'] = resource_group_id
3370
+ if (resource_group_crn := _dict.get('resource_group_crn')) is not None:
3371
+ args['resource_group_crn'] = resource_group_crn
3372
+ if (target_crn := _dict.get('target_crn')) is not None:
3373
+ args['target_crn'] = target_crn
3374
+ if (onetime_credentials := _dict.get('onetime_credentials')) is not None:
3375
+ args['onetime_credentials'] = onetime_credentials
3376
+ if (parameters := _dict.get('parameters')) is not None:
3377
+ args['parameters'] = parameters
3378
+ if (allow_cleanup := _dict.get('allow_cleanup')) is not None:
3379
+ args['allow_cleanup'] = allow_cleanup
3380
+ if (crn := _dict.get('crn')) is not None:
3381
+ args['crn'] = crn
3382
+ if (state := _dict.get('state')) is not None:
3383
+ args['state'] = state
3384
+ if (type := _dict.get('type')) is not None:
3385
+ args['type'] = type
3386
+ if (sub_type := _dict.get('sub_type')) is not None:
3387
+ args['sub_type'] = sub_type
3388
+ if (resource_id := _dict.get('resource_id')) is not None:
3389
+ args['resource_id'] = resource_id
3390
+ if (dashboard_url := _dict.get('dashboard_url')) is not None:
3391
+ args['dashboard_url'] = dashboard_url
3392
+ if (last_operation := _dict.get('last_operation')) is not None:
3393
+ args['last_operation'] = ResourceInstanceLastOperation.from_dict(last_operation)
3394
+ if (resource_aliases_url := _dict.get('resource_aliases_url')) is not None:
3395
+ args['resource_aliases_url'] = resource_aliases_url
3396
+ if (resource_bindings_url := _dict.get('resource_bindings_url')) is not None:
3397
+ args['resource_bindings_url'] = resource_bindings_url
3398
+ if (resource_keys_url := _dict.get('resource_keys_url')) is not None:
3399
+ args['resource_keys_url'] = resource_keys_url
3400
+ if (plan_history := _dict.get('plan_history')) is not None:
3401
+ args['plan_history'] = [PlanHistoryItem.from_dict(v) for v in plan_history]
3402
+ if (migrated := _dict.get('migrated')) is not None:
3403
+ args['migrated'] = migrated
3404
+ if (extensions := _dict.get('extensions')) is not None:
3405
+ args['extensions'] = extensions
3406
+ if (controlled_by := _dict.get('controlled_by')) is not None:
3407
+ args['controlled_by'] = controlled_by
3408
+ if (locked := _dict.get('locked')) is not None:
3409
+ args['locked'] = locked
3410
+ return cls(**args)
3411
+
3412
+ @classmethod
3413
+ def _from_dict(cls, _dict):
3414
+ """Initialize a ResourceInstance object from a json dictionary."""
3415
+ return cls.from_dict(_dict)
3416
+
3417
+ def to_dict(self) -> Dict:
3418
+ """Return a json dictionary representing this model."""
3419
+ _dict = {}
3420
+ if hasattr(self, 'id') and self.id is not None:
3421
+ _dict['id'] = self.id
3422
+ if hasattr(self, 'guid') and self.guid is not None:
3423
+ _dict['guid'] = self.guid
3424
+ if hasattr(self, 'url') and self.url is not None:
3425
+ _dict['url'] = self.url
3426
+ if hasattr(self, 'created_at') and self.created_at is not None:
3427
+ _dict['created_at'] = datetime_to_string(self.created_at)
3428
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
3429
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
3430
+ if hasattr(self, 'deleted_at') and self.deleted_at is not None:
3431
+ _dict['deleted_at'] = datetime_to_string(self.deleted_at)
3432
+ if hasattr(self, 'created_by') and self.created_by is not None:
3433
+ _dict['created_by'] = self.created_by
3434
+ if hasattr(self, 'updated_by') and self.updated_by is not None:
3435
+ _dict['updated_by'] = self.updated_by
3436
+ if hasattr(self, 'deleted_by') and self.deleted_by is not None:
3437
+ _dict['deleted_by'] = self.deleted_by
3438
+ if hasattr(self, 'scheduled_reclaim_at') and self.scheduled_reclaim_at is not None:
3439
+ _dict['scheduled_reclaim_at'] = datetime_to_string(self.scheduled_reclaim_at)
3440
+ if hasattr(self, 'restored_at') and self.restored_at is not None:
3441
+ _dict['restored_at'] = datetime_to_string(self.restored_at)
3442
+ if hasattr(self, 'restored_by') and self.restored_by is not None:
3443
+ _dict['restored_by'] = self.restored_by
3444
+ if hasattr(self, 'scheduled_reclaim_by') and self.scheduled_reclaim_by is not None:
3445
+ _dict['scheduled_reclaim_by'] = self.scheduled_reclaim_by
3446
+ if hasattr(self, 'name') and self.name is not None:
3447
+ _dict['name'] = self.name
3448
+ if hasattr(self, 'region_id') and self.region_id is not None:
3449
+ _dict['region_id'] = self.region_id
3450
+ if hasattr(self, 'account_id') and self.account_id is not None:
3451
+ _dict['account_id'] = self.account_id
3452
+ if hasattr(self, 'reseller_channel_id') and self.reseller_channel_id is not None:
3453
+ _dict['reseller_channel_id'] = self.reseller_channel_id
3454
+ if hasattr(self, 'resource_plan_id') and self.resource_plan_id is not None:
3455
+ _dict['resource_plan_id'] = self.resource_plan_id
3456
+ if hasattr(self, 'resource_group_id') and self.resource_group_id is not None:
3457
+ _dict['resource_group_id'] = self.resource_group_id
3458
+ if hasattr(self, 'resource_group_crn') and self.resource_group_crn is not None:
3459
+ _dict['resource_group_crn'] = self.resource_group_crn
3460
+ if hasattr(self, 'target_crn') and self.target_crn is not None:
3461
+ _dict['target_crn'] = self.target_crn
3462
+ if hasattr(self, 'onetime_credentials') and self.onetime_credentials is not None:
3463
+ _dict['onetime_credentials'] = self.onetime_credentials
3464
+ if hasattr(self, 'parameters') and self.parameters is not None:
3465
+ _dict['parameters'] = self.parameters
3466
+ if hasattr(self, 'allow_cleanup') and self.allow_cleanup is not None:
3467
+ _dict['allow_cleanup'] = self.allow_cleanup
3468
+ if hasattr(self, 'crn') and self.crn is not None:
3469
+ _dict['crn'] = self.crn
3470
+ if hasattr(self, 'state') and self.state is not None:
3471
+ _dict['state'] = self.state
3472
+ if hasattr(self, 'type') and self.type is not None:
3473
+ _dict['type'] = self.type
3474
+ if hasattr(self, 'sub_type') and self.sub_type is not None:
3475
+ _dict['sub_type'] = self.sub_type
3476
+ if hasattr(self, 'resource_id') and self.resource_id is not None:
3477
+ _dict['resource_id'] = self.resource_id
3478
+ if hasattr(self, 'dashboard_url') and self.dashboard_url is not None:
3479
+ _dict['dashboard_url'] = self.dashboard_url
3480
+ if hasattr(self, 'last_operation') and self.last_operation is not None:
3481
+ if isinstance(self.last_operation, dict):
3482
+ _dict['last_operation'] = self.last_operation
3483
+ else:
3484
+ _dict['last_operation'] = self.last_operation.to_dict()
3485
+ if hasattr(self, 'resource_aliases_url') and self.resource_aliases_url is not None:
3486
+ _dict['resource_aliases_url'] = self.resource_aliases_url
3487
+ if hasattr(self, 'resource_bindings_url') and self.resource_bindings_url is not None:
3488
+ _dict['resource_bindings_url'] = self.resource_bindings_url
3489
+ if hasattr(self, 'resource_keys_url') and self.resource_keys_url is not None:
3490
+ _dict['resource_keys_url'] = self.resource_keys_url
3491
+ if hasattr(self, 'plan_history') and self.plan_history is not None:
3492
+ plan_history_list = []
3493
+ for v in self.plan_history:
3494
+ if isinstance(v, dict):
3495
+ plan_history_list.append(v)
3496
+ else:
3497
+ plan_history_list.append(v.to_dict())
3498
+ _dict['plan_history'] = plan_history_list
3499
+ if hasattr(self, 'migrated') and self.migrated is not None:
3500
+ _dict['migrated'] = self.migrated
3501
+ if hasattr(self, 'extensions') and self.extensions is not None:
3502
+ _dict['extensions'] = self.extensions
3503
+ if hasattr(self, 'controlled_by') and self.controlled_by is not None:
3504
+ _dict['controlled_by'] = self.controlled_by
3505
+ if hasattr(self, 'locked') and self.locked is not None:
3506
+ _dict['locked'] = self.locked
3507
+ return _dict
3508
+
3509
+ def _to_dict(self):
3510
+ """Return a json dictionary representing this model."""
3511
+ return self.to_dict()
3512
+
3513
+ def __str__(self) -> str:
3514
+ """Return a `str` version of this ResourceInstance object."""
3515
+ return json.dumps(self.to_dict(), indent=2)
3516
+
3517
+ def __eq__(self, other: 'ResourceInstance') -> bool:
3518
+ """Return `true` when self and other are equal, false otherwise."""
3519
+ if not isinstance(other, self.__class__):
3520
+ return False
3521
+ return self.__dict__ == other.__dict__
3522
+
3523
+ def __ne__(self, other: 'ResourceInstance') -> bool:
3524
+ """Return `true` when self and other are not equal, false otherwise."""
3525
+ return not self == other
3526
+
3527
+ class StateEnum(str, Enum):
3528
+ """
3529
+ The current state of the instance. For example, if the instance is deleted, it
3530
+ will return removed.
3531
+ """
3532
+
3533
+ ACTIVE = 'active'
3534
+ INACTIVE = 'inactive'
3535
+ REMOVED = 'removed'
3536
+ PENDING_REMOVAL = 'pending_removal'
3537
+ PENDING_RECLAMATION = 'pending_reclamation'
3538
+ FAILED = 'failed'
3539
+ PROVISIONING = 'provisioning'
3540
+ PRE_PROVISIONING = 'pre_provisioning'
3541
+
3542
+
3543
+ class ResourceInstanceLastOperation:
3544
+ """
3545
+ The status of the last operation requested on the instance.
3546
+
3547
+ :param str type: The last operation type of the resource instance.
3548
+ :param str state: The last operation state of the resoure instance. This
3549
+ indicates if the resource's last operation is in progress, succeeded or failed.
3550
+ :param str sub_type: (optional) The last operation sub type of the resoure
3551
+ instance.
3552
+ :param bool async_: A boolean that indicates if the resource is provisioned
3553
+ asynchronously or not.
3554
+ :param str description: The description of the status of last operation.
3555
+ :param str reason_code: (optional) Optional string that states the reason code
3556
+ for the last operation state change.
3557
+ :param float poll_after: (optional) A field which indicates the time after which
3558
+ the instance's last operation is to be polled.
3559
+ :param bool cancelable: A boolean that indicates if the resource's last
3560
+ operation is cancelable or not.
3561
+ :param bool poll: A boolean that indicates if the resource broker's last
3562
+ operation can be polled or not.
3563
+ """
3564
+
3565
+ # The set of defined properties for the class
3566
+ _properties = frozenset(
3567
+ [
3568
+ 'type',
3569
+ 'state',
3570
+ 'sub_type',
3571
+ 'async_',
3572
+ 'async',
3573
+ 'description',
3574
+ 'reason_code',
3575
+ 'poll_after',
3576
+ 'cancelable',
3577
+ 'poll',
3578
+ ]
3579
+ )
3580
+
3581
+ def __init__(
3582
+ self,
3583
+ type: str,
3584
+ state: str,
3585
+ async_: bool,
3586
+ description: str,
3587
+ cancelable: bool,
3588
+ poll: bool,
3589
+ *,
3590
+ sub_type: Optional[str] = None,
3591
+ reason_code: Optional[str] = None,
3592
+ poll_after: Optional[float] = None,
3593
+ **kwargs,
3594
+ ) -> None:
3595
+ """
3596
+ Initialize a ResourceInstanceLastOperation object.
3597
+
3598
+ :param str type: The last operation type of the resource instance.
3599
+ :param str state: The last operation state of the resoure instance. This
3600
+ indicates if the resource's last operation is in progress, succeeded or
3601
+ failed.
3602
+ :param bool async_: A boolean that indicates if the resource is provisioned
3603
+ asynchronously or not.
3604
+ :param str description: The description of the status of last operation.
3605
+ :param bool cancelable: A boolean that indicates if the resource's last
3606
+ operation is cancelable or not.
3607
+ :param bool poll: A boolean that indicates if the resource broker's last
3608
+ operation can be polled or not.
3609
+ :param str sub_type: (optional) The last operation sub type of the resoure
3610
+ instance.
3611
+ :param str reason_code: (optional) Optional string that states the reason
3612
+ code for the last operation state change.
3613
+ :param float poll_after: (optional) A field which indicates the time after
3614
+ which the instance's last operation is to be polled.
3615
+ :param **kwargs: (optional) Any additional properties.
3616
+ """
3617
+ self.type = type
3618
+ self.state = state
3619
+ self.sub_type = sub_type
3620
+ self.async_ = async_
3621
+ self.description = description
3622
+ self.reason_code = reason_code
3623
+ self.poll_after = poll_after
3624
+ self.cancelable = cancelable
3625
+ self.poll = poll
3626
+ for _key, _value in kwargs.items():
3627
+ setattr(self, _key, _value)
3628
+
3629
+ @classmethod
3630
+ def from_dict(cls, _dict: Dict) -> 'ResourceInstanceLastOperation':
3631
+ """Initialize a ResourceInstanceLastOperation object from a json dictionary."""
3632
+ args = {}
3633
+ if (type := _dict.get('type')) is not None:
3634
+ args['type'] = type
3635
+ else:
3636
+ raise ValueError('Required property \'type\' not present in ResourceInstanceLastOperation JSON')
3637
+ if (state := _dict.get('state')) is not None:
3638
+ args['state'] = state
3639
+ else:
3640
+ raise ValueError('Required property \'state\' not present in ResourceInstanceLastOperation JSON')
3641
+ if (sub_type := _dict.get('sub_type')) is not None:
3642
+ args['sub_type'] = sub_type
3643
+ if (async_ := _dict.get('async')) is not None:
3644
+ args['async_'] = async_
3645
+ else:
3646
+ raise ValueError('Required property \'async\' not present in ResourceInstanceLastOperation JSON')
3647
+ if (description := _dict.get('description')) is not None:
3648
+ args['description'] = description
3649
+ else:
3650
+ raise ValueError('Required property \'description\' not present in ResourceInstanceLastOperation JSON')
3651
+ if (reason_code := _dict.get('reason_code')) is not None:
3652
+ args['reason_code'] = reason_code
3653
+ if (poll_after := _dict.get('poll_after')) is not None:
3654
+ args['poll_after'] = poll_after
3655
+ if (cancelable := _dict.get('cancelable')) is not None:
3656
+ args['cancelable'] = cancelable
3657
+ else:
3658
+ raise ValueError('Required property \'cancelable\' not present in ResourceInstanceLastOperation JSON')
3659
+ if (poll := _dict.get('poll')) is not None:
3660
+ args['poll'] = poll
3661
+ else:
3662
+ raise ValueError('Required property \'poll\' not present in ResourceInstanceLastOperation JSON')
3663
+ args.update({k: v for (k, v) in _dict.items() if k not in cls._properties})
3664
+ return cls(**args)
3665
+
3666
+ @classmethod
3667
+ def _from_dict(cls, _dict):
3668
+ """Initialize a ResourceInstanceLastOperation object from a json dictionary."""
3669
+ return cls.from_dict(_dict)
3670
+
3671
+ def to_dict(self) -> Dict:
3672
+ """Return a json dictionary representing this model."""
3673
+ _dict = {}
3674
+ if hasattr(self, 'type') and self.type is not None:
3675
+ _dict['type'] = self.type
3676
+ if hasattr(self, 'state') and self.state is not None:
3677
+ _dict['state'] = self.state
3678
+ if hasattr(self, 'sub_type') and self.sub_type is not None:
3679
+ _dict['sub_type'] = self.sub_type
3680
+ if hasattr(self, 'async_') and self.async_ is not None:
3681
+ _dict['async'] = self.async_
3682
+ if hasattr(self, 'description') and self.description is not None:
3683
+ _dict['description'] = self.description
3684
+ if hasattr(self, 'reason_code') and self.reason_code is not None:
3685
+ _dict['reason_code'] = self.reason_code
3686
+ if hasattr(self, 'poll_after') and self.poll_after is not None:
3687
+ _dict['poll_after'] = self.poll_after
3688
+ if hasattr(self, 'cancelable') and self.cancelable is not None:
3689
+ _dict['cancelable'] = self.cancelable
3690
+ if hasattr(self, 'poll') and self.poll is not None:
3691
+ _dict['poll'] = self.poll
3692
+ for _key in [k for k in vars(self).keys() if k not in ResourceInstanceLastOperation._properties]:
3693
+ _dict[_key] = getattr(self, _key)
3694
+ return _dict
3695
+
3696
+ def _to_dict(self):
3697
+ """Return a json dictionary representing this model."""
3698
+ return self.to_dict()
3699
+
3700
+ def get_properties(self) -> Dict:
3701
+ """Return a dictionary of arbitrary properties from this instance of ResourceInstanceLastOperation"""
3702
+ _dict = {}
3703
+
3704
+ for _key in [k for k in vars(self).keys() if k not in ResourceInstanceLastOperation._properties]:
3705
+ _dict[_key] = getattr(self, _key)
3706
+ return _dict
3707
+
3708
+ def set_properties(self, _dict: dict):
3709
+ """Set a dictionary of arbitrary properties to this instance of ResourceInstanceLastOperation"""
3710
+ for _key in [k for k in vars(self).keys() if k not in ResourceInstanceLastOperation._properties]:
3711
+ delattr(self, _key)
3712
+
3713
+ for _key, _value in _dict.items():
3714
+ if _key not in ResourceInstanceLastOperation._properties:
3715
+ setattr(self, _key, _value)
3716
+
3717
+ def __str__(self) -> str:
3718
+ """Return a `str` version of this ResourceInstanceLastOperation object."""
3719
+ return json.dumps(self.to_dict(), indent=2)
3720
+
3721
+ def __eq__(self, other: 'ResourceInstanceLastOperation') -> bool:
3722
+ """Return `true` when self and other are equal, false otherwise."""
3723
+ if not isinstance(other, self.__class__):
3724
+ return False
3725
+ return self.__dict__ == other.__dict__
3726
+
3727
+ def __ne__(self, other: 'ResourceInstanceLastOperation') -> bool:
3728
+ """Return `true` when self and other are not equal, false otherwise."""
3729
+ return not self == other
3730
+
3731
+ class StateEnum(str, Enum):
3732
+ """
3733
+ The last operation state of the resoure instance. This indicates if the resource's
3734
+ last operation is in progress, succeeded or failed.
3735
+ """
3736
+
3737
+ IN_PROGRESS = 'in progress'
3738
+ SUCCEEDED = 'succeeded'
3739
+ FAILED = 'failed'
3740
+
3741
+
3742
+ class ResourceInstancesList:
3743
+ """
3744
+ A list of resource instances.
3745
+
3746
+ :param int rows_count: The number of resource instances in `resources`.
3747
+ :param str next_url: The URL for requesting the next page of results.
3748
+ :param List[ResourceInstance] resources: A list of resource instances.
3749
+ """
3750
+
3751
+ def __init__(
3752
+ self,
3753
+ rows_count: int,
3754
+ next_url: str,
3755
+ resources: List['ResourceInstance'],
3756
+ ) -> None:
3757
+ """
3758
+ Initialize a ResourceInstancesList object.
3759
+
3760
+ :param int rows_count: The number of resource instances in `resources`.
3761
+ :param str next_url: The URL for requesting the next page of results.
3762
+ :param List[ResourceInstance] resources: A list of resource instances.
3763
+ """
3764
+ self.rows_count = rows_count
3765
+ self.next_url = next_url
3766
+ self.resources = resources
3767
+
3768
+ @classmethod
3769
+ def from_dict(cls, _dict: Dict) -> 'ResourceInstancesList':
3770
+ """Initialize a ResourceInstancesList object from a json dictionary."""
3771
+ args = {}
3772
+ if (rows_count := _dict.get('rows_count')) is not None:
3773
+ args['rows_count'] = rows_count
3774
+ else:
3775
+ raise ValueError('Required property \'rows_count\' not present in ResourceInstancesList JSON')
3776
+ if (next_url := _dict.get('next_url')) is not None:
3777
+ args['next_url'] = next_url
3778
+ else:
3779
+ raise ValueError('Required property \'next_url\' not present in ResourceInstancesList JSON')
3780
+ if (resources := _dict.get('resources')) is not None:
3781
+ args['resources'] = [ResourceInstance.from_dict(v) for v in resources]
3782
+ else:
3783
+ raise ValueError('Required property \'resources\' not present in ResourceInstancesList JSON')
3784
+ return cls(**args)
3785
+
3786
+ @classmethod
3787
+ def _from_dict(cls, _dict):
3788
+ """Initialize a ResourceInstancesList object from a json dictionary."""
3789
+ return cls.from_dict(_dict)
3790
+
3791
+ def to_dict(self) -> Dict:
3792
+ """Return a json dictionary representing this model."""
3793
+ _dict = {}
3794
+ if hasattr(self, 'rows_count') and self.rows_count is not None:
3795
+ _dict['rows_count'] = self.rows_count
3796
+ if hasattr(self, 'next_url') and self.next_url is not None:
3797
+ _dict['next_url'] = self.next_url
3798
+ if hasattr(self, 'resources') and self.resources is not None:
3799
+ resources_list = []
3800
+ for v in self.resources:
3801
+ if isinstance(v, dict):
3802
+ resources_list.append(v)
3803
+ else:
3804
+ resources_list.append(v.to_dict())
3805
+ _dict['resources'] = resources_list
3806
+ return _dict
3807
+
3808
+ def _to_dict(self):
3809
+ """Return a json dictionary representing this model."""
3810
+ return self.to_dict()
3811
+
3812
+ def __str__(self) -> str:
3813
+ """Return a `str` version of this ResourceInstancesList object."""
3814
+ return json.dumps(self.to_dict(), indent=2)
3815
+
3816
+ def __eq__(self, other: 'ResourceInstancesList') -> bool:
3817
+ """Return `true` when self and other are equal, false otherwise."""
3818
+ if not isinstance(other, self.__class__):
3819
+ return False
3820
+ return self.__dict__ == other.__dict__
3821
+
3822
+ def __ne__(self, other: 'ResourceInstancesList') -> bool:
3823
+ """Return `true` when self and other are not equal, false otherwise."""
3824
+ return not self == other
3825
+
3826
+
3827
+ class ResourceKey:
3828
+ """
3829
+ A resource key.
3830
+
3831
+ :param str id: (optional) The ID associated with the key.
3832
+ :param str guid: (optional) The GUID of the key.
3833
+ :param str url: (optional) When you created a new key, a relative URL path is
3834
+ created identifying the location of the key.
3835
+ :param datetime created_at: (optional) The date when the key was created.
3836
+ :param datetime updated_at: (optional) The date when the key was last updated.
3837
+ :param datetime deleted_at: (optional) The date when the key was deleted.
3838
+ :param str created_by: (optional) The subject who created the key.
3839
+ :param str updated_by: (optional) The subject who updated the key.
3840
+ :param str deleted_by: (optional) The subject who deleted the key.
3841
+ :param str source_crn: (optional) The CRN of resource instance or alias
3842
+ associated to the key.
3843
+ :param str name: (optional) The human-readable name of the key.
3844
+ :param str crn: (optional) The full Cloud Resource Name (CRN) associated with
3845
+ the key. For more information about this format, see [Cloud Resource
3846
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
3847
+ :param str state: (optional) The state of the key.
3848
+ :param str account_id: (optional) An alpha-numeric value identifying the account
3849
+ ID.
3850
+ :param str resource_group_id: (optional) The ID of the resource group.
3851
+ :param str resource_id: (optional) The unique ID of the offering. This value is
3852
+ provided by and stored in the global catalog.
3853
+ :param bool onetime_credentials: (optional) Whether newly created resource key
3854
+ credentials can be retrieved by using get resource key or get a list of all of
3855
+ the resource keys requests.
3856
+ :param Credentials credentials: (optional) The credentials for the key.
3857
+ Additional key-value pairs are passed through from the resource brokers. After a
3858
+ credential is created for a service, it can be viewed at any time for users that
3859
+ need the API key value. However, all users must have the correct level of access
3860
+ to see the details of a credential that includes the API key value. For
3861
+ additional details, see [viewing a
3862
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui)
3863
+ or the service’s documentation.
3864
+ :param bool iam_compatible: (optional) Specifies whether the key’s credentials
3865
+ support IAM.
3866
+ :param bool migrated: (optional) A boolean that dictates if the alias was
3867
+ migrated from a previous CF instance.
3868
+ :param str resource_instance_url: (optional) The relative path to the resource.
3869
+ :param str resource_alias_url: (optional) The relative path to the resource
3870
+ alias that this binding is associated with.
3871
+ """
3872
+
3873
+ def __init__(
3874
+ self,
3875
+ *,
3876
+ id: Optional[str] = None,
3877
+ guid: Optional[str] = None,
3878
+ url: Optional[str] = None,
3879
+ created_at: Optional[datetime] = None,
3880
+ updated_at: Optional[datetime] = None,
3881
+ deleted_at: Optional[datetime] = None,
3882
+ created_by: Optional[str] = None,
3883
+ updated_by: Optional[str] = None,
3884
+ deleted_by: Optional[str] = None,
3885
+ source_crn: Optional[str] = None,
3886
+ name: Optional[str] = None,
3887
+ crn: Optional[str] = None,
3888
+ state: Optional[str] = None,
3889
+ account_id: Optional[str] = None,
3890
+ resource_group_id: Optional[str] = None,
3891
+ resource_id: Optional[str] = None,
3892
+ onetime_credentials: Optional[bool] = None,
3893
+ credentials: Optional['Credentials'] = None,
3894
+ iam_compatible: Optional[bool] = None,
3895
+ migrated: Optional[bool] = None,
3896
+ resource_instance_url: Optional[str] = None,
3897
+ resource_alias_url: Optional[str] = None,
3898
+ ) -> None:
3899
+ """
3900
+ Initialize a ResourceKey object.
3901
+
3902
+ :param str id: (optional) The ID associated with the key.
3903
+ :param str guid: (optional) The GUID of the key.
3904
+ :param str url: (optional) When you created a new key, a relative URL path
3905
+ is created identifying the location of the key.
3906
+ :param datetime created_at: (optional) The date when the key was created.
3907
+ :param datetime updated_at: (optional) The date when the key was last
3908
+ updated.
3909
+ :param datetime deleted_at: (optional) The date when the key was deleted.
3910
+ :param str created_by: (optional) The subject who created the key.
3911
+ :param str updated_by: (optional) The subject who updated the key.
3912
+ :param str deleted_by: (optional) The subject who deleted the key.
3913
+ :param str source_crn: (optional) The CRN of resource instance or alias
3914
+ associated to the key.
3915
+ :param str name: (optional) The human-readable name of the key.
3916
+ :param str crn: (optional) The full Cloud Resource Name (CRN) associated
3917
+ with the key. For more information about this format, see [Cloud Resource
3918
+ Names](https://cloud.ibm.com/docs/overview?topic=overview-crn).
3919
+ :param str state: (optional) The state of the key.
3920
+ :param str account_id: (optional) An alpha-numeric value identifying the
3921
+ account ID.
3922
+ :param str resource_group_id: (optional) The ID of the resource group.
3923
+ :param str resource_id: (optional) The unique ID of the offering. This
3924
+ value is provided by and stored in the global catalog.
3925
+ :param bool onetime_credentials: (optional) Whether newly created resource
3926
+ key credentials can be retrieved by using get resource key or get a list of
3927
+ all of the resource keys requests.
3928
+ :param Credentials credentials: (optional) The credentials for the key.
3929
+ Additional key-value pairs are passed through from the resource brokers.
3930
+ After a credential is created for a service, it can be viewed at any time
3931
+ for users that need the API key value. However, all users must have the
3932
+ correct level of access to see the details of a credential that includes
3933
+ the API key value. For additional details, see [viewing a
3934
+ credential](https://cloud.ibm.com/docs/account?topic=account-service_credentials&interface=ui#viewing-credentials-ui)
3935
+ or the service’s documentation.
3936
+ :param bool iam_compatible: (optional) Specifies whether the key’s
3937
+ credentials support IAM.
3938
+ :param bool migrated: (optional) A boolean that dictates if the alias was
3939
+ migrated from a previous CF instance.
3940
+ :param str resource_instance_url: (optional) The relative path to the
3941
+ resource.
3942
+ :param str resource_alias_url: (optional) The relative path to the resource
3943
+ alias that this binding is associated with.
3944
+ """
3945
+ self.id = id
3946
+ self.guid = guid
3947
+ self.url = url
3948
+ self.created_at = created_at
3949
+ self.updated_at = updated_at
3950
+ self.deleted_at = deleted_at
3951
+ self.created_by = created_by
3952
+ self.updated_by = updated_by
3953
+ self.deleted_by = deleted_by
3954
+ self.source_crn = source_crn
3955
+ self.name = name
3956
+ self.crn = crn
3957
+ self.state = state
3958
+ self.account_id = account_id
3959
+ self.resource_group_id = resource_group_id
3960
+ self.resource_id = resource_id
3961
+ self.onetime_credentials = onetime_credentials
3962
+ self.credentials = credentials
3963
+ self.iam_compatible = iam_compatible
3964
+ self.migrated = migrated
3965
+ self.resource_instance_url = resource_instance_url
3966
+ self.resource_alias_url = resource_alias_url
3967
+
3968
+ @classmethod
3969
+ def from_dict(cls, _dict: Dict) -> 'ResourceKey':
3970
+ """Initialize a ResourceKey object from a json dictionary."""
3971
+ args = {}
3972
+ if (id := _dict.get('id')) is not None:
3973
+ args['id'] = id
3974
+ if (guid := _dict.get('guid')) is not None:
3975
+ args['guid'] = guid
3976
+ if (url := _dict.get('url')) is not None:
3977
+ args['url'] = url
3978
+ if (created_at := _dict.get('created_at')) is not None:
3979
+ args['created_at'] = string_to_datetime(created_at)
3980
+ if (updated_at := _dict.get('updated_at')) is not None:
3981
+ args['updated_at'] = string_to_datetime(updated_at)
3982
+ if (deleted_at := _dict.get('deleted_at')) is not None:
3983
+ args['deleted_at'] = string_to_datetime(deleted_at)
3984
+ if (created_by := _dict.get('created_by')) is not None:
3985
+ args['created_by'] = created_by
3986
+ if (updated_by := _dict.get('updated_by')) is not None:
3987
+ args['updated_by'] = updated_by
3988
+ if (deleted_by := _dict.get('deleted_by')) is not None:
3989
+ args['deleted_by'] = deleted_by
3990
+ if (source_crn := _dict.get('source_crn')) is not None:
3991
+ args['source_crn'] = source_crn
3992
+ if (name := _dict.get('name')) is not None:
3993
+ args['name'] = name
3994
+ if (crn := _dict.get('crn')) is not None:
3995
+ args['crn'] = crn
3996
+ if (state := _dict.get('state')) is not None:
3997
+ args['state'] = state
3998
+ if (account_id := _dict.get('account_id')) is not None:
3999
+ args['account_id'] = account_id
4000
+ if (resource_group_id := _dict.get('resource_group_id')) is not None:
4001
+ args['resource_group_id'] = resource_group_id
4002
+ if (resource_id := _dict.get('resource_id')) is not None:
4003
+ args['resource_id'] = resource_id
4004
+ if (onetime_credentials := _dict.get('onetime_credentials')) is not None:
4005
+ args['onetime_credentials'] = onetime_credentials
4006
+ if (credentials := _dict.get('credentials')) is not None:
4007
+ args['credentials'] = Credentials.from_dict(credentials)
4008
+ if (iam_compatible := _dict.get('iam_compatible')) is not None:
4009
+ args['iam_compatible'] = iam_compatible
4010
+ if (migrated := _dict.get('migrated')) is not None:
4011
+ args['migrated'] = migrated
4012
+ if (resource_instance_url := _dict.get('resource_instance_url')) is not None:
4013
+ args['resource_instance_url'] = resource_instance_url
4014
+ if (resource_alias_url := _dict.get('resource_alias_url')) is not None:
4015
+ args['resource_alias_url'] = resource_alias_url
4016
+ return cls(**args)
4017
+
4018
+ @classmethod
4019
+ def _from_dict(cls, _dict):
4020
+ """Initialize a ResourceKey object from a json dictionary."""
4021
+ return cls.from_dict(_dict)
4022
+
4023
+ def to_dict(self) -> Dict:
4024
+ """Return a json dictionary representing this model."""
4025
+ _dict = {}
4026
+ if hasattr(self, 'id') and self.id is not None:
4027
+ _dict['id'] = self.id
4028
+ if hasattr(self, 'guid') and self.guid is not None:
4029
+ _dict['guid'] = self.guid
4030
+ if hasattr(self, 'url') and self.url is not None:
4031
+ _dict['url'] = self.url
4032
+ if hasattr(self, 'created_at') and self.created_at is not None:
4033
+ _dict['created_at'] = datetime_to_string(self.created_at)
4034
+ if hasattr(self, 'updated_at') and self.updated_at is not None:
4035
+ _dict['updated_at'] = datetime_to_string(self.updated_at)
4036
+ if hasattr(self, 'deleted_at') and self.deleted_at is not None:
4037
+ _dict['deleted_at'] = datetime_to_string(self.deleted_at)
4038
+ if hasattr(self, 'created_by') and self.created_by is not None:
4039
+ _dict['created_by'] = self.created_by
4040
+ if hasattr(self, 'updated_by') and self.updated_by is not None:
4041
+ _dict['updated_by'] = self.updated_by
4042
+ if hasattr(self, 'deleted_by') and self.deleted_by is not None:
4043
+ _dict['deleted_by'] = self.deleted_by
4044
+ if hasattr(self, 'source_crn') and self.source_crn is not None:
4045
+ _dict['source_crn'] = self.source_crn
4046
+ if hasattr(self, 'name') and self.name is not None:
4047
+ _dict['name'] = self.name
4048
+ if hasattr(self, 'crn') and self.crn is not None:
4049
+ _dict['crn'] = self.crn
4050
+ if hasattr(self, 'state') and self.state is not None:
4051
+ _dict['state'] = self.state
4052
+ if hasattr(self, 'account_id') and self.account_id is not None:
4053
+ _dict['account_id'] = self.account_id
4054
+ if hasattr(self, 'resource_group_id') and self.resource_group_id is not None:
4055
+ _dict['resource_group_id'] = self.resource_group_id
4056
+ if hasattr(self, 'resource_id') and self.resource_id is not None:
4057
+ _dict['resource_id'] = self.resource_id
4058
+ if hasattr(self, 'onetime_credentials') and self.onetime_credentials is not None:
4059
+ _dict['onetime_credentials'] = self.onetime_credentials
4060
+ if hasattr(self, 'credentials') and self.credentials is not None:
4061
+ if isinstance(self.credentials, dict):
4062
+ _dict['credentials'] = self.credentials
4063
+ else:
4064
+ _dict['credentials'] = self.credentials.to_dict()
4065
+ if hasattr(self, 'iam_compatible') and self.iam_compatible is not None:
4066
+ _dict['iam_compatible'] = self.iam_compatible
4067
+ if hasattr(self, 'migrated') and self.migrated is not None:
4068
+ _dict['migrated'] = self.migrated
4069
+ if hasattr(self, 'resource_instance_url') and self.resource_instance_url is not None:
4070
+ _dict['resource_instance_url'] = self.resource_instance_url
4071
+ if hasattr(self, 'resource_alias_url') and self.resource_alias_url is not None:
4072
+ _dict['resource_alias_url'] = self.resource_alias_url
4073
+ return _dict
4074
+
4075
+ def _to_dict(self):
4076
+ """Return a json dictionary representing this model."""
4077
+ return self.to_dict()
4078
+
4079
+ def __str__(self) -> str:
4080
+ """Return a `str` version of this ResourceKey object."""
4081
+ return json.dumps(self.to_dict(), indent=2)
4082
+
4083
+ def __eq__(self, other: 'ResourceKey') -> bool:
4084
+ """Return `true` when self and other are equal, false otherwise."""
4085
+ if not isinstance(other, self.__class__):
4086
+ return False
4087
+ return self.__dict__ == other.__dict__
4088
+
4089
+ def __ne__(self, other: 'ResourceKey') -> bool:
4090
+ """Return `true` when self and other are not equal, false otherwise."""
4091
+ return not self == other
4092
+
4093
+
4094
+ class ResourceKeyPostParameters:
4095
+ """
4096
+ Configuration options represented as key-value pairs. Service defined options are
4097
+ passed through to the target resource brokers, whereas platform defined options are
4098
+ not.
4099
+
4100
+ :param str serviceid_crn: (optional) An optional platform defined option to
4101
+ reuse an existing IAM serviceId for the role assignment.
4102
+ """
4103
+
4104
+ # The set of defined properties for the class
4105
+ _properties = frozenset(['serviceid_crn'])
4106
+
4107
+ def __init__(
4108
+ self,
4109
+ *,
4110
+ serviceid_crn: Optional[str] = None,
4111
+ **kwargs,
4112
+ ) -> None:
4113
+ """
4114
+ Initialize a ResourceKeyPostParameters object.
4115
+
4116
+ :param str serviceid_crn: (optional) An optional platform defined option to
4117
+ reuse an existing IAM serviceId for the role assignment.
4118
+ :param **kwargs: (optional) Any additional properties.
4119
+ """
4120
+ self.serviceid_crn = serviceid_crn
4121
+ for _key, _value in kwargs.items():
4122
+ setattr(self, _key, _value)
4123
+
4124
+ @classmethod
4125
+ def from_dict(cls, _dict: Dict) -> 'ResourceKeyPostParameters':
4126
+ """Initialize a ResourceKeyPostParameters object from a json dictionary."""
4127
+ args = {}
4128
+ if (serviceid_crn := _dict.get('serviceid_crn')) is not None:
4129
+ args['serviceid_crn'] = serviceid_crn
4130
+ args.update({k: v for (k, v) in _dict.items() if k not in cls._properties})
4131
+ return cls(**args)
4132
+
4133
+ @classmethod
4134
+ def _from_dict(cls, _dict):
4135
+ """Initialize a ResourceKeyPostParameters object from a json dictionary."""
4136
+ return cls.from_dict(_dict)
4137
+
4138
+ def to_dict(self) -> Dict:
4139
+ """Return a json dictionary representing this model."""
4140
+ _dict = {}
4141
+ if hasattr(self, 'serviceid_crn') and self.serviceid_crn is not None:
4142
+ _dict['serviceid_crn'] = self.serviceid_crn
4143
+ for _key in [k for k in vars(self).keys() if k not in ResourceKeyPostParameters._properties]:
4144
+ _dict[_key] = getattr(self, _key)
4145
+ return _dict
4146
+
4147
+ def _to_dict(self):
4148
+ """Return a json dictionary representing this model."""
4149
+ return self.to_dict()
4150
+
4151
+ def get_properties(self) -> Dict:
4152
+ """Return a dictionary of arbitrary properties from this instance of ResourceKeyPostParameters"""
4153
+ _dict = {}
4154
+
4155
+ for _key in [k for k in vars(self).keys() if k not in ResourceKeyPostParameters._properties]:
4156
+ _dict[_key] = getattr(self, _key)
4157
+ return _dict
4158
+
4159
+ def set_properties(self, _dict: dict):
4160
+ """Set a dictionary of arbitrary properties to this instance of ResourceKeyPostParameters"""
4161
+ for _key in [k for k in vars(self).keys() if k not in ResourceKeyPostParameters._properties]:
4162
+ delattr(self, _key)
4163
+
4164
+ for _key, _value in _dict.items():
4165
+ if _key not in ResourceKeyPostParameters._properties:
4166
+ setattr(self, _key, _value)
4167
+
4168
+ def __str__(self) -> str:
4169
+ """Return a `str` version of this ResourceKeyPostParameters object."""
4170
+ return json.dumps(self.to_dict(), indent=2)
4171
+
4172
+ def __eq__(self, other: 'ResourceKeyPostParameters') -> bool:
4173
+ """Return `true` when self and other are equal, false otherwise."""
4174
+ if not isinstance(other, self.__class__):
4175
+ return False
4176
+ return self.__dict__ == other.__dict__
4177
+
4178
+ def __ne__(self, other: 'ResourceKeyPostParameters') -> bool:
4179
+ """Return `true` when self and other are not equal, false otherwise."""
4180
+ return not self == other
4181
+
4182
+
4183
+ class ResourceKeysList:
4184
+ """
4185
+ A list of resource keys.
4186
+
4187
+ :param int rows_count: The number of resource keys in `resources`.
4188
+ :param str next_url: The URL for requesting the next page of results.
4189
+ :param List[ResourceKey] resources: A list of resource keys.
4190
+ """
4191
+
4192
+ def __init__(
4193
+ self,
4194
+ rows_count: int,
4195
+ next_url: str,
4196
+ resources: List['ResourceKey'],
4197
+ ) -> None:
4198
+ """
4199
+ Initialize a ResourceKeysList object.
4200
+
4201
+ :param int rows_count: The number of resource keys in `resources`.
4202
+ :param str next_url: The URL for requesting the next page of results.
4203
+ :param List[ResourceKey] resources: A list of resource keys.
4204
+ """
4205
+ self.rows_count = rows_count
4206
+ self.next_url = next_url
4207
+ self.resources = resources
4208
+
4209
+ @classmethod
4210
+ def from_dict(cls, _dict: Dict) -> 'ResourceKeysList':
4211
+ """Initialize a ResourceKeysList object from a json dictionary."""
4212
+ args = {}
4213
+ if (rows_count := _dict.get('rows_count')) is not None:
4214
+ args['rows_count'] = rows_count
4215
+ else:
4216
+ raise ValueError('Required property \'rows_count\' not present in ResourceKeysList JSON')
4217
+ if (next_url := _dict.get('next_url')) is not None:
4218
+ args['next_url'] = next_url
4219
+ else:
4220
+ raise ValueError('Required property \'next_url\' not present in ResourceKeysList JSON')
4221
+ if (resources := _dict.get('resources')) is not None:
4222
+ args['resources'] = [ResourceKey.from_dict(v) for v in resources]
4223
+ else:
4224
+ raise ValueError('Required property \'resources\' not present in ResourceKeysList JSON')
4225
+ return cls(**args)
4226
+
4227
+ @classmethod
4228
+ def _from_dict(cls, _dict):
4229
+ """Initialize a ResourceKeysList object from a json dictionary."""
4230
+ return cls.from_dict(_dict)
4231
+
4232
+ def to_dict(self) -> Dict:
4233
+ """Return a json dictionary representing this model."""
4234
+ _dict = {}
4235
+ if hasattr(self, 'rows_count') and self.rows_count is not None:
4236
+ _dict['rows_count'] = self.rows_count
4237
+ if hasattr(self, 'next_url') and self.next_url is not None:
4238
+ _dict['next_url'] = self.next_url
4239
+ if hasattr(self, 'resources') and self.resources is not None:
4240
+ resources_list = []
4241
+ for v in self.resources:
4242
+ if isinstance(v, dict):
4243
+ resources_list.append(v)
4244
+ else:
4245
+ resources_list.append(v.to_dict())
4246
+ _dict['resources'] = resources_list
4247
+ return _dict
4248
+
4249
+ def _to_dict(self):
4250
+ """Return a json dictionary representing this model."""
4251
+ return self.to_dict()
4252
+
4253
+ def __str__(self) -> str:
4254
+ """Return a `str` version of this ResourceKeysList object."""
4255
+ return json.dumps(self.to_dict(), indent=2)
4256
+
4257
+ def __eq__(self, other: 'ResourceKeysList') -> bool:
4258
+ """Return `true` when self and other are equal, false otherwise."""
4259
+ if not isinstance(other, self.__class__):
4260
+ return False
4261
+ return self.__dict__ == other.__dict__
4262
+
4263
+ def __ne__(self, other: 'ResourceKeysList') -> bool:
4264
+ """Return `true` when self and other are not equal, false otherwise."""
4265
+ return not self == other
4266
+
4267
+
4268
+ ##############################################################################
4269
+ # Pagers
4270
+ ##############################################################################
4271
+
4272
+
4273
+ class ResourceInstancesPager:
4274
+ """
4275
+ ResourceInstancesPager can be used to simplify the use of the "list_resource_instances" method.
4276
+ """
4277
+
4278
+ def __init__(
4279
+ self,
4280
+ *,
4281
+ client: ResourceControllerV2,
4282
+ guid: str = None,
4283
+ name: str = None,
4284
+ resource_group_id: str = None,
4285
+ resource_id: str = None,
4286
+ resource_plan_id: str = None,
4287
+ type: str = None,
4288
+ sub_type: str = None,
4289
+ limit: int = None,
4290
+ state: str = None,
4291
+ updated_from: str = None,
4292
+ updated_to: str = None,
4293
+ ) -> None:
4294
+ """
4295
+ Initialize a ResourceInstancesPager object.
4296
+ :param str guid: (optional) The GUID of the instance.
4297
+ :param str name: (optional) The human-readable name of the instance.
4298
+ :param str resource_group_id: (optional) The ID of the resource group.
4299
+ :param str resource_id: (optional) The unique ID of the offering. This
4300
+ value is provided by and stored in the global catalog.
4301
+ :param str resource_plan_id: (optional) The unique ID of the plan
4302
+ associated with the offering. This value is provided by and stored in the
4303
+ global catalog.
4304
+ :param str type: (optional) The type of the instance, for example,
4305
+ `service_instance`.
4306
+ :param str sub_type: (optional) The sub-type of instance, for example,
4307
+ `kms`.
4308
+ :param int limit: (optional) Limit on how many items should be returned.
4309
+ :param str state: (optional) The state of the instance. If not specified,
4310
+ instances in state `active` and `provisioning` are returned.
4311
+ :param str updated_from: (optional) Start date inclusive filter.
4312
+ :param str updated_to: (optional) End date inclusive filter.
4313
+ """
4314
+ self._has_next = True
4315
+ self._client = client
4316
+ self._page_context = {'next': None}
4317
+ self._guid = guid
4318
+ self._name = name
4319
+ self._resource_group_id = resource_group_id
4320
+ self._resource_id = resource_id
4321
+ self._resource_plan_id = resource_plan_id
4322
+ self._type = type
4323
+ self._sub_type = sub_type
4324
+ self._limit = limit
4325
+ self._state = state
4326
+ self._updated_from = updated_from
4327
+ self._updated_to = updated_to
4328
+
4329
+ def has_next(self) -> bool:
4330
+ """
4331
+ Returns true if there are potentially more results to be retrieved.
4332
+ """
4333
+ return self._has_next
4334
+
4335
+ def get_next(self) -> List[dict]:
4336
+ """
4337
+ Returns the next page of results.
4338
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceInstance.
4339
+ :rtype: List[dict]
4340
+ """
4341
+ if not self.has_next():
4342
+ raise StopIteration(message='No more results available')
4343
+
4344
+ result = self._client.list_resource_instances(
4345
+ guid=self._guid,
4346
+ name=self._name,
4347
+ resource_group_id=self._resource_group_id,
4348
+ resource_id=self._resource_id,
4349
+ resource_plan_id=self._resource_plan_id,
4350
+ type=self._type,
4351
+ sub_type=self._sub_type,
4352
+ limit=self._limit,
4353
+ state=self._state,
4354
+ updated_from=self._updated_from,
4355
+ updated_to=self._updated_to,
4356
+ start=self._page_context.get('next'),
4357
+ ).get_result()
4358
+
4359
+ next = None
4360
+ next_page_link = result.get('next_url')
4361
+ if next_page_link is not None:
4362
+ next = get_query_param(next_page_link, 'start')
4363
+ self._page_context['next'] = next
4364
+ if next is None:
4365
+ self._has_next = False
4366
+
4367
+ return result.get('resources')
4368
+
4369
+ def get_all(self) -> List[dict]:
4370
+ """
4371
+ Returns all results by invoking get_next() repeatedly
4372
+ until all pages of results have been retrieved.
4373
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceInstance.
4374
+ :rtype: List[dict]
4375
+ """
4376
+ results = []
4377
+ while self.has_next():
4378
+ next_page = self.get_next()
4379
+ results.extend(next_page)
4380
+ return results
4381
+
4382
+
4383
+ class ResourceAliasesForInstancePager:
4384
+ """
4385
+ ResourceAliasesForInstancePager can be used to simplify the use of the "list_resource_aliases_for_instance" method.
4386
+ """
4387
+
4388
+ def __init__(
4389
+ self,
4390
+ *,
4391
+ client: ResourceControllerV2,
4392
+ id: str,
4393
+ limit: int = None,
4394
+ ) -> None:
4395
+ """
4396
+ Initialize a ResourceAliasesForInstancePager object.
4397
+ :param str id: The resource instance URL-encoded CRN or GUID.
4398
+ :param int limit: (optional) Limit on how many items should be returned.
4399
+ """
4400
+ self._has_next = True
4401
+ self._client = client
4402
+ self._page_context = {'next': None}
4403
+ self._id = id
4404
+ self._limit = limit
4405
+
4406
+ def has_next(self) -> bool:
4407
+ """
4408
+ Returns true if there are potentially more results to be retrieved.
4409
+ """
4410
+ return self._has_next
4411
+
4412
+ def get_next(self) -> List[dict]:
4413
+ """
4414
+ Returns the next page of results.
4415
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceAlias.
4416
+ :rtype: List[dict]
4417
+ """
4418
+ if not self.has_next():
4419
+ raise StopIteration(message='No more results available')
4420
+
4421
+ result = self._client.list_resource_aliases_for_instance(
4422
+ id=self._id,
4423
+ limit=self._limit,
4424
+ start=self._page_context.get('next'),
4425
+ ).get_result()
4426
+
4427
+ next = None
4428
+ next_page_link = result.get('next_url')
4429
+ if next_page_link is not None:
4430
+ next = get_query_param(next_page_link, 'start')
4431
+ self._page_context['next'] = next
4432
+ if next is None:
4433
+ self._has_next = False
4434
+
4435
+ return result.get('resources')
4436
+
4437
+ def get_all(self) -> List[dict]:
4438
+ """
4439
+ Returns all results by invoking get_next() repeatedly
4440
+ until all pages of results have been retrieved.
4441
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceAlias.
4442
+ :rtype: List[dict]
4443
+ """
4444
+ results = []
4445
+ while self.has_next():
4446
+ next_page = self.get_next()
4447
+ results.extend(next_page)
4448
+ return results
4449
+
4450
+
4451
+ class ResourceKeysForInstancePager:
4452
+ """
4453
+ ResourceKeysForInstancePager can be used to simplify the use of the "list_resource_keys_for_instance" method.
4454
+ """
4455
+
4456
+ def __init__(
4457
+ self,
4458
+ *,
4459
+ client: ResourceControllerV2,
4460
+ id: str,
4461
+ limit: int = None,
4462
+ ) -> None:
4463
+ """
4464
+ Initialize a ResourceKeysForInstancePager object.
4465
+ :param str id: The resource instance URL-encoded CRN or GUID.
4466
+ :param int limit: (optional) Limit on how many items should be returned.
4467
+ """
4468
+ self._has_next = True
4469
+ self._client = client
4470
+ self._page_context = {'next': None}
4471
+ self._id = id
4472
+ self._limit = limit
4473
+
4474
+ def has_next(self) -> bool:
4475
+ """
4476
+ Returns true if there are potentially more results to be retrieved.
4477
+ """
4478
+ return self._has_next
4479
+
4480
+ def get_next(self) -> List[dict]:
4481
+ """
4482
+ Returns the next page of results.
4483
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceKey.
4484
+ :rtype: List[dict]
4485
+ """
4486
+ if not self.has_next():
4487
+ raise StopIteration(message='No more results available')
4488
+
4489
+ result = self._client.list_resource_keys_for_instance(
4490
+ id=self._id,
4491
+ limit=self._limit,
4492
+ start=self._page_context.get('next'),
4493
+ ).get_result()
4494
+
4495
+ next = None
4496
+ next_page_link = result.get('next_url')
4497
+ if next_page_link is not None:
4498
+ next = get_query_param(next_page_link, 'start')
4499
+ self._page_context['next'] = next
4500
+ if next is None:
4501
+ self._has_next = False
4502
+
4503
+ return result.get('resources')
4504
+
4505
+ def get_all(self) -> List[dict]:
4506
+ """
4507
+ Returns all results by invoking get_next() repeatedly
4508
+ until all pages of results have been retrieved.
4509
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceKey.
4510
+ :rtype: List[dict]
4511
+ """
4512
+ results = []
4513
+ while self.has_next():
4514
+ next_page = self.get_next()
4515
+ results.extend(next_page)
4516
+ return results
4517
+
4518
+
4519
+ class ResourceKeysPager:
4520
+ """
4521
+ ResourceKeysPager can be used to simplify the use of the "list_resource_keys" method.
4522
+ """
4523
+
4524
+ def __init__(
4525
+ self,
4526
+ *,
4527
+ client: ResourceControllerV2,
4528
+ guid: str = None,
4529
+ name: str = None,
4530
+ resource_group_id: str = None,
4531
+ resource_id: str = None,
4532
+ limit: int = None,
4533
+ updated_from: str = None,
4534
+ updated_to: str = None,
4535
+ ) -> None:
4536
+ """
4537
+ Initialize a ResourceKeysPager object.
4538
+ :param str guid: (optional) The GUID of the key.
4539
+ :param str name: (optional) The human-readable name of the key.
4540
+ :param str resource_group_id: (optional) The ID of the resource group.
4541
+ :param str resource_id: (optional) The unique ID of the offering. This
4542
+ value is provided by and stored in the global catalog.
4543
+ :param int limit: (optional) Limit on how many items should be returned.
4544
+ :param str updated_from: (optional) Start date inclusive filter.
4545
+ :param str updated_to: (optional) End date inclusive filter.
4546
+ """
4547
+ self._has_next = True
4548
+ self._client = client
4549
+ self._page_context = {'next': None}
4550
+ self._guid = guid
4551
+ self._name = name
4552
+ self._resource_group_id = resource_group_id
4553
+ self._resource_id = resource_id
4554
+ self._limit = limit
4555
+ self._updated_from = updated_from
4556
+ self._updated_to = updated_to
4557
+
4558
+ def has_next(self) -> bool:
4559
+ """
4560
+ Returns true if there are potentially more results to be retrieved.
4561
+ """
4562
+ return self._has_next
4563
+
4564
+ def get_next(self) -> List[dict]:
4565
+ """
4566
+ Returns the next page of results.
4567
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceKey.
4568
+ :rtype: List[dict]
4569
+ """
4570
+ if not self.has_next():
4571
+ raise StopIteration(message='No more results available')
4572
+
4573
+ result = self._client.list_resource_keys(
4574
+ guid=self._guid,
4575
+ name=self._name,
4576
+ resource_group_id=self._resource_group_id,
4577
+ resource_id=self._resource_id,
4578
+ limit=self._limit,
4579
+ updated_from=self._updated_from,
4580
+ updated_to=self._updated_to,
4581
+ start=self._page_context.get('next'),
4582
+ ).get_result()
4583
+
4584
+ next = None
4585
+ next_page_link = result.get('next_url')
4586
+ if next_page_link is not None:
4587
+ next = get_query_param(next_page_link, 'start')
4588
+ self._page_context['next'] = next
4589
+ if next is None:
4590
+ self._has_next = False
4591
+
4592
+ return result.get('resources')
4593
+
4594
+ def get_all(self) -> List[dict]:
4595
+ """
4596
+ Returns all results by invoking get_next() repeatedly
4597
+ until all pages of results have been retrieved.
4598
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceKey.
4599
+ :rtype: List[dict]
4600
+ """
4601
+ results = []
4602
+ while self.has_next():
4603
+ next_page = self.get_next()
4604
+ results.extend(next_page)
4605
+ return results
4606
+
4607
+
4608
+ class ResourceBindingsPager:
4609
+ """
4610
+ ResourceBindingsPager can be used to simplify the use of the "list_resource_bindings" method.
4611
+ """
4612
+
4613
+ def __init__(
4614
+ self,
4615
+ *,
4616
+ client: ResourceControllerV2,
4617
+ guid: str = None,
4618
+ name: str = None,
4619
+ resource_group_id: str = None,
4620
+ resource_id: str = None,
4621
+ region_binding_id: str = None,
4622
+ limit: int = None,
4623
+ updated_from: str = None,
4624
+ updated_to: str = None,
4625
+ ) -> None:
4626
+ """
4627
+ Initialize a ResourceBindingsPager object.
4628
+ :param str guid: (optional) The GUID of the binding.
4629
+ :param str name: (optional) The human-readable name of the binding.
4630
+ :param str resource_group_id: (optional) The ID of the resource group.
4631
+ :param str resource_id: (optional) The unique ID of the offering (service
4632
+ name). This value is provided by and stored in the global catalog.
4633
+ :param str region_binding_id: (optional) The ID of the binding in the
4634
+ target environment. For example, `service_binding_id` in a given IBM Cloud
4635
+ environment.
4636
+ :param int limit: (optional) Limit on how many items should be returned.
4637
+ :param str updated_from: (optional) Start date inclusive filter.
4638
+ :param str updated_to: (optional) End date inclusive filter.
4639
+ """
4640
+ self._has_next = True
4641
+ self._client = client
4642
+ self._page_context = {'next': None}
4643
+ self._guid = guid
4644
+ self._name = name
4645
+ self._resource_group_id = resource_group_id
4646
+ self._resource_id = resource_id
4647
+ self._region_binding_id = region_binding_id
4648
+ self._limit = limit
4649
+ self._updated_from = updated_from
4650
+ self._updated_to = updated_to
4651
+
4652
+ def has_next(self) -> bool:
4653
+ """
4654
+ Returns true if there are potentially more results to be retrieved.
4655
+ """
4656
+ return self._has_next
4657
+
4658
+ def get_next(self) -> List[dict]:
4659
+ """
4660
+ Returns the next page of results.
4661
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceBinding.
4662
+ :rtype: List[dict]
4663
+ """
4664
+ if not self.has_next():
4665
+ raise StopIteration(message='No more results available')
4666
+
4667
+ result = self._client.list_resource_bindings(
4668
+ guid=self._guid,
4669
+ name=self._name,
4670
+ resource_group_id=self._resource_group_id,
4671
+ resource_id=self._resource_id,
4672
+ region_binding_id=self._region_binding_id,
4673
+ limit=self._limit,
4674
+ updated_from=self._updated_from,
4675
+ updated_to=self._updated_to,
4676
+ start=self._page_context.get('next'),
4677
+ ).get_result()
4678
+
4679
+ next = None
4680
+ next_page_link = result.get('next_url')
4681
+ if next_page_link is not None:
4682
+ next = get_query_param(next_page_link, 'start')
4683
+ self._page_context['next'] = next
4684
+ if next is None:
4685
+ self._has_next = False
4686
+
4687
+ return result.get('resources')
4688
+
4689
+ def get_all(self) -> List[dict]:
4690
+ """
4691
+ Returns all results by invoking get_next() repeatedly
4692
+ until all pages of results have been retrieved.
4693
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceBinding.
4694
+ :rtype: List[dict]
4695
+ """
4696
+ results = []
4697
+ while self.has_next():
4698
+ next_page = self.get_next()
4699
+ results.extend(next_page)
4700
+ return results
4701
+
4702
+
4703
+ class ResourceAliasesPager:
4704
+ """
4705
+ ResourceAliasesPager can be used to simplify the use of the "list_resource_aliases" method.
4706
+ """
4707
+
4708
+ def __init__(
4709
+ self,
4710
+ *,
4711
+ client: ResourceControllerV2,
4712
+ guid: str = None,
4713
+ name: str = None,
4714
+ resource_instance_id: str = None,
4715
+ region_instance_id: str = None,
4716
+ resource_id: str = None,
4717
+ resource_group_id: str = None,
4718
+ limit: int = None,
4719
+ updated_from: str = None,
4720
+ updated_to: str = None,
4721
+ ) -> None:
4722
+ """
4723
+ Initialize a ResourceAliasesPager object.
4724
+ :param str guid: (optional) The GUID of the alias.
4725
+ :param str name: (optional) The human-readable name of the alias.
4726
+ :param str resource_instance_id: (optional) The ID of the resource
4727
+ instance.
4728
+ :param str region_instance_id: (optional) The ID of the instance in the
4729
+ target environment. For example, `service_instance_id` in a given IBM Cloud
4730
+ environment.
4731
+ :param str resource_id: (optional) The unique ID of the offering (service
4732
+ name). This value is provided by and stored in the global catalog.
4733
+ :param str resource_group_id: (optional) The ID of the resource group.
4734
+ :param int limit: (optional) Limit on how many items should be returned.
4735
+ :param str updated_from: (optional) Start date inclusive filter.
4736
+ :param str updated_to: (optional) End date inclusive filter.
4737
+ """
4738
+ self._has_next = True
4739
+ self._client = client
4740
+ self._page_context = {'next': None}
4741
+ self._guid = guid
4742
+ self._name = name
4743
+ self._resource_instance_id = resource_instance_id
4744
+ self._region_instance_id = region_instance_id
4745
+ self._resource_id = resource_id
4746
+ self._resource_group_id = resource_group_id
4747
+ self._limit = limit
4748
+ self._updated_from = updated_from
4749
+ self._updated_to = updated_to
4750
+
4751
+ def has_next(self) -> bool:
4752
+ """
4753
+ Returns true if there are potentially more results to be retrieved.
4754
+ """
4755
+ return self._has_next
4756
+
4757
+ def get_next(self) -> List[dict]:
4758
+ """
4759
+ Returns the next page of results.
4760
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceAlias.
4761
+ :rtype: List[dict]
4762
+ """
4763
+ if not self.has_next():
4764
+ raise StopIteration(message='No more results available')
4765
+
4766
+ result = self._client.list_resource_aliases(
4767
+ guid=self._guid,
4768
+ name=self._name,
4769
+ resource_instance_id=self._resource_instance_id,
4770
+ region_instance_id=self._region_instance_id,
4771
+ resource_id=self._resource_id,
4772
+ resource_group_id=self._resource_group_id,
4773
+ limit=self._limit,
4774
+ updated_from=self._updated_from,
4775
+ updated_to=self._updated_to,
4776
+ start=self._page_context.get('next'),
4777
+ ).get_result()
4778
+
4779
+ next = None
4780
+ next_page_link = result.get('next_url')
4781
+ if next_page_link is not None:
4782
+ next = get_query_param(next_page_link, 'start')
4783
+ self._page_context['next'] = next
4784
+ if next is None:
4785
+ self._has_next = False
4786
+
4787
+ return result.get('resources')
4788
+
4789
+ def get_all(self) -> List[dict]:
4790
+ """
4791
+ Returns all results by invoking get_next() repeatedly
4792
+ until all pages of results have been retrieved.
4793
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceAlias.
4794
+ :rtype: List[dict]
4795
+ """
4796
+ results = []
4797
+ while self.has_next():
4798
+ next_page = self.get_next()
4799
+ results.extend(next_page)
4800
+ return results
4801
+
4802
+
4803
+ class ResourceBindingsForAliasPager:
4804
+ """
4805
+ ResourceBindingsForAliasPager can be used to simplify the use of the "list_resource_bindings_for_alias" method.
4806
+ """
4807
+
4808
+ def __init__(
4809
+ self,
4810
+ *,
4811
+ client: ResourceControllerV2,
4812
+ id: str,
4813
+ limit: int = None,
4814
+ ) -> None:
4815
+ """
4816
+ Initialize a ResourceBindingsForAliasPager object.
4817
+ :param str id: The resource alias URL-encoded CRN or GUID.
4818
+ :param int limit: (optional) Limit on how many items should be returned.
4819
+ """
4820
+ self._has_next = True
4821
+ self._client = client
4822
+ self._page_context = {'next': None}
4823
+ self._id = id
4824
+ self._limit = limit
4825
+
4826
+ def has_next(self) -> bool:
4827
+ """
4828
+ Returns true if there are potentially more results to be retrieved.
4829
+ """
4830
+ return self._has_next
4831
+
4832
+ def get_next(self) -> List[dict]:
4833
+ """
4834
+ Returns the next page of results.
4835
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceBinding.
4836
+ :rtype: List[dict]
4837
+ """
4838
+ if not self.has_next():
4839
+ raise StopIteration(message='No more results available')
4840
+
4841
+ result = self._client.list_resource_bindings_for_alias(
4842
+ id=self._id,
4843
+ limit=self._limit,
4844
+ start=self._page_context.get('next'),
4845
+ ).get_result()
4846
+
4847
+ next = None
4848
+ next_page_link = result.get('next_url')
4849
+ if next_page_link is not None:
4850
+ next = get_query_param(next_page_link, 'start')
4851
+ self._page_context['next'] = next
4852
+ if next is None:
4853
+ self._has_next = False
4854
+
4855
+ return result.get('resources')
4856
+
4857
+ def get_all(self) -> List[dict]:
4858
+ """
4859
+ Returns all results by invoking get_next() repeatedly
4860
+ until all pages of results have been retrieved.
4861
+ :return: A List[dict], where each element is a dict that represents an instance of ResourceBinding.
4862
+ :rtype: List[dict]
4863
+ """
4864
+ results = []
4865
+ while self.has_next():
4866
+ next_page = self.get_next()
4867
+ results.extend(next_page)
4868
+ return results