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,2414 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# (C) Copyright IBM Corp. 2021, 2022.
|
|
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.60.0-13f6e1ba-20221019-164457
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
Case management API for creating cases, getting case statuses, adding comments to a case,
|
|
21
|
+
adding and removing users from a case watchlist, downloading and adding attachments, and
|
|
22
|
+
more.
|
|
23
|
+
|
|
24
|
+
API Version: 1.0.0
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from enum import Enum
|
|
28
|
+
from typing import BinaryIO, Dict, List
|
|
29
|
+
import json
|
|
30
|
+
import sys
|
|
31
|
+
|
|
32
|
+
from ibm_cloud_sdk_core import BaseService, DetailedResponse, get_query_param
|
|
33
|
+
from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator
|
|
34
|
+
from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment
|
|
35
|
+
from ibm_cloud_sdk_core.utils import convert_list, convert_model
|
|
36
|
+
|
|
37
|
+
from .common import get_sdk_headers
|
|
38
|
+
|
|
39
|
+
##############################################################################
|
|
40
|
+
# Service
|
|
41
|
+
##############################################################################
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class CaseManagementV1(BaseService):
|
|
45
|
+
"""The Case Management V1 service."""
|
|
46
|
+
|
|
47
|
+
DEFAULT_SERVICE_URL = 'https://support-center.cloud.ibm.com/case-management/v1'
|
|
48
|
+
DEFAULT_SERVICE_NAME = 'case_management'
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def new_instance(
|
|
52
|
+
cls,
|
|
53
|
+
service_name: str = DEFAULT_SERVICE_NAME,
|
|
54
|
+
) -> 'CaseManagementV1':
|
|
55
|
+
"""
|
|
56
|
+
Return a new client for the Case Management service using the specified
|
|
57
|
+
parameters and external configuration.
|
|
58
|
+
"""
|
|
59
|
+
authenticator = get_authenticator_from_environment(service_name)
|
|
60
|
+
service = cls(authenticator)
|
|
61
|
+
service.configure_service(service_name)
|
|
62
|
+
return service
|
|
63
|
+
|
|
64
|
+
def __init__(
|
|
65
|
+
self,
|
|
66
|
+
authenticator: Authenticator = None,
|
|
67
|
+
) -> None:
|
|
68
|
+
"""
|
|
69
|
+
Construct a new client for the Case Management service.
|
|
70
|
+
|
|
71
|
+
:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
|
|
72
|
+
Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
|
|
73
|
+
about initializing the authenticator of your choice.
|
|
74
|
+
"""
|
|
75
|
+
BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
|
|
76
|
+
|
|
77
|
+
#########################
|
|
78
|
+
# default
|
|
79
|
+
#########################
|
|
80
|
+
|
|
81
|
+
def get_cases(
|
|
82
|
+
self,
|
|
83
|
+
*,
|
|
84
|
+
offset: int = None,
|
|
85
|
+
limit: int = None,
|
|
86
|
+
search: str = None,
|
|
87
|
+
sort: str = None,
|
|
88
|
+
status: List[str] = None,
|
|
89
|
+
fields: List[str] = None,
|
|
90
|
+
**kwargs,
|
|
91
|
+
) -> DetailedResponse:
|
|
92
|
+
"""
|
|
93
|
+
Get cases in account.
|
|
94
|
+
|
|
95
|
+
Get cases in the account that are specified by the content of the IAM token.
|
|
96
|
+
|
|
97
|
+
:param int offset: (optional) Number of cases that are skipped.
|
|
98
|
+
:param int limit: (optional) Number of cases that are returned.
|
|
99
|
+
:param str search: (optional) String that a case might contain.
|
|
100
|
+
:param str sort: (optional) Sort field and direction. If omitted, default
|
|
101
|
+
to descending of updated date. Prefix "~" signifies sort in descending.
|
|
102
|
+
:param List[str] status: (optional) Case status filter.
|
|
103
|
+
:param List[str] fields: (optional) Selected fields of interest instead of
|
|
104
|
+
all of the case information.
|
|
105
|
+
:param dict headers: A `dict` containing the request headers
|
|
106
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
107
|
+
:rtype: DetailedResponse with `dict` result representing a `CaseList` object
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
headers = {}
|
|
111
|
+
sdk_headers = get_sdk_headers(
|
|
112
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_cases'
|
|
113
|
+
)
|
|
114
|
+
headers.update(sdk_headers)
|
|
115
|
+
|
|
116
|
+
params = {
|
|
117
|
+
'offset': offset,
|
|
118
|
+
'limit': limit,
|
|
119
|
+
'search': search,
|
|
120
|
+
'sort': sort,
|
|
121
|
+
'status': convert_list(status),
|
|
122
|
+
'fields': convert_list(fields),
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if 'headers' in kwargs:
|
|
126
|
+
headers.update(kwargs.get('headers'))
|
|
127
|
+
del kwargs['headers']
|
|
128
|
+
headers['Accept'] = 'application/json'
|
|
129
|
+
|
|
130
|
+
url = '/cases'
|
|
131
|
+
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
|
|
132
|
+
|
|
133
|
+
response = self.send(request, **kwargs)
|
|
134
|
+
return response
|
|
135
|
+
|
|
136
|
+
def create_case(
|
|
137
|
+
self,
|
|
138
|
+
type: str,
|
|
139
|
+
subject: str,
|
|
140
|
+
description: str,
|
|
141
|
+
*,
|
|
142
|
+
severity: int = None,
|
|
143
|
+
eu: 'CasePayloadEu' = None,
|
|
144
|
+
offering: 'Offering' = None,
|
|
145
|
+
resources: List['ResourcePayload'] = None,
|
|
146
|
+
watchlist: List['User'] = None,
|
|
147
|
+
invoice_number: str = None,
|
|
148
|
+
sla_credit_request: bool = None,
|
|
149
|
+
**kwargs,
|
|
150
|
+
) -> DetailedResponse:
|
|
151
|
+
"""
|
|
152
|
+
Create a case.
|
|
153
|
+
|
|
154
|
+
Create a support case to resolve issues in your account.
|
|
155
|
+
|
|
156
|
+
:param str type: Case type.
|
|
157
|
+
:param str subject: Short description used to identify the case.
|
|
158
|
+
:param str description: Detailed description of the issue.
|
|
159
|
+
:param int severity: (optional) Severity of the case. Smaller values mean
|
|
160
|
+
higher severity.
|
|
161
|
+
:param CasePayloadEu eu: (optional) Specify if the case should be treated
|
|
162
|
+
as EU regulated. Only one of the following properties is required. Call EU
|
|
163
|
+
support utility endpoint to determine which property must be specified for
|
|
164
|
+
your account.
|
|
165
|
+
:param Offering offering: (optional) Offering details.
|
|
166
|
+
:param List[ResourcePayload] resources: (optional) List of resources to
|
|
167
|
+
attach to case. If you attach Classic IaaS devices, use the type and id
|
|
168
|
+
fields if the Cloud Resource Name (CRN) is unavailable. Otherwise, pass the
|
|
169
|
+
resource CRN. The resource list must be consistent with the value that is
|
|
170
|
+
selected for the resource offering.
|
|
171
|
+
:param List[User] watchlist: (optional) Array of user IDs to add to the
|
|
172
|
+
watchlist.
|
|
173
|
+
:param str invoice_number: (optional) Invoice number of "Billing and
|
|
174
|
+
Invoice" case type.
|
|
175
|
+
:param bool sla_credit_request: (optional) Flag to indicate if case is for
|
|
176
|
+
an Service Level Agreement (SLA) credit request.
|
|
177
|
+
:param dict headers: A `dict` containing the request headers
|
|
178
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
179
|
+
:rtype: DetailedResponse with `dict` result representing a `Case` object
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
if type is None:
|
|
183
|
+
raise ValueError('type must be provided')
|
|
184
|
+
if subject is None:
|
|
185
|
+
raise ValueError('subject must be provided')
|
|
186
|
+
if description is None:
|
|
187
|
+
raise ValueError('description must be provided')
|
|
188
|
+
if eu is not None:
|
|
189
|
+
eu = convert_model(eu)
|
|
190
|
+
if offering is not None:
|
|
191
|
+
offering = convert_model(offering)
|
|
192
|
+
if resources is not None:
|
|
193
|
+
resources = [convert_model(x) for x in resources]
|
|
194
|
+
if watchlist is not None:
|
|
195
|
+
watchlist = [convert_model(x) for x in watchlist]
|
|
196
|
+
headers = {}
|
|
197
|
+
sdk_headers = get_sdk_headers(
|
|
198
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='create_case'
|
|
199
|
+
)
|
|
200
|
+
headers.update(sdk_headers)
|
|
201
|
+
|
|
202
|
+
data = {
|
|
203
|
+
'type': type,
|
|
204
|
+
'subject': subject,
|
|
205
|
+
'description': description,
|
|
206
|
+
'severity': severity,
|
|
207
|
+
'eu': eu,
|
|
208
|
+
'offering': offering,
|
|
209
|
+
'resources': resources,
|
|
210
|
+
'watchlist': watchlist,
|
|
211
|
+
'invoice_number': invoice_number,
|
|
212
|
+
'sla_credit_request': sla_credit_request,
|
|
213
|
+
}
|
|
214
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
215
|
+
data = json.dumps(data)
|
|
216
|
+
headers['content-type'] = 'application/json'
|
|
217
|
+
|
|
218
|
+
if 'headers' in kwargs:
|
|
219
|
+
headers.update(kwargs.get('headers'))
|
|
220
|
+
del kwargs['headers']
|
|
221
|
+
headers['Accept'] = 'application/json'
|
|
222
|
+
|
|
223
|
+
url = '/cases'
|
|
224
|
+
request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
|
|
225
|
+
|
|
226
|
+
response = self.send(request, **kwargs)
|
|
227
|
+
return response
|
|
228
|
+
|
|
229
|
+
def get_case(self, case_number: str, *, fields: List[str] = None, **kwargs) -> DetailedResponse:
|
|
230
|
+
"""
|
|
231
|
+
Get a case in account.
|
|
232
|
+
|
|
233
|
+
View a case in the account that is specified by the case number.
|
|
234
|
+
|
|
235
|
+
:param str case_number: Unique identifier of a case.
|
|
236
|
+
:param List[str] fields: (optional) Selected fields of interest instead of
|
|
237
|
+
all of the case information.
|
|
238
|
+
:param dict headers: A `dict` containing the request headers
|
|
239
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
240
|
+
:rtype: DetailedResponse with `dict` result representing a `Case` object
|
|
241
|
+
"""
|
|
242
|
+
|
|
243
|
+
if not case_number:
|
|
244
|
+
raise ValueError('case_number must be provided')
|
|
245
|
+
headers = {}
|
|
246
|
+
sdk_headers = get_sdk_headers(
|
|
247
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_case'
|
|
248
|
+
)
|
|
249
|
+
headers.update(sdk_headers)
|
|
250
|
+
|
|
251
|
+
params = {'fields': convert_list(fields)}
|
|
252
|
+
|
|
253
|
+
if 'headers' in kwargs:
|
|
254
|
+
headers.update(kwargs.get('headers'))
|
|
255
|
+
del kwargs['headers']
|
|
256
|
+
headers['Accept'] = 'application/json'
|
|
257
|
+
|
|
258
|
+
path_param_keys = ['case_number']
|
|
259
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
260
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
261
|
+
url = '/cases/{case_number}'.format(**path_param_dict)
|
|
262
|
+
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
|
|
263
|
+
|
|
264
|
+
response = self.send(request, **kwargs)
|
|
265
|
+
return response
|
|
266
|
+
|
|
267
|
+
def update_case_status(self, case_number: str, status_payload: 'StatusPayload', **kwargs) -> DetailedResponse:
|
|
268
|
+
"""
|
|
269
|
+
Update case status.
|
|
270
|
+
|
|
271
|
+
Mark the case as resolved or unresolved, or accept the provided resolution.
|
|
272
|
+
|
|
273
|
+
:param str case_number: Unique identifier of a case.
|
|
274
|
+
:param StatusPayload status_payload:
|
|
275
|
+
:param dict headers: A `dict` containing the request headers
|
|
276
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
277
|
+
:rtype: DetailedResponse with `dict` result representing a `Case` object
|
|
278
|
+
"""
|
|
279
|
+
|
|
280
|
+
if not case_number:
|
|
281
|
+
raise ValueError('case_number must be provided')
|
|
282
|
+
if status_payload is None:
|
|
283
|
+
raise ValueError('status_payload must be provided')
|
|
284
|
+
if isinstance(status_payload, StatusPayload):
|
|
285
|
+
status_payload = convert_model(status_payload)
|
|
286
|
+
headers = {}
|
|
287
|
+
sdk_headers = get_sdk_headers(
|
|
288
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_case_status'
|
|
289
|
+
)
|
|
290
|
+
headers.update(sdk_headers)
|
|
291
|
+
|
|
292
|
+
data = json.dumps(status_payload)
|
|
293
|
+
headers['content-type'] = 'application/json'
|
|
294
|
+
|
|
295
|
+
if 'headers' in kwargs:
|
|
296
|
+
headers.update(kwargs.get('headers'))
|
|
297
|
+
del kwargs['headers']
|
|
298
|
+
headers['Accept'] = 'application/json'
|
|
299
|
+
|
|
300
|
+
path_param_keys = ['case_number']
|
|
301
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
302
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
303
|
+
url = '/cases/{case_number}/status'.format(**path_param_dict)
|
|
304
|
+
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
|
|
305
|
+
|
|
306
|
+
response = self.send(request, **kwargs)
|
|
307
|
+
return response
|
|
308
|
+
|
|
309
|
+
def add_comment(self, case_number: str, comment: str, **kwargs) -> DetailedResponse:
|
|
310
|
+
"""
|
|
311
|
+
Add comment to case.
|
|
312
|
+
|
|
313
|
+
Add a comment to a case to be viewed by a support engineer.
|
|
314
|
+
|
|
315
|
+
:param str case_number: Unique identifier of a case.
|
|
316
|
+
:param str comment: Comment to add to the case.
|
|
317
|
+
:param dict headers: A `dict` containing the request headers
|
|
318
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
319
|
+
:rtype: DetailedResponse with `dict` result representing a `Comment` object
|
|
320
|
+
"""
|
|
321
|
+
|
|
322
|
+
if not case_number:
|
|
323
|
+
raise ValueError('case_number must be provided')
|
|
324
|
+
if comment is None:
|
|
325
|
+
raise ValueError('comment must be provided')
|
|
326
|
+
headers = {}
|
|
327
|
+
sdk_headers = get_sdk_headers(
|
|
328
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='add_comment'
|
|
329
|
+
)
|
|
330
|
+
headers.update(sdk_headers)
|
|
331
|
+
|
|
332
|
+
data = {'comment': comment}
|
|
333
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
334
|
+
data = json.dumps(data)
|
|
335
|
+
headers['content-type'] = 'application/json'
|
|
336
|
+
|
|
337
|
+
if 'headers' in kwargs:
|
|
338
|
+
headers.update(kwargs.get('headers'))
|
|
339
|
+
del kwargs['headers']
|
|
340
|
+
headers['Accept'] = 'application/json'
|
|
341
|
+
|
|
342
|
+
path_param_keys = ['case_number']
|
|
343
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
344
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
345
|
+
url = '/cases/{case_number}/comments'.format(**path_param_dict)
|
|
346
|
+
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
|
|
347
|
+
|
|
348
|
+
response = self.send(request, **kwargs)
|
|
349
|
+
return response
|
|
350
|
+
|
|
351
|
+
def add_watchlist(self, case_number: str, *, watchlist: List['User'] = None, **kwargs) -> DetailedResponse:
|
|
352
|
+
"""
|
|
353
|
+
Add users to watchlist of case.
|
|
354
|
+
|
|
355
|
+
Add users to the watchlist of case. By adding a user to the watchlist of the case,
|
|
356
|
+
you are granting them read and write permissions, so the user can view the case,
|
|
357
|
+
receive updates, and make updates to the case. Note that the user must be in the
|
|
358
|
+
account to be added to the watchlist.
|
|
359
|
+
|
|
360
|
+
:param str case_number: Unique identifier of a case.
|
|
361
|
+
:param List[User] watchlist: (optional) Array of user ID objects.
|
|
362
|
+
:param dict headers: A `dict` containing the request headers
|
|
363
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
364
|
+
:rtype: DetailedResponse with `dict` result representing a `WatchlistAddResponse` object
|
|
365
|
+
"""
|
|
366
|
+
|
|
367
|
+
if not case_number:
|
|
368
|
+
raise ValueError('case_number must be provided')
|
|
369
|
+
if watchlist is not None:
|
|
370
|
+
watchlist = [convert_model(x) for x in watchlist]
|
|
371
|
+
headers = {}
|
|
372
|
+
sdk_headers = get_sdk_headers(
|
|
373
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='add_watchlist'
|
|
374
|
+
)
|
|
375
|
+
headers.update(sdk_headers)
|
|
376
|
+
|
|
377
|
+
data = {'watchlist': watchlist}
|
|
378
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
379
|
+
data = json.dumps(data)
|
|
380
|
+
headers['content-type'] = 'application/json'
|
|
381
|
+
|
|
382
|
+
if 'headers' in kwargs:
|
|
383
|
+
headers.update(kwargs.get('headers'))
|
|
384
|
+
del kwargs['headers']
|
|
385
|
+
headers['Accept'] = 'application/json'
|
|
386
|
+
|
|
387
|
+
path_param_keys = ['case_number']
|
|
388
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
389
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
390
|
+
url = '/cases/{case_number}/watchlist'.format(**path_param_dict)
|
|
391
|
+
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
|
|
392
|
+
|
|
393
|
+
response = self.send(request, **kwargs)
|
|
394
|
+
return response
|
|
395
|
+
|
|
396
|
+
def remove_watchlist(self, case_number: str, *, watchlist: List['User'] = None, **kwargs) -> DetailedResponse:
|
|
397
|
+
"""
|
|
398
|
+
Remove users from watchlist of case.
|
|
399
|
+
|
|
400
|
+
Remove users from the watchlist of a case if you don't want them to view the case,
|
|
401
|
+
receive updates, or make updates to the case.
|
|
402
|
+
|
|
403
|
+
:param str case_number: Unique identifier of a case.
|
|
404
|
+
:param List[User] watchlist: (optional) Array of user ID objects.
|
|
405
|
+
:param dict headers: A `dict` containing the request headers
|
|
406
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
407
|
+
:rtype: DetailedResponse with `dict` result representing a `Watchlist` object
|
|
408
|
+
"""
|
|
409
|
+
|
|
410
|
+
if not case_number:
|
|
411
|
+
raise ValueError('case_number must be provided')
|
|
412
|
+
if watchlist is not None:
|
|
413
|
+
watchlist = [convert_model(x) for x in watchlist]
|
|
414
|
+
headers = {}
|
|
415
|
+
sdk_headers = get_sdk_headers(
|
|
416
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='remove_watchlist'
|
|
417
|
+
)
|
|
418
|
+
headers.update(sdk_headers)
|
|
419
|
+
|
|
420
|
+
data = {'watchlist': watchlist}
|
|
421
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
422
|
+
data = json.dumps(data)
|
|
423
|
+
headers['content-type'] = 'application/json'
|
|
424
|
+
|
|
425
|
+
if 'headers' in kwargs:
|
|
426
|
+
headers.update(kwargs.get('headers'))
|
|
427
|
+
del kwargs['headers']
|
|
428
|
+
headers['Accept'] = 'application/json'
|
|
429
|
+
|
|
430
|
+
path_param_keys = ['case_number']
|
|
431
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
432
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
433
|
+
url = '/cases/{case_number}/watchlist'.format(**path_param_dict)
|
|
434
|
+
request = self.prepare_request(method='DELETE', url=url, headers=headers, data=data)
|
|
435
|
+
|
|
436
|
+
response = self.send(request, **kwargs)
|
|
437
|
+
return response
|
|
438
|
+
|
|
439
|
+
def add_resource(
|
|
440
|
+
self, case_number: str, *, crn: str = None, type: str = None, id: float = None, note: str = None, **kwargs
|
|
441
|
+
) -> DetailedResponse:
|
|
442
|
+
"""
|
|
443
|
+
Add a resource to case.
|
|
444
|
+
|
|
445
|
+
Add a resource to case by specifying the Cloud Resource Name (CRN), or id and type
|
|
446
|
+
if attaching a class iaaS resource.
|
|
447
|
+
|
|
448
|
+
:param str case_number: Unique identifier of a case.
|
|
449
|
+
:param str crn: (optional) Cloud Resource Name of the resource.
|
|
450
|
+
:param str type: (optional) Only used to attach Classic IaaS devices that
|
|
451
|
+
have no CRN.
|
|
452
|
+
:param float id: (optional) Deprecated: Only used to attach Classic IaaS
|
|
453
|
+
devices that have no CRN. Id of Classic IaaS device. This is deprecated in
|
|
454
|
+
favor of the crn field.
|
|
455
|
+
:param str note: (optional) A note about this resource.
|
|
456
|
+
:param dict headers: A `dict` containing the request headers
|
|
457
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
458
|
+
:rtype: DetailedResponse with `dict` result representing a `Resource` object
|
|
459
|
+
"""
|
|
460
|
+
|
|
461
|
+
if not case_number:
|
|
462
|
+
raise ValueError('case_number must be provided')
|
|
463
|
+
headers = {}
|
|
464
|
+
sdk_headers = get_sdk_headers(
|
|
465
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='add_resource'
|
|
466
|
+
)
|
|
467
|
+
headers.update(sdk_headers)
|
|
468
|
+
|
|
469
|
+
data = {'crn': crn, 'type': type, 'id': id, 'note': note}
|
|
470
|
+
data = {k: v for (k, v) in data.items() if v is not None}
|
|
471
|
+
data = json.dumps(data)
|
|
472
|
+
headers['content-type'] = 'application/json'
|
|
473
|
+
|
|
474
|
+
if 'headers' in kwargs:
|
|
475
|
+
headers.update(kwargs.get('headers'))
|
|
476
|
+
del kwargs['headers']
|
|
477
|
+
headers['Accept'] = 'application/json'
|
|
478
|
+
|
|
479
|
+
path_param_keys = ['case_number']
|
|
480
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
481
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
482
|
+
url = '/cases/{case_number}/resources'.format(**path_param_dict)
|
|
483
|
+
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
|
|
484
|
+
|
|
485
|
+
response = self.send(request, **kwargs)
|
|
486
|
+
return response
|
|
487
|
+
|
|
488
|
+
def upload_file(self, case_number: str, file: List[BinaryIO], **kwargs) -> DetailedResponse:
|
|
489
|
+
"""
|
|
490
|
+
Add attachments to a support case.
|
|
491
|
+
|
|
492
|
+
You can add attachments to a case to provide more information for the support team
|
|
493
|
+
about the issue that you're experiencing.
|
|
494
|
+
|
|
495
|
+
:param str case_number: Unique identifier of a case.
|
|
496
|
+
:param list[FileWithMetadata] file: file of supported types, 8MB in size
|
|
497
|
+
limit.
|
|
498
|
+
:param dict headers: A `dict` containing the request headers
|
|
499
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
500
|
+
:rtype: DetailedResponse with `dict` result representing a `Attachment` object
|
|
501
|
+
"""
|
|
502
|
+
|
|
503
|
+
if not case_number:
|
|
504
|
+
raise ValueError('case_number must be provided')
|
|
505
|
+
if file is None:
|
|
506
|
+
raise ValueError('file must be provided')
|
|
507
|
+
headers = {}
|
|
508
|
+
sdk_headers = get_sdk_headers(
|
|
509
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='upload_file'
|
|
510
|
+
)
|
|
511
|
+
headers.update(sdk_headers)
|
|
512
|
+
|
|
513
|
+
form_data = []
|
|
514
|
+
for item in file:
|
|
515
|
+
item = convert_model(item)
|
|
516
|
+
_file = (item.get('filename') or None, item['data'], item.get('content_type') or 'application/octet-stream')
|
|
517
|
+
form_data.append(('file', _file))
|
|
518
|
+
|
|
519
|
+
if 'headers' in kwargs:
|
|
520
|
+
headers.update(kwargs.get('headers'))
|
|
521
|
+
del kwargs['headers']
|
|
522
|
+
headers['Accept'] = 'application/json'
|
|
523
|
+
|
|
524
|
+
path_param_keys = ['case_number']
|
|
525
|
+
path_param_values = self.encode_path_vars(case_number)
|
|
526
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
527
|
+
url = '/cases/{case_number}/attachments'.format(**path_param_dict)
|
|
528
|
+
request = self.prepare_request(method='PUT', url=url, headers=headers, files=form_data)
|
|
529
|
+
|
|
530
|
+
response = self.send(request, **kwargs)
|
|
531
|
+
return response
|
|
532
|
+
|
|
533
|
+
def download_file(self, case_number: str, file_id: str, **kwargs) -> DetailedResponse:
|
|
534
|
+
"""
|
|
535
|
+
Download an attachment.
|
|
536
|
+
|
|
537
|
+
Download an attachment from a case.
|
|
538
|
+
|
|
539
|
+
:param str case_number: Unique identifier of a case.
|
|
540
|
+
:param str file_id: Unique identifier of a file.
|
|
541
|
+
:param dict headers: A `dict` containing the request headers
|
|
542
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
543
|
+
:rtype: DetailedResponse with `BinaryIO` result
|
|
544
|
+
"""
|
|
545
|
+
|
|
546
|
+
if not case_number:
|
|
547
|
+
raise ValueError('case_number must be provided')
|
|
548
|
+
if not file_id:
|
|
549
|
+
raise ValueError('file_id must be provided')
|
|
550
|
+
headers = {}
|
|
551
|
+
sdk_headers = get_sdk_headers(
|
|
552
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='download_file'
|
|
553
|
+
)
|
|
554
|
+
headers.update(sdk_headers)
|
|
555
|
+
|
|
556
|
+
if 'headers' in kwargs:
|
|
557
|
+
headers.update(kwargs.get('headers'))
|
|
558
|
+
del kwargs['headers']
|
|
559
|
+
headers['Accept'] = 'application/octet-stream'
|
|
560
|
+
|
|
561
|
+
path_param_keys = ['case_number', 'file_id']
|
|
562
|
+
path_param_values = self.encode_path_vars(case_number, file_id)
|
|
563
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
564
|
+
url = '/cases/{case_number}/attachments/{file_id}'.format(**path_param_dict)
|
|
565
|
+
request = self.prepare_request(method='GET', url=url, headers=headers)
|
|
566
|
+
|
|
567
|
+
response = self.send(request, **kwargs)
|
|
568
|
+
return response
|
|
569
|
+
|
|
570
|
+
def delete_file(self, case_number: str, file_id: str, **kwargs) -> DetailedResponse:
|
|
571
|
+
"""
|
|
572
|
+
Remove attachment from case.
|
|
573
|
+
|
|
574
|
+
Remove an attachment from a case.
|
|
575
|
+
|
|
576
|
+
:param str case_number: Unique identifier of a case.
|
|
577
|
+
:param str file_id: Unique identifier of a file.
|
|
578
|
+
:param dict headers: A `dict` containing the request headers
|
|
579
|
+
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
|
|
580
|
+
:rtype: DetailedResponse with `dict` result representing a `AttachmentList` object
|
|
581
|
+
"""
|
|
582
|
+
|
|
583
|
+
if not case_number:
|
|
584
|
+
raise ValueError('case_number must be provided')
|
|
585
|
+
if not file_id:
|
|
586
|
+
raise ValueError('file_id must be provided')
|
|
587
|
+
headers = {}
|
|
588
|
+
sdk_headers = get_sdk_headers(
|
|
589
|
+
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_file'
|
|
590
|
+
)
|
|
591
|
+
headers.update(sdk_headers)
|
|
592
|
+
|
|
593
|
+
if 'headers' in kwargs:
|
|
594
|
+
headers.update(kwargs.get('headers'))
|
|
595
|
+
del kwargs['headers']
|
|
596
|
+
headers['Accept'] = 'application/json'
|
|
597
|
+
|
|
598
|
+
path_param_keys = ['case_number', 'file_id']
|
|
599
|
+
path_param_values = self.encode_path_vars(case_number, file_id)
|
|
600
|
+
path_param_dict = dict(zip(path_param_keys, path_param_values))
|
|
601
|
+
url = '/cases/{case_number}/attachments/{file_id}'.format(**path_param_dict)
|
|
602
|
+
request = self.prepare_request(method='DELETE', url=url, headers=headers)
|
|
603
|
+
|
|
604
|
+
response = self.send(request, **kwargs)
|
|
605
|
+
return response
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
class GetCasesEnums:
|
|
609
|
+
"""
|
|
610
|
+
Enums for get_cases parameters.
|
|
611
|
+
"""
|
|
612
|
+
|
|
613
|
+
class Status(str, Enum):
|
|
614
|
+
"""
|
|
615
|
+
Case status filter.
|
|
616
|
+
"""
|
|
617
|
+
|
|
618
|
+
NEW = 'new'
|
|
619
|
+
IN_PROGRESS = 'in_progress'
|
|
620
|
+
WAITING_ON_CLIENT = 'waiting_on_client'
|
|
621
|
+
RESOLUTION_PROVIDED = 'resolution_provided'
|
|
622
|
+
RESOLVED = 'resolved'
|
|
623
|
+
CLOSED = 'closed'
|
|
624
|
+
|
|
625
|
+
class Fields(str, Enum):
|
|
626
|
+
"""
|
|
627
|
+
Selected fields of interest instead of all of the case information.
|
|
628
|
+
"""
|
|
629
|
+
|
|
630
|
+
NUMBER = 'number'
|
|
631
|
+
SHORT_DESCRIPTION = 'short_description'
|
|
632
|
+
DESCRIPTION = 'description'
|
|
633
|
+
CREATED_AT = 'created_at'
|
|
634
|
+
CREATED_BY = 'created_by'
|
|
635
|
+
UPDATED_AT = 'updated_at'
|
|
636
|
+
UPDATED_BY = 'updated_by'
|
|
637
|
+
CONTACT = 'contact'
|
|
638
|
+
CONTACT_TYPE = 'contact_type'
|
|
639
|
+
STATUS = 'status'
|
|
640
|
+
SEVERITY = 'severity'
|
|
641
|
+
SUPPORT_TIER = 'support_tier'
|
|
642
|
+
RESOLUTION = 'resolution'
|
|
643
|
+
CLOSE_NOTES = 'close_notes'
|
|
644
|
+
INVOICE_NUMBER = 'invoice_number'
|
|
645
|
+
AGENT_CLOSE_ONLY = 'agent_close_only'
|
|
646
|
+
EU = 'eu'
|
|
647
|
+
WATCHLIST = 'watchlist'
|
|
648
|
+
ATTACHMENTS = 'attachments'
|
|
649
|
+
RESOURCES = 'resources'
|
|
650
|
+
COMMENTS = 'comments'
|
|
651
|
+
OFFERING = 'offering'
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
class GetCaseEnums:
|
|
655
|
+
"""
|
|
656
|
+
Enums for get_case parameters.
|
|
657
|
+
"""
|
|
658
|
+
|
|
659
|
+
class Fields(str, Enum):
|
|
660
|
+
"""
|
|
661
|
+
Selected fields of interest instead of all of the case information.
|
|
662
|
+
"""
|
|
663
|
+
|
|
664
|
+
NUMBER = 'number'
|
|
665
|
+
SHORT_DESCRIPTION = 'short_description'
|
|
666
|
+
DESCRIPTION = 'description'
|
|
667
|
+
CREATED_AT = 'created_at'
|
|
668
|
+
CREATED_BY = 'created_by'
|
|
669
|
+
UPDATED_AT = 'updated_at'
|
|
670
|
+
UPDATED_BY = 'updated_by'
|
|
671
|
+
CONTACT = 'contact'
|
|
672
|
+
CONTACT_TYPE = 'contact_type'
|
|
673
|
+
STATUS = 'status'
|
|
674
|
+
SEVERITY = 'severity'
|
|
675
|
+
SUPPORT_TIER = 'support_tier'
|
|
676
|
+
RESOLUTION = 'resolution'
|
|
677
|
+
CLOSE_NOTES = 'close_notes'
|
|
678
|
+
INVOICE_NUMBER = 'invoice_number'
|
|
679
|
+
AGENT_CLOSE_ONLY = 'agent_close_only'
|
|
680
|
+
EU = 'eu'
|
|
681
|
+
WATCHLIST = 'watchlist'
|
|
682
|
+
ATTACHMENTS = 'attachments'
|
|
683
|
+
RESOURCES = 'resources'
|
|
684
|
+
COMMENTS = 'comments'
|
|
685
|
+
OFFERING = 'offering'
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
##############################################################################
|
|
689
|
+
# Models
|
|
690
|
+
##############################################################################
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
class Attachment:
|
|
694
|
+
"""
|
|
695
|
+
Details of an attachment.
|
|
696
|
+
|
|
697
|
+
:attr str id: (optional) Unique identifier of the attachment in database.
|
|
698
|
+
:attr str filename: (optional) Name of the attachment.
|
|
699
|
+
:attr int size_in_bytes: (optional) Size of the attachment in bytes.
|
|
700
|
+
:attr str created_at: (optional) Date time of uploading in UTC.
|
|
701
|
+
:attr str url: (optional) URL of the attachment used to download.
|
|
702
|
+
"""
|
|
703
|
+
|
|
704
|
+
def __init__(
|
|
705
|
+
self,
|
|
706
|
+
*,
|
|
707
|
+
id: str = None,
|
|
708
|
+
filename: str = None,
|
|
709
|
+
size_in_bytes: int = None,
|
|
710
|
+
created_at: str = None,
|
|
711
|
+
url: str = None,
|
|
712
|
+
) -> None:
|
|
713
|
+
"""
|
|
714
|
+
Initialize a Attachment object.
|
|
715
|
+
|
|
716
|
+
:param str id: (optional) Unique identifier of the attachment in database.
|
|
717
|
+
:param str filename: (optional) Name of the attachment.
|
|
718
|
+
:param int size_in_bytes: (optional) Size of the attachment in bytes.
|
|
719
|
+
:param str created_at: (optional) Date time of uploading in UTC.
|
|
720
|
+
:param str url: (optional) URL of the attachment used to download.
|
|
721
|
+
"""
|
|
722
|
+
self.id = id
|
|
723
|
+
self.filename = filename
|
|
724
|
+
self.size_in_bytes = size_in_bytes
|
|
725
|
+
self.created_at = created_at
|
|
726
|
+
self.url = url
|
|
727
|
+
|
|
728
|
+
@classmethod
|
|
729
|
+
def from_dict(cls, _dict: Dict) -> 'Attachment':
|
|
730
|
+
"""Initialize a Attachment object from a json dictionary."""
|
|
731
|
+
args = {}
|
|
732
|
+
if 'id' in _dict:
|
|
733
|
+
args['id'] = _dict.get('id')
|
|
734
|
+
if 'filename' in _dict:
|
|
735
|
+
args['filename'] = _dict.get('filename')
|
|
736
|
+
if 'size_in_bytes' in _dict:
|
|
737
|
+
args['size_in_bytes'] = _dict.get('size_in_bytes')
|
|
738
|
+
if 'created_at' in _dict:
|
|
739
|
+
args['created_at'] = _dict.get('created_at')
|
|
740
|
+
if 'url' in _dict:
|
|
741
|
+
args['url'] = _dict.get('url')
|
|
742
|
+
return cls(**args)
|
|
743
|
+
|
|
744
|
+
@classmethod
|
|
745
|
+
def _from_dict(cls, _dict):
|
|
746
|
+
"""Initialize a Attachment object from a json dictionary."""
|
|
747
|
+
return cls.from_dict(_dict)
|
|
748
|
+
|
|
749
|
+
def to_dict(self) -> Dict:
|
|
750
|
+
"""Return a json dictionary representing this model."""
|
|
751
|
+
_dict = {}
|
|
752
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
753
|
+
_dict['id'] = self.id
|
|
754
|
+
if hasattr(self, 'filename') and self.filename is not None:
|
|
755
|
+
_dict['filename'] = self.filename
|
|
756
|
+
if hasattr(self, 'size_in_bytes') and self.size_in_bytes is not None:
|
|
757
|
+
_dict['size_in_bytes'] = self.size_in_bytes
|
|
758
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
759
|
+
_dict['created_at'] = self.created_at
|
|
760
|
+
if hasattr(self, 'url') and self.url is not None:
|
|
761
|
+
_dict['url'] = self.url
|
|
762
|
+
return _dict
|
|
763
|
+
|
|
764
|
+
def _to_dict(self):
|
|
765
|
+
"""Return a json dictionary representing this model."""
|
|
766
|
+
return self.to_dict()
|
|
767
|
+
|
|
768
|
+
def __str__(self) -> str:
|
|
769
|
+
"""Return a `str` version of this Attachment object."""
|
|
770
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
771
|
+
|
|
772
|
+
def __eq__(self, other: 'Attachment') -> bool:
|
|
773
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
774
|
+
if not isinstance(other, self.__class__):
|
|
775
|
+
return False
|
|
776
|
+
return self.__dict__ == other.__dict__
|
|
777
|
+
|
|
778
|
+
def __ne__(self, other: 'Attachment') -> bool:
|
|
779
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
780
|
+
return not self == other
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
class AttachmentList:
|
|
784
|
+
"""
|
|
785
|
+
List of attachments in the case.
|
|
786
|
+
|
|
787
|
+
:attr List[Attachment] attachments: (optional) New attachments array.
|
|
788
|
+
"""
|
|
789
|
+
|
|
790
|
+
def __init__(self, *, attachments: List['Attachment'] = None) -> None:
|
|
791
|
+
"""
|
|
792
|
+
Initialize a AttachmentList object.
|
|
793
|
+
|
|
794
|
+
:param List[Attachment] attachments: (optional) New attachments array.
|
|
795
|
+
"""
|
|
796
|
+
self.attachments = attachments
|
|
797
|
+
|
|
798
|
+
@classmethod
|
|
799
|
+
def from_dict(cls, _dict: Dict) -> 'AttachmentList':
|
|
800
|
+
"""Initialize a AttachmentList object from a json dictionary."""
|
|
801
|
+
args = {}
|
|
802
|
+
if 'attachments' in _dict:
|
|
803
|
+
args['attachments'] = [Attachment.from_dict(x) for x in _dict.get('attachments')]
|
|
804
|
+
return cls(**args)
|
|
805
|
+
|
|
806
|
+
@classmethod
|
|
807
|
+
def _from_dict(cls, _dict):
|
|
808
|
+
"""Initialize a AttachmentList object from a json dictionary."""
|
|
809
|
+
return cls.from_dict(_dict)
|
|
810
|
+
|
|
811
|
+
def to_dict(self) -> Dict:
|
|
812
|
+
"""Return a json dictionary representing this model."""
|
|
813
|
+
_dict = {}
|
|
814
|
+
if hasattr(self, 'attachments') and self.attachments is not None:
|
|
815
|
+
_dict['attachments'] = [x.to_dict() for x in self.attachments]
|
|
816
|
+
return _dict
|
|
817
|
+
|
|
818
|
+
def _to_dict(self):
|
|
819
|
+
"""Return a json dictionary representing this model."""
|
|
820
|
+
return self.to_dict()
|
|
821
|
+
|
|
822
|
+
def __str__(self) -> str:
|
|
823
|
+
"""Return a `str` version of this AttachmentList object."""
|
|
824
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
825
|
+
|
|
826
|
+
def __eq__(self, other: 'AttachmentList') -> bool:
|
|
827
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
828
|
+
if not isinstance(other, self.__class__):
|
|
829
|
+
return False
|
|
830
|
+
return self.__dict__ == other.__dict__
|
|
831
|
+
|
|
832
|
+
def __ne__(self, other: 'AttachmentList') -> bool:
|
|
833
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
834
|
+
return not self == other
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
class Case:
|
|
838
|
+
"""
|
|
839
|
+
The support case.
|
|
840
|
+
|
|
841
|
+
:attr str number: (optional) Identifying number of a created case.
|
|
842
|
+
:attr str short_description: (optional) Short description of what the case is
|
|
843
|
+
about.
|
|
844
|
+
:attr str description: (optional) Full description of what the case is about.
|
|
845
|
+
:attr str created_at: (optional) Date and time of case creation in UTC.
|
|
846
|
+
:attr User created_by: (optional) User info in a case.
|
|
847
|
+
:attr str updated_at: (optional) Date and time of the last update on the case in
|
|
848
|
+
UTC.
|
|
849
|
+
:attr User updated_by: (optional) User info in a case.
|
|
850
|
+
:attr str contact_type: (optional) Name of the console to interact with the
|
|
851
|
+
contact.
|
|
852
|
+
:attr User contact: (optional) User info in a case.
|
|
853
|
+
:attr str status: (optional) Status type of the case.
|
|
854
|
+
:attr float severity: (optional) Severity level of the case.
|
|
855
|
+
:attr str support_tier: (optional) Support tier of the account.
|
|
856
|
+
:attr str resolution: (optional) Standard reasons of resolving case.
|
|
857
|
+
:attr str close_notes: (optional) Notes of case closing.
|
|
858
|
+
:attr CaseEu eu: (optional) EU support.
|
|
859
|
+
:attr List[User] watchlist: (optional) List of users in the case watchlist.
|
|
860
|
+
:attr List[Attachment] attachments: (optional) List of files that are attached
|
|
861
|
+
to the case.
|
|
862
|
+
:attr Offering offering: (optional) Offering details.
|
|
863
|
+
:attr List[Resource] resources: (optional) List of attached resources.
|
|
864
|
+
:attr List[Comment] comments: (optional) List of comments and updates that are
|
|
865
|
+
sorted in chronological order.
|
|
866
|
+
"""
|
|
867
|
+
|
|
868
|
+
def __init__(
|
|
869
|
+
self,
|
|
870
|
+
*,
|
|
871
|
+
number: str = None,
|
|
872
|
+
short_description: str = None,
|
|
873
|
+
description: str = None,
|
|
874
|
+
created_at: str = None,
|
|
875
|
+
created_by: 'User' = None,
|
|
876
|
+
updated_at: str = None,
|
|
877
|
+
updated_by: 'User' = None,
|
|
878
|
+
contact_type: str = None,
|
|
879
|
+
contact: 'User' = None,
|
|
880
|
+
status: str = None,
|
|
881
|
+
severity: float = None,
|
|
882
|
+
support_tier: str = None,
|
|
883
|
+
resolution: str = None,
|
|
884
|
+
close_notes: str = None,
|
|
885
|
+
eu: 'CaseEu' = None,
|
|
886
|
+
watchlist: List['User'] = None,
|
|
887
|
+
attachments: List['Attachment'] = None,
|
|
888
|
+
offering: 'Offering' = None,
|
|
889
|
+
resources: List['Resource'] = None,
|
|
890
|
+
comments: List['Comment'] = None,
|
|
891
|
+
) -> None:
|
|
892
|
+
"""
|
|
893
|
+
Initialize a Case object.
|
|
894
|
+
|
|
895
|
+
:param str number: (optional) Identifying number of a created case.
|
|
896
|
+
:param str short_description: (optional) Short description of what the case
|
|
897
|
+
is about.
|
|
898
|
+
:param str description: (optional) Full description of what the case is
|
|
899
|
+
about.
|
|
900
|
+
:param str created_at: (optional) Date and time of case creation in UTC.
|
|
901
|
+
:param User created_by: (optional) User info in a case.
|
|
902
|
+
:param str updated_at: (optional) Date and time of the last update on the
|
|
903
|
+
case in UTC.
|
|
904
|
+
:param User updated_by: (optional) User info in a case.
|
|
905
|
+
:param str contact_type: (optional) Name of the console to interact with
|
|
906
|
+
the contact.
|
|
907
|
+
:param User contact: (optional) User info in a case.
|
|
908
|
+
:param str status: (optional) Status type of the case.
|
|
909
|
+
:param float severity: (optional) Severity level of the case.
|
|
910
|
+
:param str support_tier: (optional) Support tier of the account.
|
|
911
|
+
:param str resolution: (optional) Standard reasons of resolving case.
|
|
912
|
+
:param str close_notes: (optional) Notes of case closing.
|
|
913
|
+
:param CaseEu eu: (optional) EU support.
|
|
914
|
+
:param List[User] watchlist: (optional) List of users in the case
|
|
915
|
+
watchlist.
|
|
916
|
+
:param List[Attachment] attachments: (optional) List of files that are
|
|
917
|
+
attached to the case.
|
|
918
|
+
:param Offering offering: (optional) Offering details.
|
|
919
|
+
:param List[Resource] resources: (optional) List of attached resources.
|
|
920
|
+
:param List[Comment] comments: (optional) List of comments and updates that
|
|
921
|
+
are sorted in chronological order.
|
|
922
|
+
"""
|
|
923
|
+
self.number = number
|
|
924
|
+
self.short_description = short_description
|
|
925
|
+
self.description = description
|
|
926
|
+
self.created_at = created_at
|
|
927
|
+
self.created_by = created_by
|
|
928
|
+
self.updated_at = updated_at
|
|
929
|
+
self.updated_by = updated_by
|
|
930
|
+
self.contact_type = contact_type
|
|
931
|
+
self.contact = contact
|
|
932
|
+
self.status = status
|
|
933
|
+
self.severity = severity
|
|
934
|
+
self.support_tier = support_tier
|
|
935
|
+
self.resolution = resolution
|
|
936
|
+
self.close_notes = close_notes
|
|
937
|
+
self.eu = eu
|
|
938
|
+
self.watchlist = watchlist
|
|
939
|
+
self.attachments = attachments
|
|
940
|
+
self.offering = offering
|
|
941
|
+
self.resources = resources
|
|
942
|
+
self.comments = comments
|
|
943
|
+
|
|
944
|
+
@classmethod
|
|
945
|
+
def from_dict(cls, _dict: Dict) -> 'Case':
|
|
946
|
+
"""Initialize a Case object from a json dictionary."""
|
|
947
|
+
args = {}
|
|
948
|
+
if 'number' in _dict:
|
|
949
|
+
args['number'] = _dict.get('number')
|
|
950
|
+
if 'short_description' in _dict:
|
|
951
|
+
args['short_description'] = _dict.get('short_description')
|
|
952
|
+
if 'description' in _dict:
|
|
953
|
+
args['description'] = _dict.get('description')
|
|
954
|
+
if 'created_at' in _dict:
|
|
955
|
+
args['created_at'] = _dict.get('created_at')
|
|
956
|
+
if 'created_by' in _dict:
|
|
957
|
+
args['created_by'] = User.from_dict(_dict.get('created_by'))
|
|
958
|
+
if 'updated_at' in _dict:
|
|
959
|
+
args['updated_at'] = _dict.get('updated_at')
|
|
960
|
+
if 'updated_by' in _dict:
|
|
961
|
+
args['updated_by'] = User.from_dict(_dict.get('updated_by'))
|
|
962
|
+
if 'contact_type' in _dict:
|
|
963
|
+
args['contact_type'] = _dict.get('contact_type')
|
|
964
|
+
if 'contact' in _dict:
|
|
965
|
+
args['contact'] = User.from_dict(_dict.get('contact'))
|
|
966
|
+
if 'status' in _dict:
|
|
967
|
+
args['status'] = _dict.get('status')
|
|
968
|
+
if 'severity' in _dict:
|
|
969
|
+
args['severity'] = _dict.get('severity')
|
|
970
|
+
if 'support_tier' in _dict:
|
|
971
|
+
args['support_tier'] = _dict.get('support_tier')
|
|
972
|
+
if 'resolution' in _dict:
|
|
973
|
+
args['resolution'] = _dict.get('resolution')
|
|
974
|
+
if 'close_notes' in _dict:
|
|
975
|
+
args['close_notes'] = _dict.get('close_notes')
|
|
976
|
+
if 'eu' in _dict:
|
|
977
|
+
args['eu'] = CaseEu.from_dict(_dict.get('eu'))
|
|
978
|
+
if 'watchlist' in _dict:
|
|
979
|
+
args['watchlist'] = [User.from_dict(x) for x in _dict.get('watchlist')]
|
|
980
|
+
if 'attachments' in _dict:
|
|
981
|
+
args['attachments'] = [Attachment.from_dict(x) for x in _dict.get('attachments')]
|
|
982
|
+
if 'offering' in _dict:
|
|
983
|
+
args['offering'] = Offering.from_dict(_dict.get('offering'))
|
|
984
|
+
if 'resources' in _dict:
|
|
985
|
+
args['resources'] = [Resource.from_dict(x) for x in _dict.get('resources')]
|
|
986
|
+
if 'comments' in _dict:
|
|
987
|
+
args['comments'] = [Comment.from_dict(x) for x in _dict.get('comments')]
|
|
988
|
+
return cls(**args)
|
|
989
|
+
|
|
990
|
+
@classmethod
|
|
991
|
+
def _from_dict(cls, _dict):
|
|
992
|
+
"""Initialize a Case object from a json dictionary."""
|
|
993
|
+
return cls.from_dict(_dict)
|
|
994
|
+
|
|
995
|
+
def to_dict(self) -> Dict:
|
|
996
|
+
"""Return a json dictionary representing this model."""
|
|
997
|
+
_dict = {}
|
|
998
|
+
if hasattr(self, 'number') and self.number is not None:
|
|
999
|
+
_dict['number'] = self.number
|
|
1000
|
+
if hasattr(self, 'short_description') and self.short_description is not None:
|
|
1001
|
+
_dict['short_description'] = self.short_description
|
|
1002
|
+
if hasattr(self, 'description') and self.description is not None:
|
|
1003
|
+
_dict['description'] = self.description
|
|
1004
|
+
if hasattr(self, 'created_at') and self.created_at is not None:
|
|
1005
|
+
_dict['created_at'] = self.created_at
|
|
1006
|
+
if hasattr(self, 'created_by') and self.created_by is not None:
|
|
1007
|
+
_dict['created_by'] = self.created_by.to_dict()
|
|
1008
|
+
if hasattr(self, 'updated_at') and self.updated_at is not None:
|
|
1009
|
+
_dict['updated_at'] = self.updated_at
|
|
1010
|
+
if hasattr(self, 'updated_by') and self.updated_by is not None:
|
|
1011
|
+
_dict['updated_by'] = self.updated_by.to_dict()
|
|
1012
|
+
if hasattr(self, 'contact_type') and self.contact_type is not None:
|
|
1013
|
+
_dict['contact_type'] = self.contact_type
|
|
1014
|
+
if hasattr(self, 'contact') and self.contact is not None:
|
|
1015
|
+
_dict['contact'] = self.contact.to_dict()
|
|
1016
|
+
if hasattr(self, 'status') and self.status is not None:
|
|
1017
|
+
_dict['status'] = self.status
|
|
1018
|
+
if hasattr(self, 'severity') and self.severity is not None:
|
|
1019
|
+
_dict['severity'] = self.severity
|
|
1020
|
+
if hasattr(self, 'support_tier') and self.support_tier is not None:
|
|
1021
|
+
_dict['support_tier'] = self.support_tier
|
|
1022
|
+
if hasattr(self, 'resolution') and self.resolution is not None:
|
|
1023
|
+
_dict['resolution'] = self.resolution
|
|
1024
|
+
if hasattr(self, 'close_notes') and self.close_notes is not None:
|
|
1025
|
+
_dict['close_notes'] = self.close_notes
|
|
1026
|
+
if hasattr(self, 'eu') and self.eu is not None:
|
|
1027
|
+
_dict['eu'] = self.eu.to_dict()
|
|
1028
|
+
if hasattr(self, 'watchlist') and self.watchlist is not None:
|
|
1029
|
+
_dict['watchlist'] = [x.to_dict() for x in self.watchlist]
|
|
1030
|
+
if hasattr(self, 'attachments') and self.attachments is not None:
|
|
1031
|
+
_dict['attachments'] = [x.to_dict() for x in self.attachments]
|
|
1032
|
+
if hasattr(self, 'offering') and self.offering is not None:
|
|
1033
|
+
_dict['offering'] = self.offering.to_dict()
|
|
1034
|
+
if hasattr(self, 'resources') and self.resources is not None:
|
|
1035
|
+
_dict['resources'] = [x.to_dict() for x in self.resources]
|
|
1036
|
+
if hasattr(self, 'comments') and self.comments is not None:
|
|
1037
|
+
_dict['comments'] = [x.to_dict() for x in self.comments]
|
|
1038
|
+
return _dict
|
|
1039
|
+
|
|
1040
|
+
def _to_dict(self):
|
|
1041
|
+
"""Return a json dictionary representing this model."""
|
|
1042
|
+
return self.to_dict()
|
|
1043
|
+
|
|
1044
|
+
def __str__(self) -> str:
|
|
1045
|
+
"""Return a `str` version of this Case object."""
|
|
1046
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1047
|
+
|
|
1048
|
+
def __eq__(self, other: 'Case') -> bool:
|
|
1049
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1050
|
+
if not isinstance(other, self.__class__):
|
|
1051
|
+
return False
|
|
1052
|
+
return self.__dict__ == other.__dict__
|
|
1053
|
+
|
|
1054
|
+
def __ne__(self, other: 'Case') -> bool:
|
|
1055
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1056
|
+
return not self == other
|
|
1057
|
+
|
|
1058
|
+
class ContactTypeEnum(str, Enum):
|
|
1059
|
+
"""
|
|
1060
|
+
Name of the console to interact with the contact.
|
|
1061
|
+
"""
|
|
1062
|
+
|
|
1063
|
+
CLOUD_SUPPORT_CENTER = 'Cloud Support Center'
|
|
1064
|
+
IMS_CONSOLE = 'IMS Console'
|
|
1065
|
+
|
|
1066
|
+
class SupportTierEnum(str, Enum):
|
|
1067
|
+
"""
|
|
1068
|
+
Support tier of the account.
|
|
1069
|
+
"""
|
|
1070
|
+
|
|
1071
|
+
FREE = 'Free'
|
|
1072
|
+
BASIC = 'Basic'
|
|
1073
|
+
STANDARD = 'Standard'
|
|
1074
|
+
PREMIUM = 'Premium'
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
class CaseEu:
|
|
1078
|
+
"""
|
|
1079
|
+
EU support.
|
|
1080
|
+
|
|
1081
|
+
:attr bool support: (optional) Identifying whether the case has EU Support.
|
|
1082
|
+
:attr str data_center: (optional) Information about the data center.
|
|
1083
|
+
"""
|
|
1084
|
+
|
|
1085
|
+
def __init__(self, *, support: bool = None, data_center: str = None) -> None:
|
|
1086
|
+
"""
|
|
1087
|
+
Initialize a CaseEu object.
|
|
1088
|
+
|
|
1089
|
+
:param bool support: (optional) Identifying whether the case has EU
|
|
1090
|
+
Support.
|
|
1091
|
+
:param str data_center: (optional) Information about the data center.
|
|
1092
|
+
"""
|
|
1093
|
+
self.support = support
|
|
1094
|
+
self.data_center = data_center
|
|
1095
|
+
|
|
1096
|
+
@classmethod
|
|
1097
|
+
def from_dict(cls, _dict: Dict) -> 'CaseEu':
|
|
1098
|
+
"""Initialize a CaseEu object from a json dictionary."""
|
|
1099
|
+
args = {}
|
|
1100
|
+
if 'support' in _dict:
|
|
1101
|
+
args['support'] = _dict.get('support')
|
|
1102
|
+
if 'data_center' in _dict:
|
|
1103
|
+
args['data_center'] = _dict.get('data_center')
|
|
1104
|
+
return cls(**args)
|
|
1105
|
+
|
|
1106
|
+
@classmethod
|
|
1107
|
+
def _from_dict(cls, _dict):
|
|
1108
|
+
"""Initialize a CaseEu object from a json dictionary."""
|
|
1109
|
+
return cls.from_dict(_dict)
|
|
1110
|
+
|
|
1111
|
+
def to_dict(self) -> Dict:
|
|
1112
|
+
"""Return a json dictionary representing this model."""
|
|
1113
|
+
_dict = {}
|
|
1114
|
+
if hasattr(self, 'support') and self.support is not None:
|
|
1115
|
+
_dict['support'] = self.support
|
|
1116
|
+
if hasattr(self, 'data_center') and self.data_center is not None:
|
|
1117
|
+
_dict['data_center'] = self.data_center
|
|
1118
|
+
return _dict
|
|
1119
|
+
|
|
1120
|
+
def _to_dict(self):
|
|
1121
|
+
"""Return a json dictionary representing this model."""
|
|
1122
|
+
return self.to_dict()
|
|
1123
|
+
|
|
1124
|
+
def __str__(self) -> str:
|
|
1125
|
+
"""Return a `str` version of this CaseEu object."""
|
|
1126
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1127
|
+
|
|
1128
|
+
def __eq__(self, other: 'CaseEu') -> bool:
|
|
1129
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1130
|
+
if not isinstance(other, self.__class__):
|
|
1131
|
+
return False
|
|
1132
|
+
return self.__dict__ == other.__dict__
|
|
1133
|
+
|
|
1134
|
+
def __ne__(self, other: 'CaseEu') -> bool:
|
|
1135
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1136
|
+
return not self == other
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
class CaseList:
|
|
1140
|
+
"""
|
|
1141
|
+
Response of a GET /cases request.
|
|
1142
|
+
|
|
1143
|
+
:attr int total_count: (optional) Total number of cases that satisfy the query.
|
|
1144
|
+
:attr PaginationLink first: (optional) Container for URL pointer to related
|
|
1145
|
+
pages of cases.
|
|
1146
|
+
:attr PaginationLink next: (optional) Container for URL pointer to related pages
|
|
1147
|
+
of cases.
|
|
1148
|
+
:attr PaginationLink previous: (optional) Container for URL pointer to related
|
|
1149
|
+
pages of cases.
|
|
1150
|
+
:attr PaginationLink last: (optional) Container for URL pointer to related pages
|
|
1151
|
+
of cases.
|
|
1152
|
+
:attr List[Case] cases: (optional) List of cases.
|
|
1153
|
+
"""
|
|
1154
|
+
|
|
1155
|
+
def __init__(
|
|
1156
|
+
self,
|
|
1157
|
+
*,
|
|
1158
|
+
total_count: int = None,
|
|
1159
|
+
first: 'PaginationLink' = None,
|
|
1160
|
+
next: 'PaginationLink' = None,
|
|
1161
|
+
previous: 'PaginationLink' = None,
|
|
1162
|
+
last: 'PaginationLink' = None,
|
|
1163
|
+
cases: List['Case'] = None,
|
|
1164
|
+
) -> None:
|
|
1165
|
+
"""
|
|
1166
|
+
Initialize a CaseList object.
|
|
1167
|
+
|
|
1168
|
+
:param int total_count: (optional) Total number of cases that satisfy the
|
|
1169
|
+
query.
|
|
1170
|
+
:param PaginationLink first: (optional) Container for URL pointer to
|
|
1171
|
+
related pages of cases.
|
|
1172
|
+
:param PaginationLink next: (optional) Container for URL pointer to related
|
|
1173
|
+
pages of cases.
|
|
1174
|
+
:param PaginationLink previous: (optional) Container for URL pointer to
|
|
1175
|
+
related pages of cases.
|
|
1176
|
+
:param PaginationLink last: (optional) Container for URL pointer to related
|
|
1177
|
+
pages of cases.
|
|
1178
|
+
:param List[Case] cases: (optional) List of cases.
|
|
1179
|
+
"""
|
|
1180
|
+
self.total_count = total_count
|
|
1181
|
+
self.first = first
|
|
1182
|
+
self.next = next
|
|
1183
|
+
self.previous = previous
|
|
1184
|
+
self.last = last
|
|
1185
|
+
self.cases = cases
|
|
1186
|
+
|
|
1187
|
+
@classmethod
|
|
1188
|
+
def from_dict(cls, _dict: Dict) -> 'CaseList':
|
|
1189
|
+
"""Initialize a CaseList object from a json dictionary."""
|
|
1190
|
+
args = {}
|
|
1191
|
+
if 'total_count' in _dict:
|
|
1192
|
+
args['total_count'] = _dict.get('total_count')
|
|
1193
|
+
if 'first' in _dict:
|
|
1194
|
+
args['first'] = PaginationLink.from_dict(_dict.get('first'))
|
|
1195
|
+
if 'next' in _dict:
|
|
1196
|
+
args['next'] = PaginationLink.from_dict(_dict.get('next'))
|
|
1197
|
+
if 'previous' in _dict:
|
|
1198
|
+
args['previous'] = PaginationLink.from_dict(_dict.get('previous'))
|
|
1199
|
+
if 'last' in _dict:
|
|
1200
|
+
args['last'] = PaginationLink.from_dict(_dict.get('last'))
|
|
1201
|
+
if 'cases' in _dict:
|
|
1202
|
+
args['cases'] = [Case.from_dict(x) for x in _dict.get('cases')]
|
|
1203
|
+
return cls(**args)
|
|
1204
|
+
|
|
1205
|
+
@classmethod
|
|
1206
|
+
def _from_dict(cls, _dict):
|
|
1207
|
+
"""Initialize a CaseList object from a json dictionary."""
|
|
1208
|
+
return cls.from_dict(_dict)
|
|
1209
|
+
|
|
1210
|
+
def to_dict(self) -> Dict:
|
|
1211
|
+
"""Return a json dictionary representing this model."""
|
|
1212
|
+
_dict = {}
|
|
1213
|
+
if hasattr(self, 'total_count') and self.total_count is not None:
|
|
1214
|
+
_dict['total_count'] = self.total_count
|
|
1215
|
+
if hasattr(self, 'first') and self.first is not None:
|
|
1216
|
+
_dict['first'] = self.first.to_dict()
|
|
1217
|
+
if hasattr(self, 'next') and self.next is not None:
|
|
1218
|
+
_dict['next'] = self.next.to_dict()
|
|
1219
|
+
if hasattr(self, 'previous') and self.previous is not None:
|
|
1220
|
+
_dict['previous'] = self.previous.to_dict()
|
|
1221
|
+
if hasattr(self, 'last') and self.last is not None:
|
|
1222
|
+
_dict['last'] = self.last.to_dict()
|
|
1223
|
+
if hasattr(self, 'cases') and self.cases is not None:
|
|
1224
|
+
_dict['cases'] = [x.to_dict() for x in self.cases]
|
|
1225
|
+
return _dict
|
|
1226
|
+
|
|
1227
|
+
def _to_dict(self):
|
|
1228
|
+
"""Return a json dictionary representing this model."""
|
|
1229
|
+
return self.to_dict()
|
|
1230
|
+
|
|
1231
|
+
def __str__(self) -> str:
|
|
1232
|
+
"""Return a `str` version of this CaseList object."""
|
|
1233
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1234
|
+
|
|
1235
|
+
def __eq__(self, other: 'CaseList') -> bool:
|
|
1236
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1237
|
+
if not isinstance(other, self.__class__):
|
|
1238
|
+
return False
|
|
1239
|
+
return self.__dict__ == other.__dict__
|
|
1240
|
+
|
|
1241
|
+
def __ne__(self, other: 'CaseList') -> bool:
|
|
1242
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1243
|
+
return not self == other
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
class CasePayloadEu:
|
|
1247
|
+
"""
|
|
1248
|
+
Specify if the case should be treated as EU regulated. Only one of the following
|
|
1249
|
+
properties is required. Call EU support utility endpoint to determine which property
|
|
1250
|
+
must be specified for your account.
|
|
1251
|
+
|
|
1252
|
+
:attr bool supported: (optional) indicating whether the case is EU supported.
|
|
1253
|
+
:attr int data_center: (optional) If EU supported utility endpoint specifies
|
|
1254
|
+
data center, then pass the data center id to mark a case as EU supported.
|
|
1255
|
+
"""
|
|
1256
|
+
|
|
1257
|
+
def __init__(self, *, supported: bool = None, data_center: int = None) -> None:
|
|
1258
|
+
"""
|
|
1259
|
+
Initialize a CasePayloadEu object.
|
|
1260
|
+
|
|
1261
|
+
:param bool supported: (optional) indicating whether the case is EU
|
|
1262
|
+
supported.
|
|
1263
|
+
:param int data_center: (optional) If EU supported utility endpoint
|
|
1264
|
+
specifies data center, then pass the data center id to mark a case as EU
|
|
1265
|
+
supported.
|
|
1266
|
+
"""
|
|
1267
|
+
self.supported = supported
|
|
1268
|
+
self.data_center = data_center
|
|
1269
|
+
|
|
1270
|
+
@classmethod
|
|
1271
|
+
def from_dict(cls, _dict: Dict) -> 'CasePayloadEu':
|
|
1272
|
+
"""Initialize a CasePayloadEu object from a json dictionary."""
|
|
1273
|
+
args = {}
|
|
1274
|
+
if 'supported' in _dict:
|
|
1275
|
+
args['supported'] = _dict.get('supported')
|
|
1276
|
+
if 'data_center' in _dict:
|
|
1277
|
+
args['data_center'] = _dict.get('data_center')
|
|
1278
|
+
return cls(**args)
|
|
1279
|
+
|
|
1280
|
+
@classmethod
|
|
1281
|
+
def _from_dict(cls, _dict):
|
|
1282
|
+
"""Initialize a CasePayloadEu object from a json dictionary."""
|
|
1283
|
+
return cls.from_dict(_dict)
|
|
1284
|
+
|
|
1285
|
+
def to_dict(self) -> Dict:
|
|
1286
|
+
"""Return a json dictionary representing this model."""
|
|
1287
|
+
_dict = {}
|
|
1288
|
+
if hasattr(self, 'supported') and self.supported is not None:
|
|
1289
|
+
_dict['supported'] = self.supported
|
|
1290
|
+
if hasattr(self, 'data_center') and self.data_center is not None:
|
|
1291
|
+
_dict['data_center'] = self.data_center
|
|
1292
|
+
return _dict
|
|
1293
|
+
|
|
1294
|
+
def _to_dict(self):
|
|
1295
|
+
"""Return a json dictionary representing this model."""
|
|
1296
|
+
return self.to_dict()
|
|
1297
|
+
|
|
1298
|
+
def __str__(self) -> str:
|
|
1299
|
+
"""Return a `str` version of this CasePayloadEu object."""
|
|
1300
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1301
|
+
|
|
1302
|
+
def __eq__(self, other: 'CasePayloadEu') -> bool:
|
|
1303
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1304
|
+
if not isinstance(other, self.__class__):
|
|
1305
|
+
return False
|
|
1306
|
+
return self.__dict__ == other.__dict__
|
|
1307
|
+
|
|
1308
|
+
def __ne__(self, other: 'CasePayloadEu') -> bool:
|
|
1309
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1310
|
+
return not self == other
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
class Comment:
|
|
1314
|
+
"""
|
|
1315
|
+
A comment in a case.
|
|
1316
|
+
|
|
1317
|
+
:attr str value: (optional) The comment.
|
|
1318
|
+
:attr str added_at: (optional) Date time when comment was added in UTC.
|
|
1319
|
+
:attr User added_by: (optional) User info in a case.
|
|
1320
|
+
"""
|
|
1321
|
+
|
|
1322
|
+
def __init__(self, *, value: str = None, added_at: str = None, added_by: 'User' = None) -> None:
|
|
1323
|
+
"""
|
|
1324
|
+
Initialize a Comment object.
|
|
1325
|
+
|
|
1326
|
+
:param str value: (optional) The comment.
|
|
1327
|
+
:param str added_at: (optional) Date time when comment was added in UTC.
|
|
1328
|
+
:param User added_by: (optional) User info in a case.
|
|
1329
|
+
"""
|
|
1330
|
+
self.value = value
|
|
1331
|
+
self.added_at = added_at
|
|
1332
|
+
self.added_by = added_by
|
|
1333
|
+
|
|
1334
|
+
@classmethod
|
|
1335
|
+
def from_dict(cls, _dict: Dict) -> 'Comment':
|
|
1336
|
+
"""Initialize a Comment object from a json dictionary."""
|
|
1337
|
+
args = {}
|
|
1338
|
+
if 'value' in _dict:
|
|
1339
|
+
args['value'] = _dict.get('value')
|
|
1340
|
+
if 'added_at' in _dict:
|
|
1341
|
+
args['added_at'] = _dict.get('added_at')
|
|
1342
|
+
if 'added_by' in _dict:
|
|
1343
|
+
args['added_by'] = User.from_dict(_dict.get('added_by'))
|
|
1344
|
+
return cls(**args)
|
|
1345
|
+
|
|
1346
|
+
@classmethod
|
|
1347
|
+
def _from_dict(cls, _dict):
|
|
1348
|
+
"""Initialize a Comment object from a json dictionary."""
|
|
1349
|
+
return cls.from_dict(_dict)
|
|
1350
|
+
|
|
1351
|
+
def to_dict(self) -> Dict:
|
|
1352
|
+
"""Return a json dictionary representing this model."""
|
|
1353
|
+
_dict = {}
|
|
1354
|
+
if hasattr(self, 'value') and self.value is not None:
|
|
1355
|
+
_dict['value'] = self.value
|
|
1356
|
+
if hasattr(self, 'added_at') and self.added_at is not None:
|
|
1357
|
+
_dict['added_at'] = self.added_at
|
|
1358
|
+
if hasattr(self, 'added_by') and self.added_by is not None:
|
|
1359
|
+
_dict['added_by'] = self.added_by.to_dict()
|
|
1360
|
+
return _dict
|
|
1361
|
+
|
|
1362
|
+
def _to_dict(self):
|
|
1363
|
+
"""Return a json dictionary representing this model."""
|
|
1364
|
+
return self.to_dict()
|
|
1365
|
+
|
|
1366
|
+
def __str__(self) -> str:
|
|
1367
|
+
"""Return a `str` version of this Comment object."""
|
|
1368
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1369
|
+
|
|
1370
|
+
def __eq__(self, other: 'Comment') -> bool:
|
|
1371
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1372
|
+
if not isinstance(other, self.__class__):
|
|
1373
|
+
return False
|
|
1374
|
+
return self.__dict__ == other.__dict__
|
|
1375
|
+
|
|
1376
|
+
def __ne__(self, other: 'Comment') -> bool:
|
|
1377
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1378
|
+
return not self == other
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
class Offering:
|
|
1382
|
+
"""
|
|
1383
|
+
Offering details.
|
|
1384
|
+
|
|
1385
|
+
:attr str name: Name of the offering.
|
|
1386
|
+
:attr OfferingType type: Offering type.
|
|
1387
|
+
"""
|
|
1388
|
+
|
|
1389
|
+
def __init__(self, name: str, type: 'OfferingType') -> None:
|
|
1390
|
+
"""
|
|
1391
|
+
Initialize a Offering object.
|
|
1392
|
+
|
|
1393
|
+
:param str name: Name of the offering.
|
|
1394
|
+
:param OfferingType type: Offering type.
|
|
1395
|
+
"""
|
|
1396
|
+
self.name = name
|
|
1397
|
+
self.type = type
|
|
1398
|
+
|
|
1399
|
+
@classmethod
|
|
1400
|
+
def from_dict(cls, _dict: Dict) -> 'Offering':
|
|
1401
|
+
"""Initialize a Offering object from a json dictionary."""
|
|
1402
|
+
args = {}
|
|
1403
|
+
if 'name' in _dict:
|
|
1404
|
+
args['name'] = _dict.get('name')
|
|
1405
|
+
else:
|
|
1406
|
+
raise ValueError('Required property \'name\' not present in Offering JSON')
|
|
1407
|
+
if 'type' in _dict:
|
|
1408
|
+
args['type'] = OfferingType.from_dict(_dict.get('type'))
|
|
1409
|
+
else:
|
|
1410
|
+
raise ValueError('Required property \'type\' not present in Offering JSON')
|
|
1411
|
+
return cls(**args)
|
|
1412
|
+
|
|
1413
|
+
@classmethod
|
|
1414
|
+
def _from_dict(cls, _dict):
|
|
1415
|
+
"""Initialize a Offering object from a json dictionary."""
|
|
1416
|
+
return cls.from_dict(_dict)
|
|
1417
|
+
|
|
1418
|
+
def to_dict(self) -> Dict:
|
|
1419
|
+
"""Return a json dictionary representing this model."""
|
|
1420
|
+
_dict = {}
|
|
1421
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1422
|
+
_dict['name'] = self.name
|
|
1423
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
1424
|
+
_dict['type'] = self.type.to_dict()
|
|
1425
|
+
return _dict
|
|
1426
|
+
|
|
1427
|
+
def _to_dict(self):
|
|
1428
|
+
"""Return a json dictionary representing this model."""
|
|
1429
|
+
return self.to_dict()
|
|
1430
|
+
|
|
1431
|
+
def __str__(self) -> str:
|
|
1432
|
+
"""Return a `str` version of this Offering object."""
|
|
1433
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1434
|
+
|
|
1435
|
+
def __eq__(self, other: 'Offering') -> bool:
|
|
1436
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1437
|
+
if not isinstance(other, self.__class__):
|
|
1438
|
+
return False
|
|
1439
|
+
return self.__dict__ == other.__dict__
|
|
1440
|
+
|
|
1441
|
+
def __ne__(self, other: 'Offering') -> bool:
|
|
1442
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1443
|
+
return not self == other
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
class OfferingType:
|
|
1447
|
+
"""
|
|
1448
|
+
Offering type.
|
|
1449
|
+
|
|
1450
|
+
:attr str group: Offering type group. "crn_service_name" is preferred over
|
|
1451
|
+
"category" as the latter is legacy and will be deprecated in the future.
|
|
1452
|
+
:attr str key: CRN service name of the offering.
|
|
1453
|
+
:attr str kind: (optional) Optional. Platform kind of the offering.
|
|
1454
|
+
:attr str id: (optional) Offering id in the catalog. This alone is enough to
|
|
1455
|
+
identify the offering.
|
|
1456
|
+
"""
|
|
1457
|
+
|
|
1458
|
+
def __init__(self, group: str, key: str, *, kind: str = None, id: str = None) -> None:
|
|
1459
|
+
"""
|
|
1460
|
+
Initialize a OfferingType object.
|
|
1461
|
+
|
|
1462
|
+
:param str group: Offering type group. "crn_service_name" is preferred over
|
|
1463
|
+
"category" as the latter is legacy and will be deprecated in the future.
|
|
1464
|
+
:param str key: CRN service name of the offering.
|
|
1465
|
+
:param str kind: (optional) Optional. Platform kind of the offering.
|
|
1466
|
+
:param str id: (optional) Offering id in the catalog. This alone is enough
|
|
1467
|
+
to identify the offering.
|
|
1468
|
+
"""
|
|
1469
|
+
self.group = group
|
|
1470
|
+
self.key = key
|
|
1471
|
+
self.kind = kind
|
|
1472
|
+
self.id = id
|
|
1473
|
+
|
|
1474
|
+
@classmethod
|
|
1475
|
+
def from_dict(cls, _dict: Dict) -> 'OfferingType':
|
|
1476
|
+
"""Initialize a OfferingType object from a json dictionary."""
|
|
1477
|
+
args = {}
|
|
1478
|
+
if 'group' in _dict:
|
|
1479
|
+
args['group'] = _dict.get('group')
|
|
1480
|
+
else:
|
|
1481
|
+
raise ValueError('Required property \'group\' not present in OfferingType JSON')
|
|
1482
|
+
if 'key' in _dict:
|
|
1483
|
+
args['key'] = _dict.get('key')
|
|
1484
|
+
else:
|
|
1485
|
+
raise ValueError('Required property \'key\' not present in OfferingType JSON')
|
|
1486
|
+
if 'kind' in _dict:
|
|
1487
|
+
args['kind'] = _dict.get('kind')
|
|
1488
|
+
if 'id' in _dict:
|
|
1489
|
+
args['id'] = _dict.get('id')
|
|
1490
|
+
return cls(**args)
|
|
1491
|
+
|
|
1492
|
+
@classmethod
|
|
1493
|
+
def _from_dict(cls, _dict):
|
|
1494
|
+
"""Initialize a OfferingType object from a json dictionary."""
|
|
1495
|
+
return cls.from_dict(_dict)
|
|
1496
|
+
|
|
1497
|
+
def to_dict(self) -> Dict:
|
|
1498
|
+
"""Return a json dictionary representing this model."""
|
|
1499
|
+
_dict = {}
|
|
1500
|
+
if hasattr(self, 'group') and self.group is not None:
|
|
1501
|
+
_dict['group'] = self.group
|
|
1502
|
+
if hasattr(self, 'key') and self.key is not None:
|
|
1503
|
+
_dict['key'] = self.key
|
|
1504
|
+
if hasattr(self, 'kind') and self.kind is not None:
|
|
1505
|
+
_dict['kind'] = self.kind
|
|
1506
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
1507
|
+
_dict['id'] = self.id
|
|
1508
|
+
return _dict
|
|
1509
|
+
|
|
1510
|
+
def _to_dict(self):
|
|
1511
|
+
"""Return a json dictionary representing this model."""
|
|
1512
|
+
return self.to_dict()
|
|
1513
|
+
|
|
1514
|
+
def __str__(self) -> str:
|
|
1515
|
+
"""Return a `str` version of this OfferingType object."""
|
|
1516
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1517
|
+
|
|
1518
|
+
def __eq__(self, other: 'OfferingType') -> bool:
|
|
1519
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1520
|
+
if not isinstance(other, self.__class__):
|
|
1521
|
+
return False
|
|
1522
|
+
return self.__dict__ == other.__dict__
|
|
1523
|
+
|
|
1524
|
+
def __ne__(self, other: 'OfferingType') -> bool:
|
|
1525
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1526
|
+
return not self == other
|
|
1527
|
+
|
|
1528
|
+
class GroupEnum(str, Enum):
|
|
1529
|
+
"""
|
|
1530
|
+
Offering type group. "crn_service_name" is preferred over "category" as the latter
|
|
1531
|
+
is legacy and will be deprecated in the future.
|
|
1532
|
+
"""
|
|
1533
|
+
|
|
1534
|
+
CRN_SERVICE_NAME = 'crn_service_name'
|
|
1535
|
+
CATEGORY = 'category'
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
class PaginationLink:
|
|
1539
|
+
"""
|
|
1540
|
+
Container for URL pointer to related pages of cases.
|
|
1541
|
+
|
|
1542
|
+
:attr str href: (optional) URL to related pages of cases.
|
|
1543
|
+
"""
|
|
1544
|
+
|
|
1545
|
+
def __init__(self, *, href: str = None) -> None:
|
|
1546
|
+
"""
|
|
1547
|
+
Initialize a PaginationLink object.
|
|
1548
|
+
|
|
1549
|
+
:param str href: (optional) URL to related pages of cases.
|
|
1550
|
+
"""
|
|
1551
|
+
self.href = href
|
|
1552
|
+
|
|
1553
|
+
@classmethod
|
|
1554
|
+
def from_dict(cls, _dict: Dict) -> 'PaginationLink':
|
|
1555
|
+
"""Initialize a PaginationLink object from a json dictionary."""
|
|
1556
|
+
args = {}
|
|
1557
|
+
if 'href' in _dict:
|
|
1558
|
+
args['href'] = _dict.get('href')
|
|
1559
|
+
return cls(**args)
|
|
1560
|
+
|
|
1561
|
+
@classmethod
|
|
1562
|
+
def _from_dict(cls, _dict):
|
|
1563
|
+
"""Initialize a PaginationLink object from a json dictionary."""
|
|
1564
|
+
return cls.from_dict(_dict)
|
|
1565
|
+
|
|
1566
|
+
def to_dict(self) -> Dict:
|
|
1567
|
+
"""Return a json dictionary representing this model."""
|
|
1568
|
+
_dict = {}
|
|
1569
|
+
if hasattr(self, 'href') and self.href is not None:
|
|
1570
|
+
_dict['href'] = self.href
|
|
1571
|
+
return _dict
|
|
1572
|
+
|
|
1573
|
+
def _to_dict(self):
|
|
1574
|
+
"""Return a json dictionary representing this model."""
|
|
1575
|
+
return self.to_dict()
|
|
1576
|
+
|
|
1577
|
+
def __str__(self) -> str:
|
|
1578
|
+
"""Return a `str` version of this PaginationLink object."""
|
|
1579
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1580
|
+
|
|
1581
|
+
def __eq__(self, other: 'PaginationLink') -> bool:
|
|
1582
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1583
|
+
if not isinstance(other, self.__class__):
|
|
1584
|
+
return False
|
|
1585
|
+
return self.__dict__ == other.__dict__
|
|
1586
|
+
|
|
1587
|
+
def __ne__(self, other: 'PaginationLink') -> bool:
|
|
1588
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1589
|
+
return not self == other
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
class Resource:
|
|
1593
|
+
"""
|
|
1594
|
+
A resource record of a case.
|
|
1595
|
+
|
|
1596
|
+
:attr str crn: (optional) ID of the resource.
|
|
1597
|
+
:attr str name: (optional) Name of the resource.
|
|
1598
|
+
:attr str type: (optional) Type of resource.
|
|
1599
|
+
:attr str url: (optional) URL of resource.
|
|
1600
|
+
:attr str note: (optional) Note about resource.
|
|
1601
|
+
"""
|
|
1602
|
+
|
|
1603
|
+
def __init__(
|
|
1604
|
+
self, *, crn: str = None, name: str = None, type: str = None, url: str = None, note: str = None
|
|
1605
|
+
) -> None:
|
|
1606
|
+
"""
|
|
1607
|
+
Initialize a Resource object.
|
|
1608
|
+
|
|
1609
|
+
:param str crn: (optional) ID of the resource.
|
|
1610
|
+
:param str name: (optional) Name of the resource.
|
|
1611
|
+
:param str type: (optional) Type of resource.
|
|
1612
|
+
:param str url: (optional) URL of resource.
|
|
1613
|
+
:param str note: (optional) Note about resource.
|
|
1614
|
+
"""
|
|
1615
|
+
self.crn = crn
|
|
1616
|
+
self.name = name
|
|
1617
|
+
self.type = type
|
|
1618
|
+
self.url = url
|
|
1619
|
+
self.note = note
|
|
1620
|
+
|
|
1621
|
+
@classmethod
|
|
1622
|
+
def from_dict(cls, _dict: Dict) -> 'Resource':
|
|
1623
|
+
"""Initialize a Resource object from a json dictionary."""
|
|
1624
|
+
args = {}
|
|
1625
|
+
if 'crn' in _dict:
|
|
1626
|
+
args['crn'] = _dict.get('crn')
|
|
1627
|
+
if 'name' in _dict:
|
|
1628
|
+
args['name'] = _dict.get('name')
|
|
1629
|
+
if 'type' in _dict:
|
|
1630
|
+
args['type'] = _dict.get('type')
|
|
1631
|
+
if 'url' in _dict:
|
|
1632
|
+
args['url'] = _dict.get('url')
|
|
1633
|
+
if 'note' in _dict:
|
|
1634
|
+
args['note'] = _dict.get('note')
|
|
1635
|
+
return cls(**args)
|
|
1636
|
+
|
|
1637
|
+
@classmethod
|
|
1638
|
+
def _from_dict(cls, _dict):
|
|
1639
|
+
"""Initialize a Resource object from a json dictionary."""
|
|
1640
|
+
return cls.from_dict(_dict)
|
|
1641
|
+
|
|
1642
|
+
def to_dict(self) -> Dict:
|
|
1643
|
+
"""Return a json dictionary representing this model."""
|
|
1644
|
+
_dict = {}
|
|
1645
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
1646
|
+
_dict['crn'] = self.crn
|
|
1647
|
+
if hasattr(self, 'name') and self.name is not None:
|
|
1648
|
+
_dict['name'] = self.name
|
|
1649
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
1650
|
+
_dict['type'] = self.type
|
|
1651
|
+
if hasattr(self, 'url') and self.url is not None:
|
|
1652
|
+
_dict['url'] = self.url
|
|
1653
|
+
if hasattr(self, 'note') and self.note is not None:
|
|
1654
|
+
_dict['note'] = self.note
|
|
1655
|
+
return _dict
|
|
1656
|
+
|
|
1657
|
+
def _to_dict(self):
|
|
1658
|
+
"""Return a json dictionary representing this model."""
|
|
1659
|
+
return self.to_dict()
|
|
1660
|
+
|
|
1661
|
+
def __str__(self) -> str:
|
|
1662
|
+
"""Return a `str` version of this Resource object."""
|
|
1663
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1664
|
+
|
|
1665
|
+
def __eq__(self, other: 'Resource') -> bool:
|
|
1666
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1667
|
+
if not isinstance(other, self.__class__):
|
|
1668
|
+
return False
|
|
1669
|
+
return self.__dict__ == other.__dict__
|
|
1670
|
+
|
|
1671
|
+
def __ne__(self, other: 'Resource') -> bool:
|
|
1672
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1673
|
+
return not self == other
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
class ResourcePayload:
|
|
1677
|
+
"""
|
|
1678
|
+
Payload to add a resource to a case.
|
|
1679
|
+
|
|
1680
|
+
:attr str crn: (optional) Cloud Resource Name of the resource.
|
|
1681
|
+
:attr str type: (optional) Only used to attach Classic IaaS devices that have no
|
|
1682
|
+
CRN.
|
|
1683
|
+
:attr float id: (optional) Deprecated: Only used to attach Classic IaaS devices
|
|
1684
|
+
that have no CRN. Id of Classic IaaS device. This is deprecated in favor of the
|
|
1685
|
+
crn field.
|
|
1686
|
+
:attr str note: (optional) A note about this resource.
|
|
1687
|
+
"""
|
|
1688
|
+
|
|
1689
|
+
def __init__(self, *, crn: str = None, type: str = None, id: float = None, note: str = None) -> None:
|
|
1690
|
+
"""
|
|
1691
|
+
Initialize a ResourcePayload object.
|
|
1692
|
+
|
|
1693
|
+
:param str crn: (optional) Cloud Resource Name of the resource.
|
|
1694
|
+
:param str type: (optional) Only used to attach Classic IaaS devices that
|
|
1695
|
+
have no CRN.
|
|
1696
|
+
:param float id: (optional) Deprecated: Only used to attach Classic IaaS
|
|
1697
|
+
devices that have no CRN. Id of Classic IaaS device. This is deprecated in
|
|
1698
|
+
favor of the crn field.
|
|
1699
|
+
:param str note: (optional) A note about this resource.
|
|
1700
|
+
"""
|
|
1701
|
+
self.crn = crn
|
|
1702
|
+
self.type = type
|
|
1703
|
+
self.id = id
|
|
1704
|
+
self.note = note
|
|
1705
|
+
|
|
1706
|
+
@classmethod
|
|
1707
|
+
def from_dict(cls, _dict: Dict) -> 'ResourcePayload':
|
|
1708
|
+
"""Initialize a ResourcePayload object from a json dictionary."""
|
|
1709
|
+
args = {}
|
|
1710
|
+
if 'crn' in _dict:
|
|
1711
|
+
args['crn'] = _dict.get('crn')
|
|
1712
|
+
if 'type' in _dict:
|
|
1713
|
+
args['type'] = _dict.get('type')
|
|
1714
|
+
if 'id' in _dict:
|
|
1715
|
+
args['id'] = _dict.get('id')
|
|
1716
|
+
if 'note' in _dict:
|
|
1717
|
+
args['note'] = _dict.get('note')
|
|
1718
|
+
return cls(**args)
|
|
1719
|
+
|
|
1720
|
+
@classmethod
|
|
1721
|
+
def _from_dict(cls, _dict):
|
|
1722
|
+
"""Initialize a ResourcePayload object from a json dictionary."""
|
|
1723
|
+
return cls.from_dict(_dict)
|
|
1724
|
+
|
|
1725
|
+
def to_dict(self) -> Dict:
|
|
1726
|
+
"""Return a json dictionary representing this model."""
|
|
1727
|
+
_dict = {}
|
|
1728
|
+
if hasattr(self, 'crn') and self.crn is not None:
|
|
1729
|
+
_dict['crn'] = self.crn
|
|
1730
|
+
if hasattr(self, 'type') and self.type is not None:
|
|
1731
|
+
_dict['type'] = self.type
|
|
1732
|
+
if hasattr(self, 'id') and self.id is not None:
|
|
1733
|
+
_dict['id'] = self.id
|
|
1734
|
+
if hasattr(self, 'note') and self.note is not None:
|
|
1735
|
+
_dict['note'] = self.note
|
|
1736
|
+
return _dict
|
|
1737
|
+
|
|
1738
|
+
def _to_dict(self):
|
|
1739
|
+
"""Return a json dictionary representing this model."""
|
|
1740
|
+
return self.to_dict()
|
|
1741
|
+
|
|
1742
|
+
def __str__(self) -> str:
|
|
1743
|
+
"""Return a `str` version of this ResourcePayload object."""
|
|
1744
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1745
|
+
|
|
1746
|
+
def __eq__(self, other: 'ResourcePayload') -> bool:
|
|
1747
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1748
|
+
if not isinstance(other, self.__class__):
|
|
1749
|
+
return False
|
|
1750
|
+
return self.__dict__ == other.__dict__
|
|
1751
|
+
|
|
1752
|
+
def __ne__(self, other: 'ResourcePayload') -> bool:
|
|
1753
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1754
|
+
return not self == other
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
class StatusPayload:
|
|
1758
|
+
"""
|
|
1759
|
+
Payload to update status of the case.
|
|
1760
|
+
|
|
1761
|
+
:attr str action: action to perform on the case.
|
|
1762
|
+
"""
|
|
1763
|
+
|
|
1764
|
+
def __init__(self, action: str) -> None:
|
|
1765
|
+
"""
|
|
1766
|
+
Initialize a StatusPayload object.
|
|
1767
|
+
|
|
1768
|
+
:param str action: action to perform on the case.
|
|
1769
|
+
"""
|
|
1770
|
+
msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format(
|
|
1771
|
+
", ".join(['ResolvePayload', 'UnresolvePayload', 'AcceptPayload'])
|
|
1772
|
+
)
|
|
1773
|
+
raise Exception(msg)
|
|
1774
|
+
|
|
1775
|
+
@classmethod
|
|
1776
|
+
def from_dict(cls, _dict: Dict) -> 'StatusPayload':
|
|
1777
|
+
"""Initialize a StatusPayload object from a json dictionary."""
|
|
1778
|
+
disc_class = cls._get_class_by_discriminator(_dict)
|
|
1779
|
+
if disc_class != cls:
|
|
1780
|
+
return disc_class.from_dict(_dict)
|
|
1781
|
+
msg = (
|
|
1782
|
+
"Cannot convert dictionary into an instance of base class 'StatusPayload'. "
|
|
1783
|
+
+ "The discriminator value should map to a valid subclass: {1}"
|
|
1784
|
+
).format(", ".join(['ResolvePayload', 'UnresolvePayload', 'AcceptPayload']))
|
|
1785
|
+
raise Exception(msg)
|
|
1786
|
+
|
|
1787
|
+
@classmethod
|
|
1788
|
+
def _from_dict(cls, _dict: Dict):
|
|
1789
|
+
"""Initialize a StatusPayload object from a json dictionary."""
|
|
1790
|
+
return cls.from_dict(_dict)
|
|
1791
|
+
|
|
1792
|
+
@classmethod
|
|
1793
|
+
def _get_class_by_discriminator(cls, _dict: Dict) -> object:
|
|
1794
|
+
mapping = {}
|
|
1795
|
+
mapping['resolve'] = 'ResolvePayload'
|
|
1796
|
+
mapping['unresolve'] = 'UnresolvePayload'
|
|
1797
|
+
mapping['accept'] = 'AcceptPayload'
|
|
1798
|
+
disc_value = _dict.get('action')
|
|
1799
|
+
if disc_value is None:
|
|
1800
|
+
raise ValueError('Discriminator property \'action\' not found in StatusPayload JSON')
|
|
1801
|
+
class_name = mapping.get(disc_value, disc_value)
|
|
1802
|
+
try:
|
|
1803
|
+
disc_class = getattr(sys.modules[__name__], class_name)
|
|
1804
|
+
except AttributeError:
|
|
1805
|
+
disc_class = cls
|
|
1806
|
+
if isinstance(disc_class, object):
|
|
1807
|
+
return disc_class
|
|
1808
|
+
raise TypeError('%s is not a discriminator class' % class_name)
|
|
1809
|
+
|
|
1810
|
+
class ActionEnum(str, Enum):
|
|
1811
|
+
"""
|
|
1812
|
+
action to perform on the case.
|
|
1813
|
+
"""
|
|
1814
|
+
|
|
1815
|
+
RESOLVE = 'resolve'
|
|
1816
|
+
UNRESOLVE = 'unresolve'
|
|
1817
|
+
ACCEPT = 'accept'
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
class User:
|
|
1821
|
+
"""
|
|
1822
|
+
User info in a case.
|
|
1823
|
+
|
|
1824
|
+
:attr str name: (optional) Full name of the user.
|
|
1825
|
+
:attr str realm: the ID realm.
|
|
1826
|
+
:attr str user_id: unique user ID in the realm specified by the type.
|
|
1827
|
+
"""
|
|
1828
|
+
|
|
1829
|
+
def __init__(self, realm: str, user_id: str, *, name: str = None) -> None:
|
|
1830
|
+
"""
|
|
1831
|
+
Initialize a User object.
|
|
1832
|
+
|
|
1833
|
+
:param str realm: the ID realm.
|
|
1834
|
+
:param str user_id: unique user ID in the realm specified by the type.
|
|
1835
|
+
"""
|
|
1836
|
+
self.name = name
|
|
1837
|
+
self.realm = realm
|
|
1838
|
+
self.user_id = user_id
|
|
1839
|
+
|
|
1840
|
+
@classmethod
|
|
1841
|
+
def from_dict(cls, _dict: Dict) -> 'User':
|
|
1842
|
+
"""Initialize a User object from a json dictionary."""
|
|
1843
|
+
args = {}
|
|
1844
|
+
if 'name' in _dict:
|
|
1845
|
+
args['name'] = _dict.get('name')
|
|
1846
|
+
if 'realm' in _dict:
|
|
1847
|
+
args['realm'] = _dict.get('realm')
|
|
1848
|
+
else:
|
|
1849
|
+
raise ValueError('Required property \'realm\' not present in User JSON')
|
|
1850
|
+
if 'user_id' in _dict:
|
|
1851
|
+
args['user_id'] = _dict.get('user_id')
|
|
1852
|
+
else:
|
|
1853
|
+
raise ValueError('Required property \'user_id\' not present in User JSON')
|
|
1854
|
+
return cls(**args)
|
|
1855
|
+
|
|
1856
|
+
@classmethod
|
|
1857
|
+
def _from_dict(cls, _dict):
|
|
1858
|
+
"""Initialize a User object from a json dictionary."""
|
|
1859
|
+
return cls.from_dict(_dict)
|
|
1860
|
+
|
|
1861
|
+
def to_dict(self) -> Dict:
|
|
1862
|
+
"""Return a json dictionary representing this model."""
|
|
1863
|
+
_dict = {}
|
|
1864
|
+
if hasattr(self, 'name') and getattr(self, 'name') is not None:
|
|
1865
|
+
_dict['name'] = getattr(self, 'name')
|
|
1866
|
+
if hasattr(self, 'realm') and self.realm is not None:
|
|
1867
|
+
_dict['realm'] = self.realm
|
|
1868
|
+
if hasattr(self, 'user_id') and self.user_id is not None:
|
|
1869
|
+
_dict['user_id'] = self.user_id
|
|
1870
|
+
return _dict
|
|
1871
|
+
|
|
1872
|
+
def _to_dict(self):
|
|
1873
|
+
"""Return a json dictionary representing this model."""
|
|
1874
|
+
return self.to_dict()
|
|
1875
|
+
|
|
1876
|
+
def __str__(self) -> str:
|
|
1877
|
+
"""Return a `str` version of this User object."""
|
|
1878
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1879
|
+
|
|
1880
|
+
def __eq__(self, other: 'User') -> bool:
|
|
1881
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1882
|
+
if not isinstance(other, self.__class__):
|
|
1883
|
+
return False
|
|
1884
|
+
return self.__dict__ == other.__dict__
|
|
1885
|
+
|
|
1886
|
+
def __ne__(self, other: 'User') -> bool:
|
|
1887
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1888
|
+
return not self == other
|
|
1889
|
+
|
|
1890
|
+
class RealmEnum(str, Enum):
|
|
1891
|
+
"""
|
|
1892
|
+
the ID realm.
|
|
1893
|
+
"""
|
|
1894
|
+
|
|
1895
|
+
IBMID = 'IBMid'
|
|
1896
|
+
SL = 'SL'
|
|
1897
|
+
BSS = 'BSS'
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
class Watchlist:
|
|
1901
|
+
"""
|
|
1902
|
+
Payload to add/remove users to/from the case watchlist.
|
|
1903
|
+
|
|
1904
|
+
:attr List[User] watchlist: (optional) Array of user ID objects.
|
|
1905
|
+
"""
|
|
1906
|
+
|
|
1907
|
+
def __init__(self, *, watchlist: List['User'] = None) -> None:
|
|
1908
|
+
"""
|
|
1909
|
+
Initialize a Watchlist object.
|
|
1910
|
+
|
|
1911
|
+
:param List[User] watchlist: (optional) Array of user ID objects.
|
|
1912
|
+
"""
|
|
1913
|
+
self.watchlist = watchlist
|
|
1914
|
+
|
|
1915
|
+
@classmethod
|
|
1916
|
+
def from_dict(cls, _dict: Dict) -> 'Watchlist':
|
|
1917
|
+
"""Initialize a Watchlist object from a json dictionary."""
|
|
1918
|
+
args = {}
|
|
1919
|
+
if 'watchlist' in _dict:
|
|
1920
|
+
args['watchlist'] = [User.from_dict(x) for x in _dict.get('watchlist')]
|
|
1921
|
+
return cls(**args)
|
|
1922
|
+
|
|
1923
|
+
@classmethod
|
|
1924
|
+
def _from_dict(cls, _dict):
|
|
1925
|
+
"""Initialize a Watchlist object from a json dictionary."""
|
|
1926
|
+
return cls.from_dict(_dict)
|
|
1927
|
+
|
|
1928
|
+
def to_dict(self) -> Dict:
|
|
1929
|
+
"""Return a json dictionary representing this model."""
|
|
1930
|
+
_dict = {}
|
|
1931
|
+
if hasattr(self, 'watchlist') and self.watchlist is not None:
|
|
1932
|
+
_dict['watchlist'] = [x.to_dict() for x in self.watchlist]
|
|
1933
|
+
return _dict
|
|
1934
|
+
|
|
1935
|
+
def _to_dict(self):
|
|
1936
|
+
"""Return a json dictionary representing this model."""
|
|
1937
|
+
return self.to_dict()
|
|
1938
|
+
|
|
1939
|
+
def __str__(self) -> str:
|
|
1940
|
+
"""Return a `str` version of this Watchlist object."""
|
|
1941
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
1942
|
+
|
|
1943
|
+
def __eq__(self, other: 'Watchlist') -> bool:
|
|
1944
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
1945
|
+
if not isinstance(other, self.__class__):
|
|
1946
|
+
return False
|
|
1947
|
+
return self.__dict__ == other.__dict__
|
|
1948
|
+
|
|
1949
|
+
def __ne__(self, other: 'Watchlist') -> bool:
|
|
1950
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
1951
|
+
return not self == other
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
class WatchlistAddResponse:
|
|
1955
|
+
"""
|
|
1956
|
+
Response of a request when adding to watchlist.
|
|
1957
|
+
|
|
1958
|
+
:attr List[User] added: (optional) List of added user.
|
|
1959
|
+
:attr List[User] failed: (optional) List of failed to add user.
|
|
1960
|
+
"""
|
|
1961
|
+
|
|
1962
|
+
def __init__(self, *, added: List['User'] = None, failed: List['User'] = None) -> None:
|
|
1963
|
+
"""
|
|
1964
|
+
Initialize a WatchlistAddResponse object.
|
|
1965
|
+
|
|
1966
|
+
:param List[User] added: (optional) List of added user.
|
|
1967
|
+
:param List[User] failed: (optional) List of failed to add user.
|
|
1968
|
+
"""
|
|
1969
|
+
self.added = added
|
|
1970
|
+
self.failed = failed
|
|
1971
|
+
|
|
1972
|
+
@classmethod
|
|
1973
|
+
def from_dict(cls, _dict: Dict) -> 'WatchlistAddResponse':
|
|
1974
|
+
"""Initialize a WatchlistAddResponse object from a json dictionary."""
|
|
1975
|
+
args = {}
|
|
1976
|
+
if 'added' in _dict:
|
|
1977
|
+
args['added'] = [User.from_dict(x) for x in _dict.get('added')]
|
|
1978
|
+
if 'failed' in _dict:
|
|
1979
|
+
args['failed'] = [User.from_dict(x) for x in _dict.get('failed')]
|
|
1980
|
+
return cls(**args)
|
|
1981
|
+
|
|
1982
|
+
@classmethod
|
|
1983
|
+
def _from_dict(cls, _dict):
|
|
1984
|
+
"""Initialize a WatchlistAddResponse object from a json dictionary."""
|
|
1985
|
+
return cls.from_dict(_dict)
|
|
1986
|
+
|
|
1987
|
+
def to_dict(self) -> Dict:
|
|
1988
|
+
"""Return a json dictionary representing this model."""
|
|
1989
|
+
_dict = {}
|
|
1990
|
+
if hasattr(self, 'added') and self.added is not None:
|
|
1991
|
+
_dict['added'] = [x.to_dict() for x in self.added]
|
|
1992
|
+
if hasattr(self, 'failed') and self.failed is not None:
|
|
1993
|
+
_dict['failed'] = [x.to_dict() for x in self.failed]
|
|
1994
|
+
return _dict
|
|
1995
|
+
|
|
1996
|
+
def _to_dict(self):
|
|
1997
|
+
"""Return a json dictionary representing this model."""
|
|
1998
|
+
return self.to_dict()
|
|
1999
|
+
|
|
2000
|
+
def __str__(self) -> str:
|
|
2001
|
+
"""Return a `str` version of this WatchlistAddResponse object."""
|
|
2002
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2003
|
+
|
|
2004
|
+
def __eq__(self, other: 'WatchlistAddResponse') -> bool:
|
|
2005
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2006
|
+
if not isinstance(other, self.__class__):
|
|
2007
|
+
return False
|
|
2008
|
+
return self.__dict__ == other.__dict__
|
|
2009
|
+
|
|
2010
|
+
def __ne__(self, other: 'WatchlistAddResponse') -> bool:
|
|
2011
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2012
|
+
return not self == other
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
class AcceptPayload(StatusPayload):
|
|
2016
|
+
"""
|
|
2017
|
+
Payload to accept the proposed resolution of the case.
|
|
2018
|
+
|
|
2019
|
+
:attr str action: action to perform on the case.
|
|
2020
|
+
:attr str comment: (optional) Comment about accepting the proposed resolution.
|
|
2021
|
+
"""
|
|
2022
|
+
|
|
2023
|
+
def __init__(self, action: str, *, comment: str = None) -> None:
|
|
2024
|
+
"""
|
|
2025
|
+
Initialize a AcceptPayload object.
|
|
2026
|
+
|
|
2027
|
+
:param str action: action to perform on the case.
|
|
2028
|
+
:param str comment: (optional) Comment about accepting the proposed
|
|
2029
|
+
resolution.
|
|
2030
|
+
"""
|
|
2031
|
+
# pylint: disable=super-init-not-called
|
|
2032
|
+
self.action = action
|
|
2033
|
+
self.comment = comment
|
|
2034
|
+
|
|
2035
|
+
@classmethod
|
|
2036
|
+
def from_dict(cls, _dict: Dict) -> 'AcceptPayload':
|
|
2037
|
+
"""Initialize a AcceptPayload object from a json dictionary."""
|
|
2038
|
+
args = {}
|
|
2039
|
+
if 'action' in _dict:
|
|
2040
|
+
args['action'] = _dict.get('action')
|
|
2041
|
+
else:
|
|
2042
|
+
raise ValueError('Required property \'action\' not present in AcceptPayload JSON')
|
|
2043
|
+
if 'comment' in _dict:
|
|
2044
|
+
args['comment'] = _dict.get('comment')
|
|
2045
|
+
return cls(**args)
|
|
2046
|
+
|
|
2047
|
+
@classmethod
|
|
2048
|
+
def _from_dict(cls, _dict):
|
|
2049
|
+
"""Initialize a AcceptPayload object from a json dictionary."""
|
|
2050
|
+
return cls.from_dict(_dict)
|
|
2051
|
+
|
|
2052
|
+
def to_dict(self) -> Dict:
|
|
2053
|
+
"""Return a json dictionary representing this model."""
|
|
2054
|
+
_dict = {}
|
|
2055
|
+
if hasattr(self, 'action') and self.action is not None:
|
|
2056
|
+
_dict['action'] = self.action
|
|
2057
|
+
if hasattr(self, 'comment') and self.comment is not None:
|
|
2058
|
+
_dict['comment'] = self.comment
|
|
2059
|
+
return _dict
|
|
2060
|
+
|
|
2061
|
+
def _to_dict(self):
|
|
2062
|
+
"""Return a json dictionary representing this model."""
|
|
2063
|
+
return self.to_dict()
|
|
2064
|
+
|
|
2065
|
+
def __str__(self) -> str:
|
|
2066
|
+
"""Return a `str` version of this AcceptPayload object."""
|
|
2067
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2068
|
+
|
|
2069
|
+
def __eq__(self, other: 'AcceptPayload') -> bool:
|
|
2070
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2071
|
+
if not isinstance(other, self.__class__):
|
|
2072
|
+
return False
|
|
2073
|
+
return self.__dict__ == other.__dict__
|
|
2074
|
+
|
|
2075
|
+
def __ne__(self, other: 'AcceptPayload') -> bool:
|
|
2076
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2077
|
+
return not self == other
|
|
2078
|
+
|
|
2079
|
+
class ActionEnum(str, Enum):
|
|
2080
|
+
"""
|
|
2081
|
+
action to perform on the case.
|
|
2082
|
+
"""
|
|
2083
|
+
|
|
2084
|
+
RESOLVE = 'resolve'
|
|
2085
|
+
UNRESOLVE = 'unresolve'
|
|
2086
|
+
ACCEPT = 'accept'
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
class ResolvePayload(StatusPayload):
|
|
2090
|
+
"""
|
|
2091
|
+
Payload to resolve the case.
|
|
2092
|
+
|
|
2093
|
+
:attr str action: action to perform on the case.
|
|
2094
|
+
:attr str comment: (optional) comment of resolution.
|
|
2095
|
+
:attr int resolution_code: * 1: Client error
|
|
2096
|
+
* 2: Defect found with Component/Service
|
|
2097
|
+
* 3: Documentation Error
|
|
2098
|
+
* 4: Solution found in forums
|
|
2099
|
+
* 5: Solution found in public Documentation
|
|
2100
|
+
* 6: Solution no longer required
|
|
2101
|
+
* 7: Solution provided by IBM outside of support case
|
|
2102
|
+
* 8: Solution provided by IBM support engineer.
|
|
2103
|
+
"""
|
|
2104
|
+
|
|
2105
|
+
def __init__(self, action: str, resolution_code: int, *, comment: str = None) -> None:
|
|
2106
|
+
"""
|
|
2107
|
+
Initialize a ResolvePayload object.
|
|
2108
|
+
|
|
2109
|
+
:param str action: action to perform on the case.
|
|
2110
|
+
:param int resolution_code: * 1: Client error
|
|
2111
|
+
* 2: Defect found with Component/Service
|
|
2112
|
+
* 3: Documentation Error
|
|
2113
|
+
* 4: Solution found in forums
|
|
2114
|
+
* 5: Solution found in public Documentation
|
|
2115
|
+
* 6: Solution no longer required
|
|
2116
|
+
* 7: Solution provided by IBM outside of support case
|
|
2117
|
+
* 8: Solution provided by IBM support engineer.
|
|
2118
|
+
:param str comment: (optional) comment of resolution.
|
|
2119
|
+
"""
|
|
2120
|
+
# pylint: disable=super-init-not-called
|
|
2121
|
+
self.action = action
|
|
2122
|
+
self.comment = comment
|
|
2123
|
+
self.resolution_code = resolution_code
|
|
2124
|
+
|
|
2125
|
+
@classmethod
|
|
2126
|
+
def from_dict(cls, _dict: Dict) -> 'ResolvePayload':
|
|
2127
|
+
"""Initialize a ResolvePayload object from a json dictionary."""
|
|
2128
|
+
args = {}
|
|
2129
|
+
if 'action' in _dict:
|
|
2130
|
+
args['action'] = _dict.get('action')
|
|
2131
|
+
else:
|
|
2132
|
+
raise ValueError('Required property \'action\' not present in ResolvePayload JSON')
|
|
2133
|
+
if 'comment' in _dict:
|
|
2134
|
+
args['comment'] = _dict.get('comment')
|
|
2135
|
+
if 'resolution_code' in _dict:
|
|
2136
|
+
args['resolution_code'] = _dict.get('resolution_code')
|
|
2137
|
+
else:
|
|
2138
|
+
raise ValueError('Required property \'resolution_code\' not present in ResolvePayload JSON')
|
|
2139
|
+
return cls(**args)
|
|
2140
|
+
|
|
2141
|
+
@classmethod
|
|
2142
|
+
def _from_dict(cls, _dict):
|
|
2143
|
+
"""Initialize a ResolvePayload object from a json dictionary."""
|
|
2144
|
+
return cls.from_dict(_dict)
|
|
2145
|
+
|
|
2146
|
+
def to_dict(self) -> Dict:
|
|
2147
|
+
"""Return a json dictionary representing this model."""
|
|
2148
|
+
_dict = {}
|
|
2149
|
+
if hasattr(self, 'action') and self.action is not None:
|
|
2150
|
+
_dict['action'] = self.action
|
|
2151
|
+
if hasattr(self, 'comment') and self.comment is not None:
|
|
2152
|
+
_dict['comment'] = self.comment
|
|
2153
|
+
if hasattr(self, 'resolution_code') and self.resolution_code is not None:
|
|
2154
|
+
_dict['resolution_code'] = self.resolution_code
|
|
2155
|
+
return _dict
|
|
2156
|
+
|
|
2157
|
+
def _to_dict(self):
|
|
2158
|
+
"""Return a json dictionary representing this model."""
|
|
2159
|
+
return self.to_dict()
|
|
2160
|
+
|
|
2161
|
+
def __str__(self) -> str:
|
|
2162
|
+
"""Return a `str` version of this ResolvePayload object."""
|
|
2163
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2164
|
+
|
|
2165
|
+
def __eq__(self, other: 'ResolvePayload') -> bool:
|
|
2166
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2167
|
+
if not isinstance(other, self.__class__):
|
|
2168
|
+
return False
|
|
2169
|
+
return self.__dict__ == other.__dict__
|
|
2170
|
+
|
|
2171
|
+
def __ne__(self, other: 'ResolvePayload') -> bool:
|
|
2172
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2173
|
+
return not self == other
|
|
2174
|
+
|
|
2175
|
+
class ActionEnum(str, Enum):
|
|
2176
|
+
"""
|
|
2177
|
+
action to perform on the case.
|
|
2178
|
+
"""
|
|
2179
|
+
|
|
2180
|
+
RESOLVE = 'resolve'
|
|
2181
|
+
UNRESOLVE = 'unresolve'
|
|
2182
|
+
ACCEPT = 'accept'
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
class UnresolvePayload(StatusPayload):
|
|
2186
|
+
"""
|
|
2187
|
+
Payload to unresolve the case.
|
|
2188
|
+
|
|
2189
|
+
:attr str action: action to perform on the case.
|
|
2190
|
+
:attr str comment: Comment why the case should be unresolved.
|
|
2191
|
+
"""
|
|
2192
|
+
|
|
2193
|
+
def __init__(self, action: str, comment: str) -> None:
|
|
2194
|
+
"""
|
|
2195
|
+
Initialize a UnresolvePayload object.
|
|
2196
|
+
|
|
2197
|
+
:param str action: action to perform on the case.
|
|
2198
|
+
:param str comment: Comment why the case should be unresolved.
|
|
2199
|
+
"""
|
|
2200
|
+
# pylint: disable=super-init-not-called
|
|
2201
|
+
self.action = action
|
|
2202
|
+
self.comment = comment
|
|
2203
|
+
|
|
2204
|
+
@classmethod
|
|
2205
|
+
def from_dict(cls, _dict: Dict) -> 'UnresolvePayload':
|
|
2206
|
+
"""Initialize a UnresolvePayload object from a json dictionary."""
|
|
2207
|
+
args = {}
|
|
2208
|
+
if 'action' in _dict:
|
|
2209
|
+
args['action'] = _dict.get('action')
|
|
2210
|
+
else:
|
|
2211
|
+
raise ValueError('Required property \'action\' not present in UnresolvePayload JSON')
|
|
2212
|
+
if 'comment' in _dict:
|
|
2213
|
+
args['comment'] = _dict.get('comment')
|
|
2214
|
+
else:
|
|
2215
|
+
raise ValueError('Required property \'comment\' not present in UnresolvePayload JSON')
|
|
2216
|
+
return cls(**args)
|
|
2217
|
+
|
|
2218
|
+
@classmethod
|
|
2219
|
+
def _from_dict(cls, _dict):
|
|
2220
|
+
"""Initialize a UnresolvePayload object from a json dictionary."""
|
|
2221
|
+
return cls.from_dict(_dict)
|
|
2222
|
+
|
|
2223
|
+
def to_dict(self) -> Dict:
|
|
2224
|
+
"""Return a json dictionary representing this model."""
|
|
2225
|
+
_dict = {}
|
|
2226
|
+
if hasattr(self, 'action') and self.action is not None:
|
|
2227
|
+
_dict['action'] = self.action
|
|
2228
|
+
if hasattr(self, 'comment') and self.comment is not None:
|
|
2229
|
+
_dict['comment'] = self.comment
|
|
2230
|
+
return _dict
|
|
2231
|
+
|
|
2232
|
+
def _to_dict(self):
|
|
2233
|
+
"""Return a json dictionary representing this model."""
|
|
2234
|
+
return self.to_dict()
|
|
2235
|
+
|
|
2236
|
+
def __str__(self) -> str:
|
|
2237
|
+
"""Return a `str` version of this UnresolvePayload object."""
|
|
2238
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2239
|
+
|
|
2240
|
+
def __eq__(self, other: 'UnresolvePayload') -> bool:
|
|
2241
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2242
|
+
if not isinstance(other, self.__class__):
|
|
2243
|
+
return False
|
|
2244
|
+
return self.__dict__ == other.__dict__
|
|
2245
|
+
|
|
2246
|
+
def __ne__(self, other: 'UnresolvePayload') -> bool:
|
|
2247
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2248
|
+
return not self == other
|
|
2249
|
+
|
|
2250
|
+
class ActionEnum(str, Enum):
|
|
2251
|
+
"""
|
|
2252
|
+
action to perform on the case.
|
|
2253
|
+
"""
|
|
2254
|
+
|
|
2255
|
+
RESOLVE = 'resolve'
|
|
2256
|
+
UNRESOLVE = 'unresolve'
|
|
2257
|
+
ACCEPT = 'accept'
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
class FileWithMetadata:
|
|
2261
|
+
"""
|
|
2262
|
+
A file with its associated metadata.
|
|
2263
|
+
|
|
2264
|
+
:attr BinaryIO data: The data / content for the file.
|
|
2265
|
+
:attr str filename: (optional) The filename of the file.
|
|
2266
|
+
:attr str content_type: (optional) The content type of the file.
|
|
2267
|
+
"""
|
|
2268
|
+
|
|
2269
|
+
def __init__(self, data: BinaryIO, *, filename: str = None, content_type: str = None) -> None:
|
|
2270
|
+
"""
|
|
2271
|
+
Initialize a FileWithMetadata object.
|
|
2272
|
+
|
|
2273
|
+
:param BinaryIO data: The data / content for the file.
|
|
2274
|
+
:param str filename: (optional) The filename of the file.
|
|
2275
|
+
:param str content_type: (optional) The content type of the file.
|
|
2276
|
+
"""
|
|
2277
|
+
self.data = data
|
|
2278
|
+
self.filename = filename
|
|
2279
|
+
self.content_type = content_type
|
|
2280
|
+
|
|
2281
|
+
@classmethod
|
|
2282
|
+
def from_dict(cls, _dict: Dict) -> 'FileWithMetadata':
|
|
2283
|
+
"""Initialize a FileWithMetadata object from a json dictionary."""
|
|
2284
|
+
args = {}
|
|
2285
|
+
if 'data' in _dict:
|
|
2286
|
+
args['data'] = _dict.get('data')
|
|
2287
|
+
else:
|
|
2288
|
+
raise ValueError('Required property \'data\' not present in FileWithMetadata JSON')
|
|
2289
|
+
if 'filename' in _dict:
|
|
2290
|
+
args['filename'] = _dict.get('filename')
|
|
2291
|
+
if 'content_type' in _dict:
|
|
2292
|
+
args['content_type'] = _dict.get('content_type')
|
|
2293
|
+
return cls(**args)
|
|
2294
|
+
|
|
2295
|
+
@classmethod
|
|
2296
|
+
def _from_dict(cls, _dict):
|
|
2297
|
+
"""Initialize a FileWithMetadata object from a json dictionary."""
|
|
2298
|
+
return cls.from_dict(_dict)
|
|
2299
|
+
|
|
2300
|
+
def to_dict(self) -> Dict:
|
|
2301
|
+
"""Return a json dictionary representing this model."""
|
|
2302
|
+
_dict = {}
|
|
2303
|
+
if hasattr(self, 'data') and self.data is not None:
|
|
2304
|
+
_dict['data'] = self.data
|
|
2305
|
+
if hasattr(self, 'filename') and self.filename is not None:
|
|
2306
|
+
_dict['filename'] = self.filename
|
|
2307
|
+
if hasattr(self, 'content_type') and self.content_type is not None:
|
|
2308
|
+
_dict['content_type'] = self.content_type
|
|
2309
|
+
return _dict
|
|
2310
|
+
|
|
2311
|
+
def _to_dict(self):
|
|
2312
|
+
"""Return a json dictionary representing this model."""
|
|
2313
|
+
return self.to_dict()
|
|
2314
|
+
|
|
2315
|
+
def __str__(self) -> str:
|
|
2316
|
+
"""Return a `str` version of this FileWithMetadata object."""
|
|
2317
|
+
return json.dumps(self.to_dict(), indent=2)
|
|
2318
|
+
|
|
2319
|
+
def __eq__(self, other: 'FileWithMetadata') -> bool:
|
|
2320
|
+
"""Return `true` when self and other are equal, false otherwise."""
|
|
2321
|
+
if not isinstance(other, self.__class__):
|
|
2322
|
+
return False
|
|
2323
|
+
return self.__dict__ == other.__dict__
|
|
2324
|
+
|
|
2325
|
+
def __ne__(self, other: 'FileWithMetadata') -> bool:
|
|
2326
|
+
"""Return `true` when self and other are not equal, false otherwise."""
|
|
2327
|
+
return not self == other
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
##############################################################################
|
|
2331
|
+
# Pagers
|
|
2332
|
+
##############################################################################
|
|
2333
|
+
|
|
2334
|
+
|
|
2335
|
+
class GetCasesPager:
|
|
2336
|
+
"""
|
|
2337
|
+
GetCasesPager can be used to simplify the use of the "get_cases" method.
|
|
2338
|
+
"""
|
|
2339
|
+
|
|
2340
|
+
def __init__(
|
|
2341
|
+
self,
|
|
2342
|
+
*,
|
|
2343
|
+
client: CaseManagementV1,
|
|
2344
|
+
limit: int = None,
|
|
2345
|
+
search: str = None,
|
|
2346
|
+
sort: str = None,
|
|
2347
|
+
status: List[str] = None,
|
|
2348
|
+
fields: List[str] = None,
|
|
2349
|
+
) -> None:
|
|
2350
|
+
"""
|
|
2351
|
+
Initialize a GetCasesPager object.
|
|
2352
|
+
:param int limit: (optional) Number of cases that are returned.
|
|
2353
|
+
:param str search: (optional) String that a case might contain.
|
|
2354
|
+
:param str sort: (optional) Sort field and direction. If omitted, default
|
|
2355
|
+
to descending of updated date. Prefix "~" signifies sort in descending.
|
|
2356
|
+
:param List[str] status: (optional) Case status filter.
|
|
2357
|
+
:param List[str] fields: (optional) Selected fields of interest instead of
|
|
2358
|
+
all of the case information.
|
|
2359
|
+
"""
|
|
2360
|
+
self._has_next = True
|
|
2361
|
+
self._client = client
|
|
2362
|
+
self._page_context = {'next': None}
|
|
2363
|
+
self._limit = limit
|
|
2364
|
+
self._search = search
|
|
2365
|
+
self._sort = sort
|
|
2366
|
+
self._status = status
|
|
2367
|
+
self._fields = fields
|
|
2368
|
+
|
|
2369
|
+
def has_next(self) -> bool:
|
|
2370
|
+
"""
|
|
2371
|
+
Returns true if there are potentially more results to be retrieved.
|
|
2372
|
+
"""
|
|
2373
|
+
return self._has_next
|
|
2374
|
+
|
|
2375
|
+
def get_next(self) -> List[dict]:
|
|
2376
|
+
"""
|
|
2377
|
+
Returns the next page of results.
|
|
2378
|
+
:return: A List[dict], where each element is a dict that represents an instance of Case.
|
|
2379
|
+
:rtype: List[dict]
|
|
2380
|
+
"""
|
|
2381
|
+
if not self.has_next():
|
|
2382
|
+
raise StopIteration(message='No more results available')
|
|
2383
|
+
|
|
2384
|
+
result = self._client.get_cases(
|
|
2385
|
+
limit=self._limit,
|
|
2386
|
+
search=self._search,
|
|
2387
|
+
sort=self._sort,
|
|
2388
|
+
status=self._status,
|
|
2389
|
+
fields=self._fields,
|
|
2390
|
+
offset=self._page_context.get('next'),
|
|
2391
|
+
).get_result()
|
|
2392
|
+
|
|
2393
|
+
next = None
|
|
2394
|
+
next_page_link = result.get('next')
|
|
2395
|
+
if next_page_link is not None:
|
|
2396
|
+
next = get_query_param(next_page_link.get('href'), 'offset')
|
|
2397
|
+
self._page_context['next'] = next
|
|
2398
|
+
if next is None:
|
|
2399
|
+
self._has_next = False
|
|
2400
|
+
|
|
2401
|
+
return result.get('cases')
|
|
2402
|
+
|
|
2403
|
+
def get_all(self) -> List[dict]:
|
|
2404
|
+
"""
|
|
2405
|
+
Returns all results by invoking get_next() repeatedly
|
|
2406
|
+
until all pages of results have been retrieved.
|
|
2407
|
+
:return: A List[dict], where each element is a dict that represents an instance of Case.
|
|
2408
|
+
:rtype: List[dict]
|
|
2409
|
+
"""
|
|
2410
|
+
results = []
|
|
2411
|
+
while self.has_next():
|
|
2412
|
+
next_page = self.get_next()
|
|
2413
|
+
results.extend(next_page)
|
|
2414
|
+
return results
|