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.
- ibm_platform_services/__init__.py +43 -0
- ibm_platform_services/case_management_v1.py +2414 -0
- ibm_platform_services/catalog_management_v1.py +10127 -0
- ibm_platform_services/common.py +56 -0
- ibm_platform_services/context_based_restrictions_v1.py +3633 -0
- ibm_platform_services/enterprise_billing_units_v1.py +1324 -0
- ibm_platform_services/enterprise_management_v1.py +2497 -0
- ibm_platform_services/enterprise_usage_reports_v1.py +978 -0
- ibm_platform_services/global_catalog_v1.py +5129 -0
- ibm_platform_services/global_search_v2.py +497 -0
- ibm_platform_services/global_tagging_v1.py +1601 -0
- ibm_platform_services/iam_access_groups_v2.py +7684 -0
- ibm_platform_services/iam_identity_v1.py +11525 -0
- ibm_platform_services/iam_policy_management_v1.py +9016 -0
- ibm_platform_services/ibm_cloud_shell_v1.py +480 -0
- ibm_platform_services/open_service_broker_v1.py +1774 -0
- ibm_platform_services/partner_billing_units_v1.py +1381 -0
- ibm_platform_services/partner_usage_reports_v1.py +1091 -0
- ibm_platform_services/resource_controller_v2.py +4868 -0
- ibm_platform_services/resource_manager_v2.py +986 -0
- ibm_platform_services/usage_metering_v4.py +470 -0
- ibm_platform_services/usage_reports_v4.py +5165 -0
- ibm_platform_services/user_management_v1.py +1639 -0
- ibm_platform_services/version.py +5 -0
- ibm_platform_services-0.55.3.dist-info/LICENSE +201 -0
- ibm_platform_services-0.55.3.dist-info/METADATA +165 -0
- ibm_platform_services-0.55.3.dist-info/RECORD +29 -0
- ibm_platform_services-0.55.3.dist-info/WHEEL +5 -0
- ibm_platform_services-0.55.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2497 @@
|
|
|
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.89.1-ed9d96f4-20240417-193115
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
The Enterprise Management API enables you to create and manage an enterprise, account
|
|
21
|
+
groups, and accounts within the enterprise.
|
|
22
|
+
|
|
23
|
+
API Version: 1.0
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from datetime import datetime
|
|
27
|
+
from typing import Dict, List, Optional
|
|
28
|
+
import json
|
|
29
|
+
|
|
30
|
+
from ibm_cloud_sdk_core import BaseService, DetailedResponse, get_query_param
|
|
31
|
+
from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
|
|
32
|
+
from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
|
|
33
|
+
from ibm_cloud_sdk_core.utils import convert_model, datetime_to_string, string_to_datetime
|
|
34
|
+
|
|
35
|
+
from .common import get_sdk_headers
|
|
36
|
+
|
|
37
|
+
##############################################################################
|
|
38
|
+
# Service
|
|
39
|
+
##############################################################################
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class EnterpriseManagementV1(BaseService):
|
|
43
|
+
"""The Enterprise Management V1 service."""
|
|
44
|
+
|
|
45
|
+
DEFAULT_SERVICE_URL = 'https://enterprise.cloud.ibm.com/v1'
|
|
46
|
+
DEFAULT_SERVICE_NAME = 'enterprise_management'
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def new_instance(
|
|
50
|
+
cls,
|
|
51
|
+
service_name: str = DEFAULT_SERVICE_NAME,
|
|
52
|
+
) -> 'EnterpriseManagementV1':
|
|
53
|
+
"""
|
|
54
|
+
Return a new client for the Enterprise Management service using the
|
|
55
|
+
specified parameters and external configuration.
|
|
56
|
+
"""
|
|
57
|
+
authenticator = get_authenticator_from_environment(service_name)
|
|
58
|
+
service = cls(authenticator)
|
|
59
|
+
service.configure_service(service_name)
|
|
60
|
+
return service
|
|
61
|
+
|
|
62
|
+
def __init__(
|
|
63
|
+
self,
|
|
64
|
+
authenticator: Authenticator = None,
|
|
65
|
+
) -> None:
|
|
66
|
+
"""
|
|
67
|
+
Construct a new client for the Enterprise Management service.
|
|
68
|
+
|
|
69
|
+
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
|
|
70
|
+
Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
|
|
71
|
+
about initializing the authenticator of your choice.
|
|
72
|
+
"""
|
|
73
|
+
BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
|
|
74
|
+
|
|
75
|
+
#########################
|
|
76
|
+
# Enterprise Operations
|
|
77
|
+
#########################
|
|
78
|
+
|
|
79
|
+
def create_enterprise(
|
|
80
|
+
self,
|
|
81
|
+
source_account_id: str,
|
|
82
|
+
name: str,
|
|
83
|
+
primary_contact_iam_id: str,
|
|
84
|
+
*,
|
|
85
|
+
domain: Optional[str] = None,
|
|
86
|
+
**kwargs,
|
|
87
|
+
) -> DetailedResponse:
|
|
88
|
+
"""
|
|
89
|
+
Create an enterprise.
|
|
90
|
+
|
|
91
|
+
Create a new enterprise, which you can use to centrally manage multiple accounts.
|
|
92
|
+
To create an enterprise, you must have an active Subscription account.
|
|
93
|
+
<br/><br/>The API creates an enterprise entity, which is the root of the
|
|
94
|
+
enterprise hierarchy. It also creates a new enterprise account that is used to
|
|
95
|
+
manage the enterprise. All subscriptions, support entitlements, credits, and
|
|
96
|
+
discounts from the source subscription account are migrated to the enterprise
|
|
97
|
+
account, and the source account becomes a child account in the hierarchy. The user
|
|
98
|
+
that you assign as the enterprise primary contact is also assigned as the owner of
|
|
99
|
+
the enterprise account.
|
|
100
|
+
|
|
101
|
+
:param str source_account_id: The ID of the account that is used to create
|
|
102
|
+
the enterprise.
|
|
103
|
+
:param str name: The name of the enterprise. This field must have 3 - 60
|
|
104
|
+
characters.
|
|
105
|
+
:param str primary_contact_iam_id: The IAM ID of the enterprise primary
|
|
106
|
+
contact, such as `IBMid-0123ABC`. The IAM ID must already exist.
|
|
107
|
+
:param str domain: (optional) A domain or subdomain for the enterprise,
|
|
108
|
+
such as `example.com` or `my.example.com`.
|
|
109
|
+
:param dict headers: A `dict` containing the request headers
|
|
110
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
111
|
+
:rtype: DetailedResponse with `dict` result representing a `CreateEnterpriseResponse` object
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
if source_account_id is None:
|
|
115
|
+
raise ValueError('source_account_id must be provided')
|
|
116
|
+
if name is None:
|
|
117
|
+
raise ValueError('name must be provided')
|
|
118
|
+
if primary_contact_iam_id is None:
|
|
119
|
+
raise ValueError('primary_contact_iam_id must be provided')
|
|
120
|
+
headers = {}
|
|
121
|
+
sdk_headers = get_sdk_headers(
|
|
122
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
123
|
+
service_version='V1',
|
|
124
|
+
operation_id='create_enterprise',
|
|
125
|
+
)
|
|
126
|
+
headers.update(sdk_headers)
|
|
127
|
+
|
|
128
|
+
data = {
|
|
129
|
+
'source_account_id': source_account_id,
|
|
130
|
+
'name': name,
|
|
131
|
+
'primary_contact_iam_id': primary_contact_iam_id,
|
|
132
|
+
'domain': domain,
|
|
133
|
+
}
|
|
134
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
135
|
+
data = json.dumps(data)
|
|
136
|
+
headers['content-type'] = 'application/json'
|
|
137
|
+
|
|
138
|
+
if 'headers' in kwargs:
|
|
139
|
+
headers.update(kwargs.get('headers'))
|
|
140
|
+
del kwargs['headers']
|
|
141
|
+
headers['Accept'] = 'application/json'
|
|
142
|
+
|
|
143
|
+
url = '/enterprises'
|
|
144
|
+
request = self.prepare_request(
|
|
145
|
+
method='POST',
|
|
146
|
+
url=url,
|
|
147
|
+
headers=headers,
|
|
148
|
+
data=data,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
response = self.send(request, **kwargs)
|
|
152
|
+
return response
|
|
153
|
+
|
|
154
|
+
def list_enterprises(
|
|
155
|
+
self,
|
|
156
|
+
*,
|
|
157
|
+
enterprise_account_id: Optional[str] = None,
|
|
158
|
+
account_group_id: Optional[str] = None,
|
|
159
|
+
account_id: Optional[str] = None,
|
|
160
|
+
next_docid: Optional[str] = None,
|
|
161
|
+
limit: Optional[int] = None,
|
|
162
|
+
**kwargs,
|
|
163
|
+
) -> DetailedResponse:
|
|
164
|
+
"""
|
|
165
|
+
List enterprises.
|
|
166
|
+
|
|
167
|
+
Retrieve all enterprises for a given ID by passing the IDs on query parameters. If
|
|
168
|
+
no ID is passed, the enterprises for which the calling identity is the primary
|
|
169
|
+
contact are returned. You can use pagination parameters to filter the results.
|
|
170
|
+
<br/><br/>This method ensures that only the enterprises that the user has access
|
|
171
|
+
to are returned. Access can be controlled either through a policy on a specific
|
|
172
|
+
enterprise, or account-level platform services access roles, such as
|
|
173
|
+
Administrator, Editor, Operator, or Viewer. When you call the method with the
|
|
174
|
+
`enterprise_account_id` or `account_id` query parameter, the account ID in the
|
|
175
|
+
token is compared with that in the query parameter. If these account IDs match,
|
|
176
|
+
authentication isn't performed and the enterprise information is returned. If the
|
|
177
|
+
account IDs don't match, authentication is performed and only then is the
|
|
178
|
+
enterprise information returned in the response.
|
|
179
|
+
|
|
180
|
+
:param str enterprise_account_id: (optional) Get enterprises for a given
|
|
181
|
+
enterprise account ID.
|
|
182
|
+
:param str account_group_id: (optional) Get enterprises for a given account
|
|
183
|
+
group ID.
|
|
184
|
+
:param str account_id: (optional) Get enterprises for a given account ID.
|
|
185
|
+
:param str next_docid: (optional) The first item to be returned in the page
|
|
186
|
+
of results. This value can be obtained from the next_url property from the
|
|
187
|
+
previous call of the operation. If not specified, then the first page of
|
|
188
|
+
results is returned.
|
|
189
|
+
:param int limit: (optional) Return results up to this limit. Valid values
|
|
190
|
+
are between `0` and `100`.
|
|
191
|
+
:param dict headers: A `dict` containing the request headers
|
|
192
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
193
|
+
:rtype: DetailedResponse with `dict` result representing a `ListEnterprisesResponse` object
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
headers = {}
|
|
197
|
+
sdk_headers = get_sdk_headers(
|
|
198
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
199
|
+
service_version='V1',
|
|
200
|
+
operation_id='list_enterprises',
|
|
201
|
+
)
|
|
202
|
+
headers.update(sdk_headers)
|
|
203
|
+
|
|
204
|
+
params = {
|
|
205
|
+
'enterprise_account_id': enterprise_account_id,
|
|
206
|
+
'account_group_id': account_group_id,
|
|
207
|
+
'account_id': account_id,
|
|
208
|
+
'next_docid': next_docid,
|
|
209
|
+
'limit': limit,
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if 'headers' in kwargs:
|
|
213
|
+
headers.update(kwargs.get('headers'))
|
|
214
|
+
del kwargs['headers']
|
|
215
|
+
headers['Accept'] = 'application/json'
|
|
216
|
+
|
|
217
|
+
url = '/enterprises'
|
|
218
|
+
request = self.prepare_request(
|
|
219
|
+
method='GET',
|
|
220
|
+
url=url,
|
|
221
|
+
headers=headers,
|
|
222
|
+
params=params,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
response = self.send(request, **kwargs)
|
|
226
|
+
return response
|
|
227
|
+
|
|
228
|
+
def get_enterprise(
|
|
229
|
+
self,
|
|
230
|
+
enterprise_id: str,
|
|
231
|
+
**kwargs,
|
|
232
|
+
) -> DetailedResponse:
|
|
233
|
+
"""
|
|
234
|
+
Get enterprise by ID.
|
|
235
|
+
|
|
236
|
+
Retrieve an enterprise by the `enterprise_id` parameter. All data related to the
|
|
237
|
+
enterprise is returned only if the caller has access to retrieve the enterprise.
|
|
238
|
+
|
|
239
|
+
:param str enterprise_id: The ID of the enterprise to retrieve.
|
|
240
|
+
:param dict headers: A `dict` containing the request headers
|
|
241
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
242
|
+
:rtype: DetailedResponse with `dict` result representing a `Enterprise` object
|
|
243
|
+
"""
|
|
244
|
+
|
|
245
|
+
if not enterprise_id:
|
|
246
|
+
raise ValueError('enterprise_id must be provided')
|
|
247
|
+
headers = {}
|
|
248
|
+
sdk_headers = get_sdk_headers(
|
|
249
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
250
|
+
service_version='V1',
|
|
251
|
+
operation_id='get_enterprise',
|
|
252
|
+
)
|
|
253
|
+
headers.update(sdk_headers)
|
|
254
|
+
|
|
255
|
+
if 'headers' in kwargs:
|
|
256
|
+
headers.update(kwargs.get('headers'))
|
|
257
|
+
del kwargs['headers']
|
|
258
|
+
headers['Accept'] = 'application/json'
|
|
259
|
+
|
|
260
|
+
path_param_keys = ['enterprise_id']
|
|
261
|
+
path_param_values = self.encode_path_vars(enterprise_id)
|
|
262
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
263
|
+
url = '/enterprises/{enterprise_id}'.format(**path_param_dict)
|
|
264
|
+
request = self.prepare_request(
|
|
265
|
+
method='GET',
|
|
266
|
+
url=url,
|
|
267
|
+
headers=headers,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
response = self.send(request, **kwargs)
|
|
271
|
+
return response
|
|
272
|
+
|
|
273
|
+
def update_enterprise(
|
|
274
|
+
self,
|
|
275
|
+
enterprise_id: str,
|
|
276
|
+
*,
|
|
277
|
+
name: Optional[str] = None,
|
|
278
|
+
domain: Optional[str] = None,
|
|
279
|
+
primary_contact_iam_id: Optional[str] = None,
|
|
280
|
+
**kwargs,
|
|
281
|
+
) -> DetailedResponse:
|
|
282
|
+
"""
|
|
283
|
+
Update an enterprise.
|
|
284
|
+
|
|
285
|
+
Update the name, domain, or IAM ID of the primary contact for an existing
|
|
286
|
+
enterprise. The new primary contact must already be a user in the enterprise
|
|
287
|
+
account.
|
|
288
|
+
|
|
289
|
+
:param str enterprise_id: The ID of the enterprise to retrieve.
|
|
290
|
+
:param str name: (optional) The new name of the enterprise. This field must
|
|
291
|
+
have 3 - 60 characters.
|
|
292
|
+
:param str domain: (optional) The new domain of the enterprise. This field
|
|
293
|
+
has a limit of 60 characters.
|
|
294
|
+
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
|
|
295
|
+
the new primary contact for the enterprise.
|
|
296
|
+
:param dict headers: A `dict` containing the request headers
|
|
297
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
298
|
+
:rtype: DetailedResponse
|
|
299
|
+
"""
|
|
300
|
+
|
|
301
|
+
if not enterprise_id:
|
|
302
|
+
raise ValueError('enterprise_id must be provided')
|
|
303
|
+
headers = {}
|
|
304
|
+
sdk_headers = get_sdk_headers(
|
|
305
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
306
|
+
service_version='V1',
|
|
307
|
+
operation_id='update_enterprise',
|
|
308
|
+
)
|
|
309
|
+
headers.update(sdk_headers)
|
|
310
|
+
|
|
311
|
+
data = {
|
|
312
|
+
'name': name,
|
|
313
|
+
'domain': domain,
|
|
314
|
+
'primary_contact_iam_id': primary_contact_iam_id,
|
|
315
|
+
}
|
|
316
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
317
|
+
data = json.dumps(data)
|
|
318
|
+
headers['content-type'] = 'application/json'
|
|
319
|
+
|
|
320
|
+
if 'headers' in kwargs:
|
|
321
|
+
headers.update(kwargs.get('headers'))
|
|
322
|
+
del kwargs['headers']
|
|
323
|
+
|
|
324
|
+
path_param_keys = ['enterprise_id']
|
|
325
|
+
path_param_values = self.encode_path_vars(enterprise_id)
|
|
326
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
327
|
+
url = '/enterprises/{enterprise_id}'.format(**path_param_dict)
|
|
328
|
+
request = self.prepare_request(
|
|
329
|
+
method='PATCH',
|
|
330
|
+
url=url,
|
|
331
|
+
headers=headers,
|
|
332
|
+
data=data,
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
response = self.send(request, **kwargs)
|
|
336
|
+
return response
|
|
337
|
+
|
|
338
|
+
#########################
|
|
339
|
+
# Account Operations
|
|
340
|
+
#########################
|
|
341
|
+
|
|
342
|
+
def import_account_to_enterprise(
|
|
343
|
+
self,
|
|
344
|
+
enterprise_id: str,
|
|
345
|
+
account_id: str,
|
|
346
|
+
*,
|
|
347
|
+
parent: Optional[str] = None,
|
|
348
|
+
billing_unit_id: Optional[str] = None,
|
|
349
|
+
**kwargs,
|
|
350
|
+
) -> DetailedResponse:
|
|
351
|
+
"""
|
|
352
|
+
Import an account into an enterprise.
|
|
353
|
+
|
|
354
|
+
Import an existing stand-alone account into an enterprise. The existing account
|
|
355
|
+
can be any type: trial (`TRIAL`), Lite (`STANDARD`), Pay-As-You-Go (`PAYG`), or
|
|
356
|
+
Subscription (`SUBSCRIPTION`). In the case of a `SUBSCRIPTION` account, the
|
|
357
|
+
credits, promotional offers, and discounts are migrated to the billing unit of the
|
|
358
|
+
enterprise. For a billable account (`PAYG` or `SUBSCRIPTION`), the country and
|
|
359
|
+
currency code of the existing account and the billing unit of the enterprise must
|
|
360
|
+
match. The API returns a `202` response and performs asynchronous operations to
|
|
361
|
+
import the account into the enterprise. <br/></br>For more information about
|
|
362
|
+
impacts to the account, see [Adding accounts to an
|
|
363
|
+
enterprise](https://{DomainName}/docs/account?topic=account-enterprise-add).
|
|
364
|
+
|
|
365
|
+
:param str enterprise_id: The ID of the enterprise to import the
|
|
366
|
+
stand-alone account into.
|
|
367
|
+
:param str account_id: The ID of the existing stand-alone account to be
|
|
368
|
+
imported.
|
|
369
|
+
:param str parent: (optional) The CRN of the expected parent of the
|
|
370
|
+
imported account. The parent is the enterprise or account group that the
|
|
371
|
+
account is added to.
|
|
372
|
+
:param str billing_unit_id: (optional) The ID of the [billing
|
|
373
|
+
unit](/apidocs/enterprise-apis/billing-unit) to use for billing this
|
|
374
|
+
account in the enterprise.
|
|
375
|
+
:param dict headers: A `dict` containing the request headers
|
|
376
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
377
|
+
:rtype: DetailedResponse
|
|
378
|
+
"""
|
|
379
|
+
|
|
380
|
+
if not enterprise_id:
|
|
381
|
+
raise ValueError('enterprise_id must be provided')
|
|
382
|
+
if not account_id:
|
|
383
|
+
raise ValueError('account_id must be provided')
|
|
384
|
+
headers = {}
|
|
385
|
+
sdk_headers = get_sdk_headers(
|
|
386
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
387
|
+
service_version='V1',
|
|
388
|
+
operation_id='import_account_to_enterprise',
|
|
389
|
+
)
|
|
390
|
+
headers.update(sdk_headers)
|
|
391
|
+
|
|
392
|
+
data = {
|
|
393
|
+
'parent': parent,
|
|
394
|
+
'billing_unit_id': billing_unit_id,
|
|
395
|
+
}
|
|
396
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
397
|
+
data = json.dumps(data)
|
|
398
|
+
headers['content-type'] = 'application/json'
|
|
399
|
+
|
|
400
|
+
if 'headers' in kwargs:
|
|
401
|
+
headers.update(kwargs.get('headers'))
|
|
402
|
+
del kwargs['headers']
|
|
403
|
+
|
|
404
|
+
path_param_keys = ['enterprise_id', 'account_id']
|
|
405
|
+
path_param_values = self.encode_path_vars(enterprise_id, account_id)
|
|
406
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
407
|
+
url = '/enterprises/{enterprise_id}/import/accounts/{account_id}'.format(**path_param_dict)
|
|
408
|
+
request = self.prepare_request(
|
|
409
|
+
method='PUT',
|
|
410
|
+
url=url,
|
|
411
|
+
headers=headers,
|
|
412
|
+
data=data,
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
response = self.send(request, **kwargs)
|
|
416
|
+
return response
|
|
417
|
+
|
|
418
|
+
def create_account(
|
|
419
|
+
self,
|
|
420
|
+
parent: str,
|
|
421
|
+
name: str,
|
|
422
|
+
owner_iam_id: str,
|
|
423
|
+
*,
|
|
424
|
+
traits: Optional['CreateAccountRequestTraits'] = None,
|
|
425
|
+
options: Optional['CreateAccountRequestOptions'] = None,
|
|
426
|
+
**kwargs,
|
|
427
|
+
) -> DetailedResponse:
|
|
428
|
+
"""
|
|
429
|
+
Create a new account in an enterprise.
|
|
430
|
+
|
|
431
|
+
Create a new account as a part of an existing enterprise. The API creates an
|
|
432
|
+
account entity under the parent that is specified in the payload of the request.
|
|
433
|
+
The request also takes in the name and the owner of this new account. The owner
|
|
434
|
+
must have a valid IBMid that's registered with IBM Cloud, but they don't need to
|
|
435
|
+
be a user in the enterprise account.
|
|
436
|
+
|
|
437
|
+
:param str parent: The CRN of the parent under which the account will be
|
|
438
|
+
created. The parent can be an existing account group or the enterprise
|
|
439
|
+
itself.
|
|
440
|
+
:param str name: The name of the account. This field must have 3 - 60
|
|
441
|
+
characters.
|
|
442
|
+
:param str owner_iam_id: The IAM ID of the account owner, such as
|
|
443
|
+
`IBMid-0123ABC`. The IAM ID must already exist.
|
|
444
|
+
:param CreateAccountRequestTraits traits: (optional) The traits object can
|
|
445
|
+
be used to set properties on child accounts of an enterprise. You can pass
|
|
446
|
+
a field to opt-out of the default multi-factor authentication setting or
|
|
447
|
+
enable enterprise-managed IAM when creating a child account in the
|
|
448
|
+
enterprise. This is an optional field.
|
|
449
|
+
:param CreateAccountRequestOptions options: (optional) The options object
|
|
450
|
+
can be used to set properties on child accounts of an enterprise. You can
|
|
451
|
+
pass a field to to create IAM service id with IAM api keyg when creating a
|
|
452
|
+
child account in the enterprise. This is an optional field.
|
|
453
|
+
:param dict headers: A `dict` containing the request headers
|
|
454
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
455
|
+
:rtype: DetailedResponse with `dict` result representing a `CreateAccountResponse` object
|
|
456
|
+
"""
|
|
457
|
+
|
|
458
|
+
if parent is None:
|
|
459
|
+
raise ValueError('parent must be provided')
|
|
460
|
+
if name is None:
|
|
461
|
+
raise ValueError('name must be provided')
|
|
462
|
+
if owner_iam_id is None:
|
|
463
|
+
raise ValueError('owner_iam_id must be provided')
|
|
464
|
+
if traits is not None:
|
|
465
|
+
traits = convert_model(traits)
|
|
466
|
+
if options is not None:
|
|
467
|
+
options = convert_model(options)
|
|
468
|
+
headers = {}
|
|
469
|
+
sdk_headers = get_sdk_headers(
|
|
470
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
471
|
+
service_version='V1',
|
|
472
|
+
operation_id='create_account',
|
|
473
|
+
)
|
|
474
|
+
headers.update(sdk_headers)
|
|
475
|
+
|
|
476
|
+
data = {
|
|
477
|
+
'parent': parent,
|
|
478
|
+
'name': name,
|
|
479
|
+
'owner_iam_id': owner_iam_id,
|
|
480
|
+
'traits': traits,
|
|
481
|
+
'options': options,
|
|
482
|
+
}
|
|
483
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
484
|
+
data = json.dumps(data)
|
|
485
|
+
headers['content-type'] = 'application/json'
|
|
486
|
+
|
|
487
|
+
if 'headers' in kwargs:
|
|
488
|
+
headers.update(kwargs.get('headers'))
|
|
489
|
+
del kwargs['headers']
|
|
490
|
+
headers['Accept'] = 'application/json'
|
|
491
|
+
|
|
492
|
+
url = '/accounts'
|
|
493
|
+
request = self.prepare_request(
|
|
494
|
+
method='POST',
|
|
495
|
+
url=url,
|
|
496
|
+
headers=headers,
|
|
497
|
+
data=data,
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
response = self.send(request, **kwargs)
|
|
501
|
+
return response
|
|
502
|
+
|
|
503
|
+
def list_accounts(
|
|
504
|
+
self,
|
|
505
|
+
*,
|
|
506
|
+
enterprise_id: Optional[str] = None,
|
|
507
|
+
account_group_id: Optional[str] = None,
|
|
508
|
+
next_docid: Optional[str] = None,
|
|
509
|
+
parent: Optional[str] = None,
|
|
510
|
+
limit: Optional[int] = None,
|
|
511
|
+
include_deleted: Optional[bool] = None,
|
|
512
|
+
**kwargs,
|
|
513
|
+
) -> DetailedResponse:
|
|
514
|
+
"""
|
|
515
|
+
List accounts.
|
|
516
|
+
|
|
517
|
+
Retrieve all accounts based on the values that are passed in the query parameters.
|
|
518
|
+
If no query parameter is passed, all of the accounts in the enterprise for which
|
|
519
|
+
the calling identity has access are returned. <br/><br/>You can use pagination
|
|
520
|
+
parameters to filter the results. The `limit` field can be used to limit the
|
|
521
|
+
number of results that are displayed for this method.<br/><br/>This method ensures
|
|
522
|
+
that only the accounts that the user has access to are returned. Access can be
|
|
523
|
+
controlled either through a policy on a specific account, or account-level
|
|
524
|
+
platform services access roles, such as Administrator, Editor, Operator, or
|
|
525
|
+
Viewer. When you call the method with the `enterprise_id`, `account_group_id` or
|
|
526
|
+
`parent` query parameter, all of the accounts that are immediate children of this
|
|
527
|
+
entity are returned. Authentication is performed on all the accounts before they
|
|
528
|
+
are returned to the user to ensure that only those accounts are returned to which
|
|
529
|
+
the calling identity has access to.
|
|
530
|
+
|
|
531
|
+
:param str enterprise_id: (optional) Get accounts that are either immediate
|
|
532
|
+
children or are a part of the hierarchy for a given enterprise ID.
|
|
533
|
+
:param str account_group_id: (optional) Get accounts that are either
|
|
534
|
+
immediate children or are a part of the hierarchy for a given account group
|
|
535
|
+
ID.
|
|
536
|
+
:param str next_docid: (optional) The first item to be returned in the page
|
|
537
|
+
of results. This value can be obtained from the next_url property from the
|
|
538
|
+
previous call of the operation. If not specified, then the first page of
|
|
539
|
+
results is returned.
|
|
540
|
+
:param str parent: (optional) Get accounts that are either immediate
|
|
541
|
+
children or are a part of the hierarchy for a given parent CRN.
|
|
542
|
+
:param int limit: (optional) Return results up to this limit. Valid values
|
|
543
|
+
are between `0` and `100`.
|
|
544
|
+
:param bool include_deleted: (optional) Include the deleted accounts from
|
|
545
|
+
an enterprise when used in conjunction with enterprise_id.
|
|
546
|
+
:param dict headers: A `dict` containing the request headers
|
|
547
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
548
|
+
:rtype: DetailedResponse with `dict` result representing a `ListAccountsResponse` object
|
|
549
|
+
"""
|
|
550
|
+
|
|
551
|
+
headers = {}
|
|
552
|
+
sdk_headers = get_sdk_headers(
|
|
553
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
554
|
+
service_version='V1',
|
|
555
|
+
operation_id='list_accounts',
|
|
556
|
+
)
|
|
557
|
+
headers.update(sdk_headers)
|
|
558
|
+
|
|
559
|
+
params = {
|
|
560
|
+
'enterprise_id': enterprise_id,
|
|
561
|
+
'account_group_id': account_group_id,
|
|
562
|
+
'next_docid': next_docid,
|
|
563
|
+
'parent': parent,
|
|
564
|
+
'limit': limit,
|
|
565
|
+
'include_deleted': include_deleted,
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if 'headers' in kwargs:
|
|
569
|
+
headers.update(kwargs.get('headers'))
|
|
570
|
+
del kwargs['headers']
|
|
571
|
+
headers['Accept'] = 'application/json'
|
|
572
|
+
|
|
573
|
+
url = '/accounts'
|
|
574
|
+
request = self.prepare_request(
|
|
575
|
+
method='GET',
|
|
576
|
+
url=url,
|
|
577
|
+
headers=headers,
|
|
578
|
+
params=params,
|
|
579
|
+
)
|
|
580
|
+
|
|
581
|
+
response = self.send(request, **kwargs)
|
|
582
|
+
return response
|
|
583
|
+
|
|
584
|
+
def get_account(
|
|
585
|
+
self,
|
|
586
|
+
account_id: str,
|
|
587
|
+
**kwargs,
|
|
588
|
+
) -> DetailedResponse:
|
|
589
|
+
"""
|
|
590
|
+
Get account by ID.
|
|
591
|
+
|
|
592
|
+
Retrieve an account by the `account_id` parameter. All data related to the account
|
|
593
|
+
is returned only if the caller has access to retrieve the account.
|
|
594
|
+
|
|
595
|
+
:param str account_id: The ID of the target account.
|
|
596
|
+
:param dict headers: A `dict` containing the request headers
|
|
597
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
598
|
+
:rtype: DetailedResponse with `dict` result representing a `Account` object
|
|
599
|
+
"""
|
|
600
|
+
|
|
601
|
+
if not account_id:
|
|
602
|
+
raise ValueError('account_id must be provided')
|
|
603
|
+
headers = {}
|
|
604
|
+
sdk_headers = get_sdk_headers(
|
|
605
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
606
|
+
service_version='V1',
|
|
607
|
+
operation_id='get_account',
|
|
608
|
+
)
|
|
609
|
+
headers.update(sdk_headers)
|
|
610
|
+
|
|
611
|
+
if 'headers' in kwargs:
|
|
612
|
+
headers.update(kwargs.get('headers'))
|
|
613
|
+
del kwargs['headers']
|
|
614
|
+
headers['Accept'] = 'application/json'
|
|
615
|
+
|
|
616
|
+
path_param_keys = ['account_id']
|
|
617
|
+
path_param_values = self.encode_path_vars(account_id)
|
|
618
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
619
|
+
url = '/accounts/{account_id}'.format(**path_param_dict)
|
|
620
|
+
request = self.prepare_request(
|
|
621
|
+
method='GET',
|
|
622
|
+
url=url,
|
|
623
|
+
headers=headers,
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
response = self.send(request, **kwargs)
|
|
627
|
+
return response
|
|
628
|
+
|
|
629
|
+
def update_account(
|
|
630
|
+
self,
|
|
631
|
+
account_id: str,
|
|
632
|
+
parent: str,
|
|
633
|
+
**kwargs,
|
|
634
|
+
) -> DetailedResponse:
|
|
635
|
+
"""
|
|
636
|
+
Move an account within the enterprise.
|
|
637
|
+
|
|
638
|
+
Move an account to a different parent within the same enterprise.
|
|
639
|
+
|
|
640
|
+
:param str account_id: The ID of the target account.
|
|
641
|
+
:param str parent: The CRN of the new parent within the enterprise.
|
|
642
|
+
:param dict headers: A `dict` containing the request headers
|
|
643
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
644
|
+
:rtype: DetailedResponse
|
|
645
|
+
"""
|
|
646
|
+
|
|
647
|
+
if not account_id:
|
|
648
|
+
raise ValueError('account_id must be provided')
|
|
649
|
+
if parent is None:
|
|
650
|
+
raise ValueError('parent must be provided')
|
|
651
|
+
headers = {}
|
|
652
|
+
sdk_headers = get_sdk_headers(
|
|
653
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
654
|
+
service_version='V1',
|
|
655
|
+
operation_id='update_account',
|
|
656
|
+
)
|
|
657
|
+
headers.update(sdk_headers)
|
|
658
|
+
|
|
659
|
+
data = {
|
|
660
|
+
'parent': parent,
|
|
661
|
+
}
|
|
662
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
663
|
+
data = json.dumps(data)
|
|
664
|
+
headers['content-type'] = 'application/json'
|
|
665
|
+
|
|
666
|
+
if 'headers' in kwargs:
|
|
667
|
+
headers.update(kwargs.get('headers'))
|
|
668
|
+
del kwargs['headers']
|
|
669
|
+
|
|
670
|
+
path_param_keys = ['account_id']
|
|
671
|
+
path_param_values = self.encode_path_vars(account_id)
|
|
672
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
673
|
+
url = '/accounts/{account_id}'.format(**path_param_dict)
|
|
674
|
+
request = self.prepare_request(
|
|
675
|
+
method='PATCH',
|
|
676
|
+
url=url,
|
|
677
|
+
headers=headers,
|
|
678
|
+
data=data,
|
|
679
|
+
)
|
|
680
|
+
|
|
681
|
+
response = self.send(request, **kwargs)
|
|
682
|
+
return response
|
|
683
|
+
|
|
684
|
+
def delete_account(
|
|
685
|
+
self,
|
|
686
|
+
account_id: str,
|
|
687
|
+
**kwargs,
|
|
688
|
+
) -> DetailedResponse:
|
|
689
|
+
"""
|
|
690
|
+
Remove an account from its enterprise.
|
|
691
|
+
|
|
692
|
+
Remove an account from the enterprise its currently in. After an account is
|
|
693
|
+
removed, it will be canceled and cannot be reactivated.
|
|
694
|
+
|
|
695
|
+
:param str account_id: The ID of the target account.
|
|
696
|
+
:param dict headers: A `dict` containing the request headers
|
|
697
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
698
|
+
:rtype: DetailedResponse
|
|
699
|
+
"""
|
|
700
|
+
|
|
701
|
+
if not account_id:
|
|
702
|
+
raise ValueError('account_id must be provided')
|
|
703
|
+
headers = {}
|
|
704
|
+
sdk_headers = get_sdk_headers(
|
|
705
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
706
|
+
service_version='V1',
|
|
707
|
+
operation_id='delete_account',
|
|
708
|
+
)
|
|
709
|
+
headers.update(sdk_headers)
|
|
710
|
+
|
|
711
|
+
if 'headers' in kwargs:
|
|
712
|
+
headers.update(kwargs.get('headers'))
|
|
713
|
+
del kwargs['headers']
|
|
714
|
+
|
|
715
|
+
path_param_keys = ['account_id']
|
|
716
|
+
path_param_values = self.encode_path_vars(account_id)
|
|
717
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
718
|
+
url = '/accounts/{account_id}'.format(**path_param_dict)
|
|
719
|
+
request = self.prepare_request(
|
|
720
|
+
method='DELETE',
|
|
721
|
+
url=url,
|
|
722
|
+
headers=headers,
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
response = self.send(request, **kwargs)
|
|
726
|
+
return response
|
|
727
|
+
|
|
728
|
+
#########################
|
|
729
|
+
# Account Group Operations
|
|
730
|
+
#########################
|
|
731
|
+
|
|
732
|
+
def create_account_group(
|
|
733
|
+
self,
|
|
734
|
+
parent: str,
|
|
735
|
+
name: str,
|
|
736
|
+
primary_contact_iam_id: str,
|
|
737
|
+
**kwargs,
|
|
738
|
+
) -> DetailedResponse:
|
|
739
|
+
"""
|
|
740
|
+
Create an account group.
|
|
741
|
+
|
|
742
|
+
Create a new account group, which can be used to group together multiple accounts.
|
|
743
|
+
To create an account group, you must have an existing enterprise. The API creates
|
|
744
|
+
an account group entity under the parent that is specified in the payload of the
|
|
745
|
+
request. The request also takes in the name and the primary contact of this new
|
|
746
|
+
account group.
|
|
747
|
+
|
|
748
|
+
:param str parent: The CRN of the parent under which the account group will
|
|
749
|
+
be created. The parent can be an existing account group or the enterprise
|
|
750
|
+
itself.
|
|
751
|
+
:param str name: The name of the account group. This field must have 3 - 60
|
|
752
|
+
characters.
|
|
753
|
+
:param str primary_contact_iam_id: The IAM ID of the primary contact for
|
|
754
|
+
this account group, such as `IBMid-0123ABC`. The IAM ID must already exist.
|
|
755
|
+
:param dict headers: A `dict` containing the request headers
|
|
756
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
757
|
+
:rtype: DetailedResponse with `dict` result representing a `CreateAccountGroupResponse` object
|
|
758
|
+
"""
|
|
759
|
+
|
|
760
|
+
if parent is None:
|
|
761
|
+
raise ValueError('parent must be provided')
|
|
762
|
+
if name is None:
|
|
763
|
+
raise ValueError('name must be provided')
|
|
764
|
+
if primary_contact_iam_id is None:
|
|
765
|
+
raise ValueError('primary_contact_iam_id must be provided')
|
|
766
|
+
headers = {}
|
|
767
|
+
sdk_headers = get_sdk_headers(
|
|
768
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
769
|
+
service_version='V1',
|
|
770
|
+
operation_id='create_account_group',
|
|
771
|
+
)
|
|
772
|
+
headers.update(sdk_headers)
|
|
773
|
+
|
|
774
|
+
data = {
|
|
775
|
+
'parent': parent,
|
|
776
|
+
'name': name,
|
|
777
|
+
'primary_contact_iam_id': primary_contact_iam_id,
|
|
778
|
+
}
|
|
779
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
780
|
+
data = json.dumps(data)
|
|
781
|
+
headers['content-type'] = 'application/json'
|
|
782
|
+
|
|
783
|
+
if 'headers' in kwargs:
|
|
784
|
+
headers.update(kwargs.get('headers'))
|
|
785
|
+
del kwargs['headers']
|
|
786
|
+
headers['Accept'] = 'application/json'
|
|
787
|
+
|
|
788
|
+
url = '/account-groups'
|
|
789
|
+
request = self.prepare_request(
|
|
790
|
+
method='POST',
|
|
791
|
+
url=url,
|
|
792
|
+
headers=headers,
|
|
793
|
+
data=data,
|
|
794
|
+
)
|
|
795
|
+
|
|
796
|
+
response = self.send(request, **kwargs)
|
|
797
|
+
return response
|
|
798
|
+
|
|
799
|
+
def list_account_groups(
|
|
800
|
+
self,
|
|
801
|
+
*,
|
|
802
|
+
enterprise_id: Optional[str] = None,
|
|
803
|
+
parent_account_group_id: Optional[str] = None,
|
|
804
|
+
next_docid: Optional[str] = None,
|
|
805
|
+
parent: Optional[str] = None,
|
|
806
|
+
limit: Optional[int] = None,
|
|
807
|
+
include_deleted: Optional[bool] = None,
|
|
808
|
+
**kwargs,
|
|
809
|
+
) -> DetailedResponse:
|
|
810
|
+
"""
|
|
811
|
+
List account groups.
|
|
812
|
+
|
|
813
|
+
Retrieve all account groups based on the values that are passed in the query
|
|
814
|
+
parameters. If no query parameter is passed, all of the account groups in the
|
|
815
|
+
enterprise for which the calling identity has access are returned. <br/><br/>You
|
|
816
|
+
can use pagination parameters to filter the results. The `limit` field can be used
|
|
817
|
+
to limit the number of results that are displayed for this method.<br/><br/>This
|
|
818
|
+
method ensures that only the account groups that the user has access to are
|
|
819
|
+
returned. Access can be controlled either through a policy on a specific account
|
|
820
|
+
group, or account-level platform services access roles, such as Administrator,
|
|
821
|
+
Editor, Operator, or Viewer. When you call the method with the `enterprise_id`,
|
|
822
|
+
`parent_account_group_id` or `parent` query parameter, all of the account groups
|
|
823
|
+
that are immediate children of this entity are returned. Authentication is
|
|
824
|
+
performed on all account groups before they are returned to the user to ensure
|
|
825
|
+
that only those account groups are returned to which the calling identity has
|
|
826
|
+
access.
|
|
827
|
+
|
|
828
|
+
:param str enterprise_id: (optional) Get account groups that are either
|
|
829
|
+
immediate children or are a part of the hierarchy for a given enterprise
|
|
830
|
+
ID.
|
|
831
|
+
:param str parent_account_group_id: (optional) Get account groups that are
|
|
832
|
+
either immediate children or are a part of the hierarchy for a given
|
|
833
|
+
account group ID.
|
|
834
|
+
:param str next_docid: (optional) The first item to be returned in the page
|
|
835
|
+
of results. This value can be obtained from the next_url property from the
|
|
836
|
+
previous call of the operation. If not specified, then the first page of
|
|
837
|
+
results is returned.
|
|
838
|
+
:param str parent: (optional) Get account groups that are either immediate
|
|
839
|
+
children or are a part of the hierarchy for a given parent CRN.
|
|
840
|
+
:param int limit: (optional) Return results up to this limit. Valid values
|
|
841
|
+
are between `0` and `100`.
|
|
842
|
+
:param bool include_deleted: (optional) Include the deleted account groups
|
|
843
|
+
from an enterprise when used in conjunction with other query parameters.
|
|
844
|
+
:param dict headers: A `dict` containing the request headers
|
|
845
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
846
|
+
:rtype: DetailedResponse with `dict` result representing a `ListAccountGroupsResponse` object
|
|
847
|
+
"""
|
|
848
|
+
|
|
849
|
+
headers = {}
|
|
850
|
+
sdk_headers = get_sdk_headers(
|
|
851
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
852
|
+
service_version='V1',
|
|
853
|
+
operation_id='list_account_groups',
|
|
854
|
+
)
|
|
855
|
+
headers.update(sdk_headers)
|
|
856
|
+
|
|
857
|
+
params = {
|
|
858
|
+
'enterprise_id': enterprise_id,
|
|
859
|
+
'parent_account_group_id': parent_account_group_id,
|
|
860
|
+
'next_docid': next_docid,
|
|
861
|
+
'parent': parent,
|
|
862
|
+
'limit': limit,
|
|
863
|
+
'include_deleted': include_deleted,
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
if 'headers' in kwargs:
|
|
867
|
+
headers.update(kwargs.get('headers'))
|
|
868
|
+
del kwargs['headers']
|
|
869
|
+
headers['Accept'] = 'application/json'
|
|
870
|
+
|
|
871
|
+
url = '/account-groups'
|
|
872
|
+
request = self.prepare_request(
|
|
873
|
+
method='GET',
|
|
874
|
+
url=url,
|
|
875
|
+
headers=headers,
|
|
876
|
+
params=params,
|
|
877
|
+
)
|
|
878
|
+
|
|
879
|
+
response = self.send(request, **kwargs)
|
|
880
|
+
return response
|
|
881
|
+
|
|
882
|
+
def get_account_group(
|
|
883
|
+
self,
|
|
884
|
+
account_group_id: str,
|
|
885
|
+
**kwargs,
|
|
886
|
+
) -> DetailedResponse:
|
|
887
|
+
"""
|
|
888
|
+
Get account group by ID.
|
|
889
|
+
|
|
890
|
+
Retrieve an account by the `account_group_id` parameter. All data related to the
|
|
891
|
+
account group is returned only if the caller has access to retrieve the account
|
|
892
|
+
group.
|
|
893
|
+
|
|
894
|
+
:param str account_group_id: The ID of the account group to retrieve.
|
|
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 with `dict` result representing a `AccountGroup` object
|
|
898
|
+
"""
|
|
899
|
+
|
|
900
|
+
if not account_group_id:
|
|
901
|
+
raise ValueError('account_group_id must be provided')
|
|
902
|
+
headers = {}
|
|
903
|
+
sdk_headers = get_sdk_headers(
|
|
904
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
905
|
+
service_version='V1',
|
|
906
|
+
operation_id='get_account_group',
|
|
907
|
+
)
|
|
908
|
+
headers.update(sdk_headers)
|
|
909
|
+
|
|
910
|
+
if 'headers' in kwargs:
|
|
911
|
+
headers.update(kwargs.get('headers'))
|
|
912
|
+
del kwargs['headers']
|
|
913
|
+
headers['Accept'] = 'application/json'
|
|
914
|
+
|
|
915
|
+
path_param_keys = ['account_group_id']
|
|
916
|
+
path_param_values = self.encode_path_vars(account_group_id)
|
|
917
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
918
|
+
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
|
|
919
|
+
request = self.prepare_request(
|
|
920
|
+
method='GET',
|
|
921
|
+
url=url,
|
|
922
|
+
headers=headers,
|
|
923
|
+
)
|
|
924
|
+
|
|
925
|
+
response = self.send(request, **kwargs)
|
|
926
|
+
return response
|
|
927
|
+
|
|
928
|
+
def update_account_group(
|
|
929
|
+
self,
|
|
930
|
+
account_group_id: str,
|
|
931
|
+
*,
|
|
932
|
+
name: Optional[str] = None,
|
|
933
|
+
primary_contact_iam_id: Optional[str] = None,
|
|
934
|
+
**kwargs,
|
|
935
|
+
) -> DetailedResponse:
|
|
936
|
+
"""
|
|
937
|
+
Update an account group.
|
|
938
|
+
|
|
939
|
+
Update the name or IAM ID of the primary contact for an existing account group.
|
|
940
|
+
The new primary contact must already be a user in the enterprise account.
|
|
941
|
+
|
|
942
|
+
:param str account_group_id: The ID of the account group to retrieve.
|
|
943
|
+
:param str name: (optional) The new name of the account group. This field
|
|
944
|
+
must have 3 - 60 characters.
|
|
945
|
+
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
|
|
946
|
+
the new primary contact for the account group.
|
|
947
|
+
:param dict headers: A `dict` containing the request headers
|
|
948
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
949
|
+
:rtype: DetailedResponse
|
|
950
|
+
"""
|
|
951
|
+
|
|
952
|
+
if not account_group_id:
|
|
953
|
+
raise ValueError('account_group_id must be provided')
|
|
954
|
+
headers = {}
|
|
955
|
+
sdk_headers = get_sdk_headers(
|
|
956
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
957
|
+
service_version='V1',
|
|
958
|
+
operation_id='update_account_group',
|
|
959
|
+
)
|
|
960
|
+
headers.update(sdk_headers)
|
|
961
|
+
|
|
962
|
+
data = {
|
|
963
|
+
'name': name,
|
|
964
|
+
'primary_contact_iam_id': primary_contact_iam_id,
|
|
965
|
+
}
|
|
966
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
967
|
+
data = json.dumps(data)
|
|
968
|
+
headers['content-type'] = 'application/json'
|
|
969
|
+
|
|
970
|
+
if 'headers' in kwargs:
|
|
971
|
+
headers.update(kwargs.get('headers'))
|
|
972
|
+
del kwargs['headers']
|
|
973
|
+
|
|
974
|
+
path_param_keys = ['account_group_id']
|
|
975
|
+
path_param_values = self.encode_path_vars(account_group_id)
|
|
976
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
977
|
+
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
|
|
978
|
+
request = self.prepare_request(
|
|
979
|
+
method='PATCH',
|
|
980
|
+
url=url,
|
|
981
|
+
headers=headers,
|
|
982
|
+
data=data,
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
response = self.send(request, **kwargs)
|
|
986
|
+
return response
|
|
987
|
+
|
|
988
|
+
def delete_account_group(
|
|
989
|
+
self,
|
|
990
|
+
account_group_id: str,
|
|
991
|
+
**kwargs,
|
|
992
|
+
) -> DetailedResponse:
|
|
993
|
+
"""
|
|
994
|
+
Delete an account group from the enterprise.
|
|
995
|
+
|
|
996
|
+
Delete an existing account group from the enterprise. You can't delete an account
|
|
997
|
+
group that has child account groups, the delete request will fail. This API
|
|
998
|
+
doesn't perform a recursive delete on the child account groups, it only deletes
|
|
999
|
+
the current account group.
|
|
1000
|
+
|
|
1001
|
+
:param str account_group_id: The ID of the account group to retrieve.
|
|
1002
|
+
:param dict headers: A `dict` containing the request headers
|
|
1003
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
1004
|
+
:rtype: DetailedResponse
|
|
1005
|
+
"""
|
|
1006
|
+
|
|
1007
|
+
if not account_group_id:
|
|
1008
|
+
raise ValueError('account_group_id must be provided')
|
|
1009
|
+
headers = {}
|
|
1010
|
+
sdk_headers = get_sdk_headers(
|
|
1011
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
1012
|
+
service_version='V1',
|
|
1013
|
+
operation_id='delete_account_group',
|
|
1014
|
+
)
|
|
1015
|
+
headers.update(sdk_headers)
|
|
1016
|
+
|
|
1017
|
+
if 'headers' in kwargs:
|
|
1018
|
+
headers.update(kwargs.get('headers'))
|
|
1019
|
+
del kwargs['headers']
|
|
1020
|
+
|
|
1021
|
+
path_param_keys = ['account_group_id']
|
|
1022
|
+
path_param_values = self.encode_path_vars(account_group_id)
|
|
1023
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
1024
|
+
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
|
|
1025
|
+
request = self.prepare_request(
|
|
1026
|
+
method='DELETE',
|
|
1027
|
+
url=url,
|
|
1028
|
+
headers=headers,
|
|
1029
|
+
)
|
|
1030
|
+
|
|
1031
|
+
response = self.send(request, **kwargs)
|
|
1032
|
+
return response
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
##############################################################################
|
|
1036
|
+
# Models
|
|
1037
|
+
##############################################################################
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
class Account:
|
|
1041
|
+
"""
|
|
1042
|
+
An account resource.
|
|
1043
|
+
|
|
1044
|
+
:param str url: (optional) The URL of the account.
|
|
1045
|
+
:param str id: (optional) The account ID.
|
|
1046
|
+
:param str crn: (optional) The Cloud Resource Name (CRN) of the account.
|
|
1047
|
+
:param str parent: (optional) The CRN of the parent of the account.
|
|
1048
|
+
:param str enterprise_account_id: (optional) The enterprise account ID.
|
|
1049
|
+
:param str enterprise_id: (optional) The enterprise ID that the account is a
|
|
1050
|
+
part of.
|
|
1051
|
+
:param str enterprise_path: (optional) The path from the enterprise to this
|
|
1052
|
+
particular account.
|
|
1053
|
+
:param str name: (optional) The name of the account.
|
|
1054
|
+
:param str state: (optional) The state of the account.
|
|
1055
|
+
:param str owner_iam_id: (optional) The IAM ID of the owner of the account.
|
|
1056
|
+
:param bool paid: (optional) The type of account - whether it is free or paid.
|
|
1057
|
+
:param str owner_email: (optional) The email address of the owner of the
|
|
1058
|
+
account.
|
|
1059
|
+
:param bool is_enterprise_account: (optional) The flag to indicate whether the
|
|
1060
|
+
account is an enterprise account or not.
|
|
1061
|
+
:param datetime created_at: (optional) The time stamp at which the account was
|
|
1062
|
+
created.
|
|
1063
|
+
:param str created_by: (optional) The IAM ID of the user or service that created
|
|
1064
|
+
the account.
|
|
1065
|
+
:param datetime updated_at: (optional) The time stamp at which the account was
|
|
1066
|
+
last updated.
|
|
1067
|
+
:param str updated_by: (optional) The IAM ID of the user or service that updated
|
|
1068
|
+
the account.
|
|
1069
|
+
"""
|
|
1070
|
+
|
|
1071
|
+
def __init__(
|
|
1072
|
+
self,
|
|
1073
|
+
*,
|
|
1074
|
+
url: Optional[str] = None,
|
|
1075
|
+
id: Optional[str] = None,
|
|
1076
|
+
crn: Optional[str] = None,
|
|
1077
|
+
parent: Optional[str] = None,
|
|
1078
|
+
enterprise_account_id: Optional[str] = None,
|
|
1079
|
+
enterprise_id: Optional[str] = None,
|
|
1080
|
+
enterprise_path: Optional[str] = None,
|
|
1081
|
+
name: Optional[str] = None,
|
|
1082
|
+
state: Optional[str] = None,
|
|
1083
|
+
owner_iam_id: Optional[str] = None,
|
|
1084
|
+
paid: Optional[bool] = None,
|
|
1085
|
+
owner_email: Optional[str] = None,
|
|
1086
|
+
is_enterprise_account: Optional[bool] = None,
|
|
1087
|
+
created_at: Optional[datetime] = None,
|
|
1088
|
+
created_by: Optional[str] = None,
|
|
1089
|
+
updated_at: Optional[datetime] = None,
|
|
1090
|
+
updated_by: Optional[str] = None,
|
|
1091
|
+
) -> None:
|
|
1092
|
+
"""
|
|
1093
|
+
Initialize a Account object.
|
|
1094
|
+
|
|
1095
|
+
:param str url: (optional) The URL of the account.
|
|
1096
|
+
:param str id: (optional) The account ID.
|
|
1097
|
+
:param str crn: (optional) The Cloud Resource Name (CRN) of the account.
|
|
1098
|
+
:param str parent: (optional) The CRN of the parent of the account.
|
|
1099
|
+
:param str enterprise_account_id: (optional) The enterprise account ID.
|
|
1100
|
+
:param str enterprise_id: (optional) The enterprise ID that the account is
|
|
1101
|
+
a part of.
|
|
1102
|
+
:param str enterprise_path: (optional) The path from the enterprise to this
|
|
1103
|
+
particular account.
|
|
1104
|
+
:param str name: (optional) The name of the account.
|
|
1105
|
+
:param str state: (optional) The state of the account.
|
|
1106
|
+
:param str owner_iam_id: (optional) The IAM ID of the owner of the account.
|
|
1107
|
+
:param bool paid: (optional) The type of account - whether it is free or
|
|
1108
|
+
paid.
|
|
1109
|
+
:param str owner_email: (optional) The email address of the owner of the
|
|
1110
|
+
account.
|
|
1111
|
+
:param bool is_enterprise_account: (optional) The flag to indicate whether
|
|
1112
|
+
the account is an enterprise account or not.
|
|
1113
|
+
:param datetime created_at: (optional) The time stamp at which the account
|
|
1114
|
+
was created.
|
|
1115
|
+
:param str created_by: (optional) The IAM ID of the user or service that
|
|
1116
|
+
created the account.
|
|
1117
|
+
:param datetime updated_at: (optional) The time stamp at which the account
|
|
1118
|
+
was last updated.
|
|
1119
|
+
:param str updated_by: (optional) The IAM ID of the user or service that
|
|
1120
|
+
updated the account.
|
|
1121
|
+
"""
|
|
1122
|
+
self.url = url
|
|
1123
|
+
self.id = id
|
|
1124
|
+
self.crn = crn
|
|
1125
|
+
self.parent = parent
|
|
1126
|
+
self.enterprise_account_id = enterprise_account_id
|
|
1127
|
+
self.enterprise_id = enterprise_id
|
|
1128
|
+
self.enterprise_path = enterprise_path
|
|
1129
|
+
self.name = name
|
|
1130
|
+
self.state = state
|
|
1131
|
+
self.owner_iam_id = owner_iam_id
|
|
1132
|
+
self.paid = paid
|
|
1133
|
+
self.owner_email = owner_email
|
|
1134
|
+
self.is_enterprise_account = is_enterprise_account
|
|
1135
|
+
self.created_at = created_at
|
|
1136
|
+
self.created_by = created_by
|
|
1137
|
+
self.updated_at = updated_at
|
|
1138
|
+
self.updated_by = updated_by
|
|
1139
|
+
|
|
1140
|
+
@classmethod
|
|
1141
|
+
def from_dict(cls, _dict: Dict) -> 'Account':
|
|
1142
|
+
"""Initialize a Account object from a json dictionary."""
|
|
1143
|
+
args = {}
|
|
1144
|
+
if (url := _dict.get('url')) is not None:
|
|
1145
|
+
args['url'] = url
|
|
1146
|
+
if (id := _dict.get('id')) is not None:
|
|
1147
|
+
args['id'] = id
|
|
1148
|
+
if (crn := _dict.get('crn')) is not None:
|
|
1149
|
+
args['crn'] = crn
|
|
1150
|
+
if (parent := _dict.get('parent')) is not None:
|
|
1151
|
+
args['parent'] = parent
|
|
1152
|
+
if (enterprise_account_id := _dict.get('enterprise_account_id')) is not None:
|
|
1153
|
+
args['enterprise_account_id'] = enterprise_account_id
|
|
1154
|
+
if (enterprise_id := _dict.get('enterprise_id')) is not None:
|
|
1155
|
+
args['enterprise_id'] = enterprise_id
|
|
1156
|
+
if (enterprise_path := _dict.get('enterprise_path')) is not None:
|
|
1157
|
+
args['enterprise_path'] = enterprise_path
|
|
1158
|
+
if (name := _dict.get('name')) is not None:
|
|
1159
|
+
args['name'] = name
|
|
1160
|
+
if (state := _dict.get('state')) is not None:
|
|
1161
|
+
args['state'] = state
|
|
1162
|
+
if (owner_iam_id := _dict.get('owner_iam_id')) is not None:
|
|
1163
|
+
args['owner_iam_id'] = owner_iam_id
|
|
1164
|
+
if (paid := _dict.get('paid')) is not None:
|
|
1165
|
+
args['paid'] = paid
|
|
1166
|
+
if (owner_email := _dict.get('owner_email')) is not None:
|
|
1167
|
+
args['owner_email'] = owner_email
|
|
1168
|
+
if (is_enterprise_account := _dict.get('is_enterprise_account')) is not None:
|
|
1169
|
+
args['is_enterprise_account'] = is_enterprise_account
|
|
1170
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
1171
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
1172
|
+
if (created_by := _dict.get('created_by')) is not None:
|
|
1173
|
+
args['created_by'] = created_by
|
|
1174
|
+
if (updated_at := _dict.get('updated_at')) is not None:
|
|
1175
|
+
args['updated_at'] = string_to_datetime(updated_at)
|
|
1176
|
+
if (updated_by := _dict.get('updated_by')) is not None:
|
|
1177
|
+
args['updated_by'] = updated_by
|
|
1178
|
+
return cls(**args)
|
|
1179
|
+
|
|
1180
|
+
@classmethod
|
|
1181
|
+
def _from_dict(cls, _dict):
|
|
1182
|
+
"""Initialize a Account object from a json dictionary."""
|
|
1183
|
+
return cls.from_dict(_dict)
|
|
1184
|
+
|
|
1185
|
+
def to_dict(self) -> Dict:
|
|
1186
|
+
"""Return a json dictionary representing this model."""
|
|
1187
|
+
_dict = {}
|
|
1188
|
+
if hasattr(self, 'url') and self.url is not None:
|
|
1189
|
+
_dict['url'] = self.url
|
|
1190
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
1191
|
+
_dict['id'] = self.id
|
|
1192
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
1193
|
+
_dict['crn'] = self.crn
|
|
1194
|
+
if hasattr(self, 'parent') and self.parent is not None:
|
|
1195
|
+
_dict['parent'] = self.parent
|
|
1196
|
+
if hasattr(self, 'enterprise_account_id') and self.enterprise_account_id is not None:
|
|
1197
|
+
_dict['enterprise_account_id'] = self.enterprise_account_id
|
|
1198
|
+
if hasattr(self, 'enterprise_id') and self.enterprise_id is not None:
|
|
1199
|
+
_dict['enterprise_id'] = self.enterprise_id
|
|
1200
|
+
if hasattr(self, 'enterprise_path') and self.enterprise_path is not None:
|
|
1201
|
+
_dict['enterprise_path'] = self.enterprise_path
|
|
1202
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1203
|
+
_dict['name'] = self.name
|
|
1204
|
+
if hasattr(self, 'state') and self.state is not None:
|
|
1205
|
+
_dict['state'] = self.state
|
|
1206
|
+
if hasattr(self, 'owner_iam_id') and self.owner_iam_id is not None:
|
|
1207
|
+
_dict['owner_iam_id'] = self.owner_iam_id
|
|
1208
|
+
if hasattr(self, 'paid') and self.paid is not None:
|
|
1209
|
+
_dict['paid'] = self.paid
|
|
1210
|
+
if hasattr(self, 'owner_email') and self.owner_email is not None:
|
|
1211
|
+
_dict['owner_email'] = self.owner_email
|
|
1212
|
+
if hasattr(self, 'is_enterprise_account') and self.is_enterprise_account is not None:
|
|
1213
|
+
_dict['is_enterprise_account'] = self.is_enterprise_account
|
|
1214
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
1215
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
1216
|
+
if hasattr(self, 'created_by') and self.created_by is not None:
|
|
1217
|
+
_dict['created_by'] = self.created_by
|
|
1218
|
+
if hasattr(self, 'updated_at') and self.updated_at is not None:
|
|
1219
|
+
_dict['updated_at'] = datetime_to_string(self.updated_at)
|
|
1220
|
+
if hasattr(self, 'updated_by') and self.updated_by is not None:
|
|
1221
|
+
_dict['updated_by'] = self.updated_by
|
|
1222
|
+
return _dict
|
|
1223
|
+
|
|
1224
|
+
def _to_dict(self):
|
|
1225
|
+
"""Return a json dictionary representing this model."""
|
|
1226
|
+
return self.to_dict()
|
|
1227
|
+
|
|
1228
|
+
def __str__(self) -> str:
|
|
1229
|
+
"""Return a `str` version of this Account object."""
|
|
1230
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1231
|
+
|
|
1232
|
+
def __eq__(self, other: 'Account') -> bool:
|
|
1233
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1234
|
+
if not isinstance(other, self.__class__):
|
|
1235
|
+
return False
|
|
1236
|
+
return self.__dict__ == other.__dict__
|
|
1237
|
+
|
|
1238
|
+
def __ne__(self, other: 'Account') -> bool:
|
|
1239
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1240
|
+
return not self == other
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
class AccountGroup:
|
|
1244
|
+
"""
|
|
1245
|
+
An account group resource.
|
|
1246
|
+
|
|
1247
|
+
:param str url: (optional) The URL of the account group.
|
|
1248
|
+
:param str id: (optional) The account group ID.
|
|
1249
|
+
:param str crn: (optional) The Cloud Resource Name (CRN) of the account group.
|
|
1250
|
+
:param str parent: (optional) The CRN of the parent of the account group.
|
|
1251
|
+
:param str enterprise_account_id: (optional) The enterprise account ID.
|
|
1252
|
+
:param str enterprise_id: (optional) The enterprise ID that the account group is
|
|
1253
|
+
a part of.
|
|
1254
|
+
:param str enterprise_path: (optional) The path from the enterprise to this
|
|
1255
|
+
particular account group.
|
|
1256
|
+
:param str name: (optional) The name of the account group.
|
|
1257
|
+
:param str state: (optional) The state of the account group.
|
|
1258
|
+
:param str primary_contact_iam_id: (optional) The IAM ID of the primary contact
|
|
1259
|
+
of the account group.
|
|
1260
|
+
:param str primary_contact_email: (optional) The email address of the primary
|
|
1261
|
+
contact of the account group.
|
|
1262
|
+
:param datetime created_at: (optional) The time stamp at which the account group
|
|
1263
|
+
was created.
|
|
1264
|
+
:param str created_by: (optional) The IAM ID of the user or service that created
|
|
1265
|
+
the account group.
|
|
1266
|
+
:param datetime updated_at: (optional) The time stamp at which the account group
|
|
1267
|
+
was last updated.
|
|
1268
|
+
:param str updated_by: (optional) The IAM ID of the user or service that updated
|
|
1269
|
+
the account group.
|
|
1270
|
+
"""
|
|
1271
|
+
|
|
1272
|
+
def __init__(
|
|
1273
|
+
self,
|
|
1274
|
+
*,
|
|
1275
|
+
url: Optional[str] = None,
|
|
1276
|
+
id: Optional[str] = None,
|
|
1277
|
+
crn: Optional[str] = None,
|
|
1278
|
+
parent: Optional[str] = None,
|
|
1279
|
+
enterprise_account_id: Optional[str] = None,
|
|
1280
|
+
enterprise_id: Optional[str] = None,
|
|
1281
|
+
enterprise_path: Optional[str] = None,
|
|
1282
|
+
name: Optional[str] = None,
|
|
1283
|
+
state: Optional[str] = None,
|
|
1284
|
+
primary_contact_iam_id: Optional[str] = None,
|
|
1285
|
+
primary_contact_email: Optional[str] = None,
|
|
1286
|
+
created_at: Optional[datetime] = None,
|
|
1287
|
+
created_by: Optional[str] = None,
|
|
1288
|
+
updated_at: Optional[datetime] = None,
|
|
1289
|
+
updated_by: Optional[str] = None,
|
|
1290
|
+
) -> None:
|
|
1291
|
+
"""
|
|
1292
|
+
Initialize a AccountGroup object.
|
|
1293
|
+
|
|
1294
|
+
:param str url: (optional) The URL of the account group.
|
|
1295
|
+
:param str id: (optional) The account group ID.
|
|
1296
|
+
:param str crn: (optional) The Cloud Resource Name (CRN) of the account
|
|
1297
|
+
group.
|
|
1298
|
+
:param str parent: (optional) The CRN of the parent of the account group.
|
|
1299
|
+
:param str enterprise_account_id: (optional) The enterprise account ID.
|
|
1300
|
+
:param str enterprise_id: (optional) The enterprise ID that the account
|
|
1301
|
+
group is a part of.
|
|
1302
|
+
:param str enterprise_path: (optional) The path from the enterprise to this
|
|
1303
|
+
particular account group.
|
|
1304
|
+
:param str name: (optional) The name of the account group.
|
|
1305
|
+
:param str state: (optional) The state of the account group.
|
|
1306
|
+
:param str primary_contact_iam_id: (optional) The IAM ID of the primary
|
|
1307
|
+
contact of the account group.
|
|
1308
|
+
:param str primary_contact_email: (optional) The email address of the
|
|
1309
|
+
primary contact of the account group.
|
|
1310
|
+
:param datetime created_at: (optional) The time stamp at which the account
|
|
1311
|
+
group was created.
|
|
1312
|
+
:param str created_by: (optional) The IAM ID of the user or service that
|
|
1313
|
+
created the account group.
|
|
1314
|
+
:param datetime updated_at: (optional) The time stamp at which the account
|
|
1315
|
+
group was last updated.
|
|
1316
|
+
:param str updated_by: (optional) The IAM ID of the user or service that
|
|
1317
|
+
updated the account group.
|
|
1318
|
+
"""
|
|
1319
|
+
self.url = url
|
|
1320
|
+
self.id = id
|
|
1321
|
+
self.crn = crn
|
|
1322
|
+
self.parent = parent
|
|
1323
|
+
self.enterprise_account_id = enterprise_account_id
|
|
1324
|
+
self.enterprise_id = enterprise_id
|
|
1325
|
+
self.enterprise_path = enterprise_path
|
|
1326
|
+
self.name = name
|
|
1327
|
+
self.state = state
|
|
1328
|
+
self.primary_contact_iam_id = primary_contact_iam_id
|
|
1329
|
+
self.primary_contact_email = primary_contact_email
|
|
1330
|
+
self.created_at = created_at
|
|
1331
|
+
self.created_by = created_by
|
|
1332
|
+
self.updated_at = updated_at
|
|
1333
|
+
self.updated_by = updated_by
|
|
1334
|
+
|
|
1335
|
+
@classmethod
|
|
1336
|
+
def from_dict(cls, _dict: Dict) -> 'AccountGroup':
|
|
1337
|
+
"""Initialize a AccountGroup object from a json dictionary."""
|
|
1338
|
+
args = {}
|
|
1339
|
+
if (url := _dict.get('url')) is not None:
|
|
1340
|
+
args['url'] = url
|
|
1341
|
+
if (id := _dict.get('id')) is not None:
|
|
1342
|
+
args['id'] = id
|
|
1343
|
+
if (crn := _dict.get('crn')) is not None:
|
|
1344
|
+
args['crn'] = crn
|
|
1345
|
+
if (parent := _dict.get('parent')) is not None:
|
|
1346
|
+
args['parent'] = parent
|
|
1347
|
+
if (enterprise_account_id := _dict.get('enterprise_account_id')) is not None:
|
|
1348
|
+
args['enterprise_account_id'] = enterprise_account_id
|
|
1349
|
+
if (enterprise_id := _dict.get('enterprise_id')) is not None:
|
|
1350
|
+
args['enterprise_id'] = enterprise_id
|
|
1351
|
+
if (enterprise_path := _dict.get('enterprise_path')) is not None:
|
|
1352
|
+
args['enterprise_path'] = enterprise_path
|
|
1353
|
+
if (name := _dict.get('name')) is not None:
|
|
1354
|
+
args['name'] = name
|
|
1355
|
+
if (state := _dict.get('state')) is not None:
|
|
1356
|
+
args['state'] = state
|
|
1357
|
+
if (primary_contact_iam_id := _dict.get('primary_contact_iam_id')) is not None:
|
|
1358
|
+
args['primary_contact_iam_id'] = primary_contact_iam_id
|
|
1359
|
+
if (primary_contact_email := _dict.get('primary_contact_email')) is not None:
|
|
1360
|
+
args['primary_contact_email'] = primary_contact_email
|
|
1361
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
1362
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
1363
|
+
if (created_by := _dict.get('created_by')) is not None:
|
|
1364
|
+
args['created_by'] = created_by
|
|
1365
|
+
if (updated_at := _dict.get('updated_at')) is not None:
|
|
1366
|
+
args['updated_at'] = string_to_datetime(updated_at)
|
|
1367
|
+
if (updated_by := _dict.get('updated_by')) is not None:
|
|
1368
|
+
args['updated_by'] = updated_by
|
|
1369
|
+
return cls(**args)
|
|
1370
|
+
|
|
1371
|
+
@classmethod
|
|
1372
|
+
def _from_dict(cls, _dict):
|
|
1373
|
+
"""Initialize a AccountGroup object from a json dictionary."""
|
|
1374
|
+
return cls.from_dict(_dict)
|
|
1375
|
+
|
|
1376
|
+
def to_dict(self) -> Dict:
|
|
1377
|
+
"""Return a json dictionary representing this model."""
|
|
1378
|
+
_dict = {}
|
|
1379
|
+
if hasattr(self, 'url') and self.url is not None:
|
|
1380
|
+
_dict['url'] = self.url
|
|
1381
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
1382
|
+
_dict['id'] = self.id
|
|
1383
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
1384
|
+
_dict['crn'] = self.crn
|
|
1385
|
+
if hasattr(self, 'parent') and self.parent is not None:
|
|
1386
|
+
_dict['parent'] = self.parent
|
|
1387
|
+
if hasattr(self, 'enterprise_account_id') and self.enterprise_account_id is not None:
|
|
1388
|
+
_dict['enterprise_account_id'] = self.enterprise_account_id
|
|
1389
|
+
if hasattr(self, 'enterprise_id') and self.enterprise_id is not None:
|
|
1390
|
+
_dict['enterprise_id'] = self.enterprise_id
|
|
1391
|
+
if hasattr(self, 'enterprise_path') and self.enterprise_path is not None:
|
|
1392
|
+
_dict['enterprise_path'] = self.enterprise_path
|
|
1393
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1394
|
+
_dict['name'] = self.name
|
|
1395
|
+
if hasattr(self, 'state') and self.state is not None:
|
|
1396
|
+
_dict['state'] = self.state
|
|
1397
|
+
if hasattr(self, 'primary_contact_iam_id') and self.primary_contact_iam_id is not None:
|
|
1398
|
+
_dict['primary_contact_iam_id'] = self.primary_contact_iam_id
|
|
1399
|
+
if hasattr(self, 'primary_contact_email') and self.primary_contact_email is not None:
|
|
1400
|
+
_dict['primary_contact_email'] = self.primary_contact_email
|
|
1401
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
1402
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
1403
|
+
if hasattr(self, 'created_by') and self.created_by is not None:
|
|
1404
|
+
_dict['created_by'] = self.created_by
|
|
1405
|
+
if hasattr(self, 'updated_at') and self.updated_at is not None:
|
|
1406
|
+
_dict['updated_at'] = datetime_to_string(self.updated_at)
|
|
1407
|
+
if hasattr(self, 'updated_by') and self.updated_by is not None:
|
|
1408
|
+
_dict['updated_by'] = self.updated_by
|
|
1409
|
+
return _dict
|
|
1410
|
+
|
|
1411
|
+
def _to_dict(self):
|
|
1412
|
+
"""Return a json dictionary representing this model."""
|
|
1413
|
+
return self.to_dict()
|
|
1414
|
+
|
|
1415
|
+
def __str__(self) -> str:
|
|
1416
|
+
"""Return a `str` version of this AccountGroup object."""
|
|
1417
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1418
|
+
|
|
1419
|
+
def __eq__(self, other: 'AccountGroup') -> bool:
|
|
1420
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1421
|
+
if not isinstance(other, self.__class__):
|
|
1422
|
+
return False
|
|
1423
|
+
return self.__dict__ == other.__dict__
|
|
1424
|
+
|
|
1425
|
+
def __ne__(self, other: 'AccountGroup') -> bool:
|
|
1426
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1427
|
+
return not self == other
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
class CreateAccountGroupResponse:
|
|
1431
|
+
"""
|
|
1432
|
+
A newly-created account group.
|
|
1433
|
+
|
|
1434
|
+
:param str account_group_id: (optional) The ID of the account group entity that
|
|
1435
|
+
was created.
|
|
1436
|
+
"""
|
|
1437
|
+
|
|
1438
|
+
def __init__(
|
|
1439
|
+
self,
|
|
1440
|
+
*,
|
|
1441
|
+
account_group_id: Optional[str] = None,
|
|
1442
|
+
) -> None:
|
|
1443
|
+
"""
|
|
1444
|
+
Initialize a CreateAccountGroupResponse object.
|
|
1445
|
+
|
|
1446
|
+
:param str account_group_id: (optional) The ID of the account group entity
|
|
1447
|
+
that was created.
|
|
1448
|
+
"""
|
|
1449
|
+
self.account_group_id = account_group_id
|
|
1450
|
+
|
|
1451
|
+
@classmethod
|
|
1452
|
+
def from_dict(cls, _dict: Dict) -> 'CreateAccountGroupResponse':
|
|
1453
|
+
"""Initialize a CreateAccountGroupResponse object from a json dictionary."""
|
|
1454
|
+
args = {}
|
|
1455
|
+
if (account_group_id := _dict.get('account_group_id')) is not None:
|
|
1456
|
+
args['account_group_id'] = account_group_id
|
|
1457
|
+
return cls(**args)
|
|
1458
|
+
|
|
1459
|
+
@classmethod
|
|
1460
|
+
def _from_dict(cls, _dict):
|
|
1461
|
+
"""Initialize a CreateAccountGroupResponse object from a json dictionary."""
|
|
1462
|
+
return cls.from_dict(_dict)
|
|
1463
|
+
|
|
1464
|
+
def to_dict(self) -> Dict:
|
|
1465
|
+
"""Return a json dictionary representing this model."""
|
|
1466
|
+
_dict = {}
|
|
1467
|
+
if hasattr(self, 'account_group_id') and self.account_group_id is not None:
|
|
1468
|
+
_dict['account_group_id'] = self.account_group_id
|
|
1469
|
+
return _dict
|
|
1470
|
+
|
|
1471
|
+
def _to_dict(self):
|
|
1472
|
+
"""Return a json dictionary representing this model."""
|
|
1473
|
+
return self.to_dict()
|
|
1474
|
+
|
|
1475
|
+
def __str__(self) -> str:
|
|
1476
|
+
"""Return a `str` version of this CreateAccountGroupResponse object."""
|
|
1477
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1478
|
+
|
|
1479
|
+
def __eq__(self, other: 'CreateAccountGroupResponse') -> bool:
|
|
1480
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1481
|
+
if not isinstance(other, self.__class__):
|
|
1482
|
+
return False
|
|
1483
|
+
return self.__dict__ == other.__dict__
|
|
1484
|
+
|
|
1485
|
+
def __ne__(self, other: 'CreateAccountGroupResponse') -> bool:
|
|
1486
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1487
|
+
return not self == other
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
class CreateAccountRequestOptions:
|
|
1491
|
+
"""
|
|
1492
|
+
The options object can be used to set properties on child accounts of an enterprise.
|
|
1493
|
+
You can pass a field to to create IAM service id with IAM api keyg when creating a
|
|
1494
|
+
child account in the enterprise. This is an optional field.
|
|
1495
|
+
|
|
1496
|
+
:param bool create_iam_service_id_with_apikey_and_owner_policies: (optional) By
|
|
1497
|
+
default create_iam_service_id_with_apikey_and_owner_policies is turned off for a
|
|
1498
|
+
newly created child account. You can enable this property by passing 'true' in
|
|
1499
|
+
this boolean field. IAM service id has account owner IAM policies and the API
|
|
1500
|
+
key associated with it can generate a token and setup resources in the account.
|
|
1501
|
+
This is an optional field.
|
|
1502
|
+
"""
|
|
1503
|
+
|
|
1504
|
+
def __init__(
|
|
1505
|
+
self,
|
|
1506
|
+
*,
|
|
1507
|
+
create_iam_service_id_with_apikey_and_owner_policies: Optional[bool] = None,
|
|
1508
|
+
) -> None:
|
|
1509
|
+
"""
|
|
1510
|
+
Initialize a CreateAccountRequestOptions object.
|
|
1511
|
+
|
|
1512
|
+
:param bool create_iam_service_id_with_apikey_and_owner_policies:
|
|
1513
|
+
(optional) By default create_iam_service_id_with_apikey_and_owner_policies
|
|
1514
|
+
is turned off for a newly created child account. You can enable this
|
|
1515
|
+
property by passing 'true' in this boolean field. IAM service id has
|
|
1516
|
+
account owner IAM policies and the API key associated with it can generate
|
|
1517
|
+
a token and setup resources in the account. This is an optional field.
|
|
1518
|
+
"""
|
|
1519
|
+
self.create_iam_service_id_with_apikey_and_owner_policies = create_iam_service_id_with_apikey_and_owner_policies
|
|
1520
|
+
|
|
1521
|
+
@classmethod
|
|
1522
|
+
def from_dict(cls, _dict: Dict) -> 'CreateAccountRequestOptions':
|
|
1523
|
+
"""Initialize a CreateAccountRequestOptions object from a json dictionary."""
|
|
1524
|
+
args = {}
|
|
1525
|
+
if (
|
|
1526
|
+
create_iam_service_id_with_apikey_and_owner_policies := _dict.get(
|
|
1527
|
+
'create_iam_service_id_with_apikey_and_owner_policies'
|
|
1528
|
+
)
|
|
1529
|
+
) is not None:
|
|
1530
|
+
args['create_iam_service_id_with_apikey_and_owner_policies'] = (
|
|
1531
|
+
create_iam_service_id_with_apikey_and_owner_policies
|
|
1532
|
+
)
|
|
1533
|
+
return cls(**args)
|
|
1534
|
+
|
|
1535
|
+
@classmethod
|
|
1536
|
+
def _from_dict(cls, _dict):
|
|
1537
|
+
"""Initialize a CreateAccountRequestOptions object from a json dictionary."""
|
|
1538
|
+
return cls.from_dict(_dict)
|
|
1539
|
+
|
|
1540
|
+
def to_dict(self) -> Dict:
|
|
1541
|
+
"""Return a json dictionary representing this model."""
|
|
1542
|
+
_dict = {}
|
|
1543
|
+
if (
|
|
1544
|
+
hasattr(self, 'create_iam_service_id_with_apikey_and_owner_policies')
|
|
1545
|
+
and self.create_iam_service_id_with_apikey_and_owner_policies is not None
|
|
1546
|
+
):
|
|
1547
|
+
_dict['create_iam_service_id_with_apikey_and_owner_policies'] = (
|
|
1548
|
+
self.create_iam_service_id_with_apikey_and_owner_policies
|
|
1549
|
+
)
|
|
1550
|
+
return _dict
|
|
1551
|
+
|
|
1552
|
+
def _to_dict(self):
|
|
1553
|
+
"""Return a json dictionary representing this model."""
|
|
1554
|
+
return self.to_dict()
|
|
1555
|
+
|
|
1556
|
+
def __str__(self) -> str:
|
|
1557
|
+
"""Return a `str` version of this CreateAccountRequestOptions object."""
|
|
1558
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1559
|
+
|
|
1560
|
+
def __eq__(self, other: 'CreateAccountRequestOptions') -> bool:
|
|
1561
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1562
|
+
if not isinstance(other, self.__class__):
|
|
1563
|
+
return False
|
|
1564
|
+
return self.__dict__ == other.__dict__
|
|
1565
|
+
|
|
1566
|
+
def __ne__(self, other: 'CreateAccountRequestOptions') -> bool:
|
|
1567
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1568
|
+
return not self == other
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
class CreateAccountRequestTraits:
|
|
1572
|
+
"""
|
|
1573
|
+
The traits object can be used to set properties on child accounts of an enterprise.
|
|
1574
|
+
You can pass a field to opt-out of the default multi-factor authentication setting or
|
|
1575
|
+
enable enterprise-managed IAM when creating a child account in the enterprise. This is
|
|
1576
|
+
an optional field.
|
|
1577
|
+
|
|
1578
|
+
:param str mfa: (optional) By default MFA is set to `NONE_NO_ROPC` on a child
|
|
1579
|
+
account, which disables CLI logins with only a password. To opt out, pass the
|
|
1580
|
+
traits object with the mfa field set to empty string. This is an optional field.
|
|
1581
|
+
:param bool enterprise_iam_managed: (optional) By default enterprise-managed IAM
|
|
1582
|
+
is turned off for a newly created child account. You can enable this property by
|
|
1583
|
+
passing 'true' in this boolean field. Enabling enterprise-managed IAM allows the
|
|
1584
|
+
enterprise account to assign IAM resources, like access groups, trusted
|
|
1585
|
+
profiles, and account settings, to the child account. This is an optional field.
|
|
1586
|
+
"""
|
|
1587
|
+
|
|
1588
|
+
def __init__(
|
|
1589
|
+
self,
|
|
1590
|
+
*,
|
|
1591
|
+
mfa: Optional[str] = None,
|
|
1592
|
+
enterprise_iam_managed: Optional[bool] = None,
|
|
1593
|
+
) -> None:
|
|
1594
|
+
"""
|
|
1595
|
+
Initialize a CreateAccountRequestTraits object.
|
|
1596
|
+
|
|
1597
|
+
:param str mfa: (optional) By default MFA is set to `NONE_NO_ROPC` on a
|
|
1598
|
+
child account, which disables CLI logins with only a password. To opt out,
|
|
1599
|
+
pass the traits object with the mfa field set to empty string. This is an
|
|
1600
|
+
optional field.
|
|
1601
|
+
:param bool enterprise_iam_managed: (optional) By default
|
|
1602
|
+
enterprise-managed IAM is turned off for a newly created child account. You
|
|
1603
|
+
can enable this property by passing 'true' in this boolean field. Enabling
|
|
1604
|
+
enterprise-managed IAM allows the enterprise account to assign IAM
|
|
1605
|
+
resources, like access groups, trusted profiles, and account settings, to
|
|
1606
|
+
the child account. This is an optional field.
|
|
1607
|
+
"""
|
|
1608
|
+
self.mfa = mfa
|
|
1609
|
+
self.enterprise_iam_managed = enterprise_iam_managed
|
|
1610
|
+
|
|
1611
|
+
@classmethod
|
|
1612
|
+
def from_dict(cls, _dict: Dict) -> 'CreateAccountRequestTraits':
|
|
1613
|
+
"""Initialize a CreateAccountRequestTraits object from a json dictionary."""
|
|
1614
|
+
args = {}
|
|
1615
|
+
if (mfa := _dict.get('mfa')) is not None:
|
|
1616
|
+
args['mfa'] = mfa
|
|
1617
|
+
if (enterprise_iam_managed := _dict.get('enterprise_iam_managed')) is not None:
|
|
1618
|
+
args['enterprise_iam_managed'] = enterprise_iam_managed
|
|
1619
|
+
return cls(**args)
|
|
1620
|
+
|
|
1621
|
+
@classmethod
|
|
1622
|
+
def _from_dict(cls, _dict):
|
|
1623
|
+
"""Initialize a CreateAccountRequestTraits object from a json dictionary."""
|
|
1624
|
+
return cls.from_dict(_dict)
|
|
1625
|
+
|
|
1626
|
+
def to_dict(self) -> Dict:
|
|
1627
|
+
"""Return a json dictionary representing this model."""
|
|
1628
|
+
_dict = {}
|
|
1629
|
+
if hasattr(self, 'mfa') and self.mfa is not None:
|
|
1630
|
+
_dict['mfa'] = self.mfa
|
|
1631
|
+
if hasattr(self, 'enterprise_iam_managed') and self.enterprise_iam_managed is not None:
|
|
1632
|
+
_dict['enterprise_iam_managed'] = self.enterprise_iam_managed
|
|
1633
|
+
return _dict
|
|
1634
|
+
|
|
1635
|
+
def _to_dict(self):
|
|
1636
|
+
"""Return a json dictionary representing this model."""
|
|
1637
|
+
return self.to_dict()
|
|
1638
|
+
|
|
1639
|
+
def __str__(self) -> str:
|
|
1640
|
+
"""Return a `str` version of this CreateAccountRequestTraits object."""
|
|
1641
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1642
|
+
|
|
1643
|
+
def __eq__(self, other: 'CreateAccountRequestTraits') -> bool:
|
|
1644
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1645
|
+
if not isinstance(other, self.__class__):
|
|
1646
|
+
return False
|
|
1647
|
+
return self.__dict__ == other.__dict__
|
|
1648
|
+
|
|
1649
|
+
def __ne__(self, other: 'CreateAccountRequestTraits') -> bool:
|
|
1650
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1651
|
+
return not self == other
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
class CreateAccountResponse:
|
|
1655
|
+
"""
|
|
1656
|
+
A newly-created account.
|
|
1657
|
+
|
|
1658
|
+
:param str account_id: (optional) The ID of the account entity that was created.
|
|
1659
|
+
:param str iam_service_id: (optional) The iam_service_id of the account entity
|
|
1660
|
+
that was created.
|
|
1661
|
+
:param str iam_apikey_id: (optional) The iam_apikey_id of the account entity
|
|
1662
|
+
that was created.
|
|
1663
|
+
:param str iam_apikey: (optional) The iam_apikey of the account entity with
|
|
1664
|
+
owner iam policies that was created.
|
|
1665
|
+
"""
|
|
1666
|
+
|
|
1667
|
+
def __init__(
|
|
1668
|
+
self,
|
|
1669
|
+
*,
|
|
1670
|
+
account_id: Optional[str] = None,
|
|
1671
|
+
iam_service_id: Optional[str] = None,
|
|
1672
|
+
iam_apikey_id: Optional[str] = None,
|
|
1673
|
+
iam_apikey: Optional[str] = None,
|
|
1674
|
+
) -> None:
|
|
1675
|
+
"""
|
|
1676
|
+
Initialize a CreateAccountResponse object.
|
|
1677
|
+
|
|
1678
|
+
:param str account_id: (optional) The ID of the account entity that was
|
|
1679
|
+
created.
|
|
1680
|
+
:param str iam_service_id: (optional) The iam_service_id of the account
|
|
1681
|
+
entity that was created.
|
|
1682
|
+
:param str iam_apikey_id: (optional) The iam_apikey_id of the account
|
|
1683
|
+
entity that was created.
|
|
1684
|
+
:param str iam_apikey: (optional) The iam_apikey of the account entity with
|
|
1685
|
+
owner iam policies that was created.
|
|
1686
|
+
"""
|
|
1687
|
+
self.account_id = account_id
|
|
1688
|
+
self.iam_service_id = iam_service_id
|
|
1689
|
+
self.iam_apikey_id = iam_apikey_id
|
|
1690
|
+
self.iam_apikey = iam_apikey
|
|
1691
|
+
|
|
1692
|
+
@classmethod
|
|
1693
|
+
def from_dict(cls, _dict: Dict) -> 'CreateAccountResponse':
|
|
1694
|
+
"""Initialize a CreateAccountResponse object from a json dictionary."""
|
|
1695
|
+
args = {}
|
|
1696
|
+
if (account_id := _dict.get('account_id')) is not None:
|
|
1697
|
+
args['account_id'] = account_id
|
|
1698
|
+
if (iam_service_id := _dict.get('iam_service_id')) is not None:
|
|
1699
|
+
args['iam_service_id'] = iam_service_id
|
|
1700
|
+
if (iam_apikey_id := _dict.get('iam_apikey_id')) is not None:
|
|
1701
|
+
args['iam_apikey_id'] = iam_apikey_id
|
|
1702
|
+
if (iam_apikey := _dict.get('iam_apikey')) is not None:
|
|
1703
|
+
args['iam_apikey'] = iam_apikey
|
|
1704
|
+
return cls(**args)
|
|
1705
|
+
|
|
1706
|
+
@classmethod
|
|
1707
|
+
def _from_dict(cls, _dict):
|
|
1708
|
+
"""Initialize a CreateAccountResponse object from a json dictionary."""
|
|
1709
|
+
return cls.from_dict(_dict)
|
|
1710
|
+
|
|
1711
|
+
def to_dict(self) -> Dict:
|
|
1712
|
+
"""Return a json dictionary representing this model."""
|
|
1713
|
+
_dict = {}
|
|
1714
|
+
if hasattr(self, 'account_id') and self.account_id is not None:
|
|
1715
|
+
_dict['account_id'] = self.account_id
|
|
1716
|
+
if hasattr(self, 'iam_service_id') and self.iam_service_id is not None:
|
|
1717
|
+
_dict['iam_service_id'] = self.iam_service_id
|
|
1718
|
+
if hasattr(self, 'iam_apikey_id') and self.iam_apikey_id is not None:
|
|
1719
|
+
_dict['iam_apikey_id'] = self.iam_apikey_id
|
|
1720
|
+
if hasattr(self, 'iam_apikey') and self.iam_apikey is not None:
|
|
1721
|
+
_dict['iam_apikey'] = self.iam_apikey
|
|
1722
|
+
return _dict
|
|
1723
|
+
|
|
1724
|
+
def _to_dict(self):
|
|
1725
|
+
"""Return a json dictionary representing this model."""
|
|
1726
|
+
return self.to_dict()
|
|
1727
|
+
|
|
1728
|
+
def __str__(self) -> str:
|
|
1729
|
+
"""Return a `str` version of this CreateAccountResponse object."""
|
|
1730
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1731
|
+
|
|
1732
|
+
def __eq__(self, other: 'CreateAccountResponse') -> bool:
|
|
1733
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1734
|
+
if not isinstance(other, self.__class__):
|
|
1735
|
+
return False
|
|
1736
|
+
return self.__dict__ == other.__dict__
|
|
1737
|
+
|
|
1738
|
+
def __ne__(self, other: 'CreateAccountResponse') -> bool:
|
|
1739
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1740
|
+
return not self == other
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
class CreateEnterpriseResponse:
|
|
1744
|
+
"""
|
|
1745
|
+
The response from calling create enterprise.
|
|
1746
|
+
|
|
1747
|
+
:param str enterprise_id: (optional) The ID of the enterprise entity that was
|
|
1748
|
+
created. This entity is the root of the hierarchy.
|
|
1749
|
+
:param str enterprise_account_id: (optional) The ID of the enterprise account
|
|
1750
|
+
that was created. The enterprise account is used to manage billing and access to
|
|
1751
|
+
the enterprise management.
|
|
1752
|
+
"""
|
|
1753
|
+
|
|
1754
|
+
def __init__(
|
|
1755
|
+
self,
|
|
1756
|
+
*,
|
|
1757
|
+
enterprise_id: Optional[str] = None,
|
|
1758
|
+
enterprise_account_id: Optional[str] = None,
|
|
1759
|
+
) -> None:
|
|
1760
|
+
"""
|
|
1761
|
+
Initialize a CreateEnterpriseResponse object.
|
|
1762
|
+
|
|
1763
|
+
:param str enterprise_id: (optional) The ID of the enterprise entity that
|
|
1764
|
+
was created. This entity is the root of the hierarchy.
|
|
1765
|
+
:param str enterprise_account_id: (optional) The ID of the enterprise
|
|
1766
|
+
account that was created. The enterprise account is used to manage billing
|
|
1767
|
+
and access to the enterprise management.
|
|
1768
|
+
"""
|
|
1769
|
+
self.enterprise_id = enterprise_id
|
|
1770
|
+
self.enterprise_account_id = enterprise_account_id
|
|
1771
|
+
|
|
1772
|
+
@classmethod
|
|
1773
|
+
def from_dict(cls, _dict: Dict) -> 'CreateEnterpriseResponse':
|
|
1774
|
+
"""Initialize a CreateEnterpriseResponse object from a json dictionary."""
|
|
1775
|
+
args = {}
|
|
1776
|
+
if (enterprise_id := _dict.get('enterprise_id')) is not None:
|
|
1777
|
+
args['enterprise_id'] = enterprise_id
|
|
1778
|
+
if (enterprise_account_id := _dict.get('enterprise_account_id')) is not None:
|
|
1779
|
+
args['enterprise_account_id'] = enterprise_account_id
|
|
1780
|
+
return cls(**args)
|
|
1781
|
+
|
|
1782
|
+
@classmethod
|
|
1783
|
+
def _from_dict(cls, _dict):
|
|
1784
|
+
"""Initialize a CreateEnterpriseResponse object from a json dictionary."""
|
|
1785
|
+
return cls.from_dict(_dict)
|
|
1786
|
+
|
|
1787
|
+
def to_dict(self) -> Dict:
|
|
1788
|
+
"""Return a json dictionary representing this model."""
|
|
1789
|
+
_dict = {}
|
|
1790
|
+
if hasattr(self, 'enterprise_id') and self.enterprise_id is not None:
|
|
1791
|
+
_dict['enterprise_id'] = self.enterprise_id
|
|
1792
|
+
if hasattr(self, 'enterprise_account_id') and self.enterprise_account_id is not None:
|
|
1793
|
+
_dict['enterprise_account_id'] = self.enterprise_account_id
|
|
1794
|
+
return _dict
|
|
1795
|
+
|
|
1796
|
+
def _to_dict(self):
|
|
1797
|
+
"""Return a json dictionary representing this model."""
|
|
1798
|
+
return self.to_dict()
|
|
1799
|
+
|
|
1800
|
+
def __str__(self) -> str:
|
|
1801
|
+
"""Return a `str` version of this CreateEnterpriseResponse object."""
|
|
1802
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1803
|
+
|
|
1804
|
+
def __eq__(self, other: 'CreateEnterpriseResponse') -> bool:
|
|
1805
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1806
|
+
if not isinstance(other, self.__class__):
|
|
1807
|
+
return False
|
|
1808
|
+
return self.__dict__ == other.__dict__
|
|
1809
|
+
|
|
1810
|
+
def __ne__(self, other: 'CreateEnterpriseResponse') -> bool:
|
|
1811
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1812
|
+
return not self == other
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
class Enterprise:
|
|
1816
|
+
"""
|
|
1817
|
+
An enterprise resource.
|
|
1818
|
+
|
|
1819
|
+
:param str url: (optional) The URL of the enterprise.
|
|
1820
|
+
:param str id: (optional) The enterprise ID.
|
|
1821
|
+
:param str enterprise_account_id: (optional) The enterprise account ID.
|
|
1822
|
+
:param str crn: (optional) The Cloud Resource Name (CRN) of the enterprise.
|
|
1823
|
+
:param str name: (optional) The name of the enterprise.
|
|
1824
|
+
:param str domain: (optional) The domain of the enterprise.
|
|
1825
|
+
:param str state: (optional) The state of the enterprise.
|
|
1826
|
+
:param str primary_contact_iam_id: (optional) The IAM ID of the primary contact
|
|
1827
|
+
of the enterprise, such as `IBMid-0123ABC`.
|
|
1828
|
+
:param str primary_contact_email: (optional) The email of the primary contact of
|
|
1829
|
+
the enterprise.
|
|
1830
|
+
:param str source_account_id: (optional) The ID of the account that is used to
|
|
1831
|
+
create the enterprise.
|
|
1832
|
+
:param datetime created_at: (optional) The time stamp at which the enterprise
|
|
1833
|
+
was created.
|
|
1834
|
+
:param str created_by: (optional) The IAM ID of the user or service that created
|
|
1835
|
+
the enterprise.
|
|
1836
|
+
:param datetime updated_at: (optional) The time stamp at which the enterprise
|
|
1837
|
+
was last updated.
|
|
1838
|
+
:param str updated_by: (optional) The IAM ID of the user or service that updated
|
|
1839
|
+
the enterprise.
|
|
1840
|
+
"""
|
|
1841
|
+
|
|
1842
|
+
def __init__(
|
|
1843
|
+
self,
|
|
1844
|
+
*,
|
|
1845
|
+
url: Optional[str] = None,
|
|
1846
|
+
id: Optional[str] = None,
|
|
1847
|
+
enterprise_account_id: Optional[str] = None,
|
|
1848
|
+
crn: Optional[str] = None,
|
|
1849
|
+
name: Optional[str] = None,
|
|
1850
|
+
domain: Optional[str] = None,
|
|
1851
|
+
state: Optional[str] = None,
|
|
1852
|
+
primary_contact_iam_id: Optional[str] = None,
|
|
1853
|
+
primary_contact_email: Optional[str] = None,
|
|
1854
|
+
source_account_id: Optional[str] = None,
|
|
1855
|
+
created_at: Optional[datetime] = None,
|
|
1856
|
+
created_by: Optional[str] = None,
|
|
1857
|
+
updated_at: Optional[datetime] = None,
|
|
1858
|
+
updated_by: Optional[str] = None,
|
|
1859
|
+
) -> None:
|
|
1860
|
+
"""
|
|
1861
|
+
Initialize a Enterprise object.
|
|
1862
|
+
|
|
1863
|
+
:param str url: (optional) The URL of the enterprise.
|
|
1864
|
+
:param str id: (optional) The enterprise ID.
|
|
1865
|
+
:param str enterprise_account_id: (optional) The enterprise account ID.
|
|
1866
|
+
:param str crn: (optional) The Cloud Resource Name (CRN) of the enterprise.
|
|
1867
|
+
:param str name: (optional) The name of the enterprise.
|
|
1868
|
+
:param str domain: (optional) The domain of the enterprise.
|
|
1869
|
+
:param str state: (optional) The state of the enterprise.
|
|
1870
|
+
:param str primary_contact_iam_id: (optional) The IAM ID of the primary
|
|
1871
|
+
contact of the enterprise, such as `IBMid-0123ABC`.
|
|
1872
|
+
:param str primary_contact_email: (optional) The email of the primary
|
|
1873
|
+
contact of the enterprise.
|
|
1874
|
+
:param str source_account_id: (optional) The ID of the account that is used
|
|
1875
|
+
to create the enterprise.
|
|
1876
|
+
:param datetime created_at: (optional) The time stamp at which the
|
|
1877
|
+
enterprise was created.
|
|
1878
|
+
:param str created_by: (optional) The IAM ID of the user or service that
|
|
1879
|
+
created the enterprise.
|
|
1880
|
+
:param datetime updated_at: (optional) The time stamp at which the
|
|
1881
|
+
enterprise was last updated.
|
|
1882
|
+
:param str updated_by: (optional) The IAM ID of the user or service that
|
|
1883
|
+
updated the enterprise.
|
|
1884
|
+
"""
|
|
1885
|
+
self.url = url
|
|
1886
|
+
self.id = id
|
|
1887
|
+
self.enterprise_account_id = enterprise_account_id
|
|
1888
|
+
self.crn = crn
|
|
1889
|
+
self.name = name
|
|
1890
|
+
self.domain = domain
|
|
1891
|
+
self.state = state
|
|
1892
|
+
self.primary_contact_iam_id = primary_contact_iam_id
|
|
1893
|
+
self.primary_contact_email = primary_contact_email
|
|
1894
|
+
self.source_account_id = source_account_id
|
|
1895
|
+
self.created_at = created_at
|
|
1896
|
+
self.created_by = created_by
|
|
1897
|
+
self.updated_at = updated_at
|
|
1898
|
+
self.updated_by = updated_by
|
|
1899
|
+
|
|
1900
|
+
@classmethod
|
|
1901
|
+
def from_dict(cls, _dict: Dict) -> 'Enterprise':
|
|
1902
|
+
"""Initialize a Enterprise object from a json dictionary."""
|
|
1903
|
+
args = {}
|
|
1904
|
+
if (url := _dict.get('url')) is not None:
|
|
1905
|
+
args['url'] = url
|
|
1906
|
+
if (id := _dict.get('id')) is not None:
|
|
1907
|
+
args['id'] = id
|
|
1908
|
+
if (enterprise_account_id := _dict.get('enterprise_account_id')) is not None:
|
|
1909
|
+
args['enterprise_account_id'] = enterprise_account_id
|
|
1910
|
+
if (crn := _dict.get('crn')) is not None:
|
|
1911
|
+
args['crn'] = crn
|
|
1912
|
+
if (name := _dict.get('name')) is not None:
|
|
1913
|
+
args['name'] = name
|
|
1914
|
+
if (domain := _dict.get('domain')) is not None:
|
|
1915
|
+
args['domain'] = domain
|
|
1916
|
+
if (state := _dict.get('state')) is not None:
|
|
1917
|
+
args['state'] = state
|
|
1918
|
+
if (primary_contact_iam_id := _dict.get('primary_contact_iam_id')) is not None:
|
|
1919
|
+
args['primary_contact_iam_id'] = primary_contact_iam_id
|
|
1920
|
+
if (primary_contact_email := _dict.get('primary_contact_email')) is not None:
|
|
1921
|
+
args['primary_contact_email'] = primary_contact_email
|
|
1922
|
+
if (source_account_id := _dict.get('source_account_id')) is not None:
|
|
1923
|
+
args['source_account_id'] = source_account_id
|
|
1924
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
1925
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
1926
|
+
if (created_by := _dict.get('created_by')) is not None:
|
|
1927
|
+
args['created_by'] = created_by
|
|
1928
|
+
if (updated_at := _dict.get('updated_at')) is not None:
|
|
1929
|
+
args['updated_at'] = string_to_datetime(updated_at)
|
|
1930
|
+
if (updated_by := _dict.get('updated_by')) is not None:
|
|
1931
|
+
args['updated_by'] = updated_by
|
|
1932
|
+
return cls(**args)
|
|
1933
|
+
|
|
1934
|
+
@classmethod
|
|
1935
|
+
def _from_dict(cls, _dict):
|
|
1936
|
+
"""Initialize a Enterprise object from a json dictionary."""
|
|
1937
|
+
return cls.from_dict(_dict)
|
|
1938
|
+
|
|
1939
|
+
def to_dict(self) -> Dict:
|
|
1940
|
+
"""Return a json dictionary representing this model."""
|
|
1941
|
+
_dict = {}
|
|
1942
|
+
if hasattr(self, 'url') and self.url is not None:
|
|
1943
|
+
_dict['url'] = self.url
|
|
1944
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
1945
|
+
_dict['id'] = self.id
|
|
1946
|
+
if hasattr(self, 'enterprise_account_id') and self.enterprise_account_id is not None:
|
|
1947
|
+
_dict['enterprise_account_id'] = self.enterprise_account_id
|
|
1948
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
1949
|
+
_dict['crn'] = self.crn
|
|
1950
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1951
|
+
_dict['name'] = self.name
|
|
1952
|
+
if hasattr(self, 'domain') and self.domain is not None:
|
|
1953
|
+
_dict['domain'] = self.domain
|
|
1954
|
+
if hasattr(self, 'state') and self.state is not None:
|
|
1955
|
+
_dict['state'] = self.state
|
|
1956
|
+
if hasattr(self, 'primary_contact_iam_id') and self.primary_contact_iam_id is not None:
|
|
1957
|
+
_dict['primary_contact_iam_id'] = self.primary_contact_iam_id
|
|
1958
|
+
if hasattr(self, 'primary_contact_email') and self.primary_contact_email is not None:
|
|
1959
|
+
_dict['primary_contact_email'] = self.primary_contact_email
|
|
1960
|
+
if hasattr(self, 'source_account_id') and self.source_account_id is not None:
|
|
1961
|
+
_dict['source_account_id'] = self.source_account_id
|
|
1962
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
1963
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
1964
|
+
if hasattr(self, 'created_by') and self.created_by is not None:
|
|
1965
|
+
_dict['created_by'] = self.created_by
|
|
1966
|
+
if hasattr(self, 'updated_at') and self.updated_at is not None:
|
|
1967
|
+
_dict['updated_at'] = datetime_to_string(self.updated_at)
|
|
1968
|
+
if hasattr(self, 'updated_by') and self.updated_by is not None:
|
|
1969
|
+
_dict['updated_by'] = self.updated_by
|
|
1970
|
+
return _dict
|
|
1971
|
+
|
|
1972
|
+
def _to_dict(self):
|
|
1973
|
+
"""Return a json dictionary representing this model."""
|
|
1974
|
+
return self.to_dict()
|
|
1975
|
+
|
|
1976
|
+
def __str__(self) -> str:
|
|
1977
|
+
"""Return a `str` version of this Enterprise object."""
|
|
1978
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1979
|
+
|
|
1980
|
+
def __eq__(self, other: 'Enterprise') -> bool:
|
|
1981
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1982
|
+
if not isinstance(other, self.__class__):
|
|
1983
|
+
return False
|
|
1984
|
+
return self.__dict__ == other.__dict__
|
|
1985
|
+
|
|
1986
|
+
def __ne__(self, other: 'Enterprise') -> bool:
|
|
1987
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1988
|
+
return not self == other
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
class ListAccountGroupsResponse:
|
|
1992
|
+
"""
|
|
1993
|
+
The list_account_groups operation response.
|
|
1994
|
+
|
|
1995
|
+
:param int rows_count: (optional) The number of enterprises returned from
|
|
1996
|
+
calling list account groups.
|
|
1997
|
+
:param str next_url: (optional) A string that represents the link to the next
|
|
1998
|
+
page of results.
|
|
1999
|
+
:param List[AccountGroup] resources: (optional) A list of account groups.
|
|
2000
|
+
"""
|
|
2001
|
+
|
|
2002
|
+
def __init__(
|
|
2003
|
+
self,
|
|
2004
|
+
*,
|
|
2005
|
+
rows_count: Optional[int] = None,
|
|
2006
|
+
next_url: Optional[str] = None,
|
|
2007
|
+
resources: Optional[List['AccountGroup']] = None,
|
|
2008
|
+
) -> None:
|
|
2009
|
+
"""
|
|
2010
|
+
Initialize a ListAccountGroupsResponse object.
|
|
2011
|
+
|
|
2012
|
+
:param int rows_count: (optional) The number of enterprises returned from
|
|
2013
|
+
calling list account groups.
|
|
2014
|
+
:param str next_url: (optional) A string that represents the link to the
|
|
2015
|
+
next page of results.
|
|
2016
|
+
:param List[AccountGroup] resources: (optional) A list of account groups.
|
|
2017
|
+
"""
|
|
2018
|
+
self.rows_count = rows_count
|
|
2019
|
+
self.next_url = next_url
|
|
2020
|
+
self.resources = resources
|
|
2021
|
+
|
|
2022
|
+
@classmethod
|
|
2023
|
+
def from_dict(cls, _dict: Dict) -> 'ListAccountGroupsResponse':
|
|
2024
|
+
"""Initialize a ListAccountGroupsResponse object from a json dictionary."""
|
|
2025
|
+
args = {}
|
|
2026
|
+
if (rows_count := _dict.get('rows_count')) is not None:
|
|
2027
|
+
args['rows_count'] = rows_count
|
|
2028
|
+
if (next_url := _dict.get('next_url')) is not None:
|
|
2029
|
+
args['next_url'] = next_url
|
|
2030
|
+
if (resources := _dict.get('resources')) is not None:
|
|
2031
|
+
args['resources'] = [AccountGroup.from_dict(v) for v in resources]
|
|
2032
|
+
return cls(**args)
|
|
2033
|
+
|
|
2034
|
+
@classmethod
|
|
2035
|
+
def _from_dict(cls, _dict):
|
|
2036
|
+
"""Initialize a ListAccountGroupsResponse object from a json dictionary."""
|
|
2037
|
+
return cls.from_dict(_dict)
|
|
2038
|
+
|
|
2039
|
+
def to_dict(self) -> Dict:
|
|
2040
|
+
"""Return a json dictionary representing this model."""
|
|
2041
|
+
_dict = {}
|
|
2042
|
+
if hasattr(self, 'rows_count') and self.rows_count is not None:
|
|
2043
|
+
_dict['rows_count'] = self.rows_count
|
|
2044
|
+
if hasattr(self, 'next_url') and self.next_url is not None:
|
|
2045
|
+
_dict['next_url'] = self.next_url
|
|
2046
|
+
if hasattr(self, 'resources') and self.resources is not None:
|
|
2047
|
+
resources_list = []
|
|
2048
|
+
for v in self.resources:
|
|
2049
|
+
if isinstance(v, dict):
|
|
2050
|
+
resources_list.append(v)
|
|
2051
|
+
else:
|
|
2052
|
+
resources_list.append(v.to_dict())
|
|
2053
|
+
_dict['resources'] = resources_list
|
|
2054
|
+
return _dict
|
|
2055
|
+
|
|
2056
|
+
def _to_dict(self):
|
|
2057
|
+
"""Return a json dictionary representing this model."""
|
|
2058
|
+
return self.to_dict()
|
|
2059
|
+
|
|
2060
|
+
def __str__(self) -> str:
|
|
2061
|
+
"""Return a `str` version of this ListAccountGroupsResponse object."""
|
|
2062
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2063
|
+
|
|
2064
|
+
def __eq__(self, other: 'ListAccountGroupsResponse') -> bool:
|
|
2065
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2066
|
+
if not isinstance(other, self.__class__):
|
|
2067
|
+
return False
|
|
2068
|
+
return self.__dict__ == other.__dict__
|
|
2069
|
+
|
|
2070
|
+
def __ne__(self, other: 'ListAccountGroupsResponse') -> bool:
|
|
2071
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2072
|
+
return not self == other
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
class ListAccountsResponse:
|
|
2076
|
+
"""
|
|
2077
|
+
The list_accounts operation response.
|
|
2078
|
+
|
|
2079
|
+
:param int rows_count: (optional) The number of enterprises returned from
|
|
2080
|
+
calling list accounts.
|
|
2081
|
+
:param str next_url: (optional) A string that represents the link to the next
|
|
2082
|
+
page of results.
|
|
2083
|
+
:param List[Account] resources: (optional) A list of accounts.
|
|
2084
|
+
"""
|
|
2085
|
+
|
|
2086
|
+
def __init__(
|
|
2087
|
+
self,
|
|
2088
|
+
*,
|
|
2089
|
+
rows_count: Optional[int] = None,
|
|
2090
|
+
next_url: Optional[str] = None,
|
|
2091
|
+
resources: Optional[List['Account']] = None,
|
|
2092
|
+
) -> None:
|
|
2093
|
+
"""
|
|
2094
|
+
Initialize a ListAccountsResponse object.
|
|
2095
|
+
|
|
2096
|
+
:param int rows_count: (optional) The number of enterprises returned from
|
|
2097
|
+
calling list accounts.
|
|
2098
|
+
:param str next_url: (optional) A string that represents the link to the
|
|
2099
|
+
next page of results.
|
|
2100
|
+
:param List[Account] resources: (optional) A list of accounts.
|
|
2101
|
+
"""
|
|
2102
|
+
self.rows_count = rows_count
|
|
2103
|
+
self.next_url = next_url
|
|
2104
|
+
self.resources = resources
|
|
2105
|
+
|
|
2106
|
+
@classmethod
|
|
2107
|
+
def from_dict(cls, _dict: Dict) -> 'ListAccountsResponse':
|
|
2108
|
+
"""Initialize a ListAccountsResponse object from a json dictionary."""
|
|
2109
|
+
args = {}
|
|
2110
|
+
if (rows_count := _dict.get('rows_count')) is not None:
|
|
2111
|
+
args['rows_count'] = rows_count
|
|
2112
|
+
if (next_url := _dict.get('next_url')) is not None:
|
|
2113
|
+
args['next_url'] = next_url
|
|
2114
|
+
if (resources := _dict.get('resources')) is not None:
|
|
2115
|
+
args['resources'] = [Account.from_dict(v) for v in resources]
|
|
2116
|
+
return cls(**args)
|
|
2117
|
+
|
|
2118
|
+
@classmethod
|
|
2119
|
+
def _from_dict(cls, _dict):
|
|
2120
|
+
"""Initialize a ListAccountsResponse object from a json dictionary."""
|
|
2121
|
+
return cls.from_dict(_dict)
|
|
2122
|
+
|
|
2123
|
+
def to_dict(self) -> Dict:
|
|
2124
|
+
"""Return a json dictionary representing this model."""
|
|
2125
|
+
_dict = {}
|
|
2126
|
+
if hasattr(self, 'rows_count') and self.rows_count is not None:
|
|
2127
|
+
_dict['rows_count'] = self.rows_count
|
|
2128
|
+
if hasattr(self, 'next_url') and self.next_url is not None:
|
|
2129
|
+
_dict['next_url'] = self.next_url
|
|
2130
|
+
if hasattr(self, 'resources') and self.resources is not None:
|
|
2131
|
+
resources_list = []
|
|
2132
|
+
for v in self.resources:
|
|
2133
|
+
if isinstance(v, dict):
|
|
2134
|
+
resources_list.append(v)
|
|
2135
|
+
else:
|
|
2136
|
+
resources_list.append(v.to_dict())
|
|
2137
|
+
_dict['resources'] = resources_list
|
|
2138
|
+
return _dict
|
|
2139
|
+
|
|
2140
|
+
def _to_dict(self):
|
|
2141
|
+
"""Return a json dictionary representing this model."""
|
|
2142
|
+
return self.to_dict()
|
|
2143
|
+
|
|
2144
|
+
def __str__(self) -> str:
|
|
2145
|
+
"""Return a `str` version of this ListAccountsResponse object."""
|
|
2146
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2147
|
+
|
|
2148
|
+
def __eq__(self, other: 'ListAccountsResponse') -> bool:
|
|
2149
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2150
|
+
if not isinstance(other, self.__class__):
|
|
2151
|
+
return False
|
|
2152
|
+
return self.__dict__ == other.__dict__
|
|
2153
|
+
|
|
2154
|
+
def __ne__(self, other: 'ListAccountsResponse') -> bool:
|
|
2155
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2156
|
+
return not self == other
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
class ListEnterprisesResponse:
|
|
2160
|
+
"""
|
|
2161
|
+
The response from calling list enterprises.
|
|
2162
|
+
|
|
2163
|
+
:param int rows_count: (optional) The number of enterprises returned from
|
|
2164
|
+
calling list enterprise.
|
|
2165
|
+
:param str next_url: (optional) A string that represents the link to the next
|
|
2166
|
+
page of results.
|
|
2167
|
+
:param List[Enterprise] resources: (optional) A list of enterprise objects.
|
|
2168
|
+
"""
|
|
2169
|
+
|
|
2170
|
+
def __init__(
|
|
2171
|
+
self,
|
|
2172
|
+
*,
|
|
2173
|
+
rows_count: Optional[int] = None,
|
|
2174
|
+
next_url: Optional[str] = None,
|
|
2175
|
+
resources: Optional[List['Enterprise']] = None,
|
|
2176
|
+
) -> None:
|
|
2177
|
+
"""
|
|
2178
|
+
Initialize a ListEnterprisesResponse object.
|
|
2179
|
+
|
|
2180
|
+
:param int rows_count: (optional) The number of enterprises returned from
|
|
2181
|
+
calling list enterprise.
|
|
2182
|
+
:param str next_url: (optional) A string that represents the link to the
|
|
2183
|
+
next page of results.
|
|
2184
|
+
:param List[Enterprise] resources: (optional) A list of enterprise objects.
|
|
2185
|
+
"""
|
|
2186
|
+
self.rows_count = rows_count
|
|
2187
|
+
self.next_url = next_url
|
|
2188
|
+
self.resources = resources
|
|
2189
|
+
|
|
2190
|
+
@classmethod
|
|
2191
|
+
def from_dict(cls, _dict: Dict) -> 'ListEnterprisesResponse':
|
|
2192
|
+
"""Initialize a ListEnterprisesResponse object from a json dictionary."""
|
|
2193
|
+
args = {}
|
|
2194
|
+
if (rows_count := _dict.get('rows_count')) is not None:
|
|
2195
|
+
args['rows_count'] = rows_count
|
|
2196
|
+
if (next_url := _dict.get('next_url')) is not None:
|
|
2197
|
+
args['next_url'] = next_url
|
|
2198
|
+
if (resources := _dict.get('resources')) is not None:
|
|
2199
|
+
args['resources'] = [Enterprise.from_dict(v) for v in resources]
|
|
2200
|
+
return cls(**args)
|
|
2201
|
+
|
|
2202
|
+
@classmethod
|
|
2203
|
+
def _from_dict(cls, _dict):
|
|
2204
|
+
"""Initialize a ListEnterprisesResponse object from a json dictionary."""
|
|
2205
|
+
return cls.from_dict(_dict)
|
|
2206
|
+
|
|
2207
|
+
def to_dict(self) -> Dict:
|
|
2208
|
+
"""Return a json dictionary representing this model."""
|
|
2209
|
+
_dict = {}
|
|
2210
|
+
if hasattr(self, 'rows_count') and self.rows_count is not None:
|
|
2211
|
+
_dict['rows_count'] = self.rows_count
|
|
2212
|
+
if hasattr(self, 'next_url') and self.next_url is not None:
|
|
2213
|
+
_dict['next_url'] = self.next_url
|
|
2214
|
+
if hasattr(self, 'resources') and self.resources is not None:
|
|
2215
|
+
resources_list = []
|
|
2216
|
+
for v in self.resources:
|
|
2217
|
+
if isinstance(v, dict):
|
|
2218
|
+
resources_list.append(v)
|
|
2219
|
+
else:
|
|
2220
|
+
resources_list.append(v.to_dict())
|
|
2221
|
+
_dict['resources'] = resources_list
|
|
2222
|
+
return _dict
|
|
2223
|
+
|
|
2224
|
+
def _to_dict(self):
|
|
2225
|
+
"""Return a json dictionary representing this model."""
|
|
2226
|
+
return self.to_dict()
|
|
2227
|
+
|
|
2228
|
+
def __str__(self) -> str:
|
|
2229
|
+
"""Return a `str` version of this ListEnterprisesResponse object."""
|
|
2230
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2231
|
+
|
|
2232
|
+
def __eq__(self, other: 'ListEnterprisesResponse') -> bool:
|
|
2233
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2234
|
+
if not isinstance(other, self.__class__):
|
|
2235
|
+
return False
|
|
2236
|
+
return self.__dict__ == other.__dict__
|
|
2237
|
+
|
|
2238
|
+
def __ne__(self, other: 'ListEnterprisesResponse') -> bool:
|
|
2239
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2240
|
+
return not self == other
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
##############################################################################
|
|
2244
|
+
# Pagers
|
|
2245
|
+
##############################################################################
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
class EnterprisesPager:
|
|
2249
|
+
"""
|
|
2250
|
+
EnterprisesPager can be used to simplify the use of the "list_enterprises" method.
|
|
2251
|
+
"""
|
|
2252
|
+
|
|
2253
|
+
def __init__(
|
|
2254
|
+
self,
|
|
2255
|
+
*,
|
|
2256
|
+
client: EnterpriseManagementV1,
|
|
2257
|
+
enterprise_account_id: str = None,
|
|
2258
|
+
account_group_id: str = None,
|
|
2259
|
+
account_id: str = None,
|
|
2260
|
+
limit: int = None,
|
|
2261
|
+
) -> None:
|
|
2262
|
+
"""
|
|
2263
|
+
Initialize a EnterprisesPager object.
|
|
2264
|
+
:param str enterprise_account_id: (optional) Get enterprises for a given
|
|
2265
|
+
enterprise account ID.
|
|
2266
|
+
:param str account_group_id: (optional) Get enterprises for a given account
|
|
2267
|
+
group ID.
|
|
2268
|
+
:param str account_id: (optional) Get enterprises for a given account ID.
|
|
2269
|
+
:param int limit: (optional) Return results up to this limit. Valid values
|
|
2270
|
+
are between `0` and `100`.
|
|
2271
|
+
"""
|
|
2272
|
+
self._has_next = True
|
|
2273
|
+
self._client = client
|
|
2274
|
+
self._page_context = {'next': None}
|
|
2275
|
+
self._enterprise_account_id = enterprise_account_id
|
|
2276
|
+
self._account_group_id = account_group_id
|
|
2277
|
+
self._account_id = account_id
|
|
2278
|
+
self._limit = limit
|
|
2279
|
+
|
|
2280
|
+
def has_next(self) -> bool:
|
|
2281
|
+
"""
|
|
2282
|
+
Returns true if there are potentially more results to be retrieved.
|
|
2283
|
+
"""
|
|
2284
|
+
return self._has_next
|
|
2285
|
+
|
|
2286
|
+
def get_next(self) -> List[dict]:
|
|
2287
|
+
"""
|
|
2288
|
+
Returns the next page of results.
|
|
2289
|
+
:return: A List[dict], where each element is a dict that represents an instance of Enterprise.
|
|
2290
|
+
:rtype: List[dict]
|
|
2291
|
+
"""
|
|
2292
|
+
if not self.has_next():
|
|
2293
|
+
raise StopIteration(message='No more results available')
|
|
2294
|
+
|
|
2295
|
+
result = self._client.list_enterprises(
|
|
2296
|
+
enterprise_account_id=self._enterprise_account_id,
|
|
2297
|
+
account_group_id=self._account_group_id,
|
|
2298
|
+
account_id=self._account_id,
|
|
2299
|
+
limit=self._limit,
|
|
2300
|
+
next_docid=self._page_context.get('next'),
|
|
2301
|
+
).get_result()
|
|
2302
|
+
|
|
2303
|
+
next = None
|
|
2304
|
+
next_page_link = result.get('next_url')
|
|
2305
|
+
if next_page_link is not None:
|
|
2306
|
+
next = get_query_param(next_page_link, 'next_docid')
|
|
2307
|
+
self._page_context['next'] = next
|
|
2308
|
+
if next is None:
|
|
2309
|
+
self._has_next = False
|
|
2310
|
+
|
|
2311
|
+
return result.get('resources')
|
|
2312
|
+
|
|
2313
|
+
def get_all(self) -> List[dict]:
|
|
2314
|
+
"""
|
|
2315
|
+
Returns all results by invoking get_next() repeatedly
|
|
2316
|
+
until all pages of results have been retrieved.
|
|
2317
|
+
:return: A List[dict], where each element is a dict that represents an instance of Enterprise.
|
|
2318
|
+
:rtype: List[dict]
|
|
2319
|
+
"""
|
|
2320
|
+
results = []
|
|
2321
|
+
while self.has_next():
|
|
2322
|
+
next_page = self.get_next()
|
|
2323
|
+
results.extend(next_page)
|
|
2324
|
+
return results
|
|
2325
|
+
|
|
2326
|
+
|
|
2327
|
+
class AccountsPager:
|
|
2328
|
+
"""
|
|
2329
|
+
AccountsPager can be used to simplify the use of the "list_accounts" method.
|
|
2330
|
+
"""
|
|
2331
|
+
|
|
2332
|
+
def __init__(
|
|
2333
|
+
self,
|
|
2334
|
+
*,
|
|
2335
|
+
client: EnterpriseManagementV1,
|
|
2336
|
+
enterprise_id: str = None,
|
|
2337
|
+
account_group_id: str = None,
|
|
2338
|
+
parent: str = None,
|
|
2339
|
+
limit: int = None,
|
|
2340
|
+
include_deleted: bool = None,
|
|
2341
|
+
) -> None:
|
|
2342
|
+
"""
|
|
2343
|
+
Initialize a AccountsPager object.
|
|
2344
|
+
:param str enterprise_id: (optional) Get accounts that are either immediate
|
|
2345
|
+
children or are a part of the hierarchy for a given enterprise ID.
|
|
2346
|
+
:param str account_group_id: (optional) Get accounts that are either
|
|
2347
|
+
immediate children or are a part of the hierarchy for a given account group
|
|
2348
|
+
ID.
|
|
2349
|
+
:param str parent: (optional) Get accounts that are either immediate
|
|
2350
|
+
children or are a part of the hierarchy for a given parent CRN.
|
|
2351
|
+
:param int limit: (optional) Return results up to this limit. Valid values
|
|
2352
|
+
are between `0` and `100`.
|
|
2353
|
+
:param bool include_deleted: (optional) Include the deleted accounts from
|
|
2354
|
+
an enterprise when used in conjunction with enterprise_id.
|
|
2355
|
+
"""
|
|
2356
|
+
self._has_next = True
|
|
2357
|
+
self._client = client
|
|
2358
|
+
self._page_context = {'next': None}
|
|
2359
|
+
self._enterprise_id = enterprise_id
|
|
2360
|
+
self._account_group_id = account_group_id
|
|
2361
|
+
self._parent = parent
|
|
2362
|
+
self._limit = limit
|
|
2363
|
+
self._include_deleted = include_deleted
|
|
2364
|
+
|
|
2365
|
+
def has_next(self) -> bool:
|
|
2366
|
+
"""
|
|
2367
|
+
Returns true if there are potentially more results to be retrieved.
|
|
2368
|
+
"""
|
|
2369
|
+
return self._has_next
|
|
2370
|
+
|
|
2371
|
+
def get_next(self) -> List[dict]:
|
|
2372
|
+
"""
|
|
2373
|
+
Returns the next page of results.
|
|
2374
|
+
:return: A List[dict], where each element is a dict that represents an instance of Account.
|
|
2375
|
+
:rtype: List[dict]
|
|
2376
|
+
"""
|
|
2377
|
+
if not self.has_next():
|
|
2378
|
+
raise StopIteration(message='No more results available')
|
|
2379
|
+
|
|
2380
|
+
result = self._client.list_accounts(
|
|
2381
|
+
enterprise_id=self._enterprise_id,
|
|
2382
|
+
account_group_id=self._account_group_id,
|
|
2383
|
+
parent=self._parent,
|
|
2384
|
+
limit=self._limit,
|
|
2385
|
+
include_deleted=self._include_deleted,
|
|
2386
|
+
next_docid=self._page_context.get('next'),
|
|
2387
|
+
).get_result()
|
|
2388
|
+
|
|
2389
|
+
next = None
|
|
2390
|
+
next_page_link = result.get('next_url')
|
|
2391
|
+
if next_page_link is not None:
|
|
2392
|
+
next = get_query_param(next_page_link, 'next_docid')
|
|
2393
|
+
self._page_context['next'] = next
|
|
2394
|
+
if next is None:
|
|
2395
|
+
self._has_next = False
|
|
2396
|
+
|
|
2397
|
+
return result.get('resources')
|
|
2398
|
+
|
|
2399
|
+
def get_all(self) -> List[dict]:
|
|
2400
|
+
"""
|
|
2401
|
+
Returns all results by invoking get_next() repeatedly
|
|
2402
|
+
until all pages of results have been retrieved.
|
|
2403
|
+
:return: A List[dict], where each element is a dict that represents an instance of Account.
|
|
2404
|
+
:rtype: List[dict]
|
|
2405
|
+
"""
|
|
2406
|
+
results = []
|
|
2407
|
+
while self.has_next():
|
|
2408
|
+
next_page = self.get_next()
|
|
2409
|
+
results.extend(next_page)
|
|
2410
|
+
return results
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
class AccountGroupsPager:
|
|
2414
|
+
"""
|
|
2415
|
+
AccountGroupsPager can be used to simplify the use of the "list_account_groups" method.
|
|
2416
|
+
"""
|
|
2417
|
+
|
|
2418
|
+
def __init__(
|
|
2419
|
+
self,
|
|
2420
|
+
*,
|
|
2421
|
+
client: EnterpriseManagementV1,
|
|
2422
|
+
enterprise_id: str = None,
|
|
2423
|
+
parent_account_group_id: str = None,
|
|
2424
|
+
parent: str = None,
|
|
2425
|
+
limit: int = None,
|
|
2426
|
+
include_deleted: bool = None,
|
|
2427
|
+
) -> None:
|
|
2428
|
+
"""
|
|
2429
|
+
Initialize a AccountGroupsPager object.
|
|
2430
|
+
:param str enterprise_id: (optional) Get account groups that are either
|
|
2431
|
+
immediate children or are a part of the hierarchy for a given enterprise
|
|
2432
|
+
ID.
|
|
2433
|
+
:param str parent_account_group_id: (optional) Get account groups that are
|
|
2434
|
+
either immediate children or are a part of the hierarchy for a given
|
|
2435
|
+
account group ID.
|
|
2436
|
+
:param str parent: (optional) Get account groups that are either immediate
|
|
2437
|
+
children or are a part of the hierarchy for a given parent CRN.
|
|
2438
|
+
:param int limit: (optional) Return results up to this limit. Valid values
|
|
2439
|
+
are between `0` and `100`.
|
|
2440
|
+
:param bool include_deleted: (optional) Include the deleted account groups
|
|
2441
|
+
from an enterprise when used in conjunction with other query parameters.
|
|
2442
|
+
"""
|
|
2443
|
+
self._has_next = True
|
|
2444
|
+
self._client = client
|
|
2445
|
+
self._page_context = {'next': None}
|
|
2446
|
+
self._enterprise_id = enterprise_id
|
|
2447
|
+
self._parent_account_group_id = parent_account_group_id
|
|
2448
|
+
self._parent = parent
|
|
2449
|
+
self._limit = limit
|
|
2450
|
+
self._include_deleted = include_deleted
|
|
2451
|
+
|
|
2452
|
+
def has_next(self) -> bool:
|
|
2453
|
+
"""
|
|
2454
|
+
Returns true if there are potentially more results to be retrieved.
|
|
2455
|
+
"""
|
|
2456
|
+
return self._has_next
|
|
2457
|
+
|
|
2458
|
+
def get_next(self) -> List[dict]:
|
|
2459
|
+
"""
|
|
2460
|
+
Returns the next page of results.
|
|
2461
|
+
:return: A List[dict], where each element is a dict that represents an instance of AccountGroup.
|
|
2462
|
+
:rtype: List[dict]
|
|
2463
|
+
"""
|
|
2464
|
+
if not self.has_next():
|
|
2465
|
+
raise StopIteration(message='No more results available')
|
|
2466
|
+
|
|
2467
|
+
result = self._client.list_account_groups(
|
|
2468
|
+
enterprise_id=self._enterprise_id,
|
|
2469
|
+
parent_account_group_id=self._parent_account_group_id,
|
|
2470
|
+
parent=self._parent,
|
|
2471
|
+
limit=self._limit,
|
|
2472
|
+
include_deleted=self._include_deleted,
|
|
2473
|
+
next_docid=self._page_context.get('next'),
|
|
2474
|
+
).get_result()
|
|
2475
|
+
|
|
2476
|
+
next = None
|
|
2477
|
+
next_page_link = result.get('next_url')
|
|
2478
|
+
if next_page_link is not None:
|
|
2479
|
+
next = get_query_param(next_page_link, 'next_docid')
|
|
2480
|
+
self._page_context['next'] = next
|
|
2481
|
+
if next is None:
|
|
2482
|
+
self._has_next = False
|
|
2483
|
+
|
|
2484
|
+
return result.get('resources')
|
|
2485
|
+
|
|
2486
|
+
def get_all(self) -> List[dict]:
|
|
2487
|
+
"""
|
|
2488
|
+
Returns all results by invoking get_next() repeatedly
|
|
2489
|
+
until all pages of results have been retrieved.
|
|
2490
|
+
:return: A List[dict], where each element is a dict that represents an instance of AccountGroup.
|
|
2491
|
+
:rtype: List[dict]
|
|
2492
|
+
"""
|
|
2493
|
+
results = []
|
|
2494
|
+
while self.has_next():
|
|
2495
|
+
next_page = self.get_next()
|
|
2496
|
+
results.extend(next_page)
|
|
2497
|
+
return results
|