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,3633 @@
|
|
|
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.86.0-bc6f14b3-20240221-193958
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
With the Context Based Restrictions API, you can:
|
|
21
|
+
* Create, list, get, replace, and delete network zones
|
|
22
|
+
* Create, list, get, replace, and delete context-based restriction rules
|
|
23
|
+
* Get account settings
|
|
24
|
+
|
|
25
|
+
API Version: 1.0.1
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from datetime import datetime
|
|
29
|
+
from enum import Enum
|
|
30
|
+
from typing import Dict, List, Optional
|
|
31
|
+
import json
|
|
32
|
+
import sys
|
|
33
|
+
|
|
34
|
+
from ibm_cloud_sdk_core import BaseService, DetailedResponse
|
|
35
|
+
from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
|
|
36
|
+
from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
|
|
37
|
+
from ibm_cloud_sdk_core.utils import convert_model, datetime_to_string, string_to_datetime
|
|
38
|
+
|
|
39
|
+
from .common import get_sdk_headers
|
|
40
|
+
|
|
41
|
+
##############################################################################
|
|
42
|
+
# Service
|
|
43
|
+
##############################################################################
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ContextBasedRestrictionsV1(BaseService):
|
|
47
|
+
"""The Context Based Restrictions V1 service."""
|
|
48
|
+
|
|
49
|
+
DEFAULT_SERVICE_URL = 'https://cbr.cloud.ibm.com'
|
|
50
|
+
DEFAULT_SERVICE_NAME = 'context_based_restrictions'
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def new_instance(
|
|
54
|
+
cls,
|
|
55
|
+
service_name: str = DEFAULT_SERVICE_NAME,
|
|
56
|
+
) -> 'ContextBasedRestrictionsV1':
|
|
57
|
+
"""
|
|
58
|
+
Return a new client for the Context Based Restrictions service using the
|
|
59
|
+
specified parameters and external configuration.
|
|
60
|
+
"""
|
|
61
|
+
authenticator = get_authenticator_from_environment(service_name)
|
|
62
|
+
service = cls(authenticator)
|
|
63
|
+
service.configure_service(service_name)
|
|
64
|
+
return service
|
|
65
|
+
|
|
66
|
+
def __init__(
|
|
67
|
+
self,
|
|
68
|
+
authenticator: Authenticator = None,
|
|
69
|
+
) -> None:
|
|
70
|
+
"""
|
|
71
|
+
Construct a new client for the Context Based Restrictions service.
|
|
72
|
+
|
|
73
|
+
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
|
|
74
|
+
Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
|
|
75
|
+
about initializing the authenticator of your choice.
|
|
76
|
+
"""
|
|
77
|
+
BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
|
|
78
|
+
|
|
79
|
+
#########################
|
|
80
|
+
# Zones
|
|
81
|
+
#########################
|
|
82
|
+
|
|
83
|
+
def create_zone(
|
|
84
|
+
self,
|
|
85
|
+
*,
|
|
86
|
+
name: Optional[str] = None,
|
|
87
|
+
account_id: Optional[str] = None,
|
|
88
|
+
addresses: Optional[List['Address']] = None,
|
|
89
|
+
description: Optional[str] = None,
|
|
90
|
+
excluded: Optional[List['Address']] = None,
|
|
91
|
+
x_correlation_id: Optional[str] = None,
|
|
92
|
+
transaction_id: Optional[str] = None,
|
|
93
|
+
**kwargs,
|
|
94
|
+
) -> DetailedResponse:
|
|
95
|
+
"""
|
|
96
|
+
Create a network zone.
|
|
97
|
+
|
|
98
|
+
This operation creates a network zone for the specified account.
|
|
99
|
+
|
|
100
|
+
:param str name: (optional) The name of the zone.
|
|
101
|
+
:param str account_id: (optional) The id of the account owning this zone.
|
|
102
|
+
:param List[Address] addresses: (optional) The list of addresses in the
|
|
103
|
+
zone.
|
|
104
|
+
:param str description: (optional) The description of the zone.
|
|
105
|
+
:param List[Address] excluded: (optional) The list of excluded addresses in
|
|
106
|
+
the zone. Only addresses of type `ipAddress`, `ipRange`, and `subnet` can
|
|
107
|
+
be excluded.
|
|
108
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
109
|
+
this header is logged for a request and repeated in a response header for
|
|
110
|
+
the corresponding response. The same value is used for downstream requests
|
|
111
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
112
|
+
in a request, the service generates a random (version 4) UUID.
|
|
113
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
114
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
115
|
+
backward compatibility with other IBM platform services that support the
|
|
116
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
117
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
118
|
+
`Transaction-Id`.
|
|
119
|
+
:param dict headers: A `dict` containing the request headers
|
|
120
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
121
|
+
:rtype: DetailedResponse with `dict` result representing a `Zone` object
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
if addresses is not None:
|
|
125
|
+
addresses = [convert_model(x) for x in addresses]
|
|
126
|
+
if excluded is not None:
|
|
127
|
+
excluded = [convert_model(x) for x in excluded]
|
|
128
|
+
headers = {
|
|
129
|
+
'X-Correlation-Id': x_correlation_id,
|
|
130
|
+
'Transaction-Id': transaction_id,
|
|
131
|
+
}
|
|
132
|
+
sdk_headers = get_sdk_headers(
|
|
133
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
134
|
+
service_version='V1',
|
|
135
|
+
operation_id='create_zone',
|
|
136
|
+
)
|
|
137
|
+
headers.update(sdk_headers)
|
|
138
|
+
|
|
139
|
+
data = {
|
|
140
|
+
'name': name,
|
|
141
|
+
'account_id': account_id,
|
|
142
|
+
'addresses': addresses,
|
|
143
|
+
'description': description,
|
|
144
|
+
'excluded': excluded,
|
|
145
|
+
}
|
|
146
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
147
|
+
data = json.dumps(data)
|
|
148
|
+
headers['content-type'] = 'application/json'
|
|
149
|
+
|
|
150
|
+
if 'headers' in kwargs:
|
|
151
|
+
headers.update(kwargs.get('headers'))
|
|
152
|
+
del kwargs['headers']
|
|
153
|
+
headers['Accept'] = 'application/json'
|
|
154
|
+
|
|
155
|
+
url = '/v1/zones'
|
|
156
|
+
request = self.prepare_request(
|
|
157
|
+
method='POST',
|
|
158
|
+
url=url,
|
|
159
|
+
headers=headers,
|
|
160
|
+
data=data,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
response = self.send(request, **kwargs)
|
|
164
|
+
return response
|
|
165
|
+
|
|
166
|
+
def list_zones(
|
|
167
|
+
self,
|
|
168
|
+
account_id: str,
|
|
169
|
+
*,
|
|
170
|
+
x_correlation_id: Optional[str] = None,
|
|
171
|
+
transaction_id: Optional[str] = None,
|
|
172
|
+
name: Optional[str] = None,
|
|
173
|
+
sort: Optional[str] = None,
|
|
174
|
+
**kwargs,
|
|
175
|
+
) -> DetailedResponse:
|
|
176
|
+
"""
|
|
177
|
+
List network zones.
|
|
178
|
+
|
|
179
|
+
This operation lists network zones in the specified account.
|
|
180
|
+
|
|
181
|
+
:param str account_id: The ID of the managing account.
|
|
182
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
183
|
+
this header is logged for a request and repeated in a response header for
|
|
184
|
+
the corresponding response. The same value is used for downstream requests
|
|
185
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
186
|
+
in a request, the service generates a random (version 4) UUID.
|
|
187
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
188
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
189
|
+
backward compatibility with other IBM platform services that support the
|
|
190
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
191
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
192
|
+
`Transaction-Id`.
|
|
193
|
+
:param str name: (optional) The name of the zone.
|
|
194
|
+
:param str sort: (optional) Sorts results by using a valid sort field. To
|
|
195
|
+
learn more, see
|
|
196
|
+
[Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting).
|
|
197
|
+
:param dict headers: A `dict` containing the request headers
|
|
198
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
199
|
+
:rtype: DetailedResponse with `dict` result representing a `ZoneList` object
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
if not account_id:
|
|
203
|
+
raise ValueError('account_id must be provided')
|
|
204
|
+
headers = {
|
|
205
|
+
'X-Correlation-Id': x_correlation_id,
|
|
206
|
+
'Transaction-Id': transaction_id,
|
|
207
|
+
}
|
|
208
|
+
sdk_headers = get_sdk_headers(
|
|
209
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
210
|
+
service_version='V1',
|
|
211
|
+
operation_id='list_zones',
|
|
212
|
+
)
|
|
213
|
+
headers.update(sdk_headers)
|
|
214
|
+
|
|
215
|
+
params = {
|
|
216
|
+
'account_id': account_id,
|
|
217
|
+
'name': name,
|
|
218
|
+
'sort': sort,
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if 'headers' in kwargs:
|
|
222
|
+
headers.update(kwargs.get('headers'))
|
|
223
|
+
del kwargs['headers']
|
|
224
|
+
headers['Accept'] = 'application/json'
|
|
225
|
+
|
|
226
|
+
url = '/v1/zones'
|
|
227
|
+
request = self.prepare_request(
|
|
228
|
+
method='GET',
|
|
229
|
+
url=url,
|
|
230
|
+
headers=headers,
|
|
231
|
+
params=params,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
response = self.send(request, **kwargs)
|
|
235
|
+
return response
|
|
236
|
+
|
|
237
|
+
def get_zone(
|
|
238
|
+
self,
|
|
239
|
+
zone_id: str,
|
|
240
|
+
*,
|
|
241
|
+
x_correlation_id: Optional[str] = None,
|
|
242
|
+
transaction_id: Optional[str] = None,
|
|
243
|
+
**kwargs,
|
|
244
|
+
) -> DetailedResponse:
|
|
245
|
+
"""
|
|
246
|
+
Get a network zone.
|
|
247
|
+
|
|
248
|
+
This operation retrieves the network zone identified by the specified zone ID.
|
|
249
|
+
|
|
250
|
+
:param str zone_id: The ID of a zone.
|
|
251
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
252
|
+
this header is logged for a request and repeated in a response header for
|
|
253
|
+
the corresponding response. The same value is used for downstream requests
|
|
254
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
255
|
+
in a request, the service generates a random (version 4) UUID.
|
|
256
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
257
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
258
|
+
backward compatibility with other IBM platform services that support the
|
|
259
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
260
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
261
|
+
`Transaction-Id`.
|
|
262
|
+
:param dict headers: A `dict` containing the request headers
|
|
263
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
264
|
+
:rtype: DetailedResponse with `dict` result representing a `Zone` object
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
if not zone_id:
|
|
268
|
+
raise ValueError('zone_id must be provided')
|
|
269
|
+
headers = {
|
|
270
|
+
'X-Correlation-Id': x_correlation_id,
|
|
271
|
+
'Transaction-Id': transaction_id,
|
|
272
|
+
}
|
|
273
|
+
sdk_headers = get_sdk_headers(
|
|
274
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
275
|
+
service_version='V1',
|
|
276
|
+
operation_id='get_zone',
|
|
277
|
+
)
|
|
278
|
+
headers.update(sdk_headers)
|
|
279
|
+
|
|
280
|
+
if 'headers' in kwargs:
|
|
281
|
+
headers.update(kwargs.get('headers'))
|
|
282
|
+
del kwargs['headers']
|
|
283
|
+
headers['Accept'] = 'application/json'
|
|
284
|
+
|
|
285
|
+
path_param_keys = ['zone_id']
|
|
286
|
+
path_param_values = self.encode_path_vars(zone_id)
|
|
287
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
288
|
+
url = '/v1/zones/{zone_id}'.format(**path_param_dict)
|
|
289
|
+
request = self.prepare_request(
|
|
290
|
+
method='GET',
|
|
291
|
+
url=url,
|
|
292
|
+
headers=headers,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
response = self.send(request, **kwargs)
|
|
296
|
+
return response
|
|
297
|
+
|
|
298
|
+
def replace_zone(
|
|
299
|
+
self,
|
|
300
|
+
zone_id: str,
|
|
301
|
+
if_match: str,
|
|
302
|
+
*,
|
|
303
|
+
name: Optional[str] = None,
|
|
304
|
+
account_id: Optional[str] = None,
|
|
305
|
+
addresses: Optional[List['Address']] = None,
|
|
306
|
+
description: Optional[str] = None,
|
|
307
|
+
excluded: Optional[List['Address']] = None,
|
|
308
|
+
x_correlation_id: Optional[str] = None,
|
|
309
|
+
transaction_id: Optional[str] = None,
|
|
310
|
+
**kwargs,
|
|
311
|
+
) -> DetailedResponse:
|
|
312
|
+
"""
|
|
313
|
+
Replace a network zone.
|
|
314
|
+
|
|
315
|
+
This operation replaces the network zone identified by the specified zone ID.
|
|
316
|
+
Partial updates are not supported. The entire network zone object must be
|
|
317
|
+
replaced.
|
|
318
|
+
|
|
319
|
+
:param str zone_id: The ID of a zone.
|
|
320
|
+
:param str if_match: The current revision of the resource being updated.
|
|
321
|
+
This can be found in the Create/Get/Update resource response ETag header.
|
|
322
|
+
:param str name: (optional) The name of the zone.
|
|
323
|
+
:param str account_id: (optional) The id of the account owning this zone.
|
|
324
|
+
:param List[Address] addresses: (optional) The list of addresses in the
|
|
325
|
+
zone.
|
|
326
|
+
:param str description: (optional) The description of the zone.
|
|
327
|
+
:param List[Address] excluded: (optional) The list of excluded addresses in
|
|
328
|
+
the zone. Only addresses of type `ipAddress`, `ipRange`, and `subnet` can
|
|
329
|
+
be excluded.
|
|
330
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
331
|
+
this header is logged for a request and repeated in a response header for
|
|
332
|
+
the corresponding response. The same value is used for downstream requests
|
|
333
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
334
|
+
in a request, the service generates a random (version 4) UUID.
|
|
335
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
336
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
337
|
+
backward compatibility with other IBM platform services that support the
|
|
338
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
339
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
340
|
+
`Transaction-Id`.
|
|
341
|
+
:param dict headers: A `dict` containing the request headers
|
|
342
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
343
|
+
:rtype: DetailedResponse with `dict` result representing a `Zone` object
|
|
344
|
+
"""
|
|
345
|
+
|
|
346
|
+
if not zone_id:
|
|
347
|
+
raise ValueError('zone_id must be provided')
|
|
348
|
+
if not if_match:
|
|
349
|
+
raise ValueError('if_match must be provided')
|
|
350
|
+
if addresses is not None:
|
|
351
|
+
addresses = [convert_model(x) for x in addresses]
|
|
352
|
+
if excluded is not None:
|
|
353
|
+
excluded = [convert_model(x) for x in excluded]
|
|
354
|
+
headers = {
|
|
355
|
+
'If-Match': if_match,
|
|
356
|
+
'X-Correlation-Id': x_correlation_id,
|
|
357
|
+
'Transaction-Id': transaction_id,
|
|
358
|
+
}
|
|
359
|
+
sdk_headers = get_sdk_headers(
|
|
360
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
361
|
+
service_version='V1',
|
|
362
|
+
operation_id='replace_zone',
|
|
363
|
+
)
|
|
364
|
+
headers.update(sdk_headers)
|
|
365
|
+
|
|
366
|
+
data = {
|
|
367
|
+
'name': name,
|
|
368
|
+
'account_id': account_id,
|
|
369
|
+
'addresses': addresses,
|
|
370
|
+
'description': description,
|
|
371
|
+
'excluded': excluded,
|
|
372
|
+
}
|
|
373
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
374
|
+
data = json.dumps(data)
|
|
375
|
+
headers['content-type'] = 'application/json'
|
|
376
|
+
|
|
377
|
+
if 'headers' in kwargs:
|
|
378
|
+
headers.update(kwargs.get('headers'))
|
|
379
|
+
del kwargs['headers']
|
|
380
|
+
headers['Accept'] = 'application/json'
|
|
381
|
+
|
|
382
|
+
path_param_keys = ['zone_id']
|
|
383
|
+
path_param_values = self.encode_path_vars(zone_id)
|
|
384
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
385
|
+
url = '/v1/zones/{zone_id}'.format(**path_param_dict)
|
|
386
|
+
request = self.prepare_request(
|
|
387
|
+
method='PUT',
|
|
388
|
+
url=url,
|
|
389
|
+
headers=headers,
|
|
390
|
+
data=data,
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
response = self.send(request, **kwargs)
|
|
394
|
+
return response
|
|
395
|
+
|
|
396
|
+
def delete_zone(
|
|
397
|
+
self,
|
|
398
|
+
zone_id: str,
|
|
399
|
+
*,
|
|
400
|
+
x_correlation_id: Optional[str] = None,
|
|
401
|
+
transaction_id: Optional[str] = None,
|
|
402
|
+
**kwargs,
|
|
403
|
+
) -> DetailedResponse:
|
|
404
|
+
"""
|
|
405
|
+
Delete a network zone.
|
|
406
|
+
|
|
407
|
+
This operation deletes the network zone identified by the specified zone ID.
|
|
408
|
+
|
|
409
|
+
:param str zone_id: The ID of a zone.
|
|
410
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
411
|
+
this header is logged for a request and repeated in a response header for
|
|
412
|
+
the corresponding response. The same value is used for downstream requests
|
|
413
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
414
|
+
in a request, the service generates a random (version 4) UUID.
|
|
415
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
416
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
417
|
+
backward compatibility with other IBM platform services that support the
|
|
418
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
419
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
420
|
+
`Transaction-Id`.
|
|
421
|
+
:param dict headers: A `dict` containing the request headers
|
|
422
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
423
|
+
:rtype: DetailedResponse
|
|
424
|
+
"""
|
|
425
|
+
|
|
426
|
+
if not zone_id:
|
|
427
|
+
raise ValueError('zone_id must be provided')
|
|
428
|
+
headers = {
|
|
429
|
+
'X-Correlation-Id': x_correlation_id,
|
|
430
|
+
'Transaction-Id': transaction_id,
|
|
431
|
+
}
|
|
432
|
+
sdk_headers = get_sdk_headers(
|
|
433
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
434
|
+
service_version='V1',
|
|
435
|
+
operation_id='delete_zone',
|
|
436
|
+
)
|
|
437
|
+
headers.update(sdk_headers)
|
|
438
|
+
|
|
439
|
+
if 'headers' in kwargs:
|
|
440
|
+
headers.update(kwargs.get('headers'))
|
|
441
|
+
del kwargs['headers']
|
|
442
|
+
|
|
443
|
+
path_param_keys = ['zone_id']
|
|
444
|
+
path_param_values = self.encode_path_vars(zone_id)
|
|
445
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
446
|
+
url = '/v1/zones/{zone_id}'.format(**path_param_dict)
|
|
447
|
+
request = self.prepare_request(
|
|
448
|
+
method='DELETE',
|
|
449
|
+
url=url,
|
|
450
|
+
headers=headers,
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
response = self.send(request, **kwargs)
|
|
454
|
+
return response
|
|
455
|
+
|
|
456
|
+
def list_available_serviceref_targets(
|
|
457
|
+
self,
|
|
458
|
+
*,
|
|
459
|
+
x_correlation_id: Optional[str] = None,
|
|
460
|
+
transaction_id: Optional[str] = None,
|
|
461
|
+
type: Optional[str] = None,
|
|
462
|
+
**kwargs,
|
|
463
|
+
) -> DetailedResponse:
|
|
464
|
+
"""
|
|
465
|
+
List available service reference targets.
|
|
466
|
+
|
|
467
|
+
This operation lists all available service reference targets.
|
|
468
|
+
|
|
469
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
470
|
+
this header is logged for a request and repeated in a response header for
|
|
471
|
+
the corresponding response. The same value is used for downstream requests
|
|
472
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
473
|
+
in a request, the service generates a random (version 4) UUID.
|
|
474
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
475
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
476
|
+
backward compatibility with other IBM platform services that support the
|
|
477
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
478
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
479
|
+
`Transaction-Id`.
|
|
480
|
+
:param str type: (optional) Specifies the types of services to retrieve.
|
|
481
|
+
:param dict headers: A `dict` containing the request headers
|
|
482
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
483
|
+
:rtype: DetailedResponse with `dict` result representing a `ServiceRefTargetList` object
|
|
484
|
+
"""
|
|
485
|
+
|
|
486
|
+
headers = {
|
|
487
|
+
'X-Correlation-Id': x_correlation_id,
|
|
488
|
+
'Transaction-Id': transaction_id,
|
|
489
|
+
}
|
|
490
|
+
sdk_headers = get_sdk_headers(
|
|
491
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
492
|
+
service_version='V1',
|
|
493
|
+
operation_id='list_available_serviceref_targets',
|
|
494
|
+
)
|
|
495
|
+
headers.update(sdk_headers)
|
|
496
|
+
|
|
497
|
+
params = {
|
|
498
|
+
'type': type,
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if 'headers' in kwargs:
|
|
502
|
+
headers.update(kwargs.get('headers'))
|
|
503
|
+
del kwargs['headers']
|
|
504
|
+
headers['Accept'] = 'application/json'
|
|
505
|
+
|
|
506
|
+
url = '/v1/zones/serviceref_targets'
|
|
507
|
+
request = self.prepare_request(
|
|
508
|
+
method='GET',
|
|
509
|
+
url=url,
|
|
510
|
+
headers=headers,
|
|
511
|
+
params=params,
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
response = self.send(request, **kwargs)
|
|
515
|
+
return response
|
|
516
|
+
|
|
517
|
+
def get_serviceref_target(
|
|
518
|
+
self,
|
|
519
|
+
service_name: str,
|
|
520
|
+
*,
|
|
521
|
+
x_correlation_id: Optional[str] = None,
|
|
522
|
+
transaction_id: Optional[str] = None,
|
|
523
|
+
**kwargs,
|
|
524
|
+
) -> DetailedResponse:
|
|
525
|
+
"""
|
|
526
|
+
Get service reference target for a specified service name.
|
|
527
|
+
|
|
528
|
+
This operation gets the service reference target for a specified service name.
|
|
529
|
+
|
|
530
|
+
:param str service_name: The name of a service.
|
|
531
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
532
|
+
this header is logged for a request and repeated in a response header for
|
|
533
|
+
the corresponding response. The same value is used for downstream requests
|
|
534
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
535
|
+
in a request, the service generates a random (version 4) UUID.
|
|
536
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
537
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
538
|
+
backward compatibility with other IBM platform services that support the
|
|
539
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
540
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
541
|
+
`Transaction-Id`.
|
|
542
|
+
:param dict headers: A `dict` containing the request headers
|
|
543
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
544
|
+
:rtype: DetailedResponse with `dict` result representing a `ServiceRefTarget` object
|
|
545
|
+
"""
|
|
546
|
+
|
|
547
|
+
if not service_name:
|
|
548
|
+
raise ValueError('service_name must be provided')
|
|
549
|
+
headers = {
|
|
550
|
+
'X-Correlation-Id': x_correlation_id,
|
|
551
|
+
'Transaction-Id': transaction_id,
|
|
552
|
+
}
|
|
553
|
+
sdk_headers = get_sdk_headers(
|
|
554
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
555
|
+
service_version='V1',
|
|
556
|
+
operation_id='get_serviceref_target',
|
|
557
|
+
)
|
|
558
|
+
headers.update(sdk_headers)
|
|
559
|
+
|
|
560
|
+
if 'headers' in kwargs:
|
|
561
|
+
headers.update(kwargs.get('headers'))
|
|
562
|
+
del kwargs['headers']
|
|
563
|
+
headers['Accept'] = 'application/json'
|
|
564
|
+
|
|
565
|
+
path_param_keys = ['service_name']
|
|
566
|
+
path_param_values = self.encode_path_vars(service_name)
|
|
567
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
568
|
+
url = '/v1/zones/serviceref_targets/{service_name}'.format(**path_param_dict)
|
|
569
|
+
request = self.prepare_request(
|
|
570
|
+
method='GET',
|
|
571
|
+
url=url,
|
|
572
|
+
headers=headers,
|
|
573
|
+
)
|
|
574
|
+
|
|
575
|
+
response = self.send(request, **kwargs)
|
|
576
|
+
return response
|
|
577
|
+
|
|
578
|
+
#########################
|
|
579
|
+
# Rules
|
|
580
|
+
#########################
|
|
581
|
+
|
|
582
|
+
def create_rule(
|
|
583
|
+
self,
|
|
584
|
+
*,
|
|
585
|
+
contexts: Optional[List['RuleContext']] = None,
|
|
586
|
+
resources: Optional[List['Resource']] = None,
|
|
587
|
+
description: Optional[str] = None,
|
|
588
|
+
operations: Optional['NewRuleOperations'] = None,
|
|
589
|
+
enforcement_mode: Optional[str] = None,
|
|
590
|
+
x_correlation_id: Optional[str] = None,
|
|
591
|
+
transaction_id: Optional[str] = None,
|
|
592
|
+
**kwargs,
|
|
593
|
+
) -> DetailedResponse:
|
|
594
|
+
"""
|
|
595
|
+
Create a rule.
|
|
596
|
+
|
|
597
|
+
This operation creates a rule for the specified account.
|
|
598
|
+
|
|
599
|
+
:param List[RuleContext] contexts: (optional) The contexts this rule
|
|
600
|
+
applies to.
|
|
601
|
+
:param List[Resource] resources: (optional) The resources this rule apply
|
|
602
|
+
to.
|
|
603
|
+
:param str description: (optional) The description of the rule.
|
|
604
|
+
:param NewRuleOperations operations: (optional) The operations this rule
|
|
605
|
+
applies to.
|
|
606
|
+
:param str enforcement_mode: (optional) The rule enforcement mode:
|
|
607
|
+
* `enabled` - The restrictions are enforced and reported. This is the
|
|
608
|
+
default.
|
|
609
|
+
* `disabled` - The restrictions are disabled. Nothing is enforced or
|
|
610
|
+
reported.
|
|
611
|
+
* `report` - The restrictions are evaluated and reported, but not
|
|
612
|
+
enforced.
|
|
613
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
614
|
+
this header is logged for a request and repeated in a response header for
|
|
615
|
+
the corresponding response. The same value is used for downstream requests
|
|
616
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
617
|
+
in a request, the service generates a random (version 4) UUID.
|
|
618
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
619
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
620
|
+
backward compatibility with other IBM platform services that support the
|
|
621
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
622
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
623
|
+
`Transaction-Id`.
|
|
624
|
+
:param dict headers: A `dict` containing the request headers
|
|
625
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
626
|
+
:rtype: DetailedResponse with `dict` result representing a `Rule` object
|
|
627
|
+
"""
|
|
628
|
+
|
|
629
|
+
if contexts is not None:
|
|
630
|
+
contexts = [convert_model(x) for x in contexts]
|
|
631
|
+
if resources is not None:
|
|
632
|
+
resources = [convert_model(x) for x in resources]
|
|
633
|
+
if operations is not None:
|
|
634
|
+
operations = convert_model(operations)
|
|
635
|
+
headers = {
|
|
636
|
+
'X-Correlation-Id': x_correlation_id,
|
|
637
|
+
'Transaction-Id': transaction_id,
|
|
638
|
+
}
|
|
639
|
+
sdk_headers = get_sdk_headers(
|
|
640
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
641
|
+
service_version='V1',
|
|
642
|
+
operation_id='create_rule',
|
|
643
|
+
)
|
|
644
|
+
headers.update(sdk_headers)
|
|
645
|
+
|
|
646
|
+
data = {
|
|
647
|
+
'contexts': contexts,
|
|
648
|
+
'resources': resources,
|
|
649
|
+
'description': description,
|
|
650
|
+
'operations': operations,
|
|
651
|
+
'enforcement_mode': enforcement_mode,
|
|
652
|
+
}
|
|
653
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
654
|
+
data = json.dumps(data)
|
|
655
|
+
headers['content-type'] = 'application/json'
|
|
656
|
+
|
|
657
|
+
if 'headers' in kwargs:
|
|
658
|
+
headers.update(kwargs.get('headers'))
|
|
659
|
+
del kwargs['headers']
|
|
660
|
+
headers['Accept'] = 'application/json'
|
|
661
|
+
|
|
662
|
+
url = '/v1/rules'
|
|
663
|
+
request = self.prepare_request(
|
|
664
|
+
method='POST',
|
|
665
|
+
url=url,
|
|
666
|
+
headers=headers,
|
|
667
|
+
data=data,
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
response = self.send(request, **kwargs)
|
|
671
|
+
return response
|
|
672
|
+
|
|
673
|
+
def list_rules(
|
|
674
|
+
self,
|
|
675
|
+
account_id: str,
|
|
676
|
+
*,
|
|
677
|
+
x_correlation_id: Optional[str] = None,
|
|
678
|
+
transaction_id: Optional[str] = None,
|
|
679
|
+
region: Optional[str] = None,
|
|
680
|
+
resource: Optional[str] = None,
|
|
681
|
+
resource_type: Optional[str] = None,
|
|
682
|
+
service_instance: Optional[str] = None,
|
|
683
|
+
service_name: Optional[str] = None,
|
|
684
|
+
service_type: Optional[str] = None,
|
|
685
|
+
service_group_id: Optional[str] = None,
|
|
686
|
+
zone_id: Optional[str] = None,
|
|
687
|
+
sort: Optional[str] = None,
|
|
688
|
+
enforcement_mode: Optional[str] = None,
|
|
689
|
+
**kwargs,
|
|
690
|
+
) -> DetailedResponse:
|
|
691
|
+
"""
|
|
692
|
+
List rules.
|
|
693
|
+
|
|
694
|
+
This operation lists rules in the specified account.
|
|
695
|
+
|
|
696
|
+
:param str account_id: The ID of the managing account.
|
|
697
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
698
|
+
this header is logged for a request and repeated in a response header for
|
|
699
|
+
the corresponding response. The same value is used for downstream requests
|
|
700
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
701
|
+
in a request, the service generates a random (version 4) UUID.
|
|
702
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
703
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
704
|
+
backward compatibility with other IBM platform services that support the
|
|
705
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
706
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
707
|
+
`Transaction-Id`.
|
|
708
|
+
:param str region: (optional) The `region` resource attribute.
|
|
709
|
+
:param str resource: (optional) The `resource` resource attribute.
|
|
710
|
+
:param str resource_type: (optional) The `resourceType` resource attribute.
|
|
711
|
+
:param str service_instance: (optional) The `serviceInstance` resource
|
|
712
|
+
attribute.
|
|
713
|
+
:param str service_name: (optional) The `serviceName` resource attribute.
|
|
714
|
+
:param str service_type: (optional) The rule's `serviceType` resource
|
|
715
|
+
attribute.
|
|
716
|
+
:param str service_group_id: (optional) The rule's `service_group_id`
|
|
717
|
+
resource attribute.
|
|
718
|
+
:param str zone_id: (optional) The globally unique ID of the zone.
|
|
719
|
+
:param str sort: (optional) Sorts results by using a valid sort field. To
|
|
720
|
+
learn more, see
|
|
721
|
+
[Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting).
|
|
722
|
+
:param str enforcement_mode: (optional) The rule's `enforcement_mode`
|
|
723
|
+
attribute.
|
|
724
|
+
:param dict headers: A `dict` containing the request headers
|
|
725
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
726
|
+
:rtype: DetailedResponse with `dict` result representing a `RuleList` object
|
|
727
|
+
"""
|
|
728
|
+
|
|
729
|
+
if not account_id:
|
|
730
|
+
raise ValueError('account_id must be provided')
|
|
731
|
+
headers = {
|
|
732
|
+
'X-Correlation-Id': x_correlation_id,
|
|
733
|
+
'Transaction-Id': transaction_id,
|
|
734
|
+
}
|
|
735
|
+
sdk_headers = get_sdk_headers(
|
|
736
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
737
|
+
service_version='V1',
|
|
738
|
+
operation_id='list_rules',
|
|
739
|
+
)
|
|
740
|
+
headers.update(sdk_headers)
|
|
741
|
+
|
|
742
|
+
params = {
|
|
743
|
+
'account_id': account_id,
|
|
744
|
+
'region': region,
|
|
745
|
+
'resource': resource,
|
|
746
|
+
'resource_type': resource_type,
|
|
747
|
+
'service_instance': service_instance,
|
|
748
|
+
'service_name': service_name,
|
|
749
|
+
'service_type': service_type,
|
|
750
|
+
'service_group_id': service_group_id,
|
|
751
|
+
'zone_id': zone_id,
|
|
752
|
+
'sort': sort,
|
|
753
|
+
'enforcement_mode': enforcement_mode,
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
if 'headers' in kwargs:
|
|
757
|
+
headers.update(kwargs.get('headers'))
|
|
758
|
+
del kwargs['headers']
|
|
759
|
+
headers['Accept'] = 'application/json'
|
|
760
|
+
|
|
761
|
+
url = '/v1/rules'
|
|
762
|
+
request = self.prepare_request(
|
|
763
|
+
method='GET',
|
|
764
|
+
url=url,
|
|
765
|
+
headers=headers,
|
|
766
|
+
params=params,
|
|
767
|
+
)
|
|
768
|
+
|
|
769
|
+
response = self.send(request, **kwargs)
|
|
770
|
+
return response
|
|
771
|
+
|
|
772
|
+
def get_rule(
|
|
773
|
+
self,
|
|
774
|
+
rule_id: str,
|
|
775
|
+
*,
|
|
776
|
+
x_correlation_id: Optional[str] = None,
|
|
777
|
+
transaction_id: Optional[str] = None,
|
|
778
|
+
**kwargs,
|
|
779
|
+
) -> DetailedResponse:
|
|
780
|
+
"""
|
|
781
|
+
Get a rule.
|
|
782
|
+
|
|
783
|
+
This operation retrieves the rule identified by the specified rule ID.
|
|
784
|
+
|
|
785
|
+
:param str rule_id: The ID of a rule.
|
|
786
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
787
|
+
this header is logged for a request and repeated in a response header for
|
|
788
|
+
the corresponding response. The same value is used for downstream requests
|
|
789
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
790
|
+
in a request, the service generates a random (version 4) UUID.
|
|
791
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
792
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
793
|
+
backward compatibility with other IBM platform services that support the
|
|
794
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
795
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
796
|
+
`Transaction-Id`.
|
|
797
|
+
:param dict headers: A `dict` containing the request headers
|
|
798
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
799
|
+
:rtype: DetailedResponse with `dict` result representing a `Rule` object
|
|
800
|
+
"""
|
|
801
|
+
|
|
802
|
+
if not rule_id:
|
|
803
|
+
raise ValueError('rule_id must be provided')
|
|
804
|
+
headers = {
|
|
805
|
+
'X-Correlation-Id': x_correlation_id,
|
|
806
|
+
'Transaction-Id': transaction_id,
|
|
807
|
+
}
|
|
808
|
+
sdk_headers = get_sdk_headers(
|
|
809
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
810
|
+
service_version='V1',
|
|
811
|
+
operation_id='get_rule',
|
|
812
|
+
)
|
|
813
|
+
headers.update(sdk_headers)
|
|
814
|
+
|
|
815
|
+
if 'headers' in kwargs:
|
|
816
|
+
headers.update(kwargs.get('headers'))
|
|
817
|
+
del kwargs['headers']
|
|
818
|
+
headers['Accept'] = 'application/json'
|
|
819
|
+
|
|
820
|
+
path_param_keys = ['rule_id']
|
|
821
|
+
path_param_values = self.encode_path_vars(rule_id)
|
|
822
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
823
|
+
url = '/v1/rules/{rule_id}'.format(**path_param_dict)
|
|
824
|
+
request = self.prepare_request(
|
|
825
|
+
method='GET',
|
|
826
|
+
url=url,
|
|
827
|
+
headers=headers,
|
|
828
|
+
)
|
|
829
|
+
|
|
830
|
+
response = self.send(request, **kwargs)
|
|
831
|
+
return response
|
|
832
|
+
|
|
833
|
+
def replace_rule(
|
|
834
|
+
self,
|
|
835
|
+
rule_id: str,
|
|
836
|
+
if_match: str,
|
|
837
|
+
*,
|
|
838
|
+
contexts: Optional[List['RuleContext']] = None,
|
|
839
|
+
resources: Optional[List['Resource']] = None,
|
|
840
|
+
description: Optional[str] = None,
|
|
841
|
+
operations: Optional['NewRuleOperations'] = None,
|
|
842
|
+
enforcement_mode: Optional[str] = None,
|
|
843
|
+
x_correlation_id: Optional[str] = None,
|
|
844
|
+
transaction_id: Optional[str] = None,
|
|
845
|
+
**kwargs,
|
|
846
|
+
) -> DetailedResponse:
|
|
847
|
+
"""
|
|
848
|
+
Replace a rule.
|
|
849
|
+
|
|
850
|
+
This operation replaces the rule identified by the specified rule ID. Partial
|
|
851
|
+
updates are not supported. The entire rule object must be replaced.
|
|
852
|
+
|
|
853
|
+
:param str rule_id: The ID of a rule.
|
|
854
|
+
:param str if_match: The current revision of the resource being updated.
|
|
855
|
+
This can be found in the Create/Get/Update resource response ETag header.
|
|
856
|
+
:param List[RuleContext] contexts: (optional) The contexts this rule
|
|
857
|
+
applies to.
|
|
858
|
+
:param List[Resource] resources: (optional) The resources this rule apply
|
|
859
|
+
to.
|
|
860
|
+
:param str description: (optional) The description of the rule.
|
|
861
|
+
:param NewRuleOperations operations: (optional) The operations this rule
|
|
862
|
+
applies to.
|
|
863
|
+
:param str enforcement_mode: (optional) The rule enforcement mode:
|
|
864
|
+
* `enabled` - The restrictions are enforced and reported. This is the
|
|
865
|
+
default.
|
|
866
|
+
* `disabled` - The restrictions are disabled. Nothing is enforced or
|
|
867
|
+
reported.
|
|
868
|
+
* `report` - The restrictions are evaluated and reported, but not
|
|
869
|
+
enforced.
|
|
870
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
871
|
+
this header is logged for a request and repeated in a response header for
|
|
872
|
+
the corresponding response. The same value is used for downstream requests
|
|
873
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
874
|
+
in a request, the service generates a random (version 4) UUID.
|
|
875
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
876
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
877
|
+
backward compatibility with other IBM platform services that support the
|
|
878
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
879
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
880
|
+
`Transaction-Id`.
|
|
881
|
+
:param dict headers: A `dict` containing the request headers
|
|
882
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
883
|
+
:rtype: DetailedResponse with `dict` result representing a `Rule` object
|
|
884
|
+
"""
|
|
885
|
+
|
|
886
|
+
if not rule_id:
|
|
887
|
+
raise ValueError('rule_id must be provided')
|
|
888
|
+
if not if_match:
|
|
889
|
+
raise ValueError('if_match must be provided')
|
|
890
|
+
if contexts is not None:
|
|
891
|
+
contexts = [convert_model(x) for x in contexts]
|
|
892
|
+
if resources is not None:
|
|
893
|
+
resources = [convert_model(x) for x in resources]
|
|
894
|
+
if operations is not None:
|
|
895
|
+
operations = convert_model(operations)
|
|
896
|
+
headers = {
|
|
897
|
+
'If-Match': if_match,
|
|
898
|
+
'X-Correlation-Id': x_correlation_id,
|
|
899
|
+
'Transaction-Id': transaction_id,
|
|
900
|
+
}
|
|
901
|
+
sdk_headers = get_sdk_headers(
|
|
902
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
903
|
+
service_version='V1',
|
|
904
|
+
operation_id='replace_rule',
|
|
905
|
+
)
|
|
906
|
+
headers.update(sdk_headers)
|
|
907
|
+
|
|
908
|
+
data = {
|
|
909
|
+
'contexts': contexts,
|
|
910
|
+
'resources': resources,
|
|
911
|
+
'description': description,
|
|
912
|
+
'operations': operations,
|
|
913
|
+
'enforcement_mode': enforcement_mode,
|
|
914
|
+
}
|
|
915
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
916
|
+
data = json.dumps(data)
|
|
917
|
+
headers['content-type'] = 'application/json'
|
|
918
|
+
|
|
919
|
+
if 'headers' in kwargs:
|
|
920
|
+
headers.update(kwargs.get('headers'))
|
|
921
|
+
del kwargs['headers']
|
|
922
|
+
headers['Accept'] = 'application/json'
|
|
923
|
+
|
|
924
|
+
path_param_keys = ['rule_id']
|
|
925
|
+
path_param_values = self.encode_path_vars(rule_id)
|
|
926
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
927
|
+
url = '/v1/rules/{rule_id}'.format(**path_param_dict)
|
|
928
|
+
request = self.prepare_request(
|
|
929
|
+
method='PUT',
|
|
930
|
+
url=url,
|
|
931
|
+
headers=headers,
|
|
932
|
+
data=data,
|
|
933
|
+
)
|
|
934
|
+
|
|
935
|
+
response = self.send(request, **kwargs)
|
|
936
|
+
return response
|
|
937
|
+
|
|
938
|
+
def delete_rule(
|
|
939
|
+
self,
|
|
940
|
+
rule_id: str,
|
|
941
|
+
*,
|
|
942
|
+
x_correlation_id: Optional[str] = None,
|
|
943
|
+
transaction_id: Optional[str] = None,
|
|
944
|
+
**kwargs,
|
|
945
|
+
) -> DetailedResponse:
|
|
946
|
+
"""
|
|
947
|
+
Delete a rule.
|
|
948
|
+
|
|
949
|
+
This operation deletes the rule identified by the specified rule ID.
|
|
950
|
+
|
|
951
|
+
:param str rule_id: The ID of a rule.
|
|
952
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
953
|
+
this header is logged for a request and repeated in a response header for
|
|
954
|
+
the corresponding response. The same value is used for downstream requests
|
|
955
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
956
|
+
in a request, the service generates a random (version 4) UUID.
|
|
957
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
958
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
959
|
+
backward compatibility with other IBM platform services that support the
|
|
960
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
961
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
962
|
+
`Transaction-Id`.
|
|
963
|
+
:param dict headers: A `dict` containing the request headers
|
|
964
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
965
|
+
:rtype: DetailedResponse
|
|
966
|
+
"""
|
|
967
|
+
|
|
968
|
+
if not rule_id:
|
|
969
|
+
raise ValueError('rule_id must be provided')
|
|
970
|
+
headers = {
|
|
971
|
+
'X-Correlation-Id': x_correlation_id,
|
|
972
|
+
'Transaction-Id': transaction_id,
|
|
973
|
+
}
|
|
974
|
+
sdk_headers = get_sdk_headers(
|
|
975
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
976
|
+
service_version='V1',
|
|
977
|
+
operation_id='delete_rule',
|
|
978
|
+
)
|
|
979
|
+
headers.update(sdk_headers)
|
|
980
|
+
|
|
981
|
+
if 'headers' in kwargs:
|
|
982
|
+
headers.update(kwargs.get('headers'))
|
|
983
|
+
del kwargs['headers']
|
|
984
|
+
|
|
985
|
+
path_param_keys = ['rule_id']
|
|
986
|
+
path_param_values = self.encode_path_vars(rule_id)
|
|
987
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
988
|
+
url = '/v1/rules/{rule_id}'.format(**path_param_dict)
|
|
989
|
+
request = self.prepare_request(
|
|
990
|
+
method='DELETE',
|
|
991
|
+
url=url,
|
|
992
|
+
headers=headers,
|
|
993
|
+
)
|
|
994
|
+
|
|
995
|
+
response = self.send(request, **kwargs)
|
|
996
|
+
return response
|
|
997
|
+
|
|
998
|
+
#########################
|
|
999
|
+
# Account settings
|
|
1000
|
+
#########################
|
|
1001
|
+
|
|
1002
|
+
def get_account_settings(
|
|
1003
|
+
self,
|
|
1004
|
+
account_id: str,
|
|
1005
|
+
*,
|
|
1006
|
+
x_correlation_id: Optional[str] = None,
|
|
1007
|
+
transaction_id: Optional[str] = None,
|
|
1008
|
+
**kwargs,
|
|
1009
|
+
) -> DetailedResponse:
|
|
1010
|
+
"""
|
|
1011
|
+
Get account settings.
|
|
1012
|
+
|
|
1013
|
+
This operation retrieves the settings for the specified account ID.
|
|
1014
|
+
|
|
1015
|
+
:param str account_id: The ID of the account the settings are for.
|
|
1016
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
1017
|
+
this header is logged for a request and repeated in a response header for
|
|
1018
|
+
the corresponding response. The same value is used for downstream requests
|
|
1019
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
1020
|
+
in a request, the service generates a random (version 4) UUID.
|
|
1021
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
1022
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
1023
|
+
backward compatibility with other IBM platform services that support the
|
|
1024
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
1025
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
1026
|
+
`Transaction-Id`.
|
|
1027
|
+
:param dict headers: A `dict` containing the request headers
|
|
1028
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
1029
|
+
:rtype: DetailedResponse with `dict` result representing a `AccountSettings` object
|
|
1030
|
+
"""
|
|
1031
|
+
|
|
1032
|
+
if not account_id:
|
|
1033
|
+
raise ValueError('account_id must be provided')
|
|
1034
|
+
headers = {
|
|
1035
|
+
'X-Correlation-Id': x_correlation_id,
|
|
1036
|
+
'Transaction-Id': transaction_id,
|
|
1037
|
+
}
|
|
1038
|
+
sdk_headers = get_sdk_headers(
|
|
1039
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
1040
|
+
service_version='V1',
|
|
1041
|
+
operation_id='get_account_settings',
|
|
1042
|
+
)
|
|
1043
|
+
headers.update(sdk_headers)
|
|
1044
|
+
|
|
1045
|
+
if 'headers' in kwargs:
|
|
1046
|
+
headers.update(kwargs.get('headers'))
|
|
1047
|
+
del kwargs['headers']
|
|
1048
|
+
headers['Accept'] = 'application/json'
|
|
1049
|
+
|
|
1050
|
+
path_param_keys = ['account_id']
|
|
1051
|
+
path_param_values = self.encode_path_vars(account_id)
|
|
1052
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
1053
|
+
url = '/v1/account_settings/{account_id}'.format(**path_param_dict)
|
|
1054
|
+
request = self.prepare_request(
|
|
1055
|
+
method='GET',
|
|
1056
|
+
url=url,
|
|
1057
|
+
headers=headers,
|
|
1058
|
+
)
|
|
1059
|
+
|
|
1060
|
+
response = self.send(request, **kwargs)
|
|
1061
|
+
return response
|
|
1062
|
+
|
|
1063
|
+
#########################
|
|
1064
|
+
# operations
|
|
1065
|
+
#########################
|
|
1066
|
+
|
|
1067
|
+
def list_available_service_operations(
|
|
1068
|
+
self,
|
|
1069
|
+
*,
|
|
1070
|
+
x_correlation_id: Optional[str] = None,
|
|
1071
|
+
transaction_id: Optional[str] = None,
|
|
1072
|
+
service_name: Optional[str] = None,
|
|
1073
|
+
service_group_id: Optional[str] = None,
|
|
1074
|
+
resource_type: Optional[str] = None,
|
|
1075
|
+
**kwargs,
|
|
1076
|
+
) -> DetailedResponse:
|
|
1077
|
+
"""
|
|
1078
|
+
List available service operations.
|
|
1079
|
+
|
|
1080
|
+
This operation lists all available service operations.
|
|
1081
|
+
|
|
1082
|
+
:param str x_correlation_id: (optional) The supplied or generated value of
|
|
1083
|
+
this header is logged for a request and repeated in a response header for
|
|
1084
|
+
the corresponding response. The same value is used for downstream requests
|
|
1085
|
+
and retries of those requests. If a value of this headers is not supplied
|
|
1086
|
+
in a request, the service generates a random (version 4) UUID.
|
|
1087
|
+
:param str transaction_id: (optional) Deprecated: The `Transaction-Id`
|
|
1088
|
+
header behaves as the `X-Correlation-Id` header. It is supported for
|
|
1089
|
+
backward compatibility with other IBM platform services that support the
|
|
1090
|
+
`Transaction-Id` header only. If both `X-Correlation-Id` and
|
|
1091
|
+
`Transaction-Id` are provided, `X-Correlation-Id` has the precedence over
|
|
1092
|
+
`Transaction-Id`.
|
|
1093
|
+
:param str service_name: (optional) The name of the service.
|
|
1094
|
+
:param str service_group_id: (optional) The id of the service group.
|
|
1095
|
+
:param str resource_type: (optional) The type of resource.
|
|
1096
|
+
:param dict headers: A `dict` containing the request headers
|
|
1097
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
1098
|
+
:rtype: DetailedResponse with `dict` result representing a `OperationsList` object
|
|
1099
|
+
"""
|
|
1100
|
+
|
|
1101
|
+
headers = {
|
|
1102
|
+
'X-Correlation-Id': x_correlation_id,
|
|
1103
|
+
'Transaction-Id': transaction_id,
|
|
1104
|
+
}
|
|
1105
|
+
sdk_headers = get_sdk_headers(
|
|
1106
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
1107
|
+
service_version='V1',
|
|
1108
|
+
operation_id='list_available_service_operations',
|
|
1109
|
+
)
|
|
1110
|
+
headers.update(sdk_headers)
|
|
1111
|
+
|
|
1112
|
+
params = {
|
|
1113
|
+
'service_name': service_name,
|
|
1114
|
+
'service_group_id': service_group_id,
|
|
1115
|
+
'resource_type': resource_type,
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
if 'headers' in kwargs:
|
|
1119
|
+
headers.update(kwargs.get('headers'))
|
|
1120
|
+
del kwargs['headers']
|
|
1121
|
+
headers['Accept'] = 'application/json'
|
|
1122
|
+
|
|
1123
|
+
url = '/v1/operations'
|
|
1124
|
+
request = self.prepare_request(
|
|
1125
|
+
method='GET',
|
|
1126
|
+
url=url,
|
|
1127
|
+
headers=headers,
|
|
1128
|
+
params=params,
|
|
1129
|
+
)
|
|
1130
|
+
|
|
1131
|
+
response = self.send(request, **kwargs)
|
|
1132
|
+
return response
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
class ListAvailableServicerefTargetsEnums:
|
|
1136
|
+
"""
|
|
1137
|
+
Enums for list_available_serviceref_targets parameters.
|
|
1138
|
+
"""
|
|
1139
|
+
|
|
1140
|
+
class Type(str, Enum):
|
|
1141
|
+
"""
|
|
1142
|
+
Specifies the types of services to retrieve.
|
|
1143
|
+
"""
|
|
1144
|
+
|
|
1145
|
+
ALL = 'all'
|
|
1146
|
+
PLATFORM_SERVICE = 'platform_service'
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
class ListRulesEnums:
|
|
1150
|
+
"""
|
|
1151
|
+
Enums for list_rules parameters.
|
|
1152
|
+
"""
|
|
1153
|
+
|
|
1154
|
+
class EnforcementMode(str, Enum):
|
|
1155
|
+
"""
|
|
1156
|
+
The rule's `enforcement_mode` attribute.
|
|
1157
|
+
"""
|
|
1158
|
+
|
|
1159
|
+
ENABLED = 'enabled'
|
|
1160
|
+
DISABLED = 'disabled'
|
|
1161
|
+
REPORT = 'report'
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
##############################################################################
|
|
1165
|
+
# Models
|
|
1166
|
+
##############################################################################
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
class APIType:
|
|
1170
|
+
"""
|
|
1171
|
+
Service API Type details.
|
|
1172
|
+
|
|
1173
|
+
:param str api_type_id: The id of the API type.
|
|
1174
|
+
:param str display_name: The displayed name of the API type.
|
|
1175
|
+
:param str description: The description of the API type.
|
|
1176
|
+
:param str type: The type of the API type.
|
|
1177
|
+
:param List[Action] actions: The actions available for the API type.
|
|
1178
|
+
:param List[str] enforcement_modes: (optional) The enforcement modes supported
|
|
1179
|
+
by the API type.
|
|
1180
|
+
"""
|
|
1181
|
+
|
|
1182
|
+
def __init__(
|
|
1183
|
+
self,
|
|
1184
|
+
api_type_id: str,
|
|
1185
|
+
display_name: str,
|
|
1186
|
+
description: str,
|
|
1187
|
+
type: str,
|
|
1188
|
+
actions: List['Action'],
|
|
1189
|
+
*,
|
|
1190
|
+
enforcement_modes: Optional[List[str]] = None,
|
|
1191
|
+
) -> None:
|
|
1192
|
+
"""
|
|
1193
|
+
Initialize a APIType object.
|
|
1194
|
+
|
|
1195
|
+
:param str api_type_id: The id of the API type.
|
|
1196
|
+
:param str display_name: The displayed name of the API type.
|
|
1197
|
+
:param str description: The description of the API type.
|
|
1198
|
+
:param str type: The type of the API type.
|
|
1199
|
+
:param List[Action] actions: The actions available for the API type.
|
|
1200
|
+
:param List[str] enforcement_modes: (optional) The enforcement modes
|
|
1201
|
+
supported by the API type.
|
|
1202
|
+
"""
|
|
1203
|
+
self.api_type_id = api_type_id
|
|
1204
|
+
self.display_name = display_name
|
|
1205
|
+
self.description = description
|
|
1206
|
+
self.type = type
|
|
1207
|
+
self.actions = actions
|
|
1208
|
+
self.enforcement_modes = enforcement_modes
|
|
1209
|
+
|
|
1210
|
+
@classmethod
|
|
1211
|
+
def from_dict(cls, _dict: Dict) -> 'APIType':
|
|
1212
|
+
"""Initialize a APIType object from a json dictionary."""
|
|
1213
|
+
args = {}
|
|
1214
|
+
if (api_type_id := _dict.get('api_type_id')) is not None:
|
|
1215
|
+
args['api_type_id'] = api_type_id
|
|
1216
|
+
else:
|
|
1217
|
+
raise ValueError('Required property \'api_type_id\' not present in APIType JSON')
|
|
1218
|
+
if (display_name := _dict.get('display_name')) is not None:
|
|
1219
|
+
args['display_name'] = display_name
|
|
1220
|
+
else:
|
|
1221
|
+
raise ValueError('Required property \'display_name\' not present in APIType JSON')
|
|
1222
|
+
if (description := _dict.get('description')) is not None:
|
|
1223
|
+
args['description'] = description
|
|
1224
|
+
else:
|
|
1225
|
+
raise ValueError('Required property \'description\' not present in APIType JSON')
|
|
1226
|
+
if (type := _dict.get('type')) is not None:
|
|
1227
|
+
args['type'] = type
|
|
1228
|
+
else:
|
|
1229
|
+
raise ValueError('Required property \'type\' not present in APIType JSON')
|
|
1230
|
+
if (actions := _dict.get('actions')) is not None:
|
|
1231
|
+
args['actions'] = [Action.from_dict(v) for v in actions]
|
|
1232
|
+
else:
|
|
1233
|
+
raise ValueError('Required property \'actions\' not present in APIType JSON')
|
|
1234
|
+
if (enforcement_modes := _dict.get('enforcement_modes')) is not None:
|
|
1235
|
+
args['enforcement_modes'] = enforcement_modes
|
|
1236
|
+
return cls(**args)
|
|
1237
|
+
|
|
1238
|
+
@classmethod
|
|
1239
|
+
def _from_dict(cls, _dict):
|
|
1240
|
+
"""Initialize a APIType object from a json dictionary."""
|
|
1241
|
+
return cls.from_dict(_dict)
|
|
1242
|
+
|
|
1243
|
+
def to_dict(self) -> Dict:
|
|
1244
|
+
"""Return a json dictionary representing this model."""
|
|
1245
|
+
_dict = {}
|
|
1246
|
+
if hasattr(self, 'api_type_id') and self.api_type_id is not None:
|
|
1247
|
+
_dict['api_type_id'] = self.api_type_id
|
|
1248
|
+
if hasattr(self, 'display_name') and self.display_name is not None:
|
|
1249
|
+
_dict['display_name'] = self.display_name
|
|
1250
|
+
if hasattr(self, 'description') and self.description is not None:
|
|
1251
|
+
_dict['description'] = self.description
|
|
1252
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
1253
|
+
_dict['type'] = self.type
|
|
1254
|
+
if hasattr(self, 'actions') and self.actions is not None:
|
|
1255
|
+
actions_list = []
|
|
1256
|
+
for v in self.actions:
|
|
1257
|
+
if isinstance(v, dict):
|
|
1258
|
+
actions_list.append(v)
|
|
1259
|
+
else:
|
|
1260
|
+
actions_list.append(v.to_dict())
|
|
1261
|
+
_dict['actions'] = actions_list
|
|
1262
|
+
if hasattr(self, 'enforcement_modes') and self.enforcement_modes is not None:
|
|
1263
|
+
_dict['enforcement_modes'] = self.enforcement_modes
|
|
1264
|
+
return _dict
|
|
1265
|
+
|
|
1266
|
+
def _to_dict(self):
|
|
1267
|
+
"""Return a json dictionary representing this model."""
|
|
1268
|
+
return self.to_dict()
|
|
1269
|
+
|
|
1270
|
+
def __str__(self) -> str:
|
|
1271
|
+
"""Return a `str` version of this APIType object."""
|
|
1272
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1273
|
+
|
|
1274
|
+
def __eq__(self, other: 'APIType') -> bool:
|
|
1275
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1276
|
+
if not isinstance(other, self.__class__):
|
|
1277
|
+
return False
|
|
1278
|
+
return self.__dict__ == other.__dict__
|
|
1279
|
+
|
|
1280
|
+
def __ne__(self, other: 'APIType') -> bool:
|
|
1281
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1282
|
+
return not self == other
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
class AccountSettings:
|
|
1286
|
+
"""
|
|
1287
|
+
An output account settings.
|
|
1288
|
+
|
|
1289
|
+
:param str id: The globally unique ID of the account settings.
|
|
1290
|
+
:param str crn: The account settings CRN.
|
|
1291
|
+
:param int rule_count_limit: the max number of rules allowed for the account.
|
|
1292
|
+
:param int zone_count_limit: the max number of zones allowed for the account.
|
|
1293
|
+
:param int tags_rule_count_limit: (optional) the max number of rules with tags
|
|
1294
|
+
allowed for the account.
|
|
1295
|
+
:param int current_rule_count: the current number of rules used by the account.
|
|
1296
|
+
:param int current_zone_count: the current number of zones used by the account.
|
|
1297
|
+
:param int current_tags_rule_count: (optional) the current number of rules with
|
|
1298
|
+
tags used by the account.
|
|
1299
|
+
:param str href: The href link to the resource.
|
|
1300
|
+
:param datetime created_at: The time the resource was created.
|
|
1301
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
1302
|
+
resource.
|
|
1303
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
1304
|
+
:param str last_modified_by_id: IAM ID of the user or service which modified the
|
|
1305
|
+
resource.
|
|
1306
|
+
"""
|
|
1307
|
+
|
|
1308
|
+
def __init__(
|
|
1309
|
+
self,
|
|
1310
|
+
id: str,
|
|
1311
|
+
crn: str,
|
|
1312
|
+
rule_count_limit: int,
|
|
1313
|
+
zone_count_limit: int,
|
|
1314
|
+
current_rule_count: int,
|
|
1315
|
+
current_zone_count: int,
|
|
1316
|
+
href: str,
|
|
1317
|
+
created_at: datetime,
|
|
1318
|
+
created_by_id: str,
|
|
1319
|
+
last_modified_at: datetime,
|
|
1320
|
+
last_modified_by_id: str,
|
|
1321
|
+
*,
|
|
1322
|
+
tags_rule_count_limit: Optional[int] = None,
|
|
1323
|
+
current_tags_rule_count: Optional[int] = None,
|
|
1324
|
+
) -> None:
|
|
1325
|
+
"""
|
|
1326
|
+
Initialize a AccountSettings object.
|
|
1327
|
+
|
|
1328
|
+
:param str id: The globally unique ID of the account settings.
|
|
1329
|
+
:param str crn: The account settings CRN.
|
|
1330
|
+
:param int rule_count_limit: the max number of rules allowed for the
|
|
1331
|
+
account.
|
|
1332
|
+
:param int zone_count_limit: the max number of zones allowed for the
|
|
1333
|
+
account.
|
|
1334
|
+
:param int current_rule_count: the current number of rules used by the
|
|
1335
|
+
account.
|
|
1336
|
+
:param int current_zone_count: the current number of zones used by the
|
|
1337
|
+
account.
|
|
1338
|
+
:param str href: The href link to the resource.
|
|
1339
|
+
:param datetime created_at: The time the resource was created.
|
|
1340
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
1341
|
+
resource.
|
|
1342
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
1343
|
+
:param str last_modified_by_id: IAM ID of the user or service which
|
|
1344
|
+
modified the resource.
|
|
1345
|
+
:param int tags_rule_count_limit: (optional) the max number of rules with
|
|
1346
|
+
tags allowed for the account.
|
|
1347
|
+
:param int current_tags_rule_count: (optional) the current number of rules
|
|
1348
|
+
with tags used by the account.
|
|
1349
|
+
"""
|
|
1350
|
+
self.id = id
|
|
1351
|
+
self.crn = crn
|
|
1352
|
+
self.rule_count_limit = rule_count_limit
|
|
1353
|
+
self.zone_count_limit = zone_count_limit
|
|
1354
|
+
self.tags_rule_count_limit = tags_rule_count_limit
|
|
1355
|
+
self.current_rule_count = current_rule_count
|
|
1356
|
+
self.current_zone_count = current_zone_count
|
|
1357
|
+
self.current_tags_rule_count = current_tags_rule_count
|
|
1358
|
+
self.href = href
|
|
1359
|
+
self.created_at = created_at
|
|
1360
|
+
self.created_by_id = created_by_id
|
|
1361
|
+
self.last_modified_at = last_modified_at
|
|
1362
|
+
self.last_modified_by_id = last_modified_by_id
|
|
1363
|
+
|
|
1364
|
+
@classmethod
|
|
1365
|
+
def from_dict(cls, _dict: Dict) -> 'AccountSettings':
|
|
1366
|
+
"""Initialize a AccountSettings object from a json dictionary."""
|
|
1367
|
+
args = {}
|
|
1368
|
+
if (id := _dict.get('id')) is not None:
|
|
1369
|
+
args['id'] = id
|
|
1370
|
+
else:
|
|
1371
|
+
raise ValueError('Required property \'id\' not present in AccountSettings JSON')
|
|
1372
|
+
if (crn := _dict.get('crn')) is not None:
|
|
1373
|
+
args['crn'] = crn
|
|
1374
|
+
else:
|
|
1375
|
+
raise ValueError('Required property \'crn\' not present in AccountSettings JSON')
|
|
1376
|
+
if (rule_count_limit := _dict.get('rule_count_limit')) is not None:
|
|
1377
|
+
args['rule_count_limit'] = rule_count_limit
|
|
1378
|
+
else:
|
|
1379
|
+
raise ValueError('Required property \'rule_count_limit\' not present in AccountSettings JSON')
|
|
1380
|
+
if (zone_count_limit := _dict.get('zone_count_limit')) is not None:
|
|
1381
|
+
args['zone_count_limit'] = zone_count_limit
|
|
1382
|
+
else:
|
|
1383
|
+
raise ValueError('Required property \'zone_count_limit\' not present in AccountSettings JSON')
|
|
1384
|
+
if (tags_rule_count_limit := _dict.get('tags_rule_count_limit')) is not None:
|
|
1385
|
+
args['tags_rule_count_limit'] = tags_rule_count_limit
|
|
1386
|
+
if (current_rule_count := _dict.get('current_rule_count')) is not None:
|
|
1387
|
+
args['current_rule_count'] = current_rule_count
|
|
1388
|
+
else:
|
|
1389
|
+
raise ValueError('Required property \'current_rule_count\' not present in AccountSettings JSON')
|
|
1390
|
+
if (current_zone_count := _dict.get('current_zone_count')) is not None:
|
|
1391
|
+
args['current_zone_count'] = current_zone_count
|
|
1392
|
+
else:
|
|
1393
|
+
raise ValueError('Required property \'current_zone_count\' not present in AccountSettings JSON')
|
|
1394
|
+
if (current_tags_rule_count := _dict.get('current_tags_rule_count')) is not None:
|
|
1395
|
+
args['current_tags_rule_count'] = current_tags_rule_count
|
|
1396
|
+
if (href := _dict.get('href')) is not None:
|
|
1397
|
+
args['href'] = href
|
|
1398
|
+
else:
|
|
1399
|
+
raise ValueError('Required property \'href\' not present in AccountSettings JSON')
|
|
1400
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
1401
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
1402
|
+
else:
|
|
1403
|
+
raise ValueError('Required property \'created_at\' not present in AccountSettings JSON')
|
|
1404
|
+
if (created_by_id := _dict.get('created_by_id')) is not None:
|
|
1405
|
+
args['created_by_id'] = created_by_id
|
|
1406
|
+
else:
|
|
1407
|
+
raise ValueError('Required property \'created_by_id\' not present in AccountSettings JSON')
|
|
1408
|
+
if (last_modified_at := _dict.get('last_modified_at')) is not None:
|
|
1409
|
+
args['last_modified_at'] = string_to_datetime(last_modified_at)
|
|
1410
|
+
else:
|
|
1411
|
+
raise ValueError('Required property \'last_modified_at\' not present in AccountSettings JSON')
|
|
1412
|
+
if (last_modified_by_id := _dict.get('last_modified_by_id')) is not None:
|
|
1413
|
+
args['last_modified_by_id'] = last_modified_by_id
|
|
1414
|
+
else:
|
|
1415
|
+
raise ValueError('Required property \'last_modified_by_id\' not present in AccountSettings JSON')
|
|
1416
|
+
return cls(**args)
|
|
1417
|
+
|
|
1418
|
+
@classmethod
|
|
1419
|
+
def _from_dict(cls, _dict):
|
|
1420
|
+
"""Initialize a AccountSettings object from a json dictionary."""
|
|
1421
|
+
return cls.from_dict(_dict)
|
|
1422
|
+
|
|
1423
|
+
def to_dict(self) -> Dict:
|
|
1424
|
+
"""Return a json dictionary representing this model."""
|
|
1425
|
+
_dict = {}
|
|
1426
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
1427
|
+
_dict['id'] = self.id
|
|
1428
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
1429
|
+
_dict['crn'] = self.crn
|
|
1430
|
+
if hasattr(self, 'rule_count_limit') and self.rule_count_limit is not None:
|
|
1431
|
+
_dict['rule_count_limit'] = self.rule_count_limit
|
|
1432
|
+
if hasattr(self, 'zone_count_limit') and self.zone_count_limit is not None:
|
|
1433
|
+
_dict['zone_count_limit'] = self.zone_count_limit
|
|
1434
|
+
if hasattr(self, 'tags_rule_count_limit') and self.tags_rule_count_limit is not None:
|
|
1435
|
+
_dict['tags_rule_count_limit'] = self.tags_rule_count_limit
|
|
1436
|
+
if hasattr(self, 'current_rule_count') and self.current_rule_count is not None:
|
|
1437
|
+
_dict['current_rule_count'] = self.current_rule_count
|
|
1438
|
+
if hasattr(self, 'current_zone_count') and self.current_zone_count is not None:
|
|
1439
|
+
_dict['current_zone_count'] = self.current_zone_count
|
|
1440
|
+
if hasattr(self, 'current_tags_rule_count') and self.current_tags_rule_count is not None:
|
|
1441
|
+
_dict['current_tags_rule_count'] = self.current_tags_rule_count
|
|
1442
|
+
if hasattr(self, 'href') and self.href is not None:
|
|
1443
|
+
_dict['href'] = self.href
|
|
1444
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
1445
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
1446
|
+
if hasattr(self, 'created_by_id') and self.created_by_id is not None:
|
|
1447
|
+
_dict['created_by_id'] = self.created_by_id
|
|
1448
|
+
if hasattr(self, 'last_modified_at') and self.last_modified_at is not None:
|
|
1449
|
+
_dict['last_modified_at'] = datetime_to_string(self.last_modified_at)
|
|
1450
|
+
if hasattr(self, 'last_modified_by_id') and self.last_modified_by_id is not None:
|
|
1451
|
+
_dict['last_modified_by_id'] = self.last_modified_by_id
|
|
1452
|
+
return _dict
|
|
1453
|
+
|
|
1454
|
+
def _to_dict(self):
|
|
1455
|
+
"""Return a json dictionary representing this model."""
|
|
1456
|
+
return self.to_dict()
|
|
1457
|
+
|
|
1458
|
+
def __str__(self) -> str:
|
|
1459
|
+
"""Return a `str` version of this AccountSettings object."""
|
|
1460
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1461
|
+
|
|
1462
|
+
def __eq__(self, other: 'AccountSettings') -> bool:
|
|
1463
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1464
|
+
if not isinstance(other, self.__class__):
|
|
1465
|
+
return False
|
|
1466
|
+
return self.__dict__ == other.__dict__
|
|
1467
|
+
|
|
1468
|
+
def __ne__(self, other: 'AccountSettings') -> bool:
|
|
1469
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1470
|
+
return not self == other
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
class Action:
|
|
1474
|
+
"""
|
|
1475
|
+
Service API Type actions.
|
|
1476
|
+
|
|
1477
|
+
:param str action_id: The id of the action.
|
|
1478
|
+
:param str description: The description of the action.
|
|
1479
|
+
"""
|
|
1480
|
+
|
|
1481
|
+
def __init__(
|
|
1482
|
+
self,
|
|
1483
|
+
action_id: str,
|
|
1484
|
+
description: str,
|
|
1485
|
+
) -> None:
|
|
1486
|
+
"""
|
|
1487
|
+
Initialize a Action object.
|
|
1488
|
+
|
|
1489
|
+
:param str action_id: The id of the action.
|
|
1490
|
+
:param str description: The description of the action.
|
|
1491
|
+
"""
|
|
1492
|
+
self.action_id = action_id
|
|
1493
|
+
self.description = description
|
|
1494
|
+
|
|
1495
|
+
@classmethod
|
|
1496
|
+
def from_dict(cls, _dict: Dict) -> 'Action':
|
|
1497
|
+
"""Initialize a Action object from a json dictionary."""
|
|
1498
|
+
args = {}
|
|
1499
|
+
if (action_id := _dict.get('action_id')) is not None:
|
|
1500
|
+
args['action_id'] = action_id
|
|
1501
|
+
else:
|
|
1502
|
+
raise ValueError('Required property \'action_id\' not present in Action JSON')
|
|
1503
|
+
if (description := _dict.get('description')) is not None:
|
|
1504
|
+
args['description'] = description
|
|
1505
|
+
else:
|
|
1506
|
+
raise ValueError('Required property \'description\' not present in Action JSON')
|
|
1507
|
+
return cls(**args)
|
|
1508
|
+
|
|
1509
|
+
@classmethod
|
|
1510
|
+
def _from_dict(cls, _dict):
|
|
1511
|
+
"""Initialize a Action object from a json dictionary."""
|
|
1512
|
+
return cls.from_dict(_dict)
|
|
1513
|
+
|
|
1514
|
+
def to_dict(self) -> Dict:
|
|
1515
|
+
"""Return a json dictionary representing this model."""
|
|
1516
|
+
_dict = {}
|
|
1517
|
+
if hasattr(self, 'action_id') and self.action_id is not None:
|
|
1518
|
+
_dict['action_id'] = self.action_id
|
|
1519
|
+
if hasattr(self, 'description') and self.description is not None:
|
|
1520
|
+
_dict['description'] = self.description
|
|
1521
|
+
return _dict
|
|
1522
|
+
|
|
1523
|
+
def _to_dict(self):
|
|
1524
|
+
"""Return a json dictionary representing this model."""
|
|
1525
|
+
return self.to_dict()
|
|
1526
|
+
|
|
1527
|
+
def __str__(self) -> str:
|
|
1528
|
+
"""Return a `str` version of this Action object."""
|
|
1529
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1530
|
+
|
|
1531
|
+
def __eq__(self, other: 'Action') -> bool:
|
|
1532
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1533
|
+
if not isinstance(other, self.__class__):
|
|
1534
|
+
return False
|
|
1535
|
+
return self.__dict__ == other.__dict__
|
|
1536
|
+
|
|
1537
|
+
def __ne__(self, other: 'Action') -> bool:
|
|
1538
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1539
|
+
return not self == other
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
class Address:
|
|
1543
|
+
"""
|
|
1544
|
+
A zone address.
|
|
1545
|
+
|
|
1546
|
+
:param str type: (optional) The type of address.
|
|
1547
|
+
"""
|
|
1548
|
+
|
|
1549
|
+
def __init__(
|
|
1550
|
+
self,
|
|
1551
|
+
*,
|
|
1552
|
+
type: Optional[str] = None,
|
|
1553
|
+
) -> None:
|
|
1554
|
+
"""
|
|
1555
|
+
Initialize a Address object.
|
|
1556
|
+
|
|
1557
|
+
:param str type: (optional) The type of address.
|
|
1558
|
+
"""
|
|
1559
|
+
msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
|
|
1560
|
+
", ".join(['AddressIPAddress', 'AddressIPAddressRange', 'AddressSubnet', 'AddressVPC', 'AddressServiceRef'])
|
|
1561
|
+
)
|
|
1562
|
+
raise Exception(msg)
|
|
1563
|
+
|
|
1564
|
+
@classmethod
|
|
1565
|
+
def from_dict(cls, _dict: Dict) -> 'Address':
|
|
1566
|
+
"""Initialize a Address object from a json dictionary."""
|
|
1567
|
+
disc_class = cls._get_class_by_discriminator(_dict)
|
|
1568
|
+
if disc_class != cls:
|
|
1569
|
+
return disc_class.from_dict(_dict)
|
|
1570
|
+
msg = "Cannot convert dictionary into an instance of base class 'Address'. The discriminator value should map to a valid subclass: {1}".format(
|
|
1571
|
+
", ".join(['AddressIPAddress', 'AddressIPAddressRange', 'AddressSubnet', 'AddressVPC', 'AddressServiceRef'])
|
|
1572
|
+
)
|
|
1573
|
+
raise Exception(msg)
|
|
1574
|
+
|
|
1575
|
+
@classmethod
|
|
1576
|
+
def _from_dict(cls, _dict: Dict):
|
|
1577
|
+
"""Initialize a Address object from a json dictionary."""
|
|
1578
|
+
return cls.from_dict(_dict)
|
|
1579
|
+
|
|
1580
|
+
@classmethod
|
|
1581
|
+
def _get_class_by_discriminator(cls, _dict: Dict) -> object:
|
|
1582
|
+
mapping = {}
|
|
1583
|
+
mapping['ipAddress'] = 'AddressIPAddress'
|
|
1584
|
+
mapping['ipRange'] = 'AddressIPAddressRange'
|
|
1585
|
+
mapping['subnet'] = 'AddressSubnet'
|
|
1586
|
+
mapping['vpc'] = 'AddressVPC'
|
|
1587
|
+
mapping['serviceRef'] = 'AddressServiceRef'
|
|
1588
|
+
disc_value = _dict.get('type')
|
|
1589
|
+
if disc_value is None:
|
|
1590
|
+
raise ValueError('Discriminator property \'type\' not found in Address JSON')
|
|
1591
|
+
class_name = mapping.get(disc_value, disc_value)
|
|
1592
|
+
try:
|
|
1593
|
+
disc_class = getattr(sys.modules[__name__], class_name)
|
|
1594
|
+
except AttributeError:
|
|
1595
|
+
disc_class = cls
|
|
1596
|
+
if isinstance(disc_class, object):
|
|
1597
|
+
return disc_class
|
|
1598
|
+
raise TypeError('%s is not a discriminator class' % class_name)
|
|
1599
|
+
|
|
1600
|
+
class TypeEnum(str, Enum):
|
|
1601
|
+
"""
|
|
1602
|
+
The type of address.
|
|
1603
|
+
"""
|
|
1604
|
+
|
|
1605
|
+
IPADDRESS = 'ipAddress'
|
|
1606
|
+
IPRANGE = 'ipRange'
|
|
1607
|
+
SUBNET = 'subnet'
|
|
1608
|
+
VPC = 'vpc'
|
|
1609
|
+
SERVICEREF = 'serviceRef'
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
class NewRuleOperations:
|
|
1613
|
+
"""
|
|
1614
|
+
The operations this rule applies to.
|
|
1615
|
+
|
|
1616
|
+
:param List[NewRuleOperationsApiTypesItem] api_types: The API types this rule
|
|
1617
|
+
applies to.
|
|
1618
|
+
"""
|
|
1619
|
+
|
|
1620
|
+
def __init__(
|
|
1621
|
+
self,
|
|
1622
|
+
api_types: List['NewRuleOperationsApiTypesItem'],
|
|
1623
|
+
) -> None:
|
|
1624
|
+
"""
|
|
1625
|
+
Initialize a NewRuleOperations object.
|
|
1626
|
+
|
|
1627
|
+
:param List[NewRuleOperationsApiTypesItem] api_types: The API types this
|
|
1628
|
+
rule applies to.
|
|
1629
|
+
"""
|
|
1630
|
+
self.api_types = api_types
|
|
1631
|
+
|
|
1632
|
+
@classmethod
|
|
1633
|
+
def from_dict(cls, _dict: Dict) -> 'NewRuleOperations':
|
|
1634
|
+
"""Initialize a NewRuleOperations object from a json dictionary."""
|
|
1635
|
+
args = {}
|
|
1636
|
+
if (api_types := _dict.get('api_types')) is not None:
|
|
1637
|
+
args['api_types'] = [NewRuleOperationsApiTypesItem.from_dict(v) for v in api_types]
|
|
1638
|
+
else:
|
|
1639
|
+
raise ValueError('Required property \'api_types\' not present in NewRuleOperations JSON')
|
|
1640
|
+
return cls(**args)
|
|
1641
|
+
|
|
1642
|
+
@classmethod
|
|
1643
|
+
def _from_dict(cls, _dict):
|
|
1644
|
+
"""Initialize a NewRuleOperations object from a json dictionary."""
|
|
1645
|
+
return cls.from_dict(_dict)
|
|
1646
|
+
|
|
1647
|
+
def to_dict(self) -> Dict:
|
|
1648
|
+
"""Return a json dictionary representing this model."""
|
|
1649
|
+
_dict = {}
|
|
1650
|
+
if hasattr(self, 'api_types') and self.api_types is not None:
|
|
1651
|
+
api_types_list = []
|
|
1652
|
+
for v in self.api_types:
|
|
1653
|
+
if isinstance(v, dict):
|
|
1654
|
+
api_types_list.append(v)
|
|
1655
|
+
else:
|
|
1656
|
+
api_types_list.append(v.to_dict())
|
|
1657
|
+
_dict['api_types'] = api_types_list
|
|
1658
|
+
return _dict
|
|
1659
|
+
|
|
1660
|
+
def _to_dict(self):
|
|
1661
|
+
"""Return a json dictionary representing this model."""
|
|
1662
|
+
return self.to_dict()
|
|
1663
|
+
|
|
1664
|
+
def __str__(self) -> str:
|
|
1665
|
+
"""Return a `str` version of this NewRuleOperations object."""
|
|
1666
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1667
|
+
|
|
1668
|
+
def __eq__(self, other: 'NewRuleOperations') -> bool:
|
|
1669
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1670
|
+
if not isinstance(other, self.__class__):
|
|
1671
|
+
return False
|
|
1672
|
+
return self.__dict__ == other.__dict__
|
|
1673
|
+
|
|
1674
|
+
def __ne__(self, other: 'NewRuleOperations') -> bool:
|
|
1675
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1676
|
+
return not self == other
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
class NewRuleOperationsApiTypesItem:
|
|
1680
|
+
"""
|
|
1681
|
+
NewRuleOperationsApiTypesItem.
|
|
1682
|
+
|
|
1683
|
+
:param str api_type_id:
|
|
1684
|
+
"""
|
|
1685
|
+
|
|
1686
|
+
def __init__(
|
|
1687
|
+
self,
|
|
1688
|
+
api_type_id: str,
|
|
1689
|
+
) -> None:
|
|
1690
|
+
"""
|
|
1691
|
+
Initialize a NewRuleOperationsApiTypesItem object.
|
|
1692
|
+
|
|
1693
|
+
:param str api_type_id:
|
|
1694
|
+
"""
|
|
1695
|
+
self.api_type_id = api_type_id
|
|
1696
|
+
|
|
1697
|
+
@classmethod
|
|
1698
|
+
def from_dict(cls, _dict: Dict) -> 'NewRuleOperationsApiTypesItem':
|
|
1699
|
+
"""Initialize a NewRuleOperationsApiTypesItem object from a json dictionary."""
|
|
1700
|
+
args = {}
|
|
1701
|
+
if (api_type_id := _dict.get('api_type_id')) is not None:
|
|
1702
|
+
args['api_type_id'] = api_type_id
|
|
1703
|
+
else:
|
|
1704
|
+
raise ValueError('Required property \'api_type_id\' not present in NewRuleOperationsApiTypesItem JSON')
|
|
1705
|
+
return cls(**args)
|
|
1706
|
+
|
|
1707
|
+
@classmethod
|
|
1708
|
+
def _from_dict(cls, _dict):
|
|
1709
|
+
"""Initialize a NewRuleOperationsApiTypesItem object from a json dictionary."""
|
|
1710
|
+
return cls.from_dict(_dict)
|
|
1711
|
+
|
|
1712
|
+
def to_dict(self) -> Dict:
|
|
1713
|
+
"""Return a json dictionary representing this model."""
|
|
1714
|
+
_dict = {}
|
|
1715
|
+
if hasattr(self, 'api_type_id') and self.api_type_id is not None:
|
|
1716
|
+
_dict['api_type_id'] = self.api_type_id
|
|
1717
|
+
return _dict
|
|
1718
|
+
|
|
1719
|
+
def _to_dict(self):
|
|
1720
|
+
"""Return a json dictionary representing this model."""
|
|
1721
|
+
return self.to_dict()
|
|
1722
|
+
|
|
1723
|
+
def __str__(self) -> str:
|
|
1724
|
+
"""Return a `str` version of this NewRuleOperationsApiTypesItem object."""
|
|
1725
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1726
|
+
|
|
1727
|
+
def __eq__(self, other: 'NewRuleOperationsApiTypesItem') -> bool:
|
|
1728
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1729
|
+
if not isinstance(other, self.__class__):
|
|
1730
|
+
return False
|
|
1731
|
+
return self.__dict__ == other.__dict__
|
|
1732
|
+
|
|
1733
|
+
def __ne__(self, other: 'NewRuleOperationsApiTypesItem') -> bool:
|
|
1734
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1735
|
+
return not self == other
|
|
1736
|
+
|
|
1737
|
+
|
|
1738
|
+
class OperationsList:
|
|
1739
|
+
"""
|
|
1740
|
+
The response object of the `list_available_service_operations` operation.
|
|
1741
|
+
|
|
1742
|
+
:param List[APIType] api_types: The returned API types.
|
|
1743
|
+
"""
|
|
1744
|
+
|
|
1745
|
+
def __init__(
|
|
1746
|
+
self,
|
|
1747
|
+
api_types: List['APIType'],
|
|
1748
|
+
) -> None:
|
|
1749
|
+
"""
|
|
1750
|
+
Initialize a OperationsList object.
|
|
1751
|
+
|
|
1752
|
+
:param List[APIType] api_types: The returned API types.
|
|
1753
|
+
"""
|
|
1754
|
+
self.api_types = api_types
|
|
1755
|
+
|
|
1756
|
+
@classmethod
|
|
1757
|
+
def from_dict(cls, _dict: Dict) -> 'OperationsList':
|
|
1758
|
+
"""Initialize a OperationsList object from a json dictionary."""
|
|
1759
|
+
args = {}
|
|
1760
|
+
if (api_types := _dict.get('api_types')) is not None:
|
|
1761
|
+
args['api_types'] = [APIType.from_dict(v) for v in api_types]
|
|
1762
|
+
else:
|
|
1763
|
+
raise ValueError('Required property \'api_types\' not present in OperationsList JSON')
|
|
1764
|
+
return cls(**args)
|
|
1765
|
+
|
|
1766
|
+
@classmethod
|
|
1767
|
+
def _from_dict(cls, _dict):
|
|
1768
|
+
"""Initialize a OperationsList object from a json dictionary."""
|
|
1769
|
+
return cls.from_dict(_dict)
|
|
1770
|
+
|
|
1771
|
+
def to_dict(self) -> Dict:
|
|
1772
|
+
"""Return a json dictionary representing this model."""
|
|
1773
|
+
_dict = {}
|
|
1774
|
+
if hasattr(self, 'api_types') and self.api_types is not None:
|
|
1775
|
+
api_types_list = []
|
|
1776
|
+
for v in self.api_types:
|
|
1777
|
+
if isinstance(v, dict):
|
|
1778
|
+
api_types_list.append(v)
|
|
1779
|
+
else:
|
|
1780
|
+
api_types_list.append(v.to_dict())
|
|
1781
|
+
_dict['api_types'] = api_types_list
|
|
1782
|
+
return _dict
|
|
1783
|
+
|
|
1784
|
+
def _to_dict(self):
|
|
1785
|
+
"""Return a json dictionary representing this model."""
|
|
1786
|
+
return self.to_dict()
|
|
1787
|
+
|
|
1788
|
+
def __str__(self) -> str:
|
|
1789
|
+
"""Return a `str` version of this OperationsList object."""
|
|
1790
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1791
|
+
|
|
1792
|
+
def __eq__(self, other: 'OperationsList') -> bool:
|
|
1793
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1794
|
+
if not isinstance(other, self.__class__):
|
|
1795
|
+
return False
|
|
1796
|
+
return self.__dict__ == other.__dict__
|
|
1797
|
+
|
|
1798
|
+
def __ne__(self, other: 'OperationsList') -> bool:
|
|
1799
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1800
|
+
return not self == other
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
class Resource:
|
|
1804
|
+
"""
|
|
1805
|
+
An rule resource.
|
|
1806
|
+
|
|
1807
|
+
:param List[ResourceAttribute] attributes: The resource attributes.
|
|
1808
|
+
:param List[ResourceTagAttribute] tags: (optional) The optional resource tags.
|
|
1809
|
+
"""
|
|
1810
|
+
|
|
1811
|
+
def __init__(
|
|
1812
|
+
self,
|
|
1813
|
+
attributes: List['ResourceAttribute'],
|
|
1814
|
+
*,
|
|
1815
|
+
tags: Optional[List['ResourceTagAttribute']] = None,
|
|
1816
|
+
) -> None:
|
|
1817
|
+
"""
|
|
1818
|
+
Initialize a Resource object.
|
|
1819
|
+
|
|
1820
|
+
:param List[ResourceAttribute] attributes: The resource attributes.
|
|
1821
|
+
:param List[ResourceTagAttribute] tags: (optional) The optional resource
|
|
1822
|
+
tags.
|
|
1823
|
+
"""
|
|
1824
|
+
self.attributes = attributes
|
|
1825
|
+
self.tags = tags
|
|
1826
|
+
|
|
1827
|
+
@classmethod
|
|
1828
|
+
def from_dict(cls, _dict: Dict) -> 'Resource':
|
|
1829
|
+
"""Initialize a Resource object from a json dictionary."""
|
|
1830
|
+
args = {}
|
|
1831
|
+
if (attributes := _dict.get('attributes')) is not None:
|
|
1832
|
+
args['attributes'] = [ResourceAttribute.from_dict(v) for v in attributes]
|
|
1833
|
+
else:
|
|
1834
|
+
raise ValueError('Required property \'attributes\' not present in Resource JSON')
|
|
1835
|
+
if (tags := _dict.get('tags')) is not None:
|
|
1836
|
+
args['tags'] = [ResourceTagAttribute.from_dict(v) for v in tags]
|
|
1837
|
+
return cls(**args)
|
|
1838
|
+
|
|
1839
|
+
@classmethod
|
|
1840
|
+
def _from_dict(cls, _dict):
|
|
1841
|
+
"""Initialize a Resource object from a json dictionary."""
|
|
1842
|
+
return cls.from_dict(_dict)
|
|
1843
|
+
|
|
1844
|
+
def to_dict(self) -> Dict:
|
|
1845
|
+
"""Return a json dictionary representing this model."""
|
|
1846
|
+
_dict = {}
|
|
1847
|
+
if hasattr(self, 'attributes') and self.attributes is not None:
|
|
1848
|
+
attributes_list = []
|
|
1849
|
+
for v in self.attributes:
|
|
1850
|
+
if isinstance(v, dict):
|
|
1851
|
+
attributes_list.append(v)
|
|
1852
|
+
else:
|
|
1853
|
+
attributes_list.append(v.to_dict())
|
|
1854
|
+
_dict['attributes'] = attributes_list
|
|
1855
|
+
if hasattr(self, 'tags') and self.tags is not None:
|
|
1856
|
+
tags_list = []
|
|
1857
|
+
for v in self.tags:
|
|
1858
|
+
if isinstance(v, dict):
|
|
1859
|
+
tags_list.append(v)
|
|
1860
|
+
else:
|
|
1861
|
+
tags_list.append(v.to_dict())
|
|
1862
|
+
_dict['tags'] = tags_list
|
|
1863
|
+
return _dict
|
|
1864
|
+
|
|
1865
|
+
def _to_dict(self):
|
|
1866
|
+
"""Return a json dictionary representing this model."""
|
|
1867
|
+
return self.to_dict()
|
|
1868
|
+
|
|
1869
|
+
def __str__(self) -> str:
|
|
1870
|
+
"""Return a `str` version of this Resource object."""
|
|
1871
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1872
|
+
|
|
1873
|
+
def __eq__(self, other: 'Resource') -> bool:
|
|
1874
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1875
|
+
if not isinstance(other, self.__class__):
|
|
1876
|
+
return False
|
|
1877
|
+
return self.__dict__ == other.__dict__
|
|
1878
|
+
|
|
1879
|
+
def __ne__(self, other: 'Resource') -> bool:
|
|
1880
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1881
|
+
return not self == other
|
|
1882
|
+
|
|
1883
|
+
|
|
1884
|
+
class ResourceAttribute:
|
|
1885
|
+
"""
|
|
1886
|
+
A rule resource attribute.
|
|
1887
|
+
|
|
1888
|
+
:param str name: The attribute name.
|
|
1889
|
+
:param str value: The attribute value.
|
|
1890
|
+
:param str operator: (optional) The attribute operator.
|
|
1891
|
+
"""
|
|
1892
|
+
|
|
1893
|
+
def __init__(
|
|
1894
|
+
self,
|
|
1895
|
+
name: str,
|
|
1896
|
+
value: str,
|
|
1897
|
+
*,
|
|
1898
|
+
operator: Optional[str] = None,
|
|
1899
|
+
) -> None:
|
|
1900
|
+
"""
|
|
1901
|
+
Initialize a ResourceAttribute object.
|
|
1902
|
+
|
|
1903
|
+
:param str name: The attribute name.
|
|
1904
|
+
:param str value: The attribute value.
|
|
1905
|
+
:param str operator: (optional) The attribute operator.
|
|
1906
|
+
"""
|
|
1907
|
+
self.name = name
|
|
1908
|
+
self.value = value
|
|
1909
|
+
self.operator = operator
|
|
1910
|
+
|
|
1911
|
+
@classmethod
|
|
1912
|
+
def from_dict(cls, _dict: Dict) -> 'ResourceAttribute':
|
|
1913
|
+
"""Initialize a ResourceAttribute object from a json dictionary."""
|
|
1914
|
+
args = {}
|
|
1915
|
+
if (name := _dict.get('name')) is not None:
|
|
1916
|
+
args['name'] = name
|
|
1917
|
+
else:
|
|
1918
|
+
raise ValueError('Required property \'name\' not present in ResourceAttribute JSON')
|
|
1919
|
+
if (value := _dict.get('value')) is not None:
|
|
1920
|
+
args['value'] = value
|
|
1921
|
+
else:
|
|
1922
|
+
raise ValueError('Required property \'value\' not present in ResourceAttribute JSON')
|
|
1923
|
+
if (operator := _dict.get('operator')) is not None:
|
|
1924
|
+
args['operator'] = operator
|
|
1925
|
+
return cls(**args)
|
|
1926
|
+
|
|
1927
|
+
@classmethod
|
|
1928
|
+
def _from_dict(cls, _dict):
|
|
1929
|
+
"""Initialize a ResourceAttribute object from a json dictionary."""
|
|
1930
|
+
return cls.from_dict(_dict)
|
|
1931
|
+
|
|
1932
|
+
def to_dict(self) -> Dict:
|
|
1933
|
+
"""Return a json dictionary representing this model."""
|
|
1934
|
+
_dict = {}
|
|
1935
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1936
|
+
_dict['name'] = self.name
|
|
1937
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
1938
|
+
_dict['value'] = self.value
|
|
1939
|
+
if hasattr(self, 'operator') and self.operator is not None:
|
|
1940
|
+
_dict['operator'] = self.operator
|
|
1941
|
+
return _dict
|
|
1942
|
+
|
|
1943
|
+
def _to_dict(self):
|
|
1944
|
+
"""Return a json dictionary representing this model."""
|
|
1945
|
+
return self.to_dict()
|
|
1946
|
+
|
|
1947
|
+
def __str__(self) -> str:
|
|
1948
|
+
"""Return a `str` version of this ResourceAttribute object."""
|
|
1949
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1950
|
+
|
|
1951
|
+
def __eq__(self, other: 'ResourceAttribute') -> bool:
|
|
1952
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1953
|
+
if not isinstance(other, self.__class__):
|
|
1954
|
+
return False
|
|
1955
|
+
return self.__dict__ == other.__dict__
|
|
1956
|
+
|
|
1957
|
+
def __ne__(self, other: 'ResourceAttribute') -> bool:
|
|
1958
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1959
|
+
return not self == other
|
|
1960
|
+
|
|
1961
|
+
|
|
1962
|
+
class ResourceTagAttribute:
|
|
1963
|
+
"""
|
|
1964
|
+
A rule resource tag attribute.
|
|
1965
|
+
|
|
1966
|
+
:param str name: The tag attribute name.
|
|
1967
|
+
:param str value: The tag attribute value.
|
|
1968
|
+
:param str operator: (optional) The attribute operator.
|
|
1969
|
+
"""
|
|
1970
|
+
|
|
1971
|
+
def __init__(
|
|
1972
|
+
self,
|
|
1973
|
+
name: str,
|
|
1974
|
+
value: str,
|
|
1975
|
+
*,
|
|
1976
|
+
operator: Optional[str] = None,
|
|
1977
|
+
) -> None:
|
|
1978
|
+
"""
|
|
1979
|
+
Initialize a ResourceTagAttribute object.
|
|
1980
|
+
|
|
1981
|
+
:param str name: The tag attribute name.
|
|
1982
|
+
:param str value: The tag attribute value.
|
|
1983
|
+
:param str operator: (optional) The attribute operator.
|
|
1984
|
+
"""
|
|
1985
|
+
self.name = name
|
|
1986
|
+
self.value = value
|
|
1987
|
+
self.operator = operator
|
|
1988
|
+
|
|
1989
|
+
@classmethod
|
|
1990
|
+
def from_dict(cls, _dict: Dict) -> 'ResourceTagAttribute':
|
|
1991
|
+
"""Initialize a ResourceTagAttribute object from a json dictionary."""
|
|
1992
|
+
args = {}
|
|
1993
|
+
if (name := _dict.get('name')) is not None:
|
|
1994
|
+
args['name'] = name
|
|
1995
|
+
else:
|
|
1996
|
+
raise ValueError('Required property \'name\' not present in ResourceTagAttribute JSON')
|
|
1997
|
+
if (value := _dict.get('value')) is not None:
|
|
1998
|
+
args['value'] = value
|
|
1999
|
+
else:
|
|
2000
|
+
raise ValueError('Required property \'value\' not present in ResourceTagAttribute JSON')
|
|
2001
|
+
if (operator := _dict.get('operator')) is not None:
|
|
2002
|
+
args['operator'] = operator
|
|
2003
|
+
return cls(**args)
|
|
2004
|
+
|
|
2005
|
+
@classmethod
|
|
2006
|
+
def _from_dict(cls, _dict):
|
|
2007
|
+
"""Initialize a ResourceTagAttribute object from a json dictionary."""
|
|
2008
|
+
return cls.from_dict(_dict)
|
|
2009
|
+
|
|
2010
|
+
def to_dict(self) -> Dict:
|
|
2011
|
+
"""Return a json dictionary representing this model."""
|
|
2012
|
+
_dict = {}
|
|
2013
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
2014
|
+
_dict['name'] = self.name
|
|
2015
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
2016
|
+
_dict['value'] = self.value
|
|
2017
|
+
if hasattr(self, 'operator') and self.operator is not None:
|
|
2018
|
+
_dict['operator'] = self.operator
|
|
2019
|
+
return _dict
|
|
2020
|
+
|
|
2021
|
+
def _to_dict(self):
|
|
2022
|
+
"""Return a json dictionary representing this model."""
|
|
2023
|
+
return self.to_dict()
|
|
2024
|
+
|
|
2025
|
+
def __str__(self) -> str:
|
|
2026
|
+
"""Return a `str` version of this ResourceTagAttribute object."""
|
|
2027
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2028
|
+
|
|
2029
|
+
def __eq__(self, other: 'ResourceTagAttribute') -> bool:
|
|
2030
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2031
|
+
if not isinstance(other, self.__class__):
|
|
2032
|
+
return False
|
|
2033
|
+
return self.__dict__ == other.__dict__
|
|
2034
|
+
|
|
2035
|
+
def __ne__(self, other: 'ResourceTagAttribute') -> bool:
|
|
2036
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2037
|
+
return not self == other
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
class Rule:
|
|
2041
|
+
"""
|
|
2042
|
+
An output rule.
|
|
2043
|
+
|
|
2044
|
+
:param str id: The globally unique ID of the rule.
|
|
2045
|
+
:param str crn: The rule CRN.
|
|
2046
|
+
:param str description: The description of the rule.
|
|
2047
|
+
:param List[RuleContext] contexts: The contexts this rule applies to.
|
|
2048
|
+
:param List[Resource] resources: The resources this rule apply to.
|
|
2049
|
+
:param NewRuleOperations operations: (optional) The operations this rule applies
|
|
2050
|
+
to.
|
|
2051
|
+
:param str enforcement_mode: (optional) The rule enforcement mode:
|
|
2052
|
+
* `enabled` - The restrictions are enforced and reported. This is the default.
|
|
2053
|
+
* `disabled` - The restrictions are disabled. Nothing is enforced or reported.
|
|
2054
|
+
* `report` - The restrictions are evaluated and reported, but not enforced.
|
|
2055
|
+
:param str href: The href link to the resource.
|
|
2056
|
+
:param datetime created_at: The time the resource was created.
|
|
2057
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
2058
|
+
resource.
|
|
2059
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
2060
|
+
:param str last_modified_by_id: IAM ID of the user or service which modified the
|
|
2061
|
+
resource.
|
|
2062
|
+
"""
|
|
2063
|
+
|
|
2064
|
+
def __init__(
|
|
2065
|
+
self,
|
|
2066
|
+
id: str,
|
|
2067
|
+
crn: str,
|
|
2068
|
+
description: str,
|
|
2069
|
+
contexts: List['RuleContext'],
|
|
2070
|
+
resources: List['Resource'],
|
|
2071
|
+
href: str,
|
|
2072
|
+
created_at: datetime,
|
|
2073
|
+
created_by_id: str,
|
|
2074
|
+
last_modified_at: datetime,
|
|
2075
|
+
last_modified_by_id: str,
|
|
2076
|
+
*,
|
|
2077
|
+
operations: Optional['NewRuleOperations'] = None,
|
|
2078
|
+
enforcement_mode: Optional[str] = None,
|
|
2079
|
+
) -> None:
|
|
2080
|
+
"""
|
|
2081
|
+
Initialize a Rule object.
|
|
2082
|
+
|
|
2083
|
+
:param str id: The globally unique ID of the rule.
|
|
2084
|
+
:param str crn: The rule CRN.
|
|
2085
|
+
:param str description: The description of the rule.
|
|
2086
|
+
:param List[RuleContext] contexts: The contexts this rule applies to.
|
|
2087
|
+
:param List[Resource] resources: The resources this rule apply to.
|
|
2088
|
+
:param str href: The href link to the resource.
|
|
2089
|
+
:param datetime created_at: The time the resource was created.
|
|
2090
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
2091
|
+
resource.
|
|
2092
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
2093
|
+
:param str last_modified_by_id: IAM ID of the user or service which
|
|
2094
|
+
modified the resource.
|
|
2095
|
+
:param NewRuleOperations operations: (optional) The operations this rule
|
|
2096
|
+
applies to.
|
|
2097
|
+
:param str enforcement_mode: (optional) The rule enforcement mode:
|
|
2098
|
+
* `enabled` - The restrictions are enforced and reported. This is the
|
|
2099
|
+
default.
|
|
2100
|
+
* `disabled` - The restrictions are disabled. Nothing is enforced or
|
|
2101
|
+
reported.
|
|
2102
|
+
* `report` - The restrictions are evaluated and reported, but not
|
|
2103
|
+
enforced.
|
|
2104
|
+
"""
|
|
2105
|
+
self.id = id
|
|
2106
|
+
self.crn = crn
|
|
2107
|
+
self.description = description
|
|
2108
|
+
self.contexts = contexts
|
|
2109
|
+
self.resources = resources
|
|
2110
|
+
self.operations = operations
|
|
2111
|
+
self.enforcement_mode = enforcement_mode
|
|
2112
|
+
self.href = href
|
|
2113
|
+
self.created_at = created_at
|
|
2114
|
+
self.created_by_id = created_by_id
|
|
2115
|
+
self.last_modified_at = last_modified_at
|
|
2116
|
+
self.last_modified_by_id = last_modified_by_id
|
|
2117
|
+
|
|
2118
|
+
@classmethod
|
|
2119
|
+
def from_dict(cls, _dict: Dict) -> 'Rule':
|
|
2120
|
+
"""Initialize a Rule object from a json dictionary."""
|
|
2121
|
+
args = {}
|
|
2122
|
+
if (id := _dict.get('id')) is not None:
|
|
2123
|
+
args['id'] = id
|
|
2124
|
+
else:
|
|
2125
|
+
raise ValueError('Required property \'id\' not present in Rule JSON')
|
|
2126
|
+
if (crn := _dict.get('crn')) is not None:
|
|
2127
|
+
args['crn'] = crn
|
|
2128
|
+
else:
|
|
2129
|
+
raise ValueError('Required property \'crn\' not present in Rule JSON')
|
|
2130
|
+
if (description := _dict.get('description')) is not None:
|
|
2131
|
+
args['description'] = description
|
|
2132
|
+
else:
|
|
2133
|
+
raise ValueError('Required property \'description\' not present in Rule JSON')
|
|
2134
|
+
if (contexts := _dict.get('contexts')) is not None:
|
|
2135
|
+
args['contexts'] = [RuleContext.from_dict(v) for v in contexts]
|
|
2136
|
+
else:
|
|
2137
|
+
raise ValueError('Required property \'contexts\' not present in Rule JSON')
|
|
2138
|
+
if (resources := _dict.get('resources')) is not None:
|
|
2139
|
+
args['resources'] = [Resource.from_dict(v) for v in resources]
|
|
2140
|
+
else:
|
|
2141
|
+
raise ValueError('Required property \'resources\' not present in Rule JSON')
|
|
2142
|
+
if (operations := _dict.get('operations')) is not None:
|
|
2143
|
+
args['operations'] = NewRuleOperations.from_dict(operations)
|
|
2144
|
+
if (enforcement_mode := _dict.get('enforcement_mode')) is not None:
|
|
2145
|
+
args['enforcement_mode'] = enforcement_mode
|
|
2146
|
+
if (href := _dict.get('href')) is not None:
|
|
2147
|
+
args['href'] = href
|
|
2148
|
+
else:
|
|
2149
|
+
raise ValueError('Required property \'href\' not present in Rule JSON')
|
|
2150
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
2151
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
2152
|
+
else:
|
|
2153
|
+
raise ValueError('Required property \'created_at\' not present in Rule JSON')
|
|
2154
|
+
if (created_by_id := _dict.get('created_by_id')) is not None:
|
|
2155
|
+
args['created_by_id'] = created_by_id
|
|
2156
|
+
else:
|
|
2157
|
+
raise ValueError('Required property \'created_by_id\' not present in Rule JSON')
|
|
2158
|
+
if (last_modified_at := _dict.get('last_modified_at')) is not None:
|
|
2159
|
+
args['last_modified_at'] = string_to_datetime(last_modified_at)
|
|
2160
|
+
else:
|
|
2161
|
+
raise ValueError('Required property \'last_modified_at\' not present in Rule JSON')
|
|
2162
|
+
if (last_modified_by_id := _dict.get('last_modified_by_id')) is not None:
|
|
2163
|
+
args['last_modified_by_id'] = last_modified_by_id
|
|
2164
|
+
else:
|
|
2165
|
+
raise ValueError('Required property \'last_modified_by_id\' not present in Rule JSON')
|
|
2166
|
+
return cls(**args)
|
|
2167
|
+
|
|
2168
|
+
@classmethod
|
|
2169
|
+
def _from_dict(cls, _dict):
|
|
2170
|
+
"""Initialize a Rule object from a json dictionary."""
|
|
2171
|
+
return cls.from_dict(_dict)
|
|
2172
|
+
|
|
2173
|
+
def to_dict(self) -> Dict:
|
|
2174
|
+
"""Return a json dictionary representing this model."""
|
|
2175
|
+
_dict = {}
|
|
2176
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
2177
|
+
_dict['id'] = self.id
|
|
2178
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
2179
|
+
_dict['crn'] = self.crn
|
|
2180
|
+
if hasattr(self, 'description') and self.description is not None:
|
|
2181
|
+
_dict['description'] = self.description
|
|
2182
|
+
if hasattr(self, 'contexts') and self.contexts is not None:
|
|
2183
|
+
contexts_list = []
|
|
2184
|
+
for v in self.contexts:
|
|
2185
|
+
if isinstance(v, dict):
|
|
2186
|
+
contexts_list.append(v)
|
|
2187
|
+
else:
|
|
2188
|
+
contexts_list.append(v.to_dict())
|
|
2189
|
+
_dict['contexts'] = contexts_list
|
|
2190
|
+
if hasattr(self, 'resources') and self.resources is not None:
|
|
2191
|
+
resources_list = []
|
|
2192
|
+
for v in self.resources:
|
|
2193
|
+
if isinstance(v, dict):
|
|
2194
|
+
resources_list.append(v)
|
|
2195
|
+
else:
|
|
2196
|
+
resources_list.append(v.to_dict())
|
|
2197
|
+
_dict['resources'] = resources_list
|
|
2198
|
+
if hasattr(self, 'operations') and self.operations is not None:
|
|
2199
|
+
if isinstance(self.operations, dict):
|
|
2200
|
+
_dict['operations'] = self.operations
|
|
2201
|
+
else:
|
|
2202
|
+
_dict['operations'] = self.operations.to_dict()
|
|
2203
|
+
if hasattr(self, 'enforcement_mode') and self.enforcement_mode is not None:
|
|
2204
|
+
_dict['enforcement_mode'] = self.enforcement_mode
|
|
2205
|
+
if hasattr(self, 'href') and self.href is not None:
|
|
2206
|
+
_dict['href'] = self.href
|
|
2207
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
2208
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
2209
|
+
if hasattr(self, 'created_by_id') and self.created_by_id is not None:
|
|
2210
|
+
_dict['created_by_id'] = self.created_by_id
|
|
2211
|
+
if hasattr(self, 'last_modified_at') and self.last_modified_at is not None:
|
|
2212
|
+
_dict['last_modified_at'] = datetime_to_string(self.last_modified_at)
|
|
2213
|
+
if hasattr(self, 'last_modified_by_id') and self.last_modified_by_id is not None:
|
|
2214
|
+
_dict['last_modified_by_id'] = self.last_modified_by_id
|
|
2215
|
+
return _dict
|
|
2216
|
+
|
|
2217
|
+
def _to_dict(self):
|
|
2218
|
+
"""Return a json dictionary representing this model."""
|
|
2219
|
+
return self.to_dict()
|
|
2220
|
+
|
|
2221
|
+
def __str__(self) -> str:
|
|
2222
|
+
"""Return a `str` version of this Rule object."""
|
|
2223
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2224
|
+
|
|
2225
|
+
def __eq__(self, other: 'Rule') -> bool:
|
|
2226
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2227
|
+
if not isinstance(other, self.__class__):
|
|
2228
|
+
return False
|
|
2229
|
+
return self.__dict__ == other.__dict__
|
|
2230
|
+
|
|
2231
|
+
def __ne__(self, other: 'Rule') -> bool:
|
|
2232
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2233
|
+
return not self == other
|
|
2234
|
+
|
|
2235
|
+
class EnforcementModeEnum(str, Enum):
|
|
2236
|
+
"""
|
|
2237
|
+
The rule enforcement mode:
|
|
2238
|
+
* `enabled` - The restrictions are enforced and reported. This is the default.
|
|
2239
|
+
* `disabled` - The restrictions are disabled. Nothing is enforced or reported.
|
|
2240
|
+
* `report` - The restrictions are evaluated and reported, but not enforced.
|
|
2241
|
+
"""
|
|
2242
|
+
|
|
2243
|
+
ENABLED = 'enabled'
|
|
2244
|
+
DISABLED = 'disabled'
|
|
2245
|
+
REPORT = 'report'
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
class RuleContext:
|
|
2249
|
+
"""
|
|
2250
|
+
A rule context.
|
|
2251
|
+
|
|
2252
|
+
:param List[RuleContextAttribute] attributes: The attributes.
|
|
2253
|
+
"""
|
|
2254
|
+
|
|
2255
|
+
def __init__(
|
|
2256
|
+
self,
|
|
2257
|
+
attributes: List['RuleContextAttribute'],
|
|
2258
|
+
) -> None:
|
|
2259
|
+
"""
|
|
2260
|
+
Initialize a RuleContext object.
|
|
2261
|
+
|
|
2262
|
+
:param List[RuleContextAttribute] attributes: The attributes.
|
|
2263
|
+
"""
|
|
2264
|
+
self.attributes = attributes
|
|
2265
|
+
|
|
2266
|
+
@classmethod
|
|
2267
|
+
def from_dict(cls, _dict: Dict) -> 'RuleContext':
|
|
2268
|
+
"""Initialize a RuleContext object from a json dictionary."""
|
|
2269
|
+
args = {}
|
|
2270
|
+
if (attributes := _dict.get('attributes')) is not None:
|
|
2271
|
+
args['attributes'] = [RuleContextAttribute.from_dict(v) for v in attributes]
|
|
2272
|
+
else:
|
|
2273
|
+
raise ValueError('Required property \'attributes\' not present in RuleContext JSON')
|
|
2274
|
+
return cls(**args)
|
|
2275
|
+
|
|
2276
|
+
@classmethod
|
|
2277
|
+
def _from_dict(cls, _dict):
|
|
2278
|
+
"""Initialize a RuleContext object from a json dictionary."""
|
|
2279
|
+
return cls.from_dict(_dict)
|
|
2280
|
+
|
|
2281
|
+
def to_dict(self) -> Dict:
|
|
2282
|
+
"""Return a json dictionary representing this model."""
|
|
2283
|
+
_dict = {}
|
|
2284
|
+
if hasattr(self, 'attributes') and self.attributes is not None:
|
|
2285
|
+
attributes_list = []
|
|
2286
|
+
for v in self.attributes:
|
|
2287
|
+
if isinstance(v, dict):
|
|
2288
|
+
attributes_list.append(v)
|
|
2289
|
+
else:
|
|
2290
|
+
attributes_list.append(v.to_dict())
|
|
2291
|
+
_dict['attributes'] = attributes_list
|
|
2292
|
+
return _dict
|
|
2293
|
+
|
|
2294
|
+
def _to_dict(self):
|
|
2295
|
+
"""Return a json dictionary representing this model."""
|
|
2296
|
+
return self.to_dict()
|
|
2297
|
+
|
|
2298
|
+
def __str__(self) -> str:
|
|
2299
|
+
"""Return a `str` version of this RuleContext object."""
|
|
2300
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2301
|
+
|
|
2302
|
+
def __eq__(self, other: 'RuleContext') -> bool:
|
|
2303
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2304
|
+
if not isinstance(other, self.__class__):
|
|
2305
|
+
return False
|
|
2306
|
+
return self.__dict__ == other.__dict__
|
|
2307
|
+
|
|
2308
|
+
def __ne__(self, other: 'RuleContext') -> bool:
|
|
2309
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2310
|
+
return not self == other
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
class RuleContextAttribute:
|
|
2314
|
+
"""
|
|
2315
|
+
An rule context attribute.
|
|
2316
|
+
|
|
2317
|
+
:param str name: The attribute name.
|
|
2318
|
+
:param str value: The attribute value.
|
|
2319
|
+
"""
|
|
2320
|
+
|
|
2321
|
+
def __init__(
|
|
2322
|
+
self,
|
|
2323
|
+
name: str,
|
|
2324
|
+
value: str,
|
|
2325
|
+
) -> None:
|
|
2326
|
+
"""
|
|
2327
|
+
Initialize a RuleContextAttribute object.
|
|
2328
|
+
|
|
2329
|
+
:param str name: The attribute name.
|
|
2330
|
+
:param str value: The attribute value.
|
|
2331
|
+
"""
|
|
2332
|
+
self.name = name
|
|
2333
|
+
self.value = value
|
|
2334
|
+
|
|
2335
|
+
@classmethod
|
|
2336
|
+
def from_dict(cls, _dict: Dict) -> 'RuleContextAttribute':
|
|
2337
|
+
"""Initialize a RuleContextAttribute object from a json dictionary."""
|
|
2338
|
+
args = {}
|
|
2339
|
+
if (name := _dict.get('name')) is not None:
|
|
2340
|
+
args['name'] = name
|
|
2341
|
+
else:
|
|
2342
|
+
raise ValueError('Required property \'name\' not present in RuleContextAttribute JSON')
|
|
2343
|
+
if (value := _dict.get('value')) is not None:
|
|
2344
|
+
args['value'] = value
|
|
2345
|
+
else:
|
|
2346
|
+
raise ValueError('Required property \'value\' not present in RuleContextAttribute JSON')
|
|
2347
|
+
return cls(**args)
|
|
2348
|
+
|
|
2349
|
+
@classmethod
|
|
2350
|
+
def _from_dict(cls, _dict):
|
|
2351
|
+
"""Initialize a RuleContextAttribute object from a json dictionary."""
|
|
2352
|
+
return cls.from_dict(_dict)
|
|
2353
|
+
|
|
2354
|
+
def to_dict(self) -> Dict:
|
|
2355
|
+
"""Return a json dictionary representing this model."""
|
|
2356
|
+
_dict = {}
|
|
2357
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
2358
|
+
_dict['name'] = self.name
|
|
2359
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
2360
|
+
_dict['value'] = self.value
|
|
2361
|
+
return _dict
|
|
2362
|
+
|
|
2363
|
+
def _to_dict(self):
|
|
2364
|
+
"""Return a json dictionary representing this model."""
|
|
2365
|
+
return self.to_dict()
|
|
2366
|
+
|
|
2367
|
+
def __str__(self) -> str:
|
|
2368
|
+
"""Return a `str` version of this RuleContextAttribute object."""
|
|
2369
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2370
|
+
|
|
2371
|
+
def __eq__(self, other: 'RuleContextAttribute') -> bool:
|
|
2372
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2373
|
+
if not isinstance(other, self.__class__):
|
|
2374
|
+
return False
|
|
2375
|
+
return self.__dict__ == other.__dict__
|
|
2376
|
+
|
|
2377
|
+
def __ne__(self, other: 'RuleContextAttribute') -> bool:
|
|
2378
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2379
|
+
return not self == other
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
class RuleList:
|
|
2383
|
+
"""
|
|
2384
|
+
The response object of the ListRules operation.
|
|
2385
|
+
|
|
2386
|
+
:param int count: The number of returned results.
|
|
2387
|
+
:param List[Rule] rules: The returned rules.
|
|
2388
|
+
"""
|
|
2389
|
+
|
|
2390
|
+
def __init__(
|
|
2391
|
+
self,
|
|
2392
|
+
count: int,
|
|
2393
|
+
rules: List['Rule'],
|
|
2394
|
+
) -> None:
|
|
2395
|
+
"""
|
|
2396
|
+
Initialize a RuleList object.
|
|
2397
|
+
|
|
2398
|
+
:param int count: The number of returned results.
|
|
2399
|
+
:param List[Rule] rules: The returned rules.
|
|
2400
|
+
"""
|
|
2401
|
+
self.count = count
|
|
2402
|
+
self.rules = rules
|
|
2403
|
+
|
|
2404
|
+
@classmethod
|
|
2405
|
+
def from_dict(cls, _dict: Dict) -> 'RuleList':
|
|
2406
|
+
"""Initialize a RuleList object from a json dictionary."""
|
|
2407
|
+
args = {}
|
|
2408
|
+
if (count := _dict.get('count')) is not None:
|
|
2409
|
+
args['count'] = count
|
|
2410
|
+
else:
|
|
2411
|
+
raise ValueError('Required property \'count\' not present in RuleList JSON')
|
|
2412
|
+
if (rules := _dict.get('rules')) is not None:
|
|
2413
|
+
args['rules'] = [Rule.from_dict(v) for v in rules]
|
|
2414
|
+
else:
|
|
2415
|
+
raise ValueError('Required property \'rules\' not present in RuleList JSON')
|
|
2416
|
+
return cls(**args)
|
|
2417
|
+
|
|
2418
|
+
@classmethod
|
|
2419
|
+
def _from_dict(cls, _dict):
|
|
2420
|
+
"""Initialize a RuleList object from a json dictionary."""
|
|
2421
|
+
return cls.from_dict(_dict)
|
|
2422
|
+
|
|
2423
|
+
def to_dict(self) -> Dict:
|
|
2424
|
+
"""Return a json dictionary representing this model."""
|
|
2425
|
+
_dict = {}
|
|
2426
|
+
if hasattr(self, 'count') and self.count is not None:
|
|
2427
|
+
_dict['count'] = self.count
|
|
2428
|
+
if hasattr(self, 'rules') and self.rules is not None:
|
|
2429
|
+
rules_list = []
|
|
2430
|
+
for v in self.rules:
|
|
2431
|
+
if isinstance(v, dict):
|
|
2432
|
+
rules_list.append(v)
|
|
2433
|
+
else:
|
|
2434
|
+
rules_list.append(v.to_dict())
|
|
2435
|
+
_dict['rules'] = rules_list
|
|
2436
|
+
return _dict
|
|
2437
|
+
|
|
2438
|
+
def _to_dict(self):
|
|
2439
|
+
"""Return a json dictionary representing this model."""
|
|
2440
|
+
return self.to_dict()
|
|
2441
|
+
|
|
2442
|
+
def __str__(self) -> str:
|
|
2443
|
+
"""Return a `str` version of this RuleList object."""
|
|
2444
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2445
|
+
|
|
2446
|
+
def __eq__(self, other: 'RuleList') -> bool:
|
|
2447
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2448
|
+
if not isinstance(other, self.__class__):
|
|
2449
|
+
return False
|
|
2450
|
+
return self.__dict__ == other.__dict__
|
|
2451
|
+
|
|
2452
|
+
def __ne__(self, other: 'RuleList') -> bool:
|
|
2453
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2454
|
+
return not self == other
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
class ServiceRefTarget:
|
|
2458
|
+
"""
|
|
2459
|
+
Summary information about a service reference target.
|
|
2460
|
+
|
|
2461
|
+
:param str service_name: The name of the service.
|
|
2462
|
+
:param str service_type: (optional) The type of the service.
|
|
2463
|
+
:param List[ServiceRefTargetLocationsItem] locations: (optional) The locations
|
|
2464
|
+
the service is available.
|
|
2465
|
+
"""
|
|
2466
|
+
|
|
2467
|
+
def __init__(
|
|
2468
|
+
self,
|
|
2469
|
+
service_name: str,
|
|
2470
|
+
*,
|
|
2471
|
+
service_type: Optional[str] = None,
|
|
2472
|
+
locations: Optional[List['ServiceRefTargetLocationsItem']] = None,
|
|
2473
|
+
) -> None:
|
|
2474
|
+
"""
|
|
2475
|
+
Initialize a ServiceRefTarget object.
|
|
2476
|
+
|
|
2477
|
+
:param str service_name: The name of the service.
|
|
2478
|
+
:param str service_type: (optional) The type of the service.
|
|
2479
|
+
:param List[ServiceRefTargetLocationsItem] locations: (optional) The
|
|
2480
|
+
locations the service is available.
|
|
2481
|
+
"""
|
|
2482
|
+
self.service_name = service_name
|
|
2483
|
+
self.service_type = service_type
|
|
2484
|
+
self.locations = locations
|
|
2485
|
+
|
|
2486
|
+
@classmethod
|
|
2487
|
+
def from_dict(cls, _dict: Dict) -> 'ServiceRefTarget':
|
|
2488
|
+
"""Initialize a ServiceRefTarget object from a json dictionary."""
|
|
2489
|
+
args = {}
|
|
2490
|
+
if (service_name := _dict.get('service_name')) is not None:
|
|
2491
|
+
args['service_name'] = service_name
|
|
2492
|
+
else:
|
|
2493
|
+
raise ValueError('Required property \'service_name\' not present in ServiceRefTarget JSON')
|
|
2494
|
+
if (service_type := _dict.get('service_type')) is not None:
|
|
2495
|
+
args['service_type'] = service_type
|
|
2496
|
+
if (locations := _dict.get('locations')) is not None:
|
|
2497
|
+
args['locations'] = [ServiceRefTargetLocationsItem.from_dict(v) for v in locations]
|
|
2498
|
+
return cls(**args)
|
|
2499
|
+
|
|
2500
|
+
@classmethod
|
|
2501
|
+
def _from_dict(cls, _dict):
|
|
2502
|
+
"""Initialize a ServiceRefTarget object from a json dictionary."""
|
|
2503
|
+
return cls.from_dict(_dict)
|
|
2504
|
+
|
|
2505
|
+
def to_dict(self) -> Dict:
|
|
2506
|
+
"""Return a json dictionary representing this model."""
|
|
2507
|
+
_dict = {}
|
|
2508
|
+
if hasattr(self, 'service_name') and self.service_name is not None:
|
|
2509
|
+
_dict['service_name'] = self.service_name
|
|
2510
|
+
if hasattr(self, 'service_type') and self.service_type is not None:
|
|
2511
|
+
_dict['service_type'] = self.service_type
|
|
2512
|
+
if hasattr(self, 'locations') and self.locations is not None:
|
|
2513
|
+
locations_list = []
|
|
2514
|
+
for v in self.locations:
|
|
2515
|
+
if isinstance(v, dict):
|
|
2516
|
+
locations_list.append(v)
|
|
2517
|
+
else:
|
|
2518
|
+
locations_list.append(v.to_dict())
|
|
2519
|
+
_dict['locations'] = locations_list
|
|
2520
|
+
return _dict
|
|
2521
|
+
|
|
2522
|
+
def _to_dict(self):
|
|
2523
|
+
"""Return a json dictionary representing this model."""
|
|
2524
|
+
return self.to_dict()
|
|
2525
|
+
|
|
2526
|
+
def __str__(self) -> str:
|
|
2527
|
+
"""Return a `str` version of this ServiceRefTarget object."""
|
|
2528
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2529
|
+
|
|
2530
|
+
def __eq__(self, other: 'ServiceRefTarget') -> bool:
|
|
2531
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2532
|
+
if not isinstance(other, self.__class__):
|
|
2533
|
+
return False
|
|
2534
|
+
return self.__dict__ == other.__dict__
|
|
2535
|
+
|
|
2536
|
+
def __ne__(self, other: 'ServiceRefTarget') -> bool:
|
|
2537
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2538
|
+
return not self == other
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
class ServiceRefTargetList:
|
|
2542
|
+
"""
|
|
2543
|
+
A list of service reference targets.
|
|
2544
|
+
|
|
2545
|
+
:param int count: The number of returned results.
|
|
2546
|
+
:param List[ServiceRefTarget] targets: The list of service reference targets.
|
|
2547
|
+
"""
|
|
2548
|
+
|
|
2549
|
+
def __init__(
|
|
2550
|
+
self,
|
|
2551
|
+
count: int,
|
|
2552
|
+
targets: List['ServiceRefTarget'],
|
|
2553
|
+
) -> None:
|
|
2554
|
+
"""
|
|
2555
|
+
Initialize a ServiceRefTargetList object.
|
|
2556
|
+
|
|
2557
|
+
:param int count: The number of returned results.
|
|
2558
|
+
:param List[ServiceRefTarget] targets: The list of service reference
|
|
2559
|
+
targets.
|
|
2560
|
+
"""
|
|
2561
|
+
self.count = count
|
|
2562
|
+
self.targets = targets
|
|
2563
|
+
|
|
2564
|
+
@classmethod
|
|
2565
|
+
def from_dict(cls, _dict: Dict) -> 'ServiceRefTargetList':
|
|
2566
|
+
"""Initialize a ServiceRefTargetList object from a json dictionary."""
|
|
2567
|
+
args = {}
|
|
2568
|
+
if (count := _dict.get('count')) is not None:
|
|
2569
|
+
args['count'] = count
|
|
2570
|
+
else:
|
|
2571
|
+
raise ValueError('Required property \'count\' not present in ServiceRefTargetList JSON')
|
|
2572
|
+
if (targets := _dict.get('targets')) is not None:
|
|
2573
|
+
args['targets'] = [ServiceRefTarget.from_dict(v) for v in targets]
|
|
2574
|
+
else:
|
|
2575
|
+
raise ValueError('Required property \'targets\' not present in ServiceRefTargetList JSON')
|
|
2576
|
+
return cls(**args)
|
|
2577
|
+
|
|
2578
|
+
@classmethod
|
|
2579
|
+
def _from_dict(cls, _dict):
|
|
2580
|
+
"""Initialize a ServiceRefTargetList object from a json dictionary."""
|
|
2581
|
+
return cls.from_dict(_dict)
|
|
2582
|
+
|
|
2583
|
+
def to_dict(self) -> Dict:
|
|
2584
|
+
"""Return a json dictionary representing this model."""
|
|
2585
|
+
_dict = {}
|
|
2586
|
+
if hasattr(self, 'count') and self.count is not None:
|
|
2587
|
+
_dict['count'] = self.count
|
|
2588
|
+
if hasattr(self, 'targets') and self.targets is not None:
|
|
2589
|
+
targets_list = []
|
|
2590
|
+
for v in self.targets:
|
|
2591
|
+
if isinstance(v, dict):
|
|
2592
|
+
targets_list.append(v)
|
|
2593
|
+
else:
|
|
2594
|
+
targets_list.append(v.to_dict())
|
|
2595
|
+
_dict['targets'] = targets_list
|
|
2596
|
+
return _dict
|
|
2597
|
+
|
|
2598
|
+
def _to_dict(self):
|
|
2599
|
+
"""Return a json dictionary representing this model."""
|
|
2600
|
+
return self.to_dict()
|
|
2601
|
+
|
|
2602
|
+
def __str__(self) -> str:
|
|
2603
|
+
"""Return a `str` version of this ServiceRefTargetList object."""
|
|
2604
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2605
|
+
|
|
2606
|
+
def __eq__(self, other: 'ServiceRefTargetList') -> bool:
|
|
2607
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2608
|
+
if not isinstance(other, self.__class__):
|
|
2609
|
+
return False
|
|
2610
|
+
return self.__dict__ == other.__dict__
|
|
2611
|
+
|
|
2612
|
+
def __ne__(self, other: 'ServiceRefTargetList') -> bool:
|
|
2613
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2614
|
+
return not self == other
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
class ServiceRefTargetLocationsItem:
|
|
2618
|
+
"""
|
|
2619
|
+
ServiceRefTargetLocationsItem.
|
|
2620
|
+
|
|
2621
|
+
:param str display_name: (optional) The location display name.
|
|
2622
|
+
:param str kind: (optional) The location kind.
|
|
2623
|
+
:param str name: The location name.
|
|
2624
|
+
"""
|
|
2625
|
+
|
|
2626
|
+
def __init__(
|
|
2627
|
+
self,
|
|
2628
|
+
name: str,
|
|
2629
|
+
*,
|
|
2630
|
+
display_name: Optional[str] = None,
|
|
2631
|
+
kind: Optional[str] = None,
|
|
2632
|
+
) -> None:
|
|
2633
|
+
"""
|
|
2634
|
+
Initialize a ServiceRefTargetLocationsItem object.
|
|
2635
|
+
|
|
2636
|
+
:param str name: The location name.
|
|
2637
|
+
:param str display_name: (optional) The location display name.
|
|
2638
|
+
:param str kind: (optional) The location kind.
|
|
2639
|
+
"""
|
|
2640
|
+
self.display_name = display_name
|
|
2641
|
+
self.kind = kind
|
|
2642
|
+
self.name = name
|
|
2643
|
+
|
|
2644
|
+
@classmethod
|
|
2645
|
+
def from_dict(cls, _dict: Dict) -> 'ServiceRefTargetLocationsItem':
|
|
2646
|
+
"""Initialize a ServiceRefTargetLocationsItem object from a json dictionary."""
|
|
2647
|
+
args = {}
|
|
2648
|
+
if (display_name := _dict.get('display_name')) is not None:
|
|
2649
|
+
args['display_name'] = display_name
|
|
2650
|
+
if (kind := _dict.get('kind')) is not None:
|
|
2651
|
+
args['kind'] = kind
|
|
2652
|
+
if (name := _dict.get('name')) is not None:
|
|
2653
|
+
args['name'] = name
|
|
2654
|
+
else:
|
|
2655
|
+
raise ValueError('Required property \'name\' not present in ServiceRefTargetLocationsItem JSON')
|
|
2656
|
+
return cls(**args)
|
|
2657
|
+
|
|
2658
|
+
@classmethod
|
|
2659
|
+
def _from_dict(cls, _dict):
|
|
2660
|
+
"""Initialize a ServiceRefTargetLocationsItem object from a json dictionary."""
|
|
2661
|
+
return cls.from_dict(_dict)
|
|
2662
|
+
|
|
2663
|
+
def to_dict(self) -> Dict:
|
|
2664
|
+
"""Return a json dictionary representing this model."""
|
|
2665
|
+
_dict = {}
|
|
2666
|
+
if hasattr(self, 'display_name') and self.display_name is not None:
|
|
2667
|
+
_dict['display_name'] = self.display_name
|
|
2668
|
+
if hasattr(self, 'kind') and self.kind is not None:
|
|
2669
|
+
_dict['kind'] = self.kind
|
|
2670
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
2671
|
+
_dict['name'] = self.name
|
|
2672
|
+
return _dict
|
|
2673
|
+
|
|
2674
|
+
def _to_dict(self):
|
|
2675
|
+
"""Return a json dictionary representing this model."""
|
|
2676
|
+
return self.to_dict()
|
|
2677
|
+
|
|
2678
|
+
def __str__(self) -> str:
|
|
2679
|
+
"""Return a `str` version of this ServiceRefTargetLocationsItem object."""
|
|
2680
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2681
|
+
|
|
2682
|
+
def __eq__(self, other: 'ServiceRefTargetLocationsItem') -> bool:
|
|
2683
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2684
|
+
if not isinstance(other, self.__class__):
|
|
2685
|
+
return False
|
|
2686
|
+
return self.__dict__ == other.__dict__
|
|
2687
|
+
|
|
2688
|
+
def __ne__(self, other: 'ServiceRefTargetLocationsItem') -> bool:
|
|
2689
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2690
|
+
return not self == other
|
|
2691
|
+
|
|
2692
|
+
|
|
2693
|
+
class ServiceRefValue:
|
|
2694
|
+
"""
|
|
2695
|
+
A service reference value.
|
|
2696
|
+
|
|
2697
|
+
:param str account_id: The id of the account owning the service.
|
|
2698
|
+
:param str service_type: (optional) The service type.
|
|
2699
|
+
:param str service_name: (optional) The service name.
|
|
2700
|
+
:param str service_instance: (optional) The service instance.
|
|
2701
|
+
:param str location: (optional) The location.
|
|
2702
|
+
"""
|
|
2703
|
+
|
|
2704
|
+
def __init__(
|
|
2705
|
+
self,
|
|
2706
|
+
account_id: str,
|
|
2707
|
+
*,
|
|
2708
|
+
service_type: Optional[str] = None,
|
|
2709
|
+
service_name: Optional[str] = None,
|
|
2710
|
+
service_instance: Optional[str] = None,
|
|
2711
|
+
location: Optional[str] = None,
|
|
2712
|
+
) -> None:
|
|
2713
|
+
"""
|
|
2714
|
+
Initialize a ServiceRefValue object.
|
|
2715
|
+
|
|
2716
|
+
:param str account_id: The id of the account owning the service.
|
|
2717
|
+
:param str service_type: (optional) The service type.
|
|
2718
|
+
:param str service_name: (optional) The service name.
|
|
2719
|
+
:param str service_instance: (optional) The service instance.
|
|
2720
|
+
:param str location: (optional) The location.
|
|
2721
|
+
"""
|
|
2722
|
+
self.account_id = account_id
|
|
2723
|
+
self.service_type = service_type
|
|
2724
|
+
self.service_name = service_name
|
|
2725
|
+
self.service_instance = service_instance
|
|
2726
|
+
self.location = location
|
|
2727
|
+
|
|
2728
|
+
@classmethod
|
|
2729
|
+
def from_dict(cls, _dict: Dict) -> 'ServiceRefValue':
|
|
2730
|
+
"""Initialize a ServiceRefValue object from a json dictionary."""
|
|
2731
|
+
args = {}
|
|
2732
|
+
if (account_id := _dict.get('account_id')) is not None:
|
|
2733
|
+
args['account_id'] = account_id
|
|
2734
|
+
else:
|
|
2735
|
+
raise ValueError('Required property \'account_id\' not present in ServiceRefValue JSON')
|
|
2736
|
+
if (service_type := _dict.get('service_type')) is not None:
|
|
2737
|
+
args['service_type'] = service_type
|
|
2738
|
+
if (service_name := _dict.get('service_name')) is not None:
|
|
2739
|
+
args['service_name'] = service_name
|
|
2740
|
+
if (service_instance := _dict.get('service_instance')) is not None:
|
|
2741
|
+
args['service_instance'] = service_instance
|
|
2742
|
+
if (location := _dict.get('location')) is not None:
|
|
2743
|
+
args['location'] = location
|
|
2744
|
+
return cls(**args)
|
|
2745
|
+
|
|
2746
|
+
@classmethod
|
|
2747
|
+
def _from_dict(cls, _dict):
|
|
2748
|
+
"""Initialize a ServiceRefValue object from a json dictionary."""
|
|
2749
|
+
return cls.from_dict(_dict)
|
|
2750
|
+
|
|
2751
|
+
def to_dict(self) -> Dict:
|
|
2752
|
+
"""Return a json dictionary representing this model."""
|
|
2753
|
+
_dict = {}
|
|
2754
|
+
if hasattr(self, 'account_id') and self.account_id is not None:
|
|
2755
|
+
_dict['account_id'] = self.account_id
|
|
2756
|
+
if hasattr(self, 'service_type') and self.service_type is not None:
|
|
2757
|
+
_dict['service_type'] = self.service_type
|
|
2758
|
+
if hasattr(self, 'service_name') and self.service_name is not None:
|
|
2759
|
+
_dict['service_name'] = self.service_name
|
|
2760
|
+
if hasattr(self, 'service_instance') and self.service_instance is not None:
|
|
2761
|
+
_dict['service_instance'] = self.service_instance
|
|
2762
|
+
if hasattr(self, 'location') and self.location is not None:
|
|
2763
|
+
_dict['location'] = self.location
|
|
2764
|
+
return _dict
|
|
2765
|
+
|
|
2766
|
+
def _to_dict(self):
|
|
2767
|
+
"""Return a json dictionary representing this model."""
|
|
2768
|
+
return self.to_dict()
|
|
2769
|
+
|
|
2770
|
+
def __str__(self) -> str:
|
|
2771
|
+
"""Return a `str` version of this ServiceRefValue object."""
|
|
2772
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2773
|
+
|
|
2774
|
+
def __eq__(self, other: 'ServiceRefValue') -> bool:
|
|
2775
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2776
|
+
if not isinstance(other, self.__class__):
|
|
2777
|
+
return False
|
|
2778
|
+
return self.__dict__ == other.__dict__
|
|
2779
|
+
|
|
2780
|
+
def __ne__(self, other: 'ServiceRefValue') -> bool:
|
|
2781
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2782
|
+
return not self == other
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
class Zone:
|
|
2786
|
+
"""
|
|
2787
|
+
An output zone.
|
|
2788
|
+
|
|
2789
|
+
:param str id: The globally unique ID of the zone.
|
|
2790
|
+
:param str crn: The zone CRN.
|
|
2791
|
+
:param int address_count: The number of addresses in the zone.
|
|
2792
|
+
:param int excluded_count: The number of excluded addresses in the zone.
|
|
2793
|
+
:param str name: The name of the zone.
|
|
2794
|
+
:param str account_id: The id of the account owning this zone.
|
|
2795
|
+
:param str description: The description of the zone.
|
|
2796
|
+
:param List[Address] addresses: The list of addresses in the zone.
|
|
2797
|
+
:param List[Address] excluded: The list of excluded addresses in the zone. Only
|
|
2798
|
+
addresses of type `ipAddress`, `ipRange`, and `subnet` can be excluded.
|
|
2799
|
+
:param str href: The href link to the resource.
|
|
2800
|
+
:param datetime created_at: The time the resource was created.
|
|
2801
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
2802
|
+
resource.
|
|
2803
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
2804
|
+
:param str last_modified_by_id: IAM ID of the user or service which modified the
|
|
2805
|
+
resource.
|
|
2806
|
+
"""
|
|
2807
|
+
|
|
2808
|
+
def __init__(
|
|
2809
|
+
self,
|
|
2810
|
+
id: str,
|
|
2811
|
+
crn: str,
|
|
2812
|
+
address_count: int,
|
|
2813
|
+
excluded_count: int,
|
|
2814
|
+
name: str,
|
|
2815
|
+
account_id: str,
|
|
2816
|
+
description: str,
|
|
2817
|
+
addresses: List['Address'],
|
|
2818
|
+
excluded: List['Address'],
|
|
2819
|
+
href: str,
|
|
2820
|
+
created_at: datetime,
|
|
2821
|
+
created_by_id: str,
|
|
2822
|
+
last_modified_at: datetime,
|
|
2823
|
+
last_modified_by_id: str,
|
|
2824
|
+
) -> None:
|
|
2825
|
+
"""
|
|
2826
|
+
Initialize a Zone object.
|
|
2827
|
+
|
|
2828
|
+
:param str id: The globally unique ID of the zone.
|
|
2829
|
+
:param str crn: The zone CRN.
|
|
2830
|
+
:param int address_count: The number of addresses in the zone.
|
|
2831
|
+
:param int excluded_count: The number of excluded addresses in the zone.
|
|
2832
|
+
:param str name: The name of the zone.
|
|
2833
|
+
:param str account_id: The id of the account owning this zone.
|
|
2834
|
+
:param str description: The description of the zone.
|
|
2835
|
+
:param List[Address] addresses: The list of addresses in the zone.
|
|
2836
|
+
:param List[Address] excluded: The list of excluded addresses in the zone.
|
|
2837
|
+
Only addresses of type `ipAddress`, `ipRange`, and `subnet` can be
|
|
2838
|
+
excluded.
|
|
2839
|
+
:param str href: The href link to the resource.
|
|
2840
|
+
:param datetime created_at: The time the resource was created.
|
|
2841
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
2842
|
+
resource.
|
|
2843
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
2844
|
+
:param str last_modified_by_id: IAM ID of the user or service which
|
|
2845
|
+
modified the resource.
|
|
2846
|
+
"""
|
|
2847
|
+
self.id = id
|
|
2848
|
+
self.crn = crn
|
|
2849
|
+
self.address_count = address_count
|
|
2850
|
+
self.excluded_count = excluded_count
|
|
2851
|
+
self.name = name
|
|
2852
|
+
self.account_id = account_id
|
|
2853
|
+
self.description = description
|
|
2854
|
+
self.addresses = addresses
|
|
2855
|
+
self.excluded = excluded
|
|
2856
|
+
self.href = href
|
|
2857
|
+
self.created_at = created_at
|
|
2858
|
+
self.created_by_id = created_by_id
|
|
2859
|
+
self.last_modified_at = last_modified_at
|
|
2860
|
+
self.last_modified_by_id = last_modified_by_id
|
|
2861
|
+
|
|
2862
|
+
@classmethod
|
|
2863
|
+
def from_dict(cls, _dict: Dict) -> 'Zone':
|
|
2864
|
+
"""Initialize a Zone object from a json dictionary."""
|
|
2865
|
+
args = {}
|
|
2866
|
+
if (id := _dict.get('id')) is not None:
|
|
2867
|
+
args['id'] = id
|
|
2868
|
+
else:
|
|
2869
|
+
raise ValueError('Required property \'id\' not present in Zone JSON')
|
|
2870
|
+
if (crn := _dict.get('crn')) is not None:
|
|
2871
|
+
args['crn'] = crn
|
|
2872
|
+
else:
|
|
2873
|
+
raise ValueError('Required property \'crn\' not present in Zone JSON')
|
|
2874
|
+
if (address_count := _dict.get('address_count')) is not None:
|
|
2875
|
+
args['address_count'] = address_count
|
|
2876
|
+
else:
|
|
2877
|
+
raise ValueError('Required property \'address_count\' not present in Zone JSON')
|
|
2878
|
+
if (excluded_count := _dict.get('excluded_count')) is not None:
|
|
2879
|
+
args['excluded_count'] = excluded_count
|
|
2880
|
+
else:
|
|
2881
|
+
raise ValueError('Required property \'excluded_count\' not present in Zone JSON')
|
|
2882
|
+
if (name := _dict.get('name')) is not None:
|
|
2883
|
+
args['name'] = name
|
|
2884
|
+
else:
|
|
2885
|
+
raise ValueError('Required property \'name\' not present in Zone JSON')
|
|
2886
|
+
if (account_id := _dict.get('account_id')) is not None:
|
|
2887
|
+
args['account_id'] = account_id
|
|
2888
|
+
else:
|
|
2889
|
+
raise ValueError('Required property \'account_id\' not present in Zone JSON')
|
|
2890
|
+
if (description := _dict.get('description')) is not None:
|
|
2891
|
+
args['description'] = description
|
|
2892
|
+
else:
|
|
2893
|
+
raise ValueError('Required property \'description\' not present in Zone JSON')
|
|
2894
|
+
if (addresses := _dict.get('addresses')) is not None:
|
|
2895
|
+
args['addresses'] = [Address.from_dict(v) for v in addresses]
|
|
2896
|
+
else:
|
|
2897
|
+
raise ValueError('Required property \'addresses\' not present in Zone JSON')
|
|
2898
|
+
if (excluded := _dict.get('excluded')) is not None:
|
|
2899
|
+
args['excluded'] = [Address.from_dict(v) for v in excluded]
|
|
2900
|
+
else:
|
|
2901
|
+
raise ValueError('Required property \'excluded\' not present in Zone JSON')
|
|
2902
|
+
if (href := _dict.get('href')) is not None:
|
|
2903
|
+
args['href'] = href
|
|
2904
|
+
else:
|
|
2905
|
+
raise ValueError('Required property \'href\' not present in Zone JSON')
|
|
2906
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
2907
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
2908
|
+
else:
|
|
2909
|
+
raise ValueError('Required property \'created_at\' not present in Zone JSON')
|
|
2910
|
+
if (created_by_id := _dict.get('created_by_id')) is not None:
|
|
2911
|
+
args['created_by_id'] = created_by_id
|
|
2912
|
+
else:
|
|
2913
|
+
raise ValueError('Required property \'created_by_id\' not present in Zone JSON')
|
|
2914
|
+
if (last_modified_at := _dict.get('last_modified_at')) is not None:
|
|
2915
|
+
args['last_modified_at'] = string_to_datetime(last_modified_at)
|
|
2916
|
+
else:
|
|
2917
|
+
raise ValueError('Required property \'last_modified_at\' not present in Zone JSON')
|
|
2918
|
+
if (last_modified_by_id := _dict.get('last_modified_by_id')) is not None:
|
|
2919
|
+
args['last_modified_by_id'] = last_modified_by_id
|
|
2920
|
+
else:
|
|
2921
|
+
raise ValueError('Required property \'last_modified_by_id\' not present in Zone JSON')
|
|
2922
|
+
return cls(**args)
|
|
2923
|
+
|
|
2924
|
+
@classmethod
|
|
2925
|
+
def _from_dict(cls, _dict):
|
|
2926
|
+
"""Initialize a Zone object from a json dictionary."""
|
|
2927
|
+
return cls.from_dict(_dict)
|
|
2928
|
+
|
|
2929
|
+
def to_dict(self) -> Dict:
|
|
2930
|
+
"""Return a json dictionary representing this model."""
|
|
2931
|
+
_dict = {}
|
|
2932
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
2933
|
+
_dict['id'] = self.id
|
|
2934
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
2935
|
+
_dict['crn'] = self.crn
|
|
2936
|
+
if hasattr(self, 'address_count') and self.address_count is not None:
|
|
2937
|
+
_dict['address_count'] = self.address_count
|
|
2938
|
+
if hasattr(self, 'excluded_count') and self.excluded_count is not None:
|
|
2939
|
+
_dict['excluded_count'] = self.excluded_count
|
|
2940
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
2941
|
+
_dict['name'] = self.name
|
|
2942
|
+
if hasattr(self, 'account_id') and self.account_id is not None:
|
|
2943
|
+
_dict['account_id'] = self.account_id
|
|
2944
|
+
if hasattr(self, 'description') and self.description is not None:
|
|
2945
|
+
_dict['description'] = self.description
|
|
2946
|
+
if hasattr(self, 'addresses') and self.addresses is not None:
|
|
2947
|
+
addresses_list = []
|
|
2948
|
+
for v in self.addresses:
|
|
2949
|
+
if isinstance(v, dict):
|
|
2950
|
+
addresses_list.append(v)
|
|
2951
|
+
else:
|
|
2952
|
+
addresses_list.append(v.to_dict())
|
|
2953
|
+
_dict['addresses'] = addresses_list
|
|
2954
|
+
if hasattr(self, 'excluded') and self.excluded is not None:
|
|
2955
|
+
excluded_list = []
|
|
2956
|
+
for v in self.excluded:
|
|
2957
|
+
if isinstance(v, dict):
|
|
2958
|
+
excluded_list.append(v)
|
|
2959
|
+
else:
|
|
2960
|
+
excluded_list.append(v.to_dict())
|
|
2961
|
+
_dict['excluded'] = excluded_list
|
|
2962
|
+
if hasattr(self, 'href') and self.href is not None:
|
|
2963
|
+
_dict['href'] = self.href
|
|
2964
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
2965
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
2966
|
+
if hasattr(self, 'created_by_id') and self.created_by_id is not None:
|
|
2967
|
+
_dict['created_by_id'] = self.created_by_id
|
|
2968
|
+
if hasattr(self, 'last_modified_at') and self.last_modified_at is not None:
|
|
2969
|
+
_dict['last_modified_at'] = datetime_to_string(self.last_modified_at)
|
|
2970
|
+
if hasattr(self, 'last_modified_by_id') and self.last_modified_by_id is not None:
|
|
2971
|
+
_dict['last_modified_by_id'] = self.last_modified_by_id
|
|
2972
|
+
return _dict
|
|
2973
|
+
|
|
2974
|
+
def _to_dict(self):
|
|
2975
|
+
"""Return a json dictionary representing this model."""
|
|
2976
|
+
return self.to_dict()
|
|
2977
|
+
|
|
2978
|
+
def __str__(self) -> str:
|
|
2979
|
+
"""Return a `str` version of this Zone object."""
|
|
2980
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2981
|
+
|
|
2982
|
+
def __eq__(self, other: 'Zone') -> bool:
|
|
2983
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2984
|
+
if not isinstance(other, self.__class__):
|
|
2985
|
+
return False
|
|
2986
|
+
return self.__dict__ == other.__dict__
|
|
2987
|
+
|
|
2988
|
+
def __ne__(self, other: 'Zone') -> bool:
|
|
2989
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2990
|
+
return not self == other
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
class ZoneList:
|
|
2994
|
+
"""
|
|
2995
|
+
The response object of the ListZones operation.
|
|
2996
|
+
|
|
2997
|
+
:param int count: The number of returned results.
|
|
2998
|
+
:param List[ZoneSummary] zones: The returned zones.
|
|
2999
|
+
"""
|
|
3000
|
+
|
|
3001
|
+
def __init__(
|
|
3002
|
+
self,
|
|
3003
|
+
count: int,
|
|
3004
|
+
zones: List['ZoneSummary'],
|
|
3005
|
+
) -> None:
|
|
3006
|
+
"""
|
|
3007
|
+
Initialize a ZoneList object.
|
|
3008
|
+
|
|
3009
|
+
:param int count: The number of returned results.
|
|
3010
|
+
:param List[ZoneSummary] zones: The returned zones.
|
|
3011
|
+
"""
|
|
3012
|
+
self.count = count
|
|
3013
|
+
self.zones = zones
|
|
3014
|
+
|
|
3015
|
+
@classmethod
|
|
3016
|
+
def from_dict(cls, _dict: Dict) -> 'ZoneList':
|
|
3017
|
+
"""Initialize a ZoneList object from a json dictionary."""
|
|
3018
|
+
args = {}
|
|
3019
|
+
if (count := _dict.get('count')) is not None:
|
|
3020
|
+
args['count'] = count
|
|
3021
|
+
else:
|
|
3022
|
+
raise ValueError('Required property \'count\' not present in ZoneList JSON')
|
|
3023
|
+
if (zones := _dict.get('zones')) is not None:
|
|
3024
|
+
args['zones'] = [ZoneSummary.from_dict(v) for v in zones]
|
|
3025
|
+
else:
|
|
3026
|
+
raise ValueError('Required property \'zones\' not present in ZoneList JSON')
|
|
3027
|
+
return cls(**args)
|
|
3028
|
+
|
|
3029
|
+
@classmethod
|
|
3030
|
+
def _from_dict(cls, _dict):
|
|
3031
|
+
"""Initialize a ZoneList object from a json dictionary."""
|
|
3032
|
+
return cls.from_dict(_dict)
|
|
3033
|
+
|
|
3034
|
+
def to_dict(self) -> Dict:
|
|
3035
|
+
"""Return a json dictionary representing this model."""
|
|
3036
|
+
_dict = {}
|
|
3037
|
+
if hasattr(self, 'count') and self.count is not None:
|
|
3038
|
+
_dict['count'] = self.count
|
|
3039
|
+
if hasattr(self, 'zones') and self.zones is not None:
|
|
3040
|
+
zones_list = []
|
|
3041
|
+
for v in self.zones:
|
|
3042
|
+
if isinstance(v, dict):
|
|
3043
|
+
zones_list.append(v)
|
|
3044
|
+
else:
|
|
3045
|
+
zones_list.append(v.to_dict())
|
|
3046
|
+
_dict['zones'] = zones_list
|
|
3047
|
+
return _dict
|
|
3048
|
+
|
|
3049
|
+
def _to_dict(self):
|
|
3050
|
+
"""Return a json dictionary representing this model."""
|
|
3051
|
+
return self.to_dict()
|
|
3052
|
+
|
|
3053
|
+
def __str__(self) -> str:
|
|
3054
|
+
"""Return a `str` version of this ZoneList object."""
|
|
3055
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3056
|
+
|
|
3057
|
+
def __eq__(self, other: 'ZoneList') -> bool:
|
|
3058
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3059
|
+
if not isinstance(other, self.__class__):
|
|
3060
|
+
return False
|
|
3061
|
+
return self.__dict__ == other.__dict__
|
|
3062
|
+
|
|
3063
|
+
def __ne__(self, other: 'ZoneList') -> bool:
|
|
3064
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3065
|
+
return not self == other
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
class ZoneSummary:
|
|
3069
|
+
"""
|
|
3070
|
+
An output zone summary.
|
|
3071
|
+
|
|
3072
|
+
:param str id: The globally unique ID of the zone.
|
|
3073
|
+
:param str crn: The zone CRN.
|
|
3074
|
+
:param str name: The name of the zone.
|
|
3075
|
+
:param str description: (optional) The description of the zone.
|
|
3076
|
+
:param List[Address] addresses_preview: A preview of addresses in the zone (3
|
|
3077
|
+
addresses maximum).
|
|
3078
|
+
:param int address_count: The number of addresses in the zone.
|
|
3079
|
+
:param int excluded_count: The number of excluded addresses in the zone.
|
|
3080
|
+
:param str href: The href link to the resource.
|
|
3081
|
+
:param datetime created_at: The time the resource was created.
|
|
3082
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
3083
|
+
resource.
|
|
3084
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
3085
|
+
:param str last_modified_by_id: IAM ID of the user or service which modified the
|
|
3086
|
+
resource.
|
|
3087
|
+
"""
|
|
3088
|
+
|
|
3089
|
+
def __init__(
|
|
3090
|
+
self,
|
|
3091
|
+
id: str,
|
|
3092
|
+
crn: str,
|
|
3093
|
+
name: str,
|
|
3094
|
+
addresses_preview: List['Address'],
|
|
3095
|
+
address_count: int,
|
|
3096
|
+
excluded_count: int,
|
|
3097
|
+
href: str,
|
|
3098
|
+
created_at: datetime,
|
|
3099
|
+
created_by_id: str,
|
|
3100
|
+
last_modified_at: datetime,
|
|
3101
|
+
last_modified_by_id: str,
|
|
3102
|
+
*,
|
|
3103
|
+
description: Optional[str] = None,
|
|
3104
|
+
) -> None:
|
|
3105
|
+
"""
|
|
3106
|
+
Initialize a ZoneSummary object.
|
|
3107
|
+
|
|
3108
|
+
:param str id: The globally unique ID of the zone.
|
|
3109
|
+
:param str crn: The zone CRN.
|
|
3110
|
+
:param str name: The name of the zone.
|
|
3111
|
+
:param List[Address] addresses_preview: A preview of addresses in the zone
|
|
3112
|
+
(3 addresses maximum).
|
|
3113
|
+
:param int address_count: The number of addresses in the zone.
|
|
3114
|
+
:param int excluded_count: The number of excluded addresses in the zone.
|
|
3115
|
+
:param str href: The href link to the resource.
|
|
3116
|
+
:param datetime created_at: The time the resource was created.
|
|
3117
|
+
:param str created_by_id: IAM ID of the user or service which created the
|
|
3118
|
+
resource.
|
|
3119
|
+
:param datetime last_modified_at: The last time the resource was modified.
|
|
3120
|
+
:param str last_modified_by_id: IAM ID of the user or service which
|
|
3121
|
+
modified the resource.
|
|
3122
|
+
:param str description: (optional) The description of the zone.
|
|
3123
|
+
"""
|
|
3124
|
+
self.id = id
|
|
3125
|
+
self.crn = crn
|
|
3126
|
+
self.name = name
|
|
3127
|
+
self.description = description
|
|
3128
|
+
self.addresses_preview = addresses_preview
|
|
3129
|
+
self.address_count = address_count
|
|
3130
|
+
self.excluded_count = excluded_count
|
|
3131
|
+
self.href = href
|
|
3132
|
+
self.created_at = created_at
|
|
3133
|
+
self.created_by_id = created_by_id
|
|
3134
|
+
self.last_modified_at = last_modified_at
|
|
3135
|
+
self.last_modified_by_id = last_modified_by_id
|
|
3136
|
+
|
|
3137
|
+
@classmethod
|
|
3138
|
+
def from_dict(cls, _dict: Dict) -> 'ZoneSummary':
|
|
3139
|
+
"""Initialize a ZoneSummary object from a json dictionary."""
|
|
3140
|
+
args = {}
|
|
3141
|
+
if (id := _dict.get('id')) is not None:
|
|
3142
|
+
args['id'] = id
|
|
3143
|
+
else:
|
|
3144
|
+
raise ValueError('Required property \'id\' not present in ZoneSummary JSON')
|
|
3145
|
+
if (crn := _dict.get('crn')) is not None:
|
|
3146
|
+
args['crn'] = crn
|
|
3147
|
+
else:
|
|
3148
|
+
raise ValueError('Required property \'crn\' not present in ZoneSummary JSON')
|
|
3149
|
+
if (name := _dict.get('name')) is not None:
|
|
3150
|
+
args['name'] = name
|
|
3151
|
+
else:
|
|
3152
|
+
raise ValueError('Required property \'name\' not present in ZoneSummary JSON')
|
|
3153
|
+
if (description := _dict.get('description')) is not None:
|
|
3154
|
+
args['description'] = description
|
|
3155
|
+
if (addresses_preview := _dict.get('addresses_preview')) is not None:
|
|
3156
|
+
args['addresses_preview'] = [Address.from_dict(v) for v in addresses_preview]
|
|
3157
|
+
else:
|
|
3158
|
+
raise ValueError('Required property \'addresses_preview\' not present in ZoneSummary JSON')
|
|
3159
|
+
if (address_count := _dict.get('address_count')) is not None:
|
|
3160
|
+
args['address_count'] = address_count
|
|
3161
|
+
else:
|
|
3162
|
+
raise ValueError('Required property \'address_count\' not present in ZoneSummary JSON')
|
|
3163
|
+
if (excluded_count := _dict.get('excluded_count')) is not None:
|
|
3164
|
+
args['excluded_count'] = excluded_count
|
|
3165
|
+
else:
|
|
3166
|
+
raise ValueError('Required property \'excluded_count\' not present in ZoneSummary JSON')
|
|
3167
|
+
if (href := _dict.get('href')) is not None:
|
|
3168
|
+
args['href'] = href
|
|
3169
|
+
else:
|
|
3170
|
+
raise ValueError('Required property \'href\' not present in ZoneSummary JSON')
|
|
3171
|
+
if (created_at := _dict.get('created_at')) is not None:
|
|
3172
|
+
args['created_at'] = string_to_datetime(created_at)
|
|
3173
|
+
else:
|
|
3174
|
+
raise ValueError('Required property \'created_at\' not present in ZoneSummary JSON')
|
|
3175
|
+
if (created_by_id := _dict.get('created_by_id')) is not None:
|
|
3176
|
+
args['created_by_id'] = created_by_id
|
|
3177
|
+
else:
|
|
3178
|
+
raise ValueError('Required property \'created_by_id\' not present in ZoneSummary JSON')
|
|
3179
|
+
if (last_modified_at := _dict.get('last_modified_at')) is not None:
|
|
3180
|
+
args['last_modified_at'] = string_to_datetime(last_modified_at)
|
|
3181
|
+
else:
|
|
3182
|
+
raise ValueError('Required property \'last_modified_at\' not present in ZoneSummary JSON')
|
|
3183
|
+
if (last_modified_by_id := _dict.get('last_modified_by_id')) is not None:
|
|
3184
|
+
args['last_modified_by_id'] = last_modified_by_id
|
|
3185
|
+
else:
|
|
3186
|
+
raise ValueError('Required property \'last_modified_by_id\' not present in ZoneSummary JSON')
|
|
3187
|
+
return cls(**args)
|
|
3188
|
+
|
|
3189
|
+
@classmethod
|
|
3190
|
+
def _from_dict(cls, _dict):
|
|
3191
|
+
"""Initialize a ZoneSummary object from a json dictionary."""
|
|
3192
|
+
return cls.from_dict(_dict)
|
|
3193
|
+
|
|
3194
|
+
def to_dict(self) -> Dict:
|
|
3195
|
+
"""Return a json dictionary representing this model."""
|
|
3196
|
+
_dict = {}
|
|
3197
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
3198
|
+
_dict['id'] = self.id
|
|
3199
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
3200
|
+
_dict['crn'] = self.crn
|
|
3201
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
3202
|
+
_dict['name'] = self.name
|
|
3203
|
+
if hasattr(self, 'description') and self.description is not None:
|
|
3204
|
+
_dict['description'] = self.description
|
|
3205
|
+
if hasattr(self, 'addresses_preview') and self.addresses_preview is not None:
|
|
3206
|
+
addresses_preview_list = []
|
|
3207
|
+
for v in self.addresses_preview:
|
|
3208
|
+
if isinstance(v, dict):
|
|
3209
|
+
addresses_preview_list.append(v)
|
|
3210
|
+
else:
|
|
3211
|
+
addresses_preview_list.append(v.to_dict())
|
|
3212
|
+
_dict['addresses_preview'] = addresses_preview_list
|
|
3213
|
+
if hasattr(self, 'address_count') and self.address_count is not None:
|
|
3214
|
+
_dict['address_count'] = self.address_count
|
|
3215
|
+
if hasattr(self, 'excluded_count') and self.excluded_count is not None:
|
|
3216
|
+
_dict['excluded_count'] = self.excluded_count
|
|
3217
|
+
if hasattr(self, 'href') and self.href is not None:
|
|
3218
|
+
_dict['href'] = self.href
|
|
3219
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
3220
|
+
_dict['created_at'] = datetime_to_string(self.created_at)
|
|
3221
|
+
if hasattr(self, 'created_by_id') and self.created_by_id is not None:
|
|
3222
|
+
_dict['created_by_id'] = self.created_by_id
|
|
3223
|
+
if hasattr(self, 'last_modified_at') and self.last_modified_at is not None:
|
|
3224
|
+
_dict['last_modified_at'] = datetime_to_string(self.last_modified_at)
|
|
3225
|
+
if hasattr(self, 'last_modified_by_id') and self.last_modified_by_id is not None:
|
|
3226
|
+
_dict['last_modified_by_id'] = self.last_modified_by_id
|
|
3227
|
+
return _dict
|
|
3228
|
+
|
|
3229
|
+
def _to_dict(self):
|
|
3230
|
+
"""Return a json dictionary representing this model."""
|
|
3231
|
+
return self.to_dict()
|
|
3232
|
+
|
|
3233
|
+
def __str__(self) -> str:
|
|
3234
|
+
"""Return a `str` version of this ZoneSummary object."""
|
|
3235
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3236
|
+
|
|
3237
|
+
def __eq__(self, other: 'ZoneSummary') -> bool:
|
|
3238
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3239
|
+
if not isinstance(other, self.__class__):
|
|
3240
|
+
return False
|
|
3241
|
+
return self.__dict__ == other.__dict__
|
|
3242
|
+
|
|
3243
|
+
def __ne__(self, other: 'ZoneSummary') -> bool:
|
|
3244
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3245
|
+
return not self == other
|
|
3246
|
+
|
|
3247
|
+
|
|
3248
|
+
class AddressIPAddress(Address):
|
|
3249
|
+
"""
|
|
3250
|
+
A single IP address. IPv4 and IPv6 are supported.
|
|
3251
|
+
|
|
3252
|
+
:param str type: The type of address.
|
|
3253
|
+
:param str value: The IP address.
|
|
3254
|
+
"""
|
|
3255
|
+
|
|
3256
|
+
def __init__(
|
|
3257
|
+
self,
|
|
3258
|
+
type: str,
|
|
3259
|
+
value: str,
|
|
3260
|
+
) -> None:
|
|
3261
|
+
"""
|
|
3262
|
+
Initialize a AddressIPAddress object.
|
|
3263
|
+
|
|
3264
|
+
:param str type: The type of address.
|
|
3265
|
+
:param str value: The IP address.
|
|
3266
|
+
"""
|
|
3267
|
+
# pylint: disable=super-init-not-called
|
|
3268
|
+
self.type = type
|
|
3269
|
+
self.value = value
|
|
3270
|
+
|
|
3271
|
+
@classmethod
|
|
3272
|
+
def from_dict(cls, _dict: Dict) -> 'AddressIPAddress':
|
|
3273
|
+
"""Initialize a AddressIPAddress object from a json dictionary."""
|
|
3274
|
+
args = {}
|
|
3275
|
+
if (type := _dict.get('type')) is not None:
|
|
3276
|
+
args['type'] = type
|
|
3277
|
+
else:
|
|
3278
|
+
raise ValueError('Required property \'type\' not present in AddressIPAddress JSON')
|
|
3279
|
+
if (value := _dict.get('value')) is not None:
|
|
3280
|
+
args['value'] = value
|
|
3281
|
+
else:
|
|
3282
|
+
raise ValueError('Required property \'value\' not present in AddressIPAddress JSON')
|
|
3283
|
+
return cls(**args)
|
|
3284
|
+
|
|
3285
|
+
@classmethod
|
|
3286
|
+
def _from_dict(cls, _dict):
|
|
3287
|
+
"""Initialize a AddressIPAddress object from a json dictionary."""
|
|
3288
|
+
return cls.from_dict(_dict)
|
|
3289
|
+
|
|
3290
|
+
def to_dict(self) -> Dict:
|
|
3291
|
+
"""Return a json dictionary representing this model."""
|
|
3292
|
+
_dict = {}
|
|
3293
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
3294
|
+
_dict['type'] = self.type
|
|
3295
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
3296
|
+
_dict['value'] = self.value
|
|
3297
|
+
return _dict
|
|
3298
|
+
|
|
3299
|
+
def _to_dict(self):
|
|
3300
|
+
"""Return a json dictionary representing this model."""
|
|
3301
|
+
return self.to_dict()
|
|
3302
|
+
|
|
3303
|
+
def __str__(self) -> str:
|
|
3304
|
+
"""Return a `str` version of this AddressIPAddress object."""
|
|
3305
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3306
|
+
|
|
3307
|
+
def __eq__(self, other: 'AddressIPAddress') -> bool:
|
|
3308
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3309
|
+
if not isinstance(other, self.__class__):
|
|
3310
|
+
return False
|
|
3311
|
+
return self.__dict__ == other.__dict__
|
|
3312
|
+
|
|
3313
|
+
def __ne__(self, other: 'AddressIPAddress') -> bool:
|
|
3314
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3315
|
+
return not self == other
|
|
3316
|
+
|
|
3317
|
+
class TypeEnum(str, Enum):
|
|
3318
|
+
"""
|
|
3319
|
+
The type of address.
|
|
3320
|
+
"""
|
|
3321
|
+
|
|
3322
|
+
IPADDRESS = 'ipAddress'
|
|
3323
|
+
|
|
3324
|
+
|
|
3325
|
+
class AddressIPAddressRange(Address):
|
|
3326
|
+
"""
|
|
3327
|
+
An IP address range. IPv4 and IPv6 are supported.
|
|
3328
|
+
|
|
3329
|
+
:param str type: The type of address.
|
|
3330
|
+
:param str value: The ip range in <first-ip>-<last-ip> format.
|
|
3331
|
+
"""
|
|
3332
|
+
|
|
3333
|
+
def __init__(
|
|
3334
|
+
self,
|
|
3335
|
+
type: str,
|
|
3336
|
+
value: str,
|
|
3337
|
+
) -> None:
|
|
3338
|
+
"""
|
|
3339
|
+
Initialize a AddressIPAddressRange object.
|
|
3340
|
+
|
|
3341
|
+
:param str type: The type of address.
|
|
3342
|
+
:param str value: The ip range in <first-ip>-<last-ip> format.
|
|
3343
|
+
"""
|
|
3344
|
+
# pylint: disable=super-init-not-called
|
|
3345
|
+
self.type = type
|
|
3346
|
+
self.value = value
|
|
3347
|
+
|
|
3348
|
+
@classmethod
|
|
3349
|
+
def from_dict(cls, _dict: Dict) -> 'AddressIPAddressRange':
|
|
3350
|
+
"""Initialize a AddressIPAddressRange object from a json dictionary."""
|
|
3351
|
+
args = {}
|
|
3352
|
+
if (type := _dict.get('type')) is not None:
|
|
3353
|
+
args['type'] = type
|
|
3354
|
+
else:
|
|
3355
|
+
raise ValueError('Required property \'type\' not present in AddressIPAddressRange JSON')
|
|
3356
|
+
if (value := _dict.get('value')) is not None:
|
|
3357
|
+
args['value'] = value
|
|
3358
|
+
else:
|
|
3359
|
+
raise ValueError('Required property \'value\' not present in AddressIPAddressRange JSON')
|
|
3360
|
+
return cls(**args)
|
|
3361
|
+
|
|
3362
|
+
@classmethod
|
|
3363
|
+
def _from_dict(cls, _dict):
|
|
3364
|
+
"""Initialize a AddressIPAddressRange object from a json dictionary."""
|
|
3365
|
+
return cls.from_dict(_dict)
|
|
3366
|
+
|
|
3367
|
+
def to_dict(self) -> Dict:
|
|
3368
|
+
"""Return a json dictionary representing this model."""
|
|
3369
|
+
_dict = {}
|
|
3370
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
3371
|
+
_dict['type'] = self.type
|
|
3372
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
3373
|
+
_dict['value'] = self.value
|
|
3374
|
+
return _dict
|
|
3375
|
+
|
|
3376
|
+
def _to_dict(self):
|
|
3377
|
+
"""Return a json dictionary representing this model."""
|
|
3378
|
+
return self.to_dict()
|
|
3379
|
+
|
|
3380
|
+
def __str__(self) -> str:
|
|
3381
|
+
"""Return a `str` version of this AddressIPAddressRange object."""
|
|
3382
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3383
|
+
|
|
3384
|
+
def __eq__(self, other: 'AddressIPAddressRange') -> bool:
|
|
3385
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3386
|
+
if not isinstance(other, self.__class__):
|
|
3387
|
+
return False
|
|
3388
|
+
return self.__dict__ == other.__dict__
|
|
3389
|
+
|
|
3390
|
+
def __ne__(self, other: 'AddressIPAddressRange') -> bool:
|
|
3391
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3392
|
+
return not self == other
|
|
3393
|
+
|
|
3394
|
+
class TypeEnum(str, Enum):
|
|
3395
|
+
"""
|
|
3396
|
+
The type of address.
|
|
3397
|
+
"""
|
|
3398
|
+
|
|
3399
|
+
IPRANGE = 'ipRange'
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
class AddressServiceRef(Address):
|
|
3403
|
+
"""
|
|
3404
|
+
A service reference.
|
|
3405
|
+
|
|
3406
|
+
:param str type: The type of address.
|
|
3407
|
+
:param ServiceRefValue ref: A service reference value.
|
|
3408
|
+
"""
|
|
3409
|
+
|
|
3410
|
+
def __init__(
|
|
3411
|
+
self,
|
|
3412
|
+
type: str,
|
|
3413
|
+
ref: 'ServiceRefValue',
|
|
3414
|
+
) -> None:
|
|
3415
|
+
"""
|
|
3416
|
+
Initialize a AddressServiceRef object.
|
|
3417
|
+
|
|
3418
|
+
:param str type: The type of address.
|
|
3419
|
+
:param ServiceRefValue ref: A service reference value.
|
|
3420
|
+
"""
|
|
3421
|
+
# pylint: disable=super-init-not-called
|
|
3422
|
+
self.type = type
|
|
3423
|
+
self.ref = ref
|
|
3424
|
+
|
|
3425
|
+
@classmethod
|
|
3426
|
+
def from_dict(cls, _dict: Dict) -> 'AddressServiceRef':
|
|
3427
|
+
"""Initialize a AddressServiceRef object from a json dictionary."""
|
|
3428
|
+
args = {}
|
|
3429
|
+
if (type := _dict.get('type')) is not None:
|
|
3430
|
+
args['type'] = type
|
|
3431
|
+
else:
|
|
3432
|
+
raise ValueError('Required property \'type\' not present in AddressServiceRef JSON')
|
|
3433
|
+
if (ref := _dict.get('ref')) is not None:
|
|
3434
|
+
args['ref'] = ServiceRefValue.from_dict(ref)
|
|
3435
|
+
else:
|
|
3436
|
+
raise ValueError('Required property \'ref\' not present in AddressServiceRef JSON')
|
|
3437
|
+
return cls(**args)
|
|
3438
|
+
|
|
3439
|
+
@classmethod
|
|
3440
|
+
def _from_dict(cls, _dict):
|
|
3441
|
+
"""Initialize a AddressServiceRef object from a json dictionary."""
|
|
3442
|
+
return cls.from_dict(_dict)
|
|
3443
|
+
|
|
3444
|
+
def to_dict(self) -> Dict:
|
|
3445
|
+
"""Return a json dictionary representing this model."""
|
|
3446
|
+
_dict = {}
|
|
3447
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
3448
|
+
_dict['type'] = self.type
|
|
3449
|
+
if hasattr(self, 'ref') and self.ref is not None:
|
|
3450
|
+
if isinstance(self.ref, dict):
|
|
3451
|
+
_dict['ref'] = self.ref
|
|
3452
|
+
else:
|
|
3453
|
+
_dict['ref'] = self.ref.to_dict()
|
|
3454
|
+
return _dict
|
|
3455
|
+
|
|
3456
|
+
def _to_dict(self):
|
|
3457
|
+
"""Return a json dictionary representing this model."""
|
|
3458
|
+
return self.to_dict()
|
|
3459
|
+
|
|
3460
|
+
def __str__(self) -> str:
|
|
3461
|
+
"""Return a `str` version of this AddressServiceRef object."""
|
|
3462
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3463
|
+
|
|
3464
|
+
def __eq__(self, other: 'AddressServiceRef') -> bool:
|
|
3465
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3466
|
+
if not isinstance(other, self.__class__):
|
|
3467
|
+
return False
|
|
3468
|
+
return self.__dict__ == other.__dict__
|
|
3469
|
+
|
|
3470
|
+
def __ne__(self, other: 'AddressServiceRef') -> bool:
|
|
3471
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3472
|
+
return not self == other
|
|
3473
|
+
|
|
3474
|
+
class TypeEnum(str, Enum):
|
|
3475
|
+
"""
|
|
3476
|
+
The type of address.
|
|
3477
|
+
"""
|
|
3478
|
+
|
|
3479
|
+
SERVICEREF = 'serviceRef'
|
|
3480
|
+
|
|
3481
|
+
|
|
3482
|
+
class AddressSubnet(Address):
|
|
3483
|
+
"""
|
|
3484
|
+
A subnet in CIDR format.
|
|
3485
|
+
|
|
3486
|
+
:param str type: The type of address.
|
|
3487
|
+
:param str value: The subnet in CIDR format.
|
|
3488
|
+
"""
|
|
3489
|
+
|
|
3490
|
+
def __init__(
|
|
3491
|
+
self,
|
|
3492
|
+
type: str,
|
|
3493
|
+
value: str,
|
|
3494
|
+
) -> None:
|
|
3495
|
+
"""
|
|
3496
|
+
Initialize a AddressSubnet object.
|
|
3497
|
+
|
|
3498
|
+
:param str type: The type of address.
|
|
3499
|
+
:param str value: The subnet in CIDR format.
|
|
3500
|
+
"""
|
|
3501
|
+
# pylint: disable=super-init-not-called
|
|
3502
|
+
self.type = type
|
|
3503
|
+
self.value = value
|
|
3504
|
+
|
|
3505
|
+
@classmethod
|
|
3506
|
+
def from_dict(cls, _dict: Dict) -> 'AddressSubnet':
|
|
3507
|
+
"""Initialize a AddressSubnet object from a json dictionary."""
|
|
3508
|
+
args = {}
|
|
3509
|
+
if (type := _dict.get('type')) is not None:
|
|
3510
|
+
args['type'] = type
|
|
3511
|
+
else:
|
|
3512
|
+
raise ValueError('Required property \'type\' not present in AddressSubnet JSON')
|
|
3513
|
+
if (value := _dict.get('value')) is not None:
|
|
3514
|
+
args['value'] = value
|
|
3515
|
+
else:
|
|
3516
|
+
raise ValueError('Required property \'value\' not present in AddressSubnet JSON')
|
|
3517
|
+
return cls(**args)
|
|
3518
|
+
|
|
3519
|
+
@classmethod
|
|
3520
|
+
def _from_dict(cls, _dict):
|
|
3521
|
+
"""Initialize a AddressSubnet object from a json dictionary."""
|
|
3522
|
+
return cls.from_dict(_dict)
|
|
3523
|
+
|
|
3524
|
+
def to_dict(self) -> Dict:
|
|
3525
|
+
"""Return a json dictionary representing this model."""
|
|
3526
|
+
_dict = {}
|
|
3527
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
3528
|
+
_dict['type'] = self.type
|
|
3529
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
3530
|
+
_dict['value'] = self.value
|
|
3531
|
+
return _dict
|
|
3532
|
+
|
|
3533
|
+
def _to_dict(self):
|
|
3534
|
+
"""Return a json dictionary representing this model."""
|
|
3535
|
+
return self.to_dict()
|
|
3536
|
+
|
|
3537
|
+
def __str__(self) -> str:
|
|
3538
|
+
"""Return a `str` version of this AddressSubnet object."""
|
|
3539
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3540
|
+
|
|
3541
|
+
def __eq__(self, other: 'AddressSubnet') -> bool:
|
|
3542
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3543
|
+
if not isinstance(other, self.__class__):
|
|
3544
|
+
return False
|
|
3545
|
+
return self.__dict__ == other.__dict__
|
|
3546
|
+
|
|
3547
|
+
def __ne__(self, other: 'AddressSubnet') -> bool:
|
|
3548
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3549
|
+
return not self == other
|
|
3550
|
+
|
|
3551
|
+
class TypeEnum(str, Enum):
|
|
3552
|
+
"""
|
|
3553
|
+
The type of address.
|
|
3554
|
+
"""
|
|
3555
|
+
|
|
3556
|
+
SUBNET = 'subnet'
|
|
3557
|
+
|
|
3558
|
+
|
|
3559
|
+
class AddressVPC(Address):
|
|
3560
|
+
"""
|
|
3561
|
+
A single VPC address.
|
|
3562
|
+
|
|
3563
|
+
:param str type: The type of address.
|
|
3564
|
+
:param str value: The VPC CRN.
|
|
3565
|
+
"""
|
|
3566
|
+
|
|
3567
|
+
def __init__(
|
|
3568
|
+
self,
|
|
3569
|
+
type: str,
|
|
3570
|
+
value: str,
|
|
3571
|
+
) -> None:
|
|
3572
|
+
"""
|
|
3573
|
+
Initialize a AddressVPC object.
|
|
3574
|
+
|
|
3575
|
+
:param str type: The type of address.
|
|
3576
|
+
:param str value: The VPC CRN.
|
|
3577
|
+
"""
|
|
3578
|
+
# pylint: disable=super-init-not-called
|
|
3579
|
+
self.type = type
|
|
3580
|
+
self.value = value
|
|
3581
|
+
|
|
3582
|
+
@classmethod
|
|
3583
|
+
def from_dict(cls, _dict: Dict) -> 'AddressVPC':
|
|
3584
|
+
"""Initialize a AddressVPC object from a json dictionary."""
|
|
3585
|
+
args = {}
|
|
3586
|
+
if (type := _dict.get('type')) is not None:
|
|
3587
|
+
args['type'] = type
|
|
3588
|
+
else:
|
|
3589
|
+
raise ValueError('Required property \'type\' not present in AddressVPC JSON')
|
|
3590
|
+
if (value := _dict.get('value')) is not None:
|
|
3591
|
+
args['value'] = value
|
|
3592
|
+
else:
|
|
3593
|
+
raise ValueError('Required property \'value\' not present in AddressVPC JSON')
|
|
3594
|
+
return cls(**args)
|
|
3595
|
+
|
|
3596
|
+
@classmethod
|
|
3597
|
+
def _from_dict(cls, _dict):
|
|
3598
|
+
"""Initialize a AddressVPC object from a json dictionary."""
|
|
3599
|
+
return cls.from_dict(_dict)
|
|
3600
|
+
|
|
3601
|
+
def to_dict(self) -> Dict:
|
|
3602
|
+
"""Return a json dictionary representing this model."""
|
|
3603
|
+
_dict = {}
|
|
3604
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
3605
|
+
_dict['type'] = self.type
|
|
3606
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
3607
|
+
_dict['value'] = self.value
|
|
3608
|
+
return _dict
|
|
3609
|
+
|
|
3610
|
+
def _to_dict(self):
|
|
3611
|
+
"""Return a json dictionary representing this model."""
|
|
3612
|
+
return self.to_dict()
|
|
3613
|
+
|
|
3614
|
+
def __str__(self) -> str:
|
|
3615
|
+
"""Return a `str` version of this AddressVPC object."""
|
|
3616
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
3617
|
+
|
|
3618
|
+
def __eq__(self, other: 'AddressVPC') -> bool:
|
|
3619
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
3620
|
+
if not isinstance(other, self.__class__):
|
|
3621
|
+
return False
|
|
3622
|
+
return self.__dict__ == other.__dict__
|
|
3623
|
+
|
|
3624
|
+
def __ne__(self, other: 'AddressVPC') -> bool:
|
|
3625
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
3626
|
+
return not self == other
|
|
3627
|
+
|
|
3628
|
+
class TypeEnum(str, Enum):
|
|
3629
|
+
"""
|
|
3630
|
+
The type of address.
|
|
3631
|
+
"""
|
|
3632
|
+
|
|
3633
|
+
VPC = 'vpc'
|