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,1601 @@
|
|
|
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.87.0-91c7c775-20240320-213027
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete, or
|
|
21
|
+
list all of the tags in your billing account with the Tagging API. The tag name must be
|
|
22
|
+
unique within a billing account. You can create tags in two formats: `key:value` or
|
|
23
|
+
`label`. The tagging API supports three types of tag: `user` `service`, and `access` tags.
|
|
24
|
+
`service` tags cannot be attached to IMS resources. `service` tags must be in the form
|
|
25
|
+
`service_prefix:tag_label` where `service_prefix` identifies the Service owning the tag.
|
|
26
|
+
`access` tags cannot be attached to IMS and Cloud Foundry resources. They must be in the
|
|
27
|
+
form `key:value`. You can replace all resource's tags using the `replace` query parameter
|
|
28
|
+
in the attach operation. You can update the `value` of a resource's tag in the format
|
|
29
|
+
`key:value`, using the `update` query parameter in the attach operation.
|
|
30
|
+
|
|
31
|
+
API Version: 1.2.0
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
from enum import Enum
|
|
35
|
+
from typing import Dict, List, Optional
|
|
36
|
+
import json
|
|
37
|
+
|
|
38
|
+
from ibm_cloud_sdk_core import BaseService, DetailedResponse
|
|
39
|
+
from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
|
|
40
|
+
from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
|
|
41
|
+
from ibm_cloud_sdk_core.utils import convert_list, convert_model
|
|
42
|
+
|
|
43
|
+
from .common import get_sdk_headers
|
|
44
|
+
|
|
45
|
+
##############################################################################
|
|
46
|
+
# Service
|
|
47
|
+
##############################################################################
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class GlobalTaggingV1(BaseService):
|
|
51
|
+
"""The global_tagging V1 service."""
|
|
52
|
+
|
|
53
|
+
DEFAULT_SERVICE_URL = 'https://tags.global-search-tagging.cloud.ibm.com'
|
|
54
|
+
DEFAULT_SERVICE_NAME = 'global_tagging'
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def new_instance(
|
|
58
|
+
cls,
|
|
59
|
+
service_name: str = DEFAULT_SERVICE_NAME,
|
|
60
|
+
) -> 'GlobalTaggingV1':
|
|
61
|
+
"""
|
|
62
|
+
Return a new client for the global_tagging service using the specified
|
|
63
|
+
parameters and external configuration.
|
|
64
|
+
"""
|
|
65
|
+
authenticator = get_authenticator_from_environment(service_name)
|
|
66
|
+
service = cls(authenticator)
|
|
67
|
+
service.configure_service(service_name)
|
|
68
|
+
return service
|
|
69
|
+
|
|
70
|
+
def __init__(
|
|
71
|
+
self,
|
|
72
|
+
authenticator: Authenticator = None,
|
|
73
|
+
) -> None:
|
|
74
|
+
"""
|
|
75
|
+
Construct a new client for the global_tagging service.
|
|
76
|
+
|
|
77
|
+
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
|
|
78
|
+
Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
|
|
79
|
+
about initializing the authenticator of your choice.
|
|
80
|
+
"""
|
|
81
|
+
BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
|
|
82
|
+
|
|
83
|
+
#########################
|
|
84
|
+
# tags
|
|
85
|
+
#########################
|
|
86
|
+
|
|
87
|
+
def list_tags(
|
|
88
|
+
self,
|
|
89
|
+
*,
|
|
90
|
+
x_request_id: Optional[str] = None,
|
|
91
|
+
x_correlation_id: Optional[str] = None,
|
|
92
|
+
account_id: Optional[str] = None,
|
|
93
|
+
tag_type: Optional[str] = None,
|
|
94
|
+
full_data: Optional[bool] = None,
|
|
95
|
+
providers: Optional[List[str]] = None,
|
|
96
|
+
attached_to: Optional[str] = None,
|
|
97
|
+
offset: Optional[int] = None,
|
|
98
|
+
limit: Optional[int] = None,
|
|
99
|
+
timeout: Optional[int] = None,
|
|
100
|
+
order_by_name: Optional[str] = None,
|
|
101
|
+
attached_only: Optional[bool] = None,
|
|
102
|
+
**kwargs,
|
|
103
|
+
) -> DetailedResponse:
|
|
104
|
+
"""
|
|
105
|
+
Get all tags.
|
|
106
|
+
|
|
107
|
+
Lists all tags that are in a billing account. Use the `attached_to` parameter to
|
|
108
|
+
return the list of tags that are attached to the specified resource.
|
|
109
|
+
|
|
110
|
+
:param str x_request_id: (optional) An alphanumeric string that is used to
|
|
111
|
+
trace the request. The value may include ASCII alphanumerics and any of
|
|
112
|
+
following segment separators: space ( ), comma (,), hyphen, (-), and
|
|
113
|
+
underscore (_) and may have a length up to 1024 bytes. The value is
|
|
114
|
+
considered invalid and must be ignored if that value includes any other
|
|
115
|
+
character or is longer than 1024 bytes or is fewer than 8 characters. If
|
|
116
|
+
not specified or invalid, it is automatically replaced by a random (version
|
|
117
|
+
4) UUID.
|
|
118
|
+
:param str x_correlation_id: (optional) An alphanumeric string that is used
|
|
119
|
+
to trace the request as a part of a larger context: the same value is used
|
|
120
|
+
for downstream requests and retries of those requests. The value may
|
|
121
|
+
include ASCII alphanumerics and any of following segment separators: space
|
|
122
|
+
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
|
|
123
|
+
1024 bytes. The value is considered invalid and must be ignored if that
|
|
124
|
+
value includes any other character or is longer than 1024 bytes or is fewer
|
|
125
|
+
than 8 characters. If not specified or invalid, it is automatically
|
|
126
|
+
replaced by a random (version 4) UUID.
|
|
127
|
+
:param str account_id: (optional) The ID of the billing account to list the
|
|
128
|
+
tags for. If it is not set, then it is taken from the authorization token.
|
|
129
|
+
This parameter is required if `tag_type` is set to `service`.
|
|
130
|
+
:param str tag_type: (optional) The type of the tag you want to list.
|
|
131
|
+
Supported values are `user`, `service` and `access`.
|
|
132
|
+
:param bool full_data: (optional) If set to `true`, this query returns the
|
|
133
|
+
provider, `ghost`, `ims` or `ghost,ims`, where the tag exists and the
|
|
134
|
+
number of attached resources.
|
|
135
|
+
:param List[str] providers: (optional) Select a provider. Supported values
|
|
136
|
+
are `ghost` and `ims`. To list both Global Search and Tagging tags and
|
|
137
|
+
infrastructure tags, use `ghost,ims`. `service` and `access` tags can only
|
|
138
|
+
be attached to resources that are onboarded to Global Search and Tagging,
|
|
139
|
+
so you should not set this parameter to list them.
|
|
140
|
+
:param str attached_to: (optional) If you want to return only the list of
|
|
141
|
+
tags that are attached to a specified resource, pass the ID of the resource
|
|
142
|
+
on this parameter. For resources that are onboarded to Global Search and
|
|
143
|
+
Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID.
|
|
144
|
+
When using this parameter, you must specify the appropriate provider (`ims`
|
|
145
|
+
or `ghost`).
|
|
146
|
+
:param int offset: (optional) The offset is the index of the item from
|
|
147
|
+
which you want to start returning data from.
|
|
148
|
+
:param int limit: (optional) The number of tags to return.
|
|
149
|
+
:param int timeout: (optional) The timeout in milliseconds, bounds the
|
|
150
|
+
request to run within the specified time value. It returns the accumulated
|
|
151
|
+
results until time runs out.
|
|
152
|
+
:param str order_by_name: (optional) Order the output by tag name.
|
|
153
|
+
:param bool attached_only: (optional) Filter on attached tags. If `true`,
|
|
154
|
+
it returns only tags that are attached to one or more resources. If
|
|
155
|
+
`false`, it returns all tags.
|
|
156
|
+
:param dict headers: A `dict` containing the request headers
|
|
157
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
158
|
+
:rtype: DetailedResponse with `dict` result representing a `TagList` object
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
headers = {
|
|
162
|
+
'x-request-id': x_request_id,
|
|
163
|
+
'x-correlation-id': x_correlation_id,
|
|
164
|
+
}
|
|
165
|
+
sdk_headers = get_sdk_headers(
|
|
166
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
167
|
+
service_version='V1',
|
|
168
|
+
operation_id='list_tags',
|
|
169
|
+
)
|
|
170
|
+
headers.update(sdk_headers)
|
|
171
|
+
|
|
172
|
+
params = {
|
|
173
|
+
'account_id': account_id,
|
|
174
|
+
'tag_type': tag_type,
|
|
175
|
+
'full_data': full_data,
|
|
176
|
+
'providers': convert_list(providers),
|
|
177
|
+
'attached_to': attached_to,
|
|
178
|
+
'offset': offset,
|
|
179
|
+
'limit': limit,
|
|
180
|
+
'timeout': timeout,
|
|
181
|
+
'order_by_name': order_by_name,
|
|
182
|
+
'attached_only': attached_only,
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if 'headers' in kwargs:
|
|
186
|
+
headers.update(kwargs.get('headers'))
|
|
187
|
+
del kwargs['headers']
|
|
188
|
+
headers['Accept'] = 'application/json'
|
|
189
|
+
|
|
190
|
+
url = '/v3/tags'
|
|
191
|
+
request = self.prepare_request(
|
|
192
|
+
method='GET',
|
|
193
|
+
url=url,
|
|
194
|
+
headers=headers,
|
|
195
|
+
params=params,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
response = self.send(request, **kwargs)
|
|
199
|
+
return response
|
|
200
|
+
|
|
201
|
+
def create_tag(
|
|
202
|
+
self,
|
|
203
|
+
tag_names: List[str],
|
|
204
|
+
*,
|
|
205
|
+
x_request_id: Optional[str] = None,
|
|
206
|
+
x_correlation_id: Optional[str] = None,
|
|
207
|
+
account_id: Optional[str] = None,
|
|
208
|
+
tag_type: Optional[str] = None,
|
|
209
|
+
**kwargs,
|
|
210
|
+
) -> DetailedResponse:
|
|
211
|
+
"""
|
|
212
|
+
Create an access management tag.
|
|
213
|
+
|
|
214
|
+
Create an access management tag. To create an `access` tag, you must have the
|
|
215
|
+
access listed in the [Granting users access to tag
|
|
216
|
+
resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation.
|
|
217
|
+
`service` and `user` tags cannot be created upfront. They are created when they
|
|
218
|
+
are attached for the first time to a resource.
|
|
219
|
+
|
|
220
|
+
:param List[str] tag_names: An array of tag names to create.
|
|
221
|
+
:param str x_request_id: (optional) An alphanumeric string that is used to
|
|
222
|
+
trace the request. The value may include ASCII alphanumerics and any of
|
|
223
|
+
following segment separators: space ( ), comma (,), hyphen, (-), and
|
|
224
|
+
underscore (_) and may have a length up to 1024 bytes. The value is
|
|
225
|
+
considered invalid and must be ignored if that value includes any other
|
|
226
|
+
character or is longer than 1024 bytes or is fewer than 8 characters. If
|
|
227
|
+
not specified or invalid, it is automatically replaced by a random (version
|
|
228
|
+
4) UUID.
|
|
229
|
+
:param str x_correlation_id: (optional) An alphanumeric string that is used
|
|
230
|
+
to trace the request as a part of a larger context: the same value is used
|
|
231
|
+
for downstream requests and retries of those requests. The value may
|
|
232
|
+
include ASCII alphanumerics and any of following segment separators: space
|
|
233
|
+
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
|
|
234
|
+
1024 bytes. The value is considered invalid and must be ignored if that
|
|
235
|
+
value includes any other character or is longer than 1024 bytes or is fewer
|
|
236
|
+
than 8 characters. If not specified or invalid, it is automatically
|
|
237
|
+
replaced by a random (version 4) UUID.
|
|
238
|
+
:param str account_id: (optional) The ID of the billing account where the
|
|
239
|
+
tag must be created.
|
|
240
|
+
:param str tag_type: (optional) The type of the tags you want to create.
|
|
241
|
+
The only allowed value is `access`.
|
|
242
|
+
:param dict headers: A `dict` containing the request headers
|
|
243
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
244
|
+
:rtype: DetailedResponse with `dict` result representing a `CreateTagResults` object
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
if tag_names is None:
|
|
248
|
+
raise ValueError('tag_names must be provided')
|
|
249
|
+
headers = {
|
|
250
|
+
'x-request-id': x_request_id,
|
|
251
|
+
'x-correlation-id': x_correlation_id,
|
|
252
|
+
}
|
|
253
|
+
sdk_headers = get_sdk_headers(
|
|
254
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
255
|
+
service_version='V1',
|
|
256
|
+
operation_id='create_tag',
|
|
257
|
+
)
|
|
258
|
+
headers.update(sdk_headers)
|
|
259
|
+
|
|
260
|
+
params = {
|
|
261
|
+
'account_id': account_id,
|
|
262
|
+
'tag_type': tag_type,
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
data = {
|
|
266
|
+
'tag_names': tag_names,
|
|
267
|
+
}
|
|
268
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
269
|
+
data = json.dumps(data)
|
|
270
|
+
headers['content-type'] = 'application/json'
|
|
271
|
+
|
|
272
|
+
if 'headers' in kwargs:
|
|
273
|
+
headers.update(kwargs.get('headers'))
|
|
274
|
+
del kwargs['headers']
|
|
275
|
+
headers['Accept'] = 'application/json'
|
|
276
|
+
|
|
277
|
+
url = '/v3/tags'
|
|
278
|
+
request = self.prepare_request(
|
|
279
|
+
method='POST',
|
|
280
|
+
url=url,
|
|
281
|
+
headers=headers,
|
|
282
|
+
params=params,
|
|
283
|
+
data=data,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
response = self.send(request, **kwargs)
|
|
287
|
+
return response
|
|
288
|
+
|
|
289
|
+
def delete_tag_all(
|
|
290
|
+
self,
|
|
291
|
+
*,
|
|
292
|
+
x_request_id: Optional[str] = None,
|
|
293
|
+
x_correlation_id: Optional[str] = None,
|
|
294
|
+
providers: Optional[str] = None,
|
|
295
|
+
account_id: Optional[str] = None,
|
|
296
|
+
tag_type: Optional[str] = None,
|
|
297
|
+
**kwargs,
|
|
298
|
+
) -> DetailedResponse:
|
|
299
|
+
"""
|
|
300
|
+
Delete all unused tags.
|
|
301
|
+
|
|
302
|
+
Delete the tags that are not attached to any resource.
|
|
303
|
+
|
|
304
|
+
:param str x_request_id: (optional) An alphanumeric string that is used to
|
|
305
|
+
trace the request. The value may include ASCII alphanumerics and any of
|
|
306
|
+
following segment separators: space ( ), comma (,), hyphen, (-), and
|
|
307
|
+
underscore (_) and may have a length up to 1024 bytes. The value is
|
|
308
|
+
considered invalid and must be ignored if that value includes any other
|
|
309
|
+
character or is longer than 1024 bytes or is fewer than 8 characters. If
|
|
310
|
+
not specified or invalid, it is automatically replaced by a random (version
|
|
311
|
+
4) UUID.
|
|
312
|
+
:param str x_correlation_id: (optional) An alphanumeric string that is used
|
|
313
|
+
to trace the request as a part of a larger context: the same value is used
|
|
314
|
+
for downstream requests and retries of those requests. The value may
|
|
315
|
+
include ASCII alphanumerics and any of following segment separators: space
|
|
316
|
+
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
|
|
317
|
+
1024 bytes. The value is considered invalid and must be ignored if that
|
|
318
|
+
value includes any other character or is longer than 1024 bytes or is fewer
|
|
319
|
+
than 8 characters. If not specified or invalid, it is automatically
|
|
320
|
+
replaced by a random (version 4) UUID.
|
|
321
|
+
:param str providers: (optional) Select a provider. Supported values are
|
|
322
|
+
`ghost` and `ims`.
|
|
323
|
+
:param str account_id: (optional) The ID of the billing account to delete
|
|
324
|
+
the tags for. If it is not set, then it is taken from the authorization
|
|
325
|
+
token. It is a required parameter if `tag_type` is set to `service`.
|
|
326
|
+
:param str tag_type: (optional) The type of the tag. Supported values are
|
|
327
|
+
`user`, `service` and `access`. `service` and `access` are not supported
|
|
328
|
+
for IMS resources (`providers` parameter set to `ims`).
|
|
329
|
+
:param dict headers: A `dict` containing the request headers
|
|
330
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
331
|
+
:rtype: DetailedResponse with `dict` result representing a `DeleteTagsResult` object
|
|
332
|
+
"""
|
|
333
|
+
|
|
334
|
+
headers = {
|
|
335
|
+
'x-request-id': x_request_id,
|
|
336
|
+
'x-correlation-id': x_correlation_id,
|
|
337
|
+
}
|
|
338
|
+
sdk_headers = get_sdk_headers(
|
|
339
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
340
|
+
service_version='V1',
|
|
341
|
+
operation_id='delete_tag_all',
|
|
342
|
+
)
|
|
343
|
+
headers.update(sdk_headers)
|
|
344
|
+
|
|
345
|
+
params = {
|
|
346
|
+
'providers': providers,
|
|
347
|
+
'account_id': account_id,
|
|
348
|
+
'tag_type': tag_type,
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if 'headers' in kwargs:
|
|
352
|
+
headers.update(kwargs.get('headers'))
|
|
353
|
+
del kwargs['headers']
|
|
354
|
+
headers['Accept'] = 'application/json'
|
|
355
|
+
|
|
356
|
+
url = '/v3/tags'
|
|
357
|
+
request = self.prepare_request(
|
|
358
|
+
method='DELETE',
|
|
359
|
+
url=url,
|
|
360
|
+
headers=headers,
|
|
361
|
+
params=params,
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
response = self.send(request, **kwargs)
|
|
365
|
+
return response
|
|
366
|
+
|
|
367
|
+
def delete_tag(
|
|
368
|
+
self,
|
|
369
|
+
tag_name: str,
|
|
370
|
+
*,
|
|
371
|
+
x_request_id: Optional[str] = None,
|
|
372
|
+
x_correlation_id: Optional[str] = None,
|
|
373
|
+
providers: Optional[List[str]] = None,
|
|
374
|
+
account_id: Optional[str] = None,
|
|
375
|
+
tag_type: Optional[str] = None,
|
|
376
|
+
**kwargs,
|
|
377
|
+
) -> DetailedResponse:
|
|
378
|
+
"""
|
|
379
|
+
Delete an unused tag.
|
|
380
|
+
|
|
381
|
+
Delete an existing tag. A tag can be deleted only if it is not attached to any
|
|
382
|
+
resource.
|
|
383
|
+
|
|
384
|
+
:param str tag_name: The name of tag to be deleted.
|
|
385
|
+
:param str x_request_id: (optional) An alphanumeric string that is used to
|
|
386
|
+
trace the request. The value may include ASCII alphanumerics and any of
|
|
387
|
+
following segment separators: space ( ), comma (,), hyphen, (-), and
|
|
388
|
+
underscore (_) and may have a length up to 1024 bytes. The value is
|
|
389
|
+
considered invalid and must be ignored if that value includes any other
|
|
390
|
+
character or is longer than 1024 bytes or is fewer than 8 characters. If
|
|
391
|
+
not specified or invalid, it is automatically replaced by a random (version
|
|
392
|
+
4) UUID.
|
|
393
|
+
:param str x_correlation_id: (optional) An alphanumeric string that is used
|
|
394
|
+
to trace the request as a part of a larger context: the same value is used
|
|
395
|
+
for downstream requests and retries of those requests. The value may
|
|
396
|
+
include ASCII alphanumerics and any of following segment separators: space
|
|
397
|
+
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
|
|
398
|
+
1024 bytes. The value is considered invalid and must be ignored if that
|
|
399
|
+
value includes any other character or is longer than 1024 bytes or is fewer
|
|
400
|
+
than 8 characters. If not specified or invalid, it is automatically
|
|
401
|
+
replaced by a random (version 4) UUID.
|
|
402
|
+
:param List[str] providers: (optional) Select a provider. Supported values
|
|
403
|
+
are `ghost` and `ims`. To delete tags both in Global Search and Tagging and
|
|
404
|
+
in IMS, use `ghost,ims`.
|
|
405
|
+
:param str account_id: (optional) The ID of the billing account to delete
|
|
406
|
+
the tag for. It is a required parameter if `tag_type` is set to `service`,
|
|
407
|
+
otherwise it is inferred from the authorization IAM token.
|
|
408
|
+
:param str tag_type: (optional) The type of the tag. Supported values are
|
|
409
|
+
`user`, `service` and `access`. `service` and `access` are not supported
|
|
410
|
+
for IMS resources (`providers` parameter set to `ims`).
|
|
411
|
+
:param dict headers: A `dict` containing the request headers
|
|
412
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
413
|
+
:rtype: DetailedResponse with `dict` result representing a `DeleteTagResults` object
|
|
414
|
+
"""
|
|
415
|
+
|
|
416
|
+
if not tag_name:
|
|
417
|
+
raise ValueError('tag_name must be provided')
|
|
418
|
+
headers = {
|
|
419
|
+
'x-request-id': x_request_id,
|
|
420
|
+
'x-correlation-id': x_correlation_id,
|
|
421
|
+
}
|
|
422
|
+
sdk_headers = get_sdk_headers(
|
|
423
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
424
|
+
service_version='V1',
|
|
425
|
+
operation_id='delete_tag',
|
|
426
|
+
)
|
|
427
|
+
headers.update(sdk_headers)
|
|
428
|
+
|
|
429
|
+
params = {
|
|
430
|
+
'providers': convert_list(providers),
|
|
431
|
+
'account_id': account_id,
|
|
432
|
+
'tag_type': tag_type,
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if 'headers' in kwargs:
|
|
436
|
+
headers.update(kwargs.get('headers'))
|
|
437
|
+
del kwargs['headers']
|
|
438
|
+
headers['Accept'] = 'application/json'
|
|
439
|
+
|
|
440
|
+
path_param_keys = ['tag_name']
|
|
441
|
+
path_param_values = self.encode_path_vars(tag_name)
|
|
442
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
443
|
+
url = '/v3/tags/{tag_name}'.format(**path_param_dict)
|
|
444
|
+
request = self.prepare_request(
|
|
445
|
+
method='DELETE',
|
|
446
|
+
url=url,
|
|
447
|
+
headers=headers,
|
|
448
|
+
params=params,
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
response = self.send(request, **kwargs)
|
|
452
|
+
return response
|
|
453
|
+
|
|
454
|
+
def attach_tag(
|
|
455
|
+
self,
|
|
456
|
+
resources: List['Resource'],
|
|
457
|
+
*,
|
|
458
|
+
tag_name: Optional[str] = None,
|
|
459
|
+
tag_names: Optional[List[str]] = None,
|
|
460
|
+
x_request_id: Optional[str] = None,
|
|
461
|
+
x_correlation_id: Optional[str] = None,
|
|
462
|
+
account_id: Optional[str] = None,
|
|
463
|
+
tag_type: Optional[str] = None,
|
|
464
|
+
replace: Optional[bool] = None,
|
|
465
|
+
update: Optional[bool] = None,
|
|
466
|
+
**kwargs,
|
|
467
|
+
) -> DetailedResponse:
|
|
468
|
+
"""
|
|
469
|
+
Attach tags.
|
|
470
|
+
|
|
471
|
+
Attaches one or more tags to one or more resources. Each resource can have no more
|
|
472
|
+
than 1000 tags per each 'user' and 'service' type, and no more than 250 'access'
|
|
473
|
+
tags (which is the account limit).
|
|
474
|
+
|
|
475
|
+
:param List[Resource] resources: List of resources on which the tag or tags
|
|
476
|
+
are attached.
|
|
477
|
+
:param str tag_name: (optional) The name of the tag to attach.
|
|
478
|
+
:param List[str] tag_names: (optional) An array of tag names to attach.
|
|
479
|
+
:param str x_request_id: (optional) An alphanumeric string that is used to
|
|
480
|
+
trace the request. The value may include ASCII alphanumerics and any of
|
|
481
|
+
following segment separators: space ( ), comma (,), hyphen, (-), and
|
|
482
|
+
underscore (_) and may have a length up to 1024 bytes. The value is
|
|
483
|
+
considered invalid and must be ignored if that value includes any other
|
|
484
|
+
character or is longer than 1024 bytes or is fewer than 8 characters. If
|
|
485
|
+
not specified or invalid, it is automatically replaced by a random (version
|
|
486
|
+
4) UUID.
|
|
487
|
+
:param str x_correlation_id: (optional) An alphanumeric string that is used
|
|
488
|
+
to trace the request as a part of a larger context: the same value is used
|
|
489
|
+
for downstream requests and retries of those requests. The value may
|
|
490
|
+
include ASCII alphanumerics and any of following segment separators: space
|
|
491
|
+
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
|
|
492
|
+
1024 bytes. The value is considered invalid and must be ignored if that
|
|
493
|
+
value includes any other character or is longer than 1024 bytes or is fewer
|
|
494
|
+
than 8 characters. If not specified or invalid, it is automatically
|
|
495
|
+
replaced by a random (version 4) UUID.
|
|
496
|
+
:param str account_id: (optional) The ID of the billing account of the
|
|
497
|
+
tagged resource. It is a required parameter if `tag_type` is set to
|
|
498
|
+
`service`. Otherwise, it is inferred from the authorization IAM token.
|
|
499
|
+
:param str tag_type: (optional) The type of the tag. Supported values are
|
|
500
|
+
`user`, `service` and `access`. `service` and `access` are not supported
|
|
501
|
+
for IMS resources.
|
|
502
|
+
:param bool replace: (optional) Flag to request replacement of all attached
|
|
503
|
+
tags. Set `true` if you want to replace all tags attached to the resource
|
|
504
|
+
with the current ones. Default value is false.
|
|
505
|
+
:param bool update: (optional) Flag to request update of attached tags in
|
|
506
|
+
the format `key:value`. Here's how it works for each tag in the request
|
|
507
|
+
body: If the tag to attach is in the format `key:value`, the System will
|
|
508
|
+
atomically detach all existing tags starting with `key:` and attach the new
|
|
509
|
+
`key:value` tag. If no such tags exist, a new `key:value` tag will be
|
|
510
|
+
attached. If the tag is not in the `key:value` format (e.g., a simple
|
|
511
|
+
label), the System will attach the label as usual. The update query
|
|
512
|
+
parameter is available for user and access management tags, but not for
|
|
513
|
+
service tags.
|
|
514
|
+
:param dict headers: A `dict` containing the request headers
|
|
515
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
516
|
+
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
|
|
517
|
+
"""
|
|
518
|
+
|
|
519
|
+
if resources is None:
|
|
520
|
+
raise ValueError('resources must be provided')
|
|
521
|
+
resources = [convert_model(x) for x in resources]
|
|
522
|
+
headers = {
|
|
523
|
+
'x-request-id': x_request_id,
|
|
524
|
+
'x-correlation-id': x_correlation_id,
|
|
525
|
+
}
|
|
526
|
+
sdk_headers = get_sdk_headers(
|
|
527
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
528
|
+
service_version='V1',
|
|
529
|
+
operation_id='attach_tag',
|
|
530
|
+
)
|
|
531
|
+
headers.update(sdk_headers)
|
|
532
|
+
|
|
533
|
+
params = {
|
|
534
|
+
'account_id': account_id,
|
|
535
|
+
'tag_type': tag_type,
|
|
536
|
+
'replace': replace,
|
|
537
|
+
'update': update,
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
data = {
|
|
541
|
+
'resources': resources,
|
|
542
|
+
'tag_name': tag_name,
|
|
543
|
+
'tag_names': tag_names,
|
|
544
|
+
}
|
|
545
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
546
|
+
data = json.dumps(data)
|
|
547
|
+
headers['content-type'] = 'application/json'
|
|
548
|
+
|
|
549
|
+
if 'headers' in kwargs:
|
|
550
|
+
headers.update(kwargs.get('headers'))
|
|
551
|
+
del kwargs['headers']
|
|
552
|
+
headers['Accept'] = 'application/json'
|
|
553
|
+
|
|
554
|
+
url = '/v3/tags/attach'
|
|
555
|
+
request = self.prepare_request(
|
|
556
|
+
method='POST',
|
|
557
|
+
url=url,
|
|
558
|
+
headers=headers,
|
|
559
|
+
params=params,
|
|
560
|
+
data=data,
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
response = self.send(request, **kwargs)
|
|
564
|
+
return response
|
|
565
|
+
|
|
566
|
+
def detach_tag(
|
|
567
|
+
self,
|
|
568
|
+
resources: List['Resource'],
|
|
569
|
+
*,
|
|
570
|
+
tag_name: Optional[str] = None,
|
|
571
|
+
tag_names: Optional[List[str]] = None,
|
|
572
|
+
x_request_id: Optional[str] = None,
|
|
573
|
+
x_correlation_id: Optional[str] = None,
|
|
574
|
+
account_id: Optional[str] = None,
|
|
575
|
+
tag_type: Optional[str] = None,
|
|
576
|
+
**kwargs,
|
|
577
|
+
) -> DetailedResponse:
|
|
578
|
+
"""
|
|
579
|
+
Detach tags.
|
|
580
|
+
|
|
581
|
+
Detaches one or more tags from one or more resources.
|
|
582
|
+
|
|
583
|
+
:param List[Resource] resources: List of resources on which the tag or tags
|
|
584
|
+
are detached.
|
|
585
|
+
:param str tag_name: (optional) The name of the tag to detach.
|
|
586
|
+
:param List[str] tag_names: (optional) An array of tag names to detach.
|
|
587
|
+
:param str x_request_id: (optional) An alphanumeric string that is used to
|
|
588
|
+
trace the request. The value may include ASCII alphanumerics and any of
|
|
589
|
+
following segment separators: space ( ), comma (,), hyphen, (-), and
|
|
590
|
+
underscore (_) and may have a length up to 1024 bytes. The value is
|
|
591
|
+
considered invalid and must be ignored if that value includes any other
|
|
592
|
+
character or is longer than 1024 bytes or is fewer than 8 characters. If
|
|
593
|
+
not specified or invalid, it is automatically replaced by a random (version
|
|
594
|
+
4) UUID.
|
|
595
|
+
:param str x_correlation_id: (optional) An alphanumeric string that is used
|
|
596
|
+
to trace the request as a part of a larger context: the same value is used
|
|
597
|
+
for downstream requests and retries of those requests. The value may
|
|
598
|
+
include ASCII alphanumerics and any of following segment separators: space
|
|
599
|
+
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
|
|
600
|
+
1024 bytes. The value is considered invalid and must be ignored if that
|
|
601
|
+
value includes any other character or is longer than 1024 bytes or is fewer
|
|
602
|
+
than 8 characters. If not specified or invalid, it is automatically
|
|
603
|
+
replaced by a random (version 4) UUID.
|
|
604
|
+
:param str account_id: (optional) The ID of the billing account of the
|
|
605
|
+
untagged resource. It is a required parameter if `tag_type` is set to
|
|
606
|
+
`service`, otherwise it is inferred from the authorization IAM token.
|
|
607
|
+
:param str tag_type: (optional) The type of the tag. Supported values are
|
|
608
|
+
`user`, `service` and `access`. `service` and `access` are not supported
|
|
609
|
+
for IMS resources.
|
|
610
|
+
:param dict headers: A `dict` containing the request headers
|
|
611
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
612
|
+
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
|
|
613
|
+
"""
|
|
614
|
+
|
|
615
|
+
if resources is None:
|
|
616
|
+
raise ValueError('resources must be provided')
|
|
617
|
+
resources = [convert_model(x) for x in resources]
|
|
618
|
+
headers = {
|
|
619
|
+
'x-request-id': x_request_id,
|
|
620
|
+
'x-correlation-id': x_correlation_id,
|
|
621
|
+
}
|
|
622
|
+
sdk_headers = get_sdk_headers(
|
|
623
|
+
service_name=self.DEFAULT_SERVICE_NAME,
|
|
624
|
+
service_version='V1',
|
|
625
|
+
operation_id='detach_tag',
|
|
626
|
+
)
|
|
627
|
+
headers.update(sdk_headers)
|
|
628
|
+
|
|
629
|
+
params = {
|
|
630
|
+
'account_id': account_id,
|
|
631
|
+
'tag_type': tag_type,
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
data = {
|
|
635
|
+
'resources': resources,
|
|
636
|
+
'tag_name': tag_name,
|
|
637
|
+
'tag_names': tag_names,
|
|
638
|
+
}
|
|
639
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
640
|
+
data = json.dumps(data)
|
|
641
|
+
headers['content-type'] = 'application/json'
|
|
642
|
+
|
|
643
|
+
if 'headers' in kwargs:
|
|
644
|
+
headers.update(kwargs.get('headers'))
|
|
645
|
+
del kwargs['headers']
|
|
646
|
+
headers['Accept'] = 'application/json'
|
|
647
|
+
|
|
648
|
+
url = '/v3/tags/detach'
|
|
649
|
+
request = self.prepare_request(
|
|
650
|
+
method='POST',
|
|
651
|
+
url=url,
|
|
652
|
+
headers=headers,
|
|
653
|
+
params=params,
|
|
654
|
+
data=data,
|
|
655
|
+
)
|
|
656
|
+
|
|
657
|
+
response = self.send(request, **kwargs)
|
|
658
|
+
return response
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
class ListTagsEnums:
|
|
662
|
+
"""
|
|
663
|
+
Enums for list_tags parameters.
|
|
664
|
+
"""
|
|
665
|
+
|
|
666
|
+
class TagType(str, Enum):
|
|
667
|
+
"""
|
|
668
|
+
The type of the tag you want to list. Supported values are `user`, `service` and
|
|
669
|
+
`access`.
|
|
670
|
+
"""
|
|
671
|
+
|
|
672
|
+
USER = 'user'
|
|
673
|
+
SERVICE = 'service'
|
|
674
|
+
ACCESS = 'access'
|
|
675
|
+
|
|
676
|
+
class Providers(str, Enum):
|
|
677
|
+
"""
|
|
678
|
+
Select a provider. Supported values are `ghost` and `ims`. To list both Global
|
|
679
|
+
Search and Tagging tags and infrastructure tags, use `ghost,ims`. `service` and
|
|
680
|
+
`access` tags can only be attached to resources that are onboarded to Global
|
|
681
|
+
Search and Tagging, so you should not set this parameter to list them.
|
|
682
|
+
"""
|
|
683
|
+
|
|
684
|
+
GHOST = 'ghost'
|
|
685
|
+
IMS = 'ims'
|
|
686
|
+
|
|
687
|
+
class OrderByName(str, Enum):
|
|
688
|
+
"""
|
|
689
|
+
Order the output by tag name.
|
|
690
|
+
"""
|
|
691
|
+
|
|
692
|
+
ASC = 'asc'
|
|
693
|
+
DESC = 'desc'
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
class CreateTagEnums:
|
|
697
|
+
"""
|
|
698
|
+
Enums for create_tag parameters.
|
|
699
|
+
"""
|
|
700
|
+
|
|
701
|
+
class TagType(str, Enum):
|
|
702
|
+
"""
|
|
703
|
+
The type of the tags you want to create. The only allowed value is `access`.
|
|
704
|
+
"""
|
|
705
|
+
|
|
706
|
+
ACCESS = 'access'
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
class DeleteTagAllEnums:
|
|
710
|
+
"""
|
|
711
|
+
Enums for delete_tag_all parameters.
|
|
712
|
+
"""
|
|
713
|
+
|
|
714
|
+
class Providers(str, Enum):
|
|
715
|
+
"""
|
|
716
|
+
Select a provider. Supported values are `ghost` and `ims`.
|
|
717
|
+
"""
|
|
718
|
+
|
|
719
|
+
GHOST = 'ghost'
|
|
720
|
+
IMS = 'ims'
|
|
721
|
+
|
|
722
|
+
class TagType(str, Enum):
|
|
723
|
+
"""
|
|
724
|
+
The type of the tag. Supported values are `user`, `service` and `access`.
|
|
725
|
+
`service` and `access` are not supported for IMS resources (`providers` parameter
|
|
726
|
+
set to `ims`).
|
|
727
|
+
"""
|
|
728
|
+
|
|
729
|
+
USER = 'user'
|
|
730
|
+
SERVICE = 'service'
|
|
731
|
+
ACCESS = 'access'
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
class DeleteTagEnums:
|
|
735
|
+
"""
|
|
736
|
+
Enums for delete_tag parameters.
|
|
737
|
+
"""
|
|
738
|
+
|
|
739
|
+
class Providers(str, Enum):
|
|
740
|
+
"""
|
|
741
|
+
Select a provider. Supported values are `ghost` and `ims`. To delete tags both in
|
|
742
|
+
Global Search and Tagging and in IMS, use `ghost,ims`.
|
|
743
|
+
"""
|
|
744
|
+
|
|
745
|
+
GHOST = 'ghost'
|
|
746
|
+
IMS = 'ims'
|
|
747
|
+
|
|
748
|
+
class TagType(str, Enum):
|
|
749
|
+
"""
|
|
750
|
+
The type of the tag. Supported values are `user`, `service` and `access`.
|
|
751
|
+
`service` and `access` are not supported for IMS resources (`providers` parameter
|
|
752
|
+
set to `ims`).
|
|
753
|
+
"""
|
|
754
|
+
|
|
755
|
+
USER = 'user'
|
|
756
|
+
SERVICE = 'service'
|
|
757
|
+
ACCESS = 'access'
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
class AttachTagEnums:
|
|
761
|
+
"""
|
|
762
|
+
Enums for attach_tag parameters.
|
|
763
|
+
"""
|
|
764
|
+
|
|
765
|
+
class TagType(str, Enum):
|
|
766
|
+
"""
|
|
767
|
+
The type of the tag. Supported values are `user`, `service` and `access`.
|
|
768
|
+
`service` and `access` are not supported for IMS resources.
|
|
769
|
+
"""
|
|
770
|
+
|
|
771
|
+
USER = 'user'
|
|
772
|
+
SERVICE = 'service'
|
|
773
|
+
ACCESS = 'access'
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
class DetachTagEnums:
|
|
777
|
+
"""
|
|
778
|
+
Enums for detach_tag parameters.
|
|
779
|
+
"""
|
|
780
|
+
|
|
781
|
+
class TagType(str, Enum):
|
|
782
|
+
"""
|
|
783
|
+
The type of the tag. Supported values are `user`, `service` and `access`.
|
|
784
|
+
`service` and `access` are not supported for IMS resources.
|
|
785
|
+
"""
|
|
786
|
+
|
|
787
|
+
USER = 'user'
|
|
788
|
+
SERVICE = 'service'
|
|
789
|
+
ACCESS = 'access'
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
##############################################################################
|
|
793
|
+
# Models
|
|
794
|
+
##############################################################################
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
class CreateTagResults:
|
|
798
|
+
"""
|
|
799
|
+
Results of a create tag(s) request.
|
|
800
|
+
|
|
801
|
+
:param List[CreateTagResultsResultsItem] results: (optional) Array of results of
|
|
802
|
+
a create_tag request.
|
|
803
|
+
"""
|
|
804
|
+
|
|
805
|
+
def __init__(
|
|
806
|
+
self,
|
|
807
|
+
*,
|
|
808
|
+
results: Optional[List['CreateTagResultsResultsItem']] = None,
|
|
809
|
+
) -> None:
|
|
810
|
+
"""
|
|
811
|
+
Initialize a CreateTagResults object.
|
|
812
|
+
|
|
813
|
+
:param List[CreateTagResultsResultsItem] results: (optional) Array of
|
|
814
|
+
results of a create_tag request.
|
|
815
|
+
"""
|
|
816
|
+
self.results = results
|
|
817
|
+
|
|
818
|
+
@classmethod
|
|
819
|
+
def from_dict(cls, _dict: Dict) -> 'CreateTagResults':
|
|
820
|
+
"""Initialize a CreateTagResults object from a json dictionary."""
|
|
821
|
+
args = {}
|
|
822
|
+
if (results := _dict.get('results')) is not None:
|
|
823
|
+
args['results'] = [CreateTagResultsResultsItem.from_dict(v) for v in results]
|
|
824
|
+
return cls(**args)
|
|
825
|
+
|
|
826
|
+
@classmethod
|
|
827
|
+
def _from_dict(cls, _dict):
|
|
828
|
+
"""Initialize a CreateTagResults object from a json dictionary."""
|
|
829
|
+
return cls.from_dict(_dict)
|
|
830
|
+
|
|
831
|
+
def to_dict(self) -> Dict:
|
|
832
|
+
"""Return a json dictionary representing this model."""
|
|
833
|
+
_dict = {}
|
|
834
|
+
if hasattr(self, 'results') and self.results is not None:
|
|
835
|
+
results_list = []
|
|
836
|
+
for v in self.results:
|
|
837
|
+
if isinstance(v, dict):
|
|
838
|
+
results_list.append(v)
|
|
839
|
+
else:
|
|
840
|
+
results_list.append(v.to_dict())
|
|
841
|
+
_dict['results'] = results_list
|
|
842
|
+
return _dict
|
|
843
|
+
|
|
844
|
+
def _to_dict(self):
|
|
845
|
+
"""Return a json dictionary representing this model."""
|
|
846
|
+
return self.to_dict()
|
|
847
|
+
|
|
848
|
+
def __str__(self) -> str:
|
|
849
|
+
"""Return a `str` version of this CreateTagResults object."""
|
|
850
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
851
|
+
|
|
852
|
+
def __eq__(self, other: 'CreateTagResults') -> bool:
|
|
853
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
854
|
+
if not isinstance(other, self.__class__):
|
|
855
|
+
return False
|
|
856
|
+
return self.__dict__ == other.__dict__
|
|
857
|
+
|
|
858
|
+
def __ne__(self, other: 'CreateTagResults') -> bool:
|
|
859
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
860
|
+
return not self == other
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
class CreateTagResultsResultsItem:
|
|
864
|
+
"""
|
|
865
|
+
CreateTagResultsResultsItem.
|
|
866
|
+
|
|
867
|
+
:param str tag_name: (optional) The name of the tag created.
|
|
868
|
+
:param bool is_error: (optional) true if the tag was not created (for example,
|
|
869
|
+
the tag already exists).
|
|
870
|
+
"""
|
|
871
|
+
|
|
872
|
+
def __init__(
|
|
873
|
+
self,
|
|
874
|
+
*,
|
|
875
|
+
tag_name: Optional[str] = None,
|
|
876
|
+
is_error: Optional[bool] = None,
|
|
877
|
+
) -> None:
|
|
878
|
+
"""
|
|
879
|
+
Initialize a CreateTagResultsResultsItem object.
|
|
880
|
+
|
|
881
|
+
:param str tag_name: (optional) The name of the tag created.
|
|
882
|
+
:param bool is_error: (optional) true if the tag was not created (for
|
|
883
|
+
example, the tag already exists).
|
|
884
|
+
"""
|
|
885
|
+
self.tag_name = tag_name
|
|
886
|
+
self.is_error = is_error
|
|
887
|
+
|
|
888
|
+
@classmethod
|
|
889
|
+
def from_dict(cls, _dict: Dict) -> 'CreateTagResultsResultsItem':
|
|
890
|
+
"""Initialize a CreateTagResultsResultsItem object from a json dictionary."""
|
|
891
|
+
args = {}
|
|
892
|
+
if (tag_name := _dict.get('tag_name')) is not None:
|
|
893
|
+
args['tag_name'] = tag_name
|
|
894
|
+
if (is_error := _dict.get('is_error')) is not None:
|
|
895
|
+
args['is_error'] = is_error
|
|
896
|
+
return cls(**args)
|
|
897
|
+
|
|
898
|
+
@classmethod
|
|
899
|
+
def _from_dict(cls, _dict):
|
|
900
|
+
"""Initialize a CreateTagResultsResultsItem object from a json dictionary."""
|
|
901
|
+
return cls.from_dict(_dict)
|
|
902
|
+
|
|
903
|
+
def to_dict(self) -> Dict:
|
|
904
|
+
"""Return a json dictionary representing this model."""
|
|
905
|
+
_dict = {}
|
|
906
|
+
if hasattr(self, 'tag_name') and self.tag_name is not None:
|
|
907
|
+
_dict['tag_name'] = self.tag_name
|
|
908
|
+
if hasattr(self, 'is_error') and self.is_error is not None:
|
|
909
|
+
_dict['is_error'] = self.is_error
|
|
910
|
+
return _dict
|
|
911
|
+
|
|
912
|
+
def _to_dict(self):
|
|
913
|
+
"""Return a json dictionary representing this model."""
|
|
914
|
+
return self.to_dict()
|
|
915
|
+
|
|
916
|
+
def __str__(self) -> str:
|
|
917
|
+
"""Return a `str` version of this CreateTagResultsResultsItem object."""
|
|
918
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
919
|
+
|
|
920
|
+
def __eq__(self, other: 'CreateTagResultsResultsItem') -> bool:
|
|
921
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
922
|
+
if not isinstance(other, self.__class__):
|
|
923
|
+
return False
|
|
924
|
+
return self.__dict__ == other.__dict__
|
|
925
|
+
|
|
926
|
+
def __ne__(self, other: 'CreateTagResultsResultsItem') -> bool:
|
|
927
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
928
|
+
return not self == other
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
class DeleteTagResults:
|
|
932
|
+
"""
|
|
933
|
+
Results of a delete_tag request.
|
|
934
|
+
|
|
935
|
+
:param List[DeleteTagResultsItem] results: (optional) Array of results of a
|
|
936
|
+
delete_tag request.
|
|
937
|
+
"""
|
|
938
|
+
|
|
939
|
+
def __init__(
|
|
940
|
+
self,
|
|
941
|
+
*,
|
|
942
|
+
results: Optional[List['DeleteTagResultsItem']] = None,
|
|
943
|
+
) -> None:
|
|
944
|
+
"""
|
|
945
|
+
Initialize a DeleteTagResults object.
|
|
946
|
+
|
|
947
|
+
:param List[DeleteTagResultsItem] results: (optional) Array of results of a
|
|
948
|
+
delete_tag request.
|
|
949
|
+
"""
|
|
950
|
+
self.results = results
|
|
951
|
+
|
|
952
|
+
@classmethod
|
|
953
|
+
def from_dict(cls, _dict: Dict) -> 'DeleteTagResults':
|
|
954
|
+
"""Initialize a DeleteTagResults object from a json dictionary."""
|
|
955
|
+
args = {}
|
|
956
|
+
if (results := _dict.get('results')) is not None:
|
|
957
|
+
args['results'] = [DeleteTagResultsItem.from_dict(v) for v in results]
|
|
958
|
+
return cls(**args)
|
|
959
|
+
|
|
960
|
+
@classmethod
|
|
961
|
+
def _from_dict(cls, _dict):
|
|
962
|
+
"""Initialize a DeleteTagResults object from a json dictionary."""
|
|
963
|
+
return cls.from_dict(_dict)
|
|
964
|
+
|
|
965
|
+
def to_dict(self) -> Dict:
|
|
966
|
+
"""Return a json dictionary representing this model."""
|
|
967
|
+
_dict = {}
|
|
968
|
+
if hasattr(self, 'results') and self.results is not None:
|
|
969
|
+
results_list = []
|
|
970
|
+
for v in self.results:
|
|
971
|
+
if isinstance(v, dict):
|
|
972
|
+
results_list.append(v)
|
|
973
|
+
else:
|
|
974
|
+
results_list.append(v.to_dict())
|
|
975
|
+
_dict['results'] = results_list
|
|
976
|
+
return _dict
|
|
977
|
+
|
|
978
|
+
def _to_dict(self):
|
|
979
|
+
"""Return a json dictionary representing this model."""
|
|
980
|
+
return self.to_dict()
|
|
981
|
+
|
|
982
|
+
def __str__(self) -> str:
|
|
983
|
+
"""Return a `str` version of this DeleteTagResults object."""
|
|
984
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
985
|
+
|
|
986
|
+
def __eq__(self, other: 'DeleteTagResults') -> bool:
|
|
987
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
988
|
+
if not isinstance(other, self.__class__):
|
|
989
|
+
return False
|
|
990
|
+
return self.__dict__ == other.__dict__
|
|
991
|
+
|
|
992
|
+
def __ne__(self, other: 'DeleteTagResults') -> bool:
|
|
993
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
994
|
+
return not self == other
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
class DeleteTagResultsItem:
|
|
998
|
+
"""
|
|
999
|
+
Result of a delete_tag request.
|
|
1000
|
+
|
|
1001
|
+
:param str provider: (optional) The provider of the tag.
|
|
1002
|
+
:param bool is_error: (optional) It is `true` if the operation exits with an
|
|
1003
|
+
error (for example, the tag does not exist).
|
|
1004
|
+
"""
|
|
1005
|
+
|
|
1006
|
+
# The set of defined properties for the class
|
|
1007
|
+
_properties = frozenset(['provider', 'is_error'])
|
|
1008
|
+
|
|
1009
|
+
def __init__(
|
|
1010
|
+
self,
|
|
1011
|
+
*,
|
|
1012
|
+
provider: Optional[str] = None,
|
|
1013
|
+
is_error: Optional[bool] = None,
|
|
1014
|
+
**kwargs,
|
|
1015
|
+
) -> None:
|
|
1016
|
+
"""
|
|
1017
|
+
Initialize a DeleteTagResultsItem object.
|
|
1018
|
+
|
|
1019
|
+
:param str provider: (optional) The provider of the tag.
|
|
1020
|
+
:param bool is_error: (optional) It is `true` if the operation exits with
|
|
1021
|
+
an error (for example, the tag does not exist).
|
|
1022
|
+
:param **kwargs: (optional) Any additional properties.
|
|
1023
|
+
"""
|
|
1024
|
+
self.provider = provider
|
|
1025
|
+
self.is_error = is_error
|
|
1026
|
+
for _key, _value in kwargs.items():
|
|
1027
|
+
setattr(self, _key, _value)
|
|
1028
|
+
|
|
1029
|
+
@classmethod
|
|
1030
|
+
def from_dict(cls, _dict: Dict) -> 'DeleteTagResultsItem':
|
|
1031
|
+
"""Initialize a DeleteTagResultsItem object from a json dictionary."""
|
|
1032
|
+
args = {}
|
|
1033
|
+
if (provider := _dict.get('provider')) is not None:
|
|
1034
|
+
args['provider'] = provider
|
|
1035
|
+
if (is_error := _dict.get('is_error')) is not None:
|
|
1036
|
+
args['is_error'] = is_error
|
|
1037
|
+
args.update({k: v for (k, v) in _dict.items() if k not in cls._properties})
|
|
1038
|
+
return cls(**args)
|
|
1039
|
+
|
|
1040
|
+
@classmethod
|
|
1041
|
+
def _from_dict(cls, _dict):
|
|
1042
|
+
"""Initialize a DeleteTagResultsItem object from a json dictionary."""
|
|
1043
|
+
return cls.from_dict(_dict)
|
|
1044
|
+
|
|
1045
|
+
def to_dict(self) -> Dict:
|
|
1046
|
+
"""Return a json dictionary representing this model."""
|
|
1047
|
+
_dict = {}
|
|
1048
|
+
if hasattr(self, 'provider') and self.provider is not None:
|
|
1049
|
+
_dict['provider'] = self.provider
|
|
1050
|
+
if hasattr(self, 'is_error') and self.is_error is not None:
|
|
1051
|
+
_dict['is_error'] = self.is_error
|
|
1052
|
+
for _key in [k for k in vars(self).keys() if k not in DeleteTagResultsItem._properties]:
|
|
1053
|
+
_dict[_key] = getattr(self, _key)
|
|
1054
|
+
return _dict
|
|
1055
|
+
|
|
1056
|
+
def _to_dict(self):
|
|
1057
|
+
"""Return a json dictionary representing this model."""
|
|
1058
|
+
return self.to_dict()
|
|
1059
|
+
|
|
1060
|
+
def get_properties(self) -> Dict:
|
|
1061
|
+
"""Return a dictionary of arbitrary properties from this instance of DeleteTagResultsItem"""
|
|
1062
|
+
_dict = {}
|
|
1063
|
+
|
|
1064
|
+
for _key in [k for k in vars(self).keys() if k not in DeleteTagResultsItem._properties]:
|
|
1065
|
+
_dict[_key] = getattr(self, _key)
|
|
1066
|
+
return _dict
|
|
1067
|
+
|
|
1068
|
+
def set_properties(self, _dict: dict):
|
|
1069
|
+
"""Set a dictionary of arbitrary properties to this instance of DeleteTagResultsItem"""
|
|
1070
|
+
for _key in [k for k in vars(self).keys() if k not in DeleteTagResultsItem._properties]:
|
|
1071
|
+
delattr(self, _key)
|
|
1072
|
+
|
|
1073
|
+
for _key, _value in _dict.items():
|
|
1074
|
+
if _key not in DeleteTagResultsItem._properties:
|
|
1075
|
+
setattr(self, _key, _value)
|
|
1076
|
+
|
|
1077
|
+
def __str__(self) -> str:
|
|
1078
|
+
"""Return a `str` version of this DeleteTagResultsItem object."""
|
|
1079
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1080
|
+
|
|
1081
|
+
def __eq__(self, other: 'DeleteTagResultsItem') -> bool:
|
|
1082
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1083
|
+
if not isinstance(other, self.__class__):
|
|
1084
|
+
return False
|
|
1085
|
+
return self.__dict__ == other.__dict__
|
|
1086
|
+
|
|
1087
|
+
def __ne__(self, other: 'DeleteTagResultsItem') -> bool:
|
|
1088
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1089
|
+
return not self == other
|
|
1090
|
+
|
|
1091
|
+
class ProviderEnum(str, Enum):
|
|
1092
|
+
"""
|
|
1093
|
+
The provider of the tag.
|
|
1094
|
+
"""
|
|
1095
|
+
|
|
1096
|
+
GHOST = 'ghost'
|
|
1097
|
+
IMS = 'ims'
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
class DeleteTagsResult:
|
|
1101
|
+
"""
|
|
1102
|
+
Results of deleting unattatched tags.
|
|
1103
|
+
|
|
1104
|
+
:param int total_count: (optional) The number of tags that have been deleted.
|
|
1105
|
+
:param bool errors: (optional) It is set to true if there is at least one tag
|
|
1106
|
+
operation in error.
|
|
1107
|
+
:param List[DeleteTagsResultItem] items: (optional) The list of tag operation
|
|
1108
|
+
results.
|
|
1109
|
+
"""
|
|
1110
|
+
|
|
1111
|
+
def __init__(
|
|
1112
|
+
self,
|
|
1113
|
+
*,
|
|
1114
|
+
total_count: Optional[int] = None,
|
|
1115
|
+
errors: Optional[bool] = None,
|
|
1116
|
+
items: Optional[List['DeleteTagsResultItem']] = None,
|
|
1117
|
+
) -> None:
|
|
1118
|
+
"""
|
|
1119
|
+
Initialize a DeleteTagsResult object.
|
|
1120
|
+
|
|
1121
|
+
:param int total_count: (optional) The number of tags that have been
|
|
1122
|
+
deleted.
|
|
1123
|
+
:param bool errors: (optional) It is set to true if there is at least one
|
|
1124
|
+
tag operation in error.
|
|
1125
|
+
:param List[DeleteTagsResultItem] items: (optional) The list of tag
|
|
1126
|
+
operation results.
|
|
1127
|
+
"""
|
|
1128
|
+
self.total_count = total_count
|
|
1129
|
+
self.errors = errors
|
|
1130
|
+
self.items = items
|
|
1131
|
+
|
|
1132
|
+
@classmethod
|
|
1133
|
+
def from_dict(cls, _dict: Dict) -> 'DeleteTagsResult':
|
|
1134
|
+
"""Initialize a DeleteTagsResult object from a json dictionary."""
|
|
1135
|
+
args = {}
|
|
1136
|
+
if (total_count := _dict.get('total_count')) is not None:
|
|
1137
|
+
args['total_count'] = total_count
|
|
1138
|
+
if (errors := _dict.get('errors')) is not None:
|
|
1139
|
+
args['errors'] = errors
|
|
1140
|
+
if (items := _dict.get('items')) is not None:
|
|
1141
|
+
args['items'] = [DeleteTagsResultItem.from_dict(v) for v in items]
|
|
1142
|
+
return cls(**args)
|
|
1143
|
+
|
|
1144
|
+
@classmethod
|
|
1145
|
+
def _from_dict(cls, _dict):
|
|
1146
|
+
"""Initialize a DeleteTagsResult object from a json dictionary."""
|
|
1147
|
+
return cls.from_dict(_dict)
|
|
1148
|
+
|
|
1149
|
+
def to_dict(self) -> Dict:
|
|
1150
|
+
"""Return a json dictionary representing this model."""
|
|
1151
|
+
_dict = {}
|
|
1152
|
+
if hasattr(self, 'total_count') and self.total_count is not None:
|
|
1153
|
+
_dict['total_count'] = self.total_count
|
|
1154
|
+
if hasattr(self, 'errors') and self.errors is not None:
|
|
1155
|
+
_dict['errors'] = self.errors
|
|
1156
|
+
if hasattr(self, 'items') and self.items is not None:
|
|
1157
|
+
items_list = []
|
|
1158
|
+
for v in self.items:
|
|
1159
|
+
if isinstance(v, dict):
|
|
1160
|
+
items_list.append(v)
|
|
1161
|
+
else:
|
|
1162
|
+
items_list.append(v.to_dict())
|
|
1163
|
+
_dict['items'] = items_list
|
|
1164
|
+
return _dict
|
|
1165
|
+
|
|
1166
|
+
def _to_dict(self):
|
|
1167
|
+
"""Return a json dictionary representing this model."""
|
|
1168
|
+
return self.to_dict()
|
|
1169
|
+
|
|
1170
|
+
def __str__(self) -> str:
|
|
1171
|
+
"""Return a `str` version of this DeleteTagsResult object."""
|
|
1172
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1173
|
+
|
|
1174
|
+
def __eq__(self, other: 'DeleteTagsResult') -> bool:
|
|
1175
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1176
|
+
if not isinstance(other, self.__class__):
|
|
1177
|
+
return False
|
|
1178
|
+
return self.__dict__ == other.__dict__
|
|
1179
|
+
|
|
1180
|
+
def __ne__(self, other: 'DeleteTagsResult') -> bool:
|
|
1181
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1182
|
+
return not self == other
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
class DeleteTagsResultItem:
|
|
1186
|
+
"""
|
|
1187
|
+
Result of a delete_tags request.
|
|
1188
|
+
|
|
1189
|
+
:param str tag_name: (optional) The name of the deleted tag.
|
|
1190
|
+
:param bool is_error: (optional) true if the tag was not deleted.
|
|
1191
|
+
"""
|
|
1192
|
+
|
|
1193
|
+
def __init__(
|
|
1194
|
+
self,
|
|
1195
|
+
*,
|
|
1196
|
+
tag_name: Optional[str] = None,
|
|
1197
|
+
is_error: Optional[bool] = None,
|
|
1198
|
+
) -> None:
|
|
1199
|
+
"""
|
|
1200
|
+
Initialize a DeleteTagsResultItem object.
|
|
1201
|
+
|
|
1202
|
+
:param str tag_name: (optional) The name of the deleted tag.
|
|
1203
|
+
:param bool is_error: (optional) true if the tag was not deleted.
|
|
1204
|
+
"""
|
|
1205
|
+
self.tag_name = tag_name
|
|
1206
|
+
self.is_error = is_error
|
|
1207
|
+
|
|
1208
|
+
@classmethod
|
|
1209
|
+
def from_dict(cls, _dict: Dict) -> 'DeleteTagsResultItem':
|
|
1210
|
+
"""Initialize a DeleteTagsResultItem object from a json dictionary."""
|
|
1211
|
+
args = {}
|
|
1212
|
+
if (tag_name := _dict.get('tag_name')) is not None:
|
|
1213
|
+
args['tag_name'] = tag_name
|
|
1214
|
+
if (is_error := _dict.get('is_error')) is not None:
|
|
1215
|
+
args['is_error'] = is_error
|
|
1216
|
+
return cls(**args)
|
|
1217
|
+
|
|
1218
|
+
@classmethod
|
|
1219
|
+
def _from_dict(cls, _dict):
|
|
1220
|
+
"""Initialize a DeleteTagsResultItem object from a json dictionary."""
|
|
1221
|
+
return cls.from_dict(_dict)
|
|
1222
|
+
|
|
1223
|
+
def to_dict(self) -> Dict:
|
|
1224
|
+
"""Return a json dictionary representing this model."""
|
|
1225
|
+
_dict = {}
|
|
1226
|
+
if hasattr(self, 'tag_name') and self.tag_name is not None:
|
|
1227
|
+
_dict['tag_name'] = self.tag_name
|
|
1228
|
+
if hasattr(self, 'is_error') and self.is_error is not None:
|
|
1229
|
+
_dict['is_error'] = self.is_error
|
|
1230
|
+
return _dict
|
|
1231
|
+
|
|
1232
|
+
def _to_dict(self):
|
|
1233
|
+
"""Return a json dictionary representing this model."""
|
|
1234
|
+
return self.to_dict()
|
|
1235
|
+
|
|
1236
|
+
def __str__(self) -> str:
|
|
1237
|
+
"""Return a `str` version of this DeleteTagsResultItem object."""
|
|
1238
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1239
|
+
|
|
1240
|
+
def __eq__(self, other: 'DeleteTagsResultItem') -> bool:
|
|
1241
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1242
|
+
if not isinstance(other, self.__class__):
|
|
1243
|
+
return False
|
|
1244
|
+
return self.__dict__ == other.__dict__
|
|
1245
|
+
|
|
1246
|
+
def __ne__(self, other: 'DeleteTagsResultItem') -> bool:
|
|
1247
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1248
|
+
return not self == other
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
class Resource:
|
|
1252
|
+
"""
|
|
1253
|
+
A resource that might have tags that are attached.
|
|
1254
|
+
|
|
1255
|
+
:param str resource_id: The CRN or IMS ID of the resource.
|
|
1256
|
+
:param str resource_type: (optional) The IMS resource type of the resource.
|
|
1257
|
+
"""
|
|
1258
|
+
|
|
1259
|
+
def __init__(
|
|
1260
|
+
self,
|
|
1261
|
+
resource_id: str,
|
|
1262
|
+
*,
|
|
1263
|
+
resource_type: Optional[str] = None,
|
|
1264
|
+
) -> None:
|
|
1265
|
+
"""
|
|
1266
|
+
Initialize a Resource object.
|
|
1267
|
+
|
|
1268
|
+
:param str resource_id: The CRN or IMS ID of the resource.
|
|
1269
|
+
:param str resource_type: (optional) The IMS resource type of the resource.
|
|
1270
|
+
"""
|
|
1271
|
+
self.resource_id = resource_id
|
|
1272
|
+
self.resource_type = resource_type
|
|
1273
|
+
|
|
1274
|
+
@classmethod
|
|
1275
|
+
def from_dict(cls, _dict: Dict) -> 'Resource':
|
|
1276
|
+
"""Initialize a Resource object from a json dictionary."""
|
|
1277
|
+
args = {}
|
|
1278
|
+
if (resource_id := _dict.get('resource_id')) is not None:
|
|
1279
|
+
args['resource_id'] = resource_id
|
|
1280
|
+
else:
|
|
1281
|
+
raise ValueError('Required property \'resource_id\' not present in Resource JSON')
|
|
1282
|
+
if (resource_type := _dict.get('resource_type')) is not None:
|
|
1283
|
+
args['resource_type'] = resource_type
|
|
1284
|
+
return cls(**args)
|
|
1285
|
+
|
|
1286
|
+
@classmethod
|
|
1287
|
+
def _from_dict(cls, _dict):
|
|
1288
|
+
"""Initialize a Resource object from a json dictionary."""
|
|
1289
|
+
return cls.from_dict(_dict)
|
|
1290
|
+
|
|
1291
|
+
def to_dict(self) -> Dict:
|
|
1292
|
+
"""Return a json dictionary representing this model."""
|
|
1293
|
+
_dict = {}
|
|
1294
|
+
if hasattr(self, 'resource_id') and self.resource_id is not None:
|
|
1295
|
+
_dict['resource_id'] = self.resource_id
|
|
1296
|
+
if hasattr(self, 'resource_type') and self.resource_type is not None:
|
|
1297
|
+
_dict['resource_type'] = self.resource_type
|
|
1298
|
+
return _dict
|
|
1299
|
+
|
|
1300
|
+
def _to_dict(self):
|
|
1301
|
+
"""Return a json dictionary representing this model."""
|
|
1302
|
+
return self.to_dict()
|
|
1303
|
+
|
|
1304
|
+
def __str__(self) -> str:
|
|
1305
|
+
"""Return a `str` version of this Resource object."""
|
|
1306
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1307
|
+
|
|
1308
|
+
def __eq__(self, other: 'Resource') -> bool:
|
|
1309
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1310
|
+
if not isinstance(other, self.__class__):
|
|
1311
|
+
return False
|
|
1312
|
+
return self.__dict__ == other.__dict__
|
|
1313
|
+
|
|
1314
|
+
def __ne__(self, other: 'Resource') -> bool:
|
|
1315
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1316
|
+
return not self == other
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
class Tag:
|
|
1320
|
+
"""
|
|
1321
|
+
A tag.
|
|
1322
|
+
|
|
1323
|
+
:param str name: The name of the tag.
|
|
1324
|
+
"""
|
|
1325
|
+
|
|
1326
|
+
def __init__(
|
|
1327
|
+
self,
|
|
1328
|
+
name: str,
|
|
1329
|
+
) -> None:
|
|
1330
|
+
"""
|
|
1331
|
+
Initialize a Tag object.
|
|
1332
|
+
|
|
1333
|
+
:param str name: The name of the tag.
|
|
1334
|
+
"""
|
|
1335
|
+
self.name = name
|
|
1336
|
+
|
|
1337
|
+
@classmethod
|
|
1338
|
+
def from_dict(cls, _dict: Dict) -> 'Tag':
|
|
1339
|
+
"""Initialize a Tag object from a json dictionary."""
|
|
1340
|
+
args = {}
|
|
1341
|
+
if (name := _dict.get('name')) is not None:
|
|
1342
|
+
args['name'] = name
|
|
1343
|
+
else:
|
|
1344
|
+
raise ValueError('Required property \'name\' not present in Tag JSON')
|
|
1345
|
+
return cls(**args)
|
|
1346
|
+
|
|
1347
|
+
@classmethod
|
|
1348
|
+
def _from_dict(cls, _dict):
|
|
1349
|
+
"""Initialize a Tag object from a json dictionary."""
|
|
1350
|
+
return cls.from_dict(_dict)
|
|
1351
|
+
|
|
1352
|
+
def to_dict(self) -> Dict:
|
|
1353
|
+
"""Return a json dictionary representing this model."""
|
|
1354
|
+
_dict = {}
|
|
1355
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1356
|
+
_dict['name'] = self.name
|
|
1357
|
+
return _dict
|
|
1358
|
+
|
|
1359
|
+
def _to_dict(self):
|
|
1360
|
+
"""Return a json dictionary representing this model."""
|
|
1361
|
+
return self.to_dict()
|
|
1362
|
+
|
|
1363
|
+
def __str__(self) -> str:
|
|
1364
|
+
"""Return a `str` version of this Tag object."""
|
|
1365
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1366
|
+
|
|
1367
|
+
def __eq__(self, other: 'Tag') -> bool:
|
|
1368
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1369
|
+
if not isinstance(other, self.__class__):
|
|
1370
|
+
return False
|
|
1371
|
+
return self.__dict__ == other.__dict__
|
|
1372
|
+
|
|
1373
|
+
def __ne__(self, other: 'Tag') -> bool:
|
|
1374
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1375
|
+
return not self == other
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
class TagList:
|
|
1379
|
+
"""
|
|
1380
|
+
A list of tags.
|
|
1381
|
+
|
|
1382
|
+
:param int total_count: (optional) Set the occurrences of the total tags that
|
|
1383
|
+
are associated with this account.
|
|
1384
|
+
:param int offset: (optional) The offset at which tags are returned.
|
|
1385
|
+
:param int limit: (optional) The number of tags requested to be returned.
|
|
1386
|
+
:param List[Tag] items: (optional) Array of output results.
|
|
1387
|
+
"""
|
|
1388
|
+
|
|
1389
|
+
def __init__(
|
|
1390
|
+
self,
|
|
1391
|
+
*,
|
|
1392
|
+
total_count: Optional[int] = None,
|
|
1393
|
+
offset: Optional[int] = None,
|
|
1394
|
+
limit: Optional[int] = None,
|
|
1395
|
+
items: Optional[List['Tag']] = None,
|
|
1396
|
+
) -> None:
|
|
1397
|
+
"""
|
|
1398
|
+
Initialize a TagList object.
|
|
1399
|
+
|
|
1400
|
+
:param int total_count: (optional) Set the occurrences of the total tags
|
|
1401
|
+
that are associated with this account.
|
|
1402
|
+
:param int offset: (optional) The offset at which tags are returned.
|
|
1403
|
+
:param int limit: (optional) The number of tags requested to be returned.
|
|
1404
|
+
:param List[Tag] items: (optional) Array of output results.
|
|
1405
|
+
"""
|
|
1406
|
+
self.total_count = total_count
|
|
1407
|
+
self.offset = offset
|
|
1408
|
+
self.limit = limit
|
|
1409
|
+
self.items = items
|
|
1410
|
+
|
|
1411
|
+
@classmethod
|
|
1412
|
+
def from_dict(cls, _dict: Dict) -> 'TagList':
|
|
1413
|
+
"""Initialize a TagList object from a json dictionary."""
|
|
1414
|
+
args = {}
|
|
1415
|
+
if (total_count := _dict.get('total_count')) is not None:
|
|
1416
|
+
args['total_count'] = total_count
|
|
1417
|
+
if (offset := _dict.get('offset')) is not None:
|
|
1418
|
+
args['offset'] = offset
|
|
1419
|
+
if (limit := _dict.get('limit')) is not None:
|
|
1420
|
+
args['limit'] = limit
|
|
1421
|
+
if (items := _dict.get('items')) is not None:
|
|
1422
|
+
args['items'] = [Tag.from_dict(v) for v in items]
|
|
1423
|
+
return cls(**args)
|
|
1424
|
+
|
|
1425
|
+
@classmethod
|
|
1426
|
+
def _from_dict(cls, _dict):
|
|
1427
|
+
"""Initialize a TagList object from a json dictionary."""
|
|
1428
|
+
return cls.from_dict(_dict)
|
|
1429
|
+
|
|
1430
|
+
def to_dict(self) -> Dict:
|
|
1431
|
+
"""Return a json dictionary representing this model."""
|
|
1432
|
+
_dict = {}
|
|
1433
|
+
if hasattr(self, 'total_count') and self.total_count is not None:
|
|
1434
|
+
_dict['total_count'] = self.total_count
|
|
1435
|
+
if hasattr(self, 'offset') and self.offset is not None:
|
|
1436
|
+
_dict['offset'] = self.offset
|
|
1437
|
+
if hasattr(self, 'limit') and self.limit is not None:
|
|
1438
|
+
_dict['limit'] = self.limit
|
|
1439
|
+
if hasattr(self, 'items') and self.items is not None:
|
|
1440
|
+
items_list = []
|
|
1441
|
+
for v in self.items:
|
|
1442
|
+
if isinstance(v, dict):
|
|
1443
|
+
items_list.append(v)
|
|
1444
|
+
else:
|
|
1445
|
+
items_list.append(v.to_dict())
|
|
1446
|
+
_dict['items'] = items_list
|
|
1447
|
+
return _dict
|
|
1448
|
+
|
|
1449
|
+
def _to_dict(self):
|
|
1450
|
+
"""Return a json dictionary representing this model."""
|
|
1451
|
+
return self.to_dict()
|
|
1452
|
+
|
|
1453
|
+
def __str__(self) -> str:
|
|
1454
|
+
"""Return a `str` version of this TagList object."""
|
|
1455
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1456
|
+
|
|
1457
|
+
def __eq__(self, other: 'TagList') -> bool:
|
|
1458
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1459
|
+
if not isinstance(other, self.__class__):
|
|
1460
|
+
return False
|
|
1461
|
+
return self.__dict__ == other.__dict__
|
|
1462
|
+
|
|
1463
|
+
def __ne__(self, other: 'TagList') -> bool:
|
|
1464
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1465
|
+
return not self == other
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
class TagResults:
|
|
1469
|
+
"""
|
|
1470
|
+
Results of an attach_tag or detach_tag request.
|
|
1471
|
+
|
|
1472
|
+
:param List[TagResultsItem] results: (optional) Array of results of an
|
|
1473
|
+
attach_tag or detach_tag request.
|
|
1474
|
+
"""
|
|
1475
|
+
|
|
1476
|
+
def __init__(
|
|
1477
|
+
self,
|
|
1478
|
+
*,
|
|
1479
|
+
results: Optional[List['TagResultsItem']] = None,
|
|
1480
|
+
) -> None:
|
|
1481
|
+
"""
|
|
1482
|
+
Initialize a TagResults object.
|
|
1483
|
+
|
|
1484
|
+
:param List[TagResultsItem] results: (optional) Array of results of an
|
|
1485
|
+
attach_tag or detach_tag request.
|
|
1486
|
+
"""
|
|
1487
|
+
self.results = results
|
|
1488
|
+
|
|
1489
|
+
@classmethod
|
|
1490
|
+
def from_dict(cls, _dict: Dict) -> 'TagResults':
|
|
1491
|
+
"""Initialize a TagResults object from a json dictionary."""
|
|
1492
|
+
args = {}
|
|
1493
|
+
if (results := _dict.get('results')) is not None:
|
|
1494
|
+
args['results'] = [TagResultsItem.from_dict(v) for v in results]
|
|
1495
|
+
return cls(**args)
|
|
1496
|
+
|
|
1497
|
+
@classmethod
|
|
1498
|
+
def _from_dict(cls, _dict):
|
|
1499
|
+
"""Initialize a TagResults object from a json dictionary."""
|
|
1500
|
+
return cls.from_dict(_dict)
|
|
1501
|
+
|
|
1502
|
+
def to_dict(self) -> Dict:
|
|
1503
|
+
"""Return a json dictionary representing this model."""
|
|
1504
|
+
_dict = {}
|
|
1505
|
+
if hasattr(self, 'results') and self.results is not None:
|
|
1506
|
+
results_list = []
|
|
1507
|
+
for v in self.results:
|
|
1508
|
+
if isinstance(v, dict):
|
|
1509
|
+
results_list.append(v)
|
|
1510
|
+
else:
|
|
1511
|
+
results_list.append(v.to_dict())
|
|
1512
|
+
_dict['results'] = results_list
|
|
1513
|
+
return _dict
|
|
1514
|
+
|
|
1515
|
+
def _to_dict(self):
|
|
1516
|
+
"""Return a json dictionary representing this model."""
|
|
1517
|
+
return self.to_dict()
|
|
1518
|
+
|
|
1519
|
+
def __str__(self) -> str:
|
|
1520
|
+
"""Return a `str` version of this TagResults object."""
|
|
1521
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1522
|
+
|
|
1523
|
+
def __eq__(self, other: 'TagResults') -> bool:
|
|
1524
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1525
|
+
if not isinstance(other, self.__class__):
|
|
1526
|
+
return False
|
|
1527
|
+
return self.__dict__ == other.__dict__
|
|
1528
|
+
|
|
1529
|
+
def __ne__(self, other: 'TagResults') -> bool:
|
|
1530
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1531
|
+
return not self == other
|
|
1532
|
+
|
|
1533
|
+
|
|
1534
|
+
class TagResultsItem:
|
|
1535
|
+
"""
|
|
1536
|
+
Result of an attach_tag or detach_tag request for a tagged resource.
|
|
1537
|
+
|
|
1538
|
+
:param str resource_id: The CRN or IMS ID of the resource.
|
|
1539
|
+
:param bool is_error: (optional) It is `true` if the operation exits with an
|
|
1540
|
+
error.
|
|
1541
|
+
"""
|
|
1542
|
+
|
|
1543
|
+
def __init__(
|
|
1544
|
+
self,
|
|
1545
|
+
resource_id: str,
|
|
1546
|
+
*,
|
|
1547
|
+
is_error: Optional[bool] = None,
|
|
1548
|
+
) -> None:
|
|
1549
|
+
"""
|
|
1550
|
+
Initialize a TagResultsItem object.
|
|
1551
|
+
|
|
1552
|
+
:param str resource_id: The CRN or IMS ID of the resource.
|
|
1553
|
+
:param bool is_error: (optional) It is `true` if the operation exits with
|
|
1554
|
+
an error.
|
|
1555
|
+
"""
|
|
1556
|
+
self.resource_id = resource_id
|
|
1557
|
+
self.is_error = is_error
|
|
1558
|
+
|
|
1559
|
+
@classmethod
|
|
1560
|
+
def from_dict(cls, _dict: Dict) -> 'TagResultsItem':
|
|
1561
|
+
"""Initialize a TagResultsItem object from a json dictionary."""
|
|
1562
|
+
args = {}
|
|
1563
|
+
if (resource_id := _dict.get('resource_id')) is not None:
|
|
1564
|
+
args['resource_id'] = resource_id
|
|
1565
|
+
else:
|
|
1566
|
+
raise ValueError('Required property \'resource_id\' not present in TagResultsItem JSON')
|
|
1567
|
+
if (is_error := _dict.get('is_error')) is not None:
|
|
1568
|
+
args['is_error'] = is_error
|
|
1569
|
+
return cls(**args)
|
|
1570
|
+
|
|
1571
|
+
@classmethod
|
|
1572
|
+
def _from_dict(cls, _dict):
|
|
1573
|
+
"""Initialize a TagResultsItem object from a json dictionary."""
|
|
1574
|
+
return cls.from_dict(_dict)
|
|
1575
|
+
|
|
1576
|
+
def to_dict(self) -> Dict:
|
|
1577
|
+
"""Return a json dictionary representing this model."""
|
|
1578
|
+
_dict = {}
|
|
1579
|
+
if hasattr(self, 'resource_id') and self.resource_id is not None:
|
|
1580
|
+
_dict['resource_id'] = self.resource_id
|
|
1581
|
+
if hasattr(self, 'is_error') and self.is_error is not None:
|
|
1582
|
+
_dict['is_error'] = self.is_error
|
|
1583
|
+
return _dict
|
|
1584
|
+
|
|
1585
|
+
def _to_dict(self):
|
|
1586
|
+
"""Return a json dictionary representing this model."""
|
|
1587
|
+
return self.to_dict()
|
|
1588
|
+
|
|
1589
|
+
def __str__(self) -> str:
|
|
1590
|
+
"""Return a `str` version of this TagResultsItem object."""
|
|
1591
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1592
|
+
|
|
1593
|
+
def __eq__(self, other: 'TagResultsItem') -> bool:
|
|
1594
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1595
|
+
if not isinstance(other, self.__class__):
|
|
1596
|
+
return False
|
|
1597
|
+
return self.__dict__ == other.__dict__
|
|
1598
|
+
|
|
1599
|
+
def __ne__(self, other: 'TagResultsItem') -> bool:
|
|
1600
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1601
|
+
return not self == other
|