wds-client 0.7.0__py3-none-any.whl → 0.9.0__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.
- wds_client/__init__.py +8 -10
- wds_client/api/__init__.py +1 -2
- wds_client/api/capabilities_api.py +237 -102
- wds_client/api/cloning_api.py +782 -329
- wds_client/api/general_wds_information_api.py +463 -191
- wds_client/api/import_api.py +288 -127
- wds_client/api/instances_api.py +783 -333
- wds_client/api/job_api.py +518 -215
- wds_client/api/records_api.py +2512 -1089
- wds_client/api/schema_api.py +1450 -626
- wds_client/api_client.py +414 -310
- wds_client/api_response.py +21 -0
- wds_client/configuration.py +110 -53
- wds_client/exceptions.py +99 -20
- wds_client/models/__init__.py +4 -8
- wds_client/models/app.py +68 -125
- wds_client/models/attribute_data_type.py +31 -94
- wds_client/models/attribute_schema.py +71 -157
- wds_client/models/attribute_schema_update.py +69 -127
- wds_client/models/backup_job.py +96 -298
- wds_client/models/backup_response.py +70 -157
- wds_client/models/backup_restore_request.py +68 -129
- wds_client/models/batch_operation.py +83 -137
- wds_client/models/batch_record_request.py +70 -160
- wds_client/models/batch_response.py +68 -127
- wds_client/models/build.py +79 -207
- wds_client/models/capabilities.py +83 -103
- wds_client/models/clone_job.py +96 -298
- wds_client/models/clone_response.py +68 -129
- wds_client/models/commit.py +69 -125
- wds_client/models/error_response.py +78 -222
- wds_client/models/generic_job.py +102 -334
- wds_client/models/git.py +76 -129
- wds_client/models/import_request.py +77 -165
- wds_client/models/job.py +87 -243
- wds_client/models/job_v1.py +97 -277
- wds_client/models/record_query_response.py +86 -162
- wds_client/models/record_request.py +60 -96
- wds_client/models/record_response.py +70 -160
- wds_client/models/record_type_schema.py +84 -191
- wds_client/models/search_filter.py +60 -95
- wds_client/models/search_request.py +84 -220
- wds_client/models/search_sort_direction.py +17 -80
- wds_client/models/status_response.py +68 -125
- wds_client/models/tsv_upload_response.py +68 -127
- wds_client/models/version_response.py +86 -155
- wds_client/py.typed +0 -0
- wds_client/rest.py +136 -170
- wds_client-0.9.0.dist-info/METADATA +17 -0
- wds_client-0.9.0.dist-info/RECORD +52 -0
- {wds_client-0.7.0.dist-info → wds_client-0.9.0.dist-info}/WHEEL +1 -1
- wds_client/models/backup_job_all_of.py +0 -148
- wds_client/models/clone_job_all_of.py +0 -148
- wds_client/models/generic_job_all_of.py +0 -150
- wds_client/models/inline_object.py +0 -123
- wds_client-0.7.0.dist-info/METADATA +0 -16
- wds_client-0.7.0.dist-info/RECORD +0 -54
- {wds_client-0.7.0.dist-info → wds_client-0.9.0.dist-info}/top_level.txt +0 -0
@@ -3,146 +3,88 @@
|
|
3
3
|
"""
|
4
4
|
Workspace Data Service
|
5
5
|
|
6
|
-
This page lists current APIs.
|
6
|
+
This page lists current APIs. All v0.2 APIs are subject to change without notice. Changelog at [https://github.com/DataBiosphere/terra-workspace-data-service/releases](https://github.com/DataBiosphere/terra-workspace-data-service/releases)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: v0.2
|
9
|
-
Generated by
|
10
|
-
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
11
13
|
|
12
14
|
|
15
|
+
from __future__ import annotations
|
13
16
|
import pprint
|
14
17
|
import re # noqa: F401
|
18
|
+
import json
|
15
19
|
|
16
|
-
import
|
17
|
-
|
18
|
-
from wds_client.
|
19
|
-
|
20
|
-
|
21
|
-
class AttributeSchemaUpdate(object):
|
22
|
-
"""NOTE: This class is auto generated by OpenAPI Generator.
|
23
|
-
Ref: https://openapi-generator.tech
|
24
|
-
|
25
|
-
Do not edit the class manually.
|
26
|
-
"""
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from wds_client.models.attribute_data_type import AttributeDataType
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
27
25
|
|
26
|
+
class AttributeSchemaUpdate(BaseModel):
|
28
27
|
"""
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
self.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
:return: The name of this AttributeSchemaUpdate. # noqa: E501
|
67
|
-
:rtype: str
|
28
|
+
AttributeSchemaUpdate
|
29
|
+
""" # noqa: E501
|
30
|
+
name: Optional[StrictStr] = Field(default=None, description="new name of this attribute.")
|
31
|
+
datatype: Optional[AttributeDataType] = None
|
32
|
+
__properties: ClassVar[List[str]] = ["name", "datatype"]
|
33
|
+
|
34
|
+
model_config = ConfigDict(
|
35
|
+
populate_by_name=True,
|
36
|
+
validate_assignment=True,
|
37
|
+
protected_namespaces=(),
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
def to_str(self) -> str:
|
42
|
+
"""Returns the string representation of the model using alias"""
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
|
+
|
45
|
+
def to_json(self) -> str:
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
|
+
return json.dumps(self.to_dict())
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
+
"""Create an instance of AttributeSchemaUpdate from a JSON string"""
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
54
|
+
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
57
|
+
|
58
|
+
This has the following differences from calling pydantic's
|
59
|
+
`self.model_dump(by_alias=True)`:
|
60
|
+
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
62
|
+
were set at model initialization. Other fields with value `None`
|
63
|
+
are ignored.
|
68
64
|
"""
|
69
|
-
|
70
|
-
|
71
|
-
@name.setter
|
72
|
-
def name(self, name):
|
73
|
-
"""Sets the name of this AttributeSchemaUpdate.
|
65
|
+
excluded_fields: Set[str] = set([
|
66
|
+
])
|
74
67
|
|
75
|
-
|
68
|
+
_dict = self.model_dump(
|
69
|
+
by_alias=True,
|
70
|
+
exclude=excluded_fields,
|
71
|
+
exclude_none=True,
|
72
|
+
)
|
73
|
+
return _dict
|
76
74
|
|
77
|
-
|
78
|
-
|
79
|
-
"""
|
75
|
+
@classmethod
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
77
|
+
"""Create an instance of AttributeSchemaUpdate from a dict"""
|
78
|
+
if obj is None:
|
79
|
+
return None
|
80
80
|
|
81
|
-
|
81
|
+
if not isinstance(obj, dict):
|
82
|
+
return cls.model_validate(obj)
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
84
|
+
_obj = cls.model_validate({
|
85
|
+
"name": obj.get("name"),
|
86
|
+
"datatype": obj.get("datatype")
|
87
|
+
})
|
88
|
+
return _obj
|
86
89
|
|
87
90
|
|
88
|
-
:return: The datatype of this AttributeSchemaUpdate. # noqa: E501
|
89
|
-
:rtype: AttributeDataType
|
90
|
-
"""
|
91
|
-
return self._datatype
|
92
|
-
|
93
|
-
@datatype.setter
|
94
|
-
def datatype(self, datatype):
|
95
|
-
"""Sets the datatype of this AttributeSchemaUpdate.
|
96
|
-
|
97
|
-
|
98
|
-
:param datatype: The datatype of this AttributeSchemaUpdate. # noqa: E501
|
99
|
-
:type: AttributeDataType
|
100
|
-
"""
|
101
|
-
|
102
|
-
self._datatype = datatype
|
103
|
-
|
104
|
-
def to_dict(self):
|
105
|
-
"""Returns the model properties as a dict"""
|
106
|
-
result = {}
|
107
|
-
|
108
|
-
for attr, _ in six.iteritems(self.openapi_types):
|
109
|
-
value = getattr(self, attr)
|
110
|
-
if isinstance(value, list):
|
111
|
-
result[attr] = list(map(
|
112
|
-
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
113
|
-
value
|
114
|
-
))
|
115
|
-
elif hasattr(value, "to_dict"):
|
116
|
-
result[attr] = value.to_dict()
|
117
|
-
elif isinstance(value, dict):
|
118
|
-
result[attr] = dict(map(
|
119
|
-
lambda item: (item[0], item[1].to_dict())
|
120
|
-
if hasattr(item[1], "to_dict") else item,
|
121
|
-
value.items()
|
122
|
-
))
|
123
|
-
else:
|
124
|
-
result[attr] = value
|
125
|
-
|
126
|
-
return result
|
127
|
-
|
128
|
-
def to_str(self):
|
129
|
-
"""Returns the string representation of the model"""
|
130
|
-
return pprint.pformat(self.to_dict())
|
131
|
-
|
132
|
-
def __repr__(self):
|
133
|
-
"""For `print` and `pprint`"""
|
134
|
-
return self.to_str()
|
135
|
-
|
136
|
-
def __eq__(self, other):
|
137
|
-
"""Returns true if both objects are equal"""
|
138
|
-
if not isinstance(other, AttributeSchemaUpdate):
|
139
|
-
return False
|
140
|
-
|
141
|
-
return self.to_dict() == other.to_dict()
|
142
|
-
|
143
|
-
def __ne__(self, other):
|
144
|
-
"""Returns true if both objects are not equal"""
|
145
|
-
if not isinstance(other, AttributeSchemaUpdate):
|
146
|
-
return True
|
147
|
-
|
148
|
-
return self.to_dict() != other.to_dict()
|
wds_client/models/backup_job.py
CHANGED
@@ -3,312 +3,110 @@
|
|
3
3
|
"""
|
4
4
|
Workspace Data Service
|
5
5
|
|
6
|
-
This page lists current APIs.
|
6
|
+
This page lists current APIs. All v0.2 APIs are subject to change without notice. Changelog at [https://github.com/DataBiosphere/terra-workspace-data-service/releases](https://github.com/DataBiosphere/terra-workspace-data-service/releases)
|
7
7
|
|
8
8
|
The version of the OpenAPI document: v0.2
|
9
|
-
Generated by
|
10
|
-
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
11
13
|
|
12
14
|
|
15
|
+
from __future__ import annotations
|
13
16
|
import pprint
|
14
17
|
import re # noqa: F401
|
18
|
+
import json
|
15
19
|
|
16
|
-
import
|
17
|
-
|
18
|
-
from wds_client.
|
19
|
-
|
20
|
-
|
21
|
-
class BackupJob(object):
|
22
|
-
"""NOTE: This class is auto generated by OpenAPI Generator.
|
23
|
-
Ref: https://openapi-generator.tech
|
24
|
-
|
25
|
-
Do not edit the class manually.
|
26
|
-
"""
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from wds_client.models.backup_response import BackupResponse
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
27
25
|
|
26
|
+
class BackupJob(BaseModel):
|
28
27
|
"""
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
self.
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
:return: The job_type of this BackupJob. # noqa: E501
|
115
|
-
:rtype: str
|
116
|
-
"""
|
117
|
-
return self._job_type
|
118
|
-
|
119
|
-
@job_type.setter
|
120
|
-
def job_type(self, job_type):
|
121
|
-
"""Sets the job_type of this BackupJob.
|
122
|
-
|
123
|
-
|
124
|
-
:param job_type: The job_type of this BackupJob. # noqa: E501
|
125
|
-
:type: str
|
126
|
-
"""
|
127
|
-
|
128
|
-
self._job_type = job_type
|
129
|
-
|
130
|
-
@property
|
131
|
-
def status(self):
|
132
|
-
"""Gets the status of this BackupJob. # noqa: E501
|
133
|
-
|
134
|
-
|
135
|
-
:return: The status of this BackupJob. # noqa: E501
|
136
|
-
:rtype: str
|
137
|
-
"""
|
138
|
-
return self._status
|
139
|
-
|
140
|
-
@status.setter
|
141
|
-
def status(self, status):
|
142
|
-
"""Sets the status of this BackupJob.
|
143
|
-
|
144
|
-
|
145
|
-
:param status: The status of this BackupJob. # noqa: E501
|
146
|
-
:type: str
|
147
|
-
"""
|
148
|
-
if self.local_vars_configuration.client_side_validation and status is None: # noqa: E501
|
149
|
-
raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501
|
150
|
-
allowed_values = ["QUEUED", "RUNNING", "SUCCEEDED", "ERROR", "CANCELLED", "UNKNOWN"] # noqa: E501
|
151
|
-
if self.local_vars_configuration.client_side_validation and status not in allowed_values: # noqa: E501
|
152
|
-
raise ValueError(
|
153
|
-
"Invalid value for `status` ({0}), must be one of {1}" # noqa: E501
|
154
|
-
.format(status, allowed_values)
|
155
|
-
)
|
156
|
-
|
157
|
-
self._status = status
|
158
|
-
|
159
|
-
@property
|
160
|
-
def created(self):
|
161
|
-
"""Gets the created of this BackupJob. # noqa: E501
|
162
|
-
|
163
|
-
|
164
|
-
:return: The created of this BackupJob. # noqa: E501
|
165
|
-
:rtype: str
|
166
|
-
"""
|
167
|
-
return self._created
|
168
|
-
|
169
|
-
@created.setter
|
170
|
-
def created(self, created):
|
171
|
-
"""Sets the created of this BackupJob.
|
172
|
-
|
173
|
-
|
174
|
-
:param created: The created of this BackupJob. # noqa: E501
|
175
|
-
:type: str
|
176
|
-
"""
|
177
|
-
if self.local_vars_configuration.client_side_validation and created is None: # noqa: E501
|
178
|
-
raise ValueError("Invalid value for `created`, must not be `None`") # noqa: E501
|
179
|
-
|
180
|
-
self._created = created
|
181
|
-
|
182
|
-
@property
|
183
|
-
def updated(self):
|
184
|
-
"""Gets the updated of this BackupJob. # noqa: E501
|
185
|
-
|
186
|
-
|
187
|
-
:return: The updated of this BackupJob. # noqa: E501
|
188
|
-
:rtype: str
|
189
|
-
"""
|
190
|
-
return self._updated
|
191
|
-
|
192
|
-
@updated.setter
|
193
|
-
def updated(self, updated):
|
194
|
-
"""Sets the updated of this BackupJob.
|
195
|
-
|
196
|
-
|
197
|
-
:param updated: The updated of this BackupJob. # noqa: E501
|
198
|
-
:type: str
|
199
|
-
"""
|
200
|
-
if self.local_vars_configuration.client_side_validation and updated is None: # noqa: E501
|
201
|
-
raise ValueError("Invalid value for `updated`, must not be `None`") # noqa: E501
|
202
|
-
|
203
|
-
self._updated = updated
|
204
|
-
|
205
|
-
@property
|
206
|
-
def error_message(self):
|
207
|
-
"""Gets the error_message of this BackupJob. # noqa: E501
|
208
|
-
|
209
|
-
|
210
|
-
:return: The error_message of this BackupJob. # noqa: E501
|
211
|
-
:rtype: str
|
212
|
-
"""
|
213
|
-
return self._error_message
|
214
|
-
|
215
|
-
@error_message.setter
|
216
|
-
def error_message(self, error_message):
|
217
|
-
"""Sets the error_message of this BackupJob.
|
218
|
-
|
219
|
-
|
220
|
-
:param error_message: The error_message of this BackupJob. # noqa: E501
|
221
|
-
:type: str
|
222
|
-
"""
|
223
|
-
|
224
|
-
self._error_message = error_message
|
225
|
-
|
226
|
-
@property
|
227
|
-
def input(self):
|
228
|
-
"""Gets the input of this BackupJob. # noqa: E501
|
229
|
-
|
230
|
-
Input arguments; expected to be empty. # noqa: E501
|
231
|
-
|
232
|
-
:return: The input of this BackupJob. # noqa: E501
|
233
|
-
:rtype: object
|
234
|
-
"""
|
235
|
-
return self._input
|
236
|
-
|
237
|
-
@input.setter
|
238
|
-
def input(self, input):
|
239
|
-
"""Sets the input of this BackupJob.
|
240
|
-
|
241
|
-
Input arguments; expected to be empty. # noqa: E501
|
242
|
-
|
243
|
-
:param input: The input of this BackupJob. # noqa: E501
|
244
|
-
:type: object
|
245
|
-
"""
|
246
|
-
|
247
|
-
self._input = input
|
248
|
-
|
249
|
-
@property
|
250
|
-
def result(self):
|
251
|
-
"""Gets the result of this BackupJob. # noqa: E501
|
252
|
-
|
253
|
-
|
254
|
-
:return: The result of this BackupJob. # noqa: E501
|
255
|
-
:rtype: BackupResponse
|
256
|
-
"""
|
257
|
-
return self._result
|
258
|
-
|
259
|
-
@result.setter
|
260
|
-
def result(self, result):
|
261
|
-
"""Sets the result of this BackupJob.
|
262
|
-
|
263
|
-
|
264
|
-
:param result: The result of this BackupJob. # noqa: E501
|
265
|
-
:type: BackupResponse
|
266
|
-
"""
|
267
|
-
|
268
|
-
self._result = result
|
269
|
-
|
270
|
-
def to_dict(self):
|
271
|
-
"""Returns the model properties as a dict"""
|
272
|
-
result = {}
|
273
|
-
|
274
|
-
for attr, _ in six.iteritems(self.openapi_types):
|
275
|
-
value = getattr(self, attr)
|
276
|
-
if isinstance(value, list):
|
277
|
-
result[attr] = list(map(
|
278
|
-
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
279
|
-
value
|
280
|
-
))
|
281
|
-
elif hasattr(value, "to_dict"):
|
282
|
-
result[attr] = value.to_dict()
|
283
|
-
elif isinstance(value, dict):
|
284
|
-
result[attr] = dict(map(
|
285
|
-
lambda item: (item[0], item[1].to_dict())
|
286
|
-
if hasattr(item[1], "to_dict") else item,
|
287
|
-
value.items()
|
288
|
-
))
|
289
|
-
else:
|
290
|
-
result[attr] = value
|
291
|
-
|
292
|
-
return result
|
293
|
-
|
294
|
-
def to_str(self):
|
295
|
-
"""Returns the string representation of the model"""
|
296
|
-
return pprint.pformat(self.to_dict())
|
297
|
-
|
298
|
-
def __repr__(self):
|
299
|
-
"""For `print` and `pprint`"""
|
300
|
-
return self.to_str()
|
301
|
-
|
302
|
-
def __eq__(self, other):
|
303
|
-
"""Returns true if both objects are equal"""
|
304
|
-
if not isinstance(other, BackupJob):
|
305
|
-
return False
|
306
|
-
|
307
|
-
return self.to_dict() == other.to_dict()
|
28
|
+
BackupJob
|
29
|
+
""" # noqa: E501
|
30
|
+
job_id: StrictStr = Field(alias="jobId")
|
31
|
+
job_type: Optional[StrictStr] = Field(default=None, alias="jobType")
|
32
|
+
status: StrictStr
|
33
|
+
created: StrictStr
|
34
|
+
updated: StrictStr
|
35
|
+
error_message: Optional[StrictStr] = Field(default=None, alias="errorMessage")
|
36
|
+
input: Optional[Dict[str, Any]] = Field(default=None, description="Input arguments; expected to be empty.")
|
37
|
+
result: Optional[BackupResponse] = None
|
38
|
+
__properties: ClassVar[List[str]] = ["jobId", "jobType", "status", "created", "updated", "errorMessage", "input", "result"]
|
39
|
+
|
40
|
+
@field_validator('status')
|
41
|
+
def status_validate_enum(cls, value):
|
42
|
+
"""Validates the enum"""
|
43
|
+
if value not in set(['QUEUED', 'RUNNING', 'SUCCEEDED', 'ERROR', 'CANCELLED', 'UNKNOWN']):
|
44
|
+
raise ValueError("must be one of enum values ('QUEUED', 'RUNNING', 'SUCCEEDED', 'ERROR', 'CANCELLED', 'UNKNOWN')")
|
45
|
+
return value
|
46
|
+
|
47
|
+
model_config = ConfigDict(
|
48
|
+
populate_by_name=True,
|
49
|
+
validate_assignment=True,
|
50
|
+
protected_namespaces=(),
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
def to_str(self) -> str:
|
55
|
+
"""Returns the string representation of the model using alias"""
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
57
|
+
|
58
|
+
def to_json(self) -> str:
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
61
|
+
return json.dumps(self.to_dict())
|
62
|
+
|
63
|
+
@classmethod
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
65
|
+
"""Create an instance of BackupJob from a JSON string"""
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
67
|
+
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
70
|
+
|
71
|
+
This has the following differences from calling pydantic's
|
72
|
+
`self.model_dump(by_alias=True)`:
|
73
|
+
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
75
|
+
were set at model initialization. Other fields with value `None`
|
76
|
+
are ignored.
|
77
|
+
"""
|
78
|
+
excluded_fields: Set[str] = set([
|
79
|
+
])
|
80
|
+
|
81
|
+
_dict = self.model_dump(
|
82
|
+
by_alias=True,
|
83
|
+
exclude=excluded_fields,
|
84
|
+
exclude_none=True,
|
85
|
+
)
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of result
|
87
|
+
if self.result:
|
88
|
+
_dict['result'] = self.result.to_dict()
|
89
|
+
return _dict
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
93
|
+
"""Create an instance of BackupJob from a dict"""
|
94
|
+
if obj is None:
|
95
|
+
return None
|
96
|
+
|
97
|
+
if not isinstance(obj, dict):
|
98
|
+
return cls.model_validate(obj)
|
99
|
+
|
100
|
+
_obj = cls.model_validate({
|
101
|
+
"jobId": obj.get("jobId"),
|
102
|
+
"jobType": obj.get("jobType"),
|
103
|
+
"status": obj.get("status"),
|
104
|
+
"created": obj.get("created"),
|
105
|
+
"updated": obj.get("updated"),
|
106
|
+
"errorMessage": obj.get("errorMessage"),
|
107
|
+
"input": obj.get("input"),
|
108
|
+
"result": BackupResponse.from_dict(obj["result"]) if obj.get("result") is not None else None
|
109
|
+
})
|
110
|
+
return _obj
|
308
111
|
|
309
|
-
def __ne__(self, other):
|
310
|
-
"""Returns true if both objects are not equal"""
|
311
|
-
if not isinstance(other, BackupJob):
|
312
|
-
return True
|
313
112
|
|
314
|
-
return self.to_dict() != other.to_dict()
|