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,480 @@
1
+ # coding: utf-8
2
+
3
+ # (C) Copyright IBM Corp. 2021.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # IBM OpenAPI SDK Code Generator Version: 3.33.0-caf29bd0-20210603-225214
18
+
19
+ """
20
+ API docs for IBM Cloud Shell repository
21
+ """
22
+
23
+ from typing import Dict, List
24
+ import json
25
+
26
+ from ibm_cloud_sdk_core import BaseService, DetailedResponse
27
+ from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
28
+ from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
29
+ from ibm_cloud_sdk_core.utils import convert_model
30
+
31
+ from .common import get_sdk_headers
32
+
33
+ ##############################################################################
34
+ # Service
35
+ ##############################################################################
36
+
37
+
38
+ class IbmCloudShellV1(BaseService):
39
+ """The IBM Cloud Shell V1 service."""
40
+
41
+ DEFAULT_SERVICE_URL = 'https://api.shell.cloud.ibm.com'
42
+ DEFAULT_SERVICE_NAME = 'ibm_cloud_shell'
43
+
44
+ @classmethod
45
+ def new_instance(
46
+ cls,
47
+ service_name: str = DEFAULT_SERVICE_NAME,
48
+ ) -> 'IbmCloudShellV1':
49
+ """
50
+ Return a new client for the IBM Cloud Shell service using the specified
51
+ parameters and external configuration.
52
+ """
53
+ authenticator = get_authenticator_from_environment(service_name)
54
+ service = cls(authenticator)
55
+ service.configure_service(service_name)
56
+ return service
57
+
58
+ def __init__(
59
+ self,
60
+ authenticator: Authenticator = None,
61
+ ) -> None:
62
+ """
63
+ Construct a new client for the IBM Cloud Shell service.
64
+
65
+ :param Authenticator authenticator: The authenticator specifies the authentication mechanism.
66
+ Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md
67
+ about initializing the authenticator of your choice.
68
+ """
69
+ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
70
+
71
+ #########################
72
+ # account_settings
73
+ #########################
74
+
75
+ def get_account_settings(self, account_id: str, **kwargs) -> DetailedResponse:
76
+ """
77
+ Get account settings.
78
+
79
+ Retrieve account settings for the given account ID. Call this method to get
80
+ details about a particular account setting, whether Cloud Shell is enabled, the
81
+ list of enabled regions and the list of enabled features. Users need to be an
82
+ account owner or users need to be assigned an IAM policy with the Administrator
83
+ role for the Cloud Shell account management service.
84
+
85
+ :param str account_id: The account ID in which the account settings belong
86
+ to.
87
+ :param dict headers: A `dict` containing the request headers
88
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
89
+ :rtype: DetailedResponse with `dict` result representing a `AccountSettings` object
90
+ """
91
+
92
+ if account_id is None:
93
+ raise ValueError('account_id must be provided')
94
+ headers = {}
95
+ sdk_headers = get_sdk_headers(
96
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_account_settings'
97
+ )
98
+ headers.update(sdk_headers)
99
+
100
+ if 'headers' in kwargs:
101
+ headers.update(kwargs.get('headers'))
102
+ headers['Accept'] = 'application/json'
103
+
104
+ path_param_keys = ['account_id']
105
+ path_param_values = self.encode_path_vars(account_id)
106
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
107
+ url = '/api/v1/user/accounts/{account_id}/settings'.format(**path_param_dict)
108
+ request = self.prepare_request(method='GET', url=url, headers=headers)
109
+
110
+ response = self.send(request)
111
+ return response
112
+
113
+ def update_account_settings(
114
+ self,
115
+ account_id: str,
116
+ *,
117
+ rev: str = None,
118
+ default_enable_new_features: bool = None,
119
+ default_enable_new_regions: bool = None,
120
+ enabled: bool = None,
121
+ features: List['Feature'] = None,
122
+ regions: List['RegionSetting'] = None,
123
+ **kwargs,
124
+ ) -> DetailedResponse:
125
+ """
126
+ Update account settings.
127
+
128
+ Update account settings for the given account ID. Call this method to update
129
+ account settings configuration, you can enable or disable Cloud Shell, enable or
130
+ disable available regions and enable and disable features. To update account
131
+ settings, users need to be an account owner or users need to be assigned an IAM
132
+ policy with the Administrator role for the Cloud Shell account management service.
133
+
134
+ :param str account_id: The account ID in which the account settings belong
135
+ to.
136
+ :param str rev: (optional) Unique revision number for the settings object.
137
+ :param bool default_enable_new_features: (optional) You can choose which
138
+ Cloud Shell features are available in the account and whether any new
139
+ features are enabled as they become available. The feature settings apply
140
+ only to the enabled Cloud Shell locations.
141
+ :param bool default_enable_new_regions: (optional) Set whether Cloud Shell
142
+ is enabled in a specific location for the account. The location determines
143
+ where user and session data are stored. By default, users are routed to the
144
+ nearest available location.
145
+ :param bool enabled: (optional) When enabled, Cloud Shell is available to
146
+ all users in the account.
147
+ :param List[Feature] features: (optional) List of Cloud Shell features.
148
+ :param List[RegionSetting] regions: (optional) List of Cloud Shell region
149
+ settings.
150
+ :param dict headers: A `dict` containing the request headers
151
+ :return: A `DetailedResponse` containing the result, headers and HTTP status code.
152
+ :rtype: DetailedResponse with `dict` result representing a `AccountSettings` object
153
+ """
154
+
155
+ if account_id is None:
156
+ raise ValueError('account_id must be provided')
157
+ if features is not None:
158
+ features = [convert_model(x) for x in features]
159
+ if regions is not None:
160
+ regions = [convert_model(x) for x in regions]
161
+ headers = {}
162
+ sdk_headers = get_sdk_headers(
163
+ service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_account_settings'
164
+ )
165
+ headers.update(sdk_headers)
166
+
167
+ data = {
168
+ '_rev': rev,
169
+ 'default_enable_new_features': default_enable_new_features,
170
+ 'default_enable_new_regions': default_enable_new_regions,
171
+ 'enabled': enabled,
172
+ 'features': features,
173
+ 'regions': regions,
174
+ }
175
+ data = {k: v for (k, v) in data.items() if v is not None}
176
+ data = json.dumps(data)
177
+ headers['content-type'] = 'application/json'
178
+
179
+ if 'headers' in kwargs:
180
+ headers.update(kwargs.get('headers'))
181
+ headers['Accept'] = 'application/json'
182
+
183
+ path_param_keys = ['account_id']
184
+ path_param_values = self.encode_path_vars(account_id)
185
+ path_param_dict = dict(zip(path_param_keys, path_param_values))
186
+ url = '/api/v1/user/accounts/{account_id}/settings'.format(**path_param_dict)
187
+ request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
188
+
189
+ response = self.send(request)
190
+ return response
191
+
192
+
193
+ ##############################################################################
194
+ # Models
195
+ ##############################################################################
196
+
197
+
198
+ class AccountSettings:
199
+ """
200
+ Definition of Cloud Shell account settings.
201
+
202
+ :attr str id: (optional) Unique id of the settings object.
203
+ :attr str rev: (optional) Unique revision number for the settings object.
204
+ :attr str account_id: (optional) The id of the account the settings belong to.
205
+ :attr int created_at: (optional) Creation timestamp in Unix epoch time.
206
+ :attr str created_by: (optional) IAM ID of creator.
207
+ :attr bool default_enable_new_features: (optional) You can choose which Cloud
208
+ Shell features are available in the account and whether any new features are
209
+ enabled as they become available. The feature settings apply only to the enabled
210
+ Cloud Shell locations.
211
+ :attr bool default_enable_new_regions: (optional) Set whether Cloud Shell is
212
+ enabled in a specific location for the account. The location determines where
213
+ user and session data are stored. By default, users are routed to the nearest
214
+ available location.
215
+ :attr bool enabled: (optional) When enabled, Cloud Shell is available to all
216
+ users in the account.
217
+ :attr List[Feature] features: (optional) List of Cloud Shell features.
218
+ :attr List[RegionSetting] regions: (optional) List of Cloud Shell region
219
+ settings.
220
+ :attr str type: (optional) Type of api response object.
221
+ :attr int updated_at: (optional) Timestamp of last update in Unix epoch time.
222
+ :attr str updated_by: (optional) IAM ID of last updater.
223
+ """
224
+
225
+ def __init__(
226
+ self,
227
+ *,
228
+ id: str = None,
229
+ rev: str = None,
230
+ account_id: str = None,
231
+ created_at: int = None,
232
+ created_by: str = None,
233
+ default_enable_new_features: bool = None,
234
+ default_enable_new_regions: bool = None,
235
+ enabled: bool = None,
236
+ features: List['Feature'] = None,
237
+ regions: List['RegionSetting'] = None,
238
+ type: str = None,
239
+ updated_at: int = None,
240
+ updated_by: str = None,
241
+ ) -> None:
242
+ """
243
+ Initialize a AccountSettings object.
244
+
245
+ :param str rev: (optional) Unique revision number for the settings object.
246
+ :param bool default_enable_new_features: (optional) You can choose which
247
+ Cloud Shell features are available in the account and whether any new
248
+ features are enabled as they become available. The feature settings apply
249
+ only to the enabled Cloud Shell locations.
250
+ :param bool default_enable_new_regions: (optional) Set whether Cloud Shell
251
+ is enabled in a specific location for the account. The location determines
252
+ where user and session data are stored. By default, users are routed to the
253
+ nearest available location.
254
+ :param bool enabled: (optional) When enabled, Cloud Shell is available to
255
+ all users in the account.
256
+ :param List[Feature] features: (optional) List of Cloud Shell features.
257
+ :param List[RegionSetting] regions: (optional) List of Cloud Shell region
258
+ settings.
259
+ """
260
+ self.id = id
261
+ self.rev = rev
262
+ self.account_id = account_id
263
+ self.created_at = created_at
264
+ self.created_by = created_by
265
+ self.default_enable_new_features = default_enable_new_features
266
+ self.default_enable_new_regions = default_enable_new_regions
267
+ self.enabled = enabled
268
+ self.features = features
269
+ self.regions = regions
270
+ self.type = type
271
+ self.updated_at = updated_at
272
+ self.updated_by = updated_by
273
+
274
+ @classmethod
275
+ def from_dict(cls, _dict: Dict) -> 'AccountSettings':
276
+ """Initialize a AccountSettings object from a json dictionary."""
277
+ args = {}
278
+ if '_id' in _dict:
279
+ args['id'] = _dict.get('_id')
280
+ if '_rev' in _dict:
281
+ args['rev'] = _dict.get('_rev')
282
+ if 'account_id' in _dict:
283
+ args['account_id'] = _dict.get('account_id')
284
+ if 'created_at' in _dict:
285
+ args['created_at'] = _dict.get('created_at')
286
+ if 'created_by' in _dict:
287
+ args['created_by'] = _dict.get('created_by')
288
+ if 'default_enable_new_features' in _dict:
289
+ args['default_enable_new_features'] = _dict.get('default_enable_new_features')
290
+ if 'default_enable_new_regions' in _dict:
291
+ args['default_enable_new_regions'] = _dict.get('default_enable_new_regions')
292
+ if 'enabled' in _dict:
293
+ args['enabled'] = _dict.get('enabled')
294
+ if 'features' in _dict:
295
+ args['features'] = [Feature.from_dict(x) for x in _dict.get('features')]
296
+ if 'regions' in _dict:
297
+ args['regions'] = [RegionSetting.from_dict(x) for x in _dict.get('regions')]
298
+ if 'type' in _dict:
299
+ args['type'] = _dict.get('type')
300
+ if 'updated_at' in _dict:
301
+ args['updated_at'] = _dict.get('updated_at')
302
+ if 'updated_by' in _dict:
303
+ args['updated_by'] = _dict.get('updated_by')
304
+ return cls(**args)
305
+
306
+ @classmethod
307
+ def _from_dict(cls, _dict):
308
+ """Initialize a AccountSettings object from a json dictionary."""
309
+ return cls.from_dict(_dict)
310
+
311
+ def to_dict(self) -> Dict:
312
+ """Return a json dictionary representing this model."""
313
+ _dict = {}
314
+ if hasattr(self, 'id') and getattr(self, 'id') is not None:
315
+ _dict['_id'] = getattr(self, 'id')
316
+ if hasattr(self, 'rev') and self.rev is not None:
317
+ _dict['_rev'] = self.rev
318
+ if hasattr(self, 'account_id') and getattr(self, 'account_id') is not None:
319
+ _dict['account_id'] = getattr(self, 'account_id')
320
+ if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None:
321
+ _dict['created_at'] = getattr(self, 'created_at')
322
+ if hasattr(self, 'created_by') and getattr(self, 'created_by') is not None:
323
+ _dict['created_by'] = getattr(self, 'created_by')
324
+ if hasattr(self, 'default_enable_new_features') and self.default_enable_new_features is not None:
325
+ _dict['default_enable_new_features'] = self.default_enable_new_features
326
+ if hasattr(self, 'default_enable_new_regions') and self.default_enable_new_regions is not None:
327
+ _dict['default_enable_new_regions'] = self.default_enable_new_regions
328
+ if hasattr(self, 'enabled') and self.enabled is not None:
329
+ _dict['enabled'] = self.enabled
330
+ if hasattr(self, 'features') and self.features is not None:
331
+ _dict['features'] = [x.to_dict() for x in self.features]
332
+ if hasattr(self, 'regions') and self.regions is not None:
333
+ _dict['regions'] = [x.to_dict() for x in self.regions]
334
+ if hasattr(self, 'type') and getattr(self, 'type') is not None:
335
+ _dict['type'] = getattr(self, 'type')
336
+ if hasattr(self, 'updated_at') and getattr(self, 'updated_at') is not None:
337
+ _dict['updated_at'] = getattr(self, 'updated_at')
338
+ if hasattr(self, 'updated_by') and getattr(self, 'updated_by') is not None:
339
+ _dict['updated_by'] = getattr(self, 'updated_by')
340
+ return _dict
341
+
342
+ def _to_dict(self):
343
+ """Return a json dictionary representing this model."""
344
+ return self.to_dict()
345
+
346
+ def __str__(self) -> str:
347
+ """Return a `str` version of this AccountSettings object."""
348
+ return json.dumps(self.to_dict(), indent=2)
349
+
350
+ def __eq__(self, other: 'AccountSettings') -> bool:
351
+ """Return `true` when self and other are equal, false otherwise."""
352
+ if not isinstance(other, self.__class__):
353
+ return False
354
+ return self.__dict__ == other.__dict__
355
+
356
+ def __ne__(self, other: 'AccountSettings') -> bool:
357
+ """Return `true` when self and other are not equal, false otherwise."""
358
+ return not self == other
359
+
360
+
361
+ class Feature:
362
+ """
363
+ Describes a Cloud Shell feature.
364
+
365
+ :attr bool enabled: (optional) State of the feature.
366
+ :attr str key: (optional) Name of the feature.
367
+ """
368
+
369
+ def __init__(self, *, enabled: bool = None, key: str = None) -> None:
370
+ """
371
+ Initialize a Feature object.
372
+
373
+ :param bool enabled: (optional) State of the feature.
374
+ :param str key: (optional) Name of the feature.
375
+ """
376
+ self.enabled = enabled
377
+ self.key = key
378
+
379
+ @classmethod
380
+ def from_dict(cls, _dict: Dict) -> 'Feature':
381
+ """Initialize a Feature object from a json dictionary."""
382
+ args = {}
383
+ if 'enabled' in _dict:
384
+ args['enabled'] = _dict.get('enabled')
385
+ if 'key' in _dict:
386
+ args['key'] = _dict.get('key')
387
+ return cls(**args)
388
+
389
+ @classmethod
390
+ def _from_dict(cls, _dict):
391
+ """Initialize a Feature object from a json dictionary."""
392
+ return cls.from_dict(_dict)
393
+
394
+ def to_dict(self) -> Dict:
395
+ """Return a json dictionary representing this model."""
396
+ _dict = {}
397
+ if hasattr(self, 'enabled') and self.enabled is not None:
398
+ _dict['enabled'] = self.enabled
399
+ if hasattr(self, 'key') and self.key is not None:
400
+ _dict['key'] = self.key
401
+ return _dict
402
+
403
+ def _to_dict(self):
404
+ """Return a json dictionary representing this model."""
405
+ return self.to_dict()
406
+
407
+ def __str__(self) -> str:
408
+ """Return a `str` version of this Feature object."""
409
+ return json.dumps(self.to_dict(), indent=2)
410
+
411
+ def __eq__(self, other: 'Feature') -> bool:
412
+ """Return `true` when self and other are equal, false otherwise."""
413
+ if not isinstance(other, self.__class__):
414
+ return False
415
+ return self.__dict__ == other.__dict__
416
+
417
+ def __ne__(self, other: 'Feature') -> bool:
418
+ """Return `true` when self and other are not equal, false otherwise."""
419
+ return not self == other
420
+
421
+
422
+ class RegionSetting:
423
+ """
424
+ Describes a Cloud Shell region setting.
425
+
426
+ :attr bool enabled: (optional) State of the region.
427
+ :attr str key: (optional) Name of the region.
428
+ """
429
+
430
+ def __init__(self, *, enabled: bool = None, key: str = None) -> None:
431
+ """
432
+ Initialize a RegionSetting object.
433
+
434
+ :param bool enabled: (optional) State of the region.
435
+ :param str key: (optional) Name of the region.
436
+ """
437
+ self.enabled = enabled
438
+ self.key = key
439
+
440
+ @classmethod
441
+ def from_dict(cls, _dict: Dict) -> 'RegionSetting':
442
+ """Initialize a RegionSetting object from a json dictionary."""
443
+ args = {}
444
+ if 'enabled' in _dict:
445
+ args['enabled'] = _dict.get('enabled')
446
+ if 'key' in _dict:
447
+ args['key'] = _dict.get('key')
448
+ return cls(**args)
449
+
450
+ @classmethod
451
+ def _from_dict(cls, _dict):
452
+ """Initialize a RegionSetting object from a json dictionary."""
453
+ return cls.from_dict(_dict)
454
+
455
+ def to_dict(self) -> Dict:
456
+ """Return a json dictionary representing this model."""
457
+ _dict = {}
458
+ if hasattr(self, 'enabled') and self.enabled is not None:
459
+ _dict['enabled'] = self.enabled
460
+ if hasattr(self, 'key') and self.key is not None:
461
+ _dict['key'] = self.key
462
+ return _dict
463
+
464
+ def _to_dict(self):
465
+ """Return a json dictionary representing this model."""
466
+ return self.to_dict()
467
+
468
+ def __str__(self) -> str:
469
+ """Return a `str` version of this RegionSetting object."""
470
+ return json.dumps(self.to_dict(), indent=2)
471
+
472
+ def __eq__(self, other: 'RegionSetting') -> bool:
473
+ """Return `true` when self and other are equal, false otherwise."""
474
+ if not isinstance(other, self.__class__):
475
+ return False
476
+ return self.__dict__ == other.__dict__
477
+
478
+ def __ne__(self, other: 'RegionSetting') -> bool:
479
+ """Return `true` when self and other are not equal, false otherwise."""
480
+ return not self == other