latitudesh-python-sdk 2.0.0__py3-none-any.whl → 2.0.1__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.
Potentially problematic release.
This version of latitudesh-python-sdk might be problematic. Click here for more details.
- latitudesh_python_sdk/_version.py +3 -3
- latitudesh_python_sdk/apikeys.py +51 -138
- latitudesh_python_sdk/basesdk.py +4 -4
- latitudesh_python_sdk/billing.py +11 -32
- latitudesh_python_sdk/events_sdk.py +9 -34
- latitudesh_python_sdk/firewalls_sdk.py +89 -264
- latitudesh_python_sdk/ipaddresses_sdk.py +25 -68
- latitudesh_python_sdk/models/__init__.py +27 -4
- latitudesh_python_sdk/models/apierror.py +30 -14
- latitudesh_python_sdk/models/deploy_config.py +11 -6
- latitudesh_python_sdk/models/error_object.py +11 -6
- latitudesh_python_sdk/models/latitudesherror.py +26 -0
- latitudesh_python_sdk/models/no_response_error.py +13 -0
- latitudesh_python_sdk/models/region_resource_data.py +4 -4
- latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
- latitudesh_python_sdk/models/server.py +11 -6
- latitudesh_python_sdk/models/server_data.py +6 -3
- latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
- latitudesh_python_sdk/models/update_serverop.py +1 -3
- latitudesh_python_sdk/models/virtual_network.py +11 -6
- latitudesh_python_sdk/operatingsystems_sdk.py +11 -32
- latitudesh_python_sdk/plans.py +57 -188
- latitudesh_python_sdk/privatenetworks.py +87 -262
- latitudesh_python_sdk/projects_sdk.py +43 -130
- latitudesh_python_sdk/regions_sdk.py +21 -66
- latitudesh_python_sdk/roles.py +21 -64
- latitudesh_python_sdk/servers_sdk.py +207 -604
- latitudesh_python_sdk/sshkeys_sdk.py +85 -304
- latitudesh_python_sdk/storage.py +33 -120
- latitudesh_python_sdk/tags.py +39 -126
- latitudesh_python_sdk/teams_sdk.py +35 -100
- latitudesh_python_sdk/teamsmembers.py +31 -96
- latitudesh_python_sdk/traffic_sdk.py +25 -68
- latitudesh_python_sdk/userdata_sdk.py +79 -298
- latitudesh_python_sdk/userprofile.py +31 -100
- latitudesh_python_sdk/utils/serializers.py +3 -2
- latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
- latitudesh_python_sdk/virtualmachines.py +35 -122
- latitudesh_python_sdk/vpnsessions.py +55 -146
- {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +47 -24
- {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +43 -38
- {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +0 -0
- {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/WHEEL +0 -0
|
@@ -5,6 +5,7 @@ from latitudesh_python_sdk import models, utils
|
|
|
5
5
|
from latitudesh_python_sdk._hooks import HookContext
|
|
6
6
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
7
7
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Any, Mapping, Optional, Union
|
|
9
10
|
|
|
10
11
|
|
|
@@ -76,28 +77,15 @@ class UserProfile(BaseSDK):
|
|
|
76
77
|
)
|
|
77
78
|
|
|
78
79
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
79
|
-
return
|
|
80
|
-
http_res.text, models.GetUserProfileResponseBody
|
|
81
|
-
)
|
|
80
|
+
return unmarshal_json_response(models.GetUserProfileResponseBody, http_res)
|
|
82
81
|
if utils.match_response(http_res, "4XX", "*"):
|
|
83
82
|
http_res_text = utils.stream_to_text(http_res)
|
|
84
|
-
raise models.APIError(
|
|
85
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
86
|
-
)
|
|
83
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
87
84
|
if utils.match_response(http_res, "5XX", "*"):
|
|
88
85
|
http_res_text = utils.stream_to_text(http_res)
|
|
89
|
-
raise models.APIError(
|
|
90
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
91
|
-
)
|
|
86
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
92
87
|
|
|
93
|
-
|
|
94
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
95
|
-
raise models.APIError(
|
|
96
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
97
|
-
http_res.status_code,
|
|
98
|
-
http_res_text,
|
|
99
|
-
http_res,
|
|
100
|
-
)
|
|
88
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
101
89
|
|
|
102
90
|
async def get_async(
|
|
103
91
|
self,
|
|
@@ -166,28 +154,15 @@ class UserProfile(BaseSDK):
|
|
|
166
154
|
)
|
|
167
155
|
|
|
168
156
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
169
|
-
return
|
|
170
|
-
http_res.text, models.GetUserProfileResponseBody
|
|
171
|
-
)
|
|
157
|
+
return unmarshal_json_response(models.GetUserProfileResponseBody, http_res)
|
|
172
158
|
if utils.match_response(http_res, "4XX", "*"):
|
|
173
159
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
174
|
-
raise models.APIError(
|
|
175
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
176
|
-
)
|
|
160
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
177
161
|
if utils.match_response(http_res, "5XX", "*"):
|
|
178
162
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
179
|
-
raise models.APIError(
|
|
180
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
181
|
-
)
|
|
163
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
182
164
|
|
|
183
|
-
|
|
184
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
185
|
-
raise models.APIError(
|
|
186
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
187
|
-
http_res.status_code,
|
|
188
|
-
http_res_text,
|
|
189
|
-
http_res,
|
|
190
|
-
)
|
|
165
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
191
166
|
|
|
192
167
|
def update(
|
|
193
168
|
self,
|
|
@@ -281,31 +256,20 @@ class UserProfile(BaseSDK):
|
|
|
281
256
|
|
|
282
257
|
response_data: Any = None
|
|
283
258
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
284
|
-
return
|
|
285
|
-
|
|
259
|
+
return unmarshal_json_response(
|
|
260
|
+
models.PatchUserProfileResponseBody, http_res
|
|
286
261
|
)
|
|
287
262
|
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
288
|
-
response_data =
|
|
289
|
-
raise models.ErrorObject(
|
|
263
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
264
|
+
raise models.ErrorObject(response_data, http_res)
|
|
290
265
|
if utils.match_response(http_res, ["422", "4XX"], "*"):
|
|
291
266
|
http_res_text = utils.stream_to_text(http_res)
|
|
292
|
-
raise models.APIError(
|
|
293
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
294
|
-
)
|
|
267
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
295
268
|
if utils.match_response(http_res, "5XX", "*"):
|
|
296
269
|
http_res_text = utils.stream_to_text(http_res)
|
|
297
|
-
raise models.APIError(
|
|
298
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
299
|
-
)
|
|
270
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
300
271
|
|
|
301
|
-
|
|
302
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
303
|
-
raise models.APIError(
|
|
304
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
305
|
-
http_res.status_code,
|
|
306
|
-
http_res_text,
|
|
307
|
-
http_res,
|
|
308
|
-
)
|
|
272
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
309
273
|
|
|
310
274
|
async def update_async(
|
|
311
275
|
self,
|
|
@@ -399,31 +363,20 @@ class UserProfile(BaseSDK):
|
|
|
399
363
|
|
|
400
364
|
response_data: Any = None
|
|
401
365
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
402
|
-
return
|
|
403
|
-
|
|
366
|
+
return unmarshal_json_response(
|
|
367
|
+
models.PatchUserProfileResponseBody, http_res
|
|
404
368
|
)
|
|
405
369
|
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
406
|
-
response_data =
|
|
407
|
-
raise models.ErrorObject(
|
|
370
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
371
|
+
raise models.ErrorObject(response_data, http_res)
|
|
408
372
|
if utils.match_response(http_res, ["422", "4XX"], "*"):
|
|
409
373
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
410
|
-
raise models.APIError(
|
|
411
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
412
|
-
)
|
|
374
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
413
375
|
if utils.match_response(http_res, "5XX", "*"):
|
|
414
376
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
415
|
-
raise models.APIError(
|
|
416
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
417
|
-
)
|
|
377
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
418
378
|
|
|
419
|
-
|
|
420
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
421
|
-
raise models.APIError(
|
|
422
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
423
|
-
http_res.status_code,
|
|
424
|
-
http_res_text,
|
|
425
|
-
http_res,
|
|
426
|
-
)
|
|
379
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
427
380
|
|
|
428
381
|
def list_teams(
|
|
429
382
|
self,
|
|
@@ -492,26 +445,15 @@ class UserProfile(BaseSDK):
|
|
|
492
445
|
)
|
|
493
446
|
|
|
494
447
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
495
|
-
return
|
|
448
|
+
return unmarshal_json_response(models.UserTeams, http_res)
|
|
496
449
|
if utils.match_response(http_res, "4XX", "*"):
|
|
497
450
|
http_res_text = utils.stream_to_text(http_res)
|
|
498
|
-
raise models.APIError(
|
|
499
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
500
|
-
)
|
|
451
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
501
452
|
if utils.match_response(http_res, "5XX", "*"):
|
|
502
453
|
http_res_text = utils.stream_to_text(http_res)
|
|
503
|
-
raise models.APIError(
|
|
504
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
505
|
-
)
|
|
454
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
506
455
|
|
|
507
|
-
|
|
508
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
509
|
-
raise models.APIError(
|
|
510
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
511
|
-
http_res.status_code,
|
|
512
|
-
http_res_text,
|
|
513
|
-
http_res,
|
|
514
|
-
)
|
|
456
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
515
457
|
|
|
516
458
|
async def list_teams_async(
|
|
517
459
|
self,
|
|
@@ -580,23 +522,12 @@ class UserProfile(BaseSDK):
|
|
|
580
522
|
)
|
|
581
523
|
|
|
582
524
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
583
|
-
return
|
|
525
|
+
return unmarshal_json_response(models.UserTeams, http_res)
|
|
584
526
|
if utils.match_response(http_res, "4XX", "*"):
|
|
585
527
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
586
|
-
raise models.APIError(
|
|
587
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
588
|
-
)
|
|
528
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
589
529
|
if utils.match_response(http_res, "5XX", "*"):
|
|
590
530
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
591
|
-
raise models.APIError(
|
|
592
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
593
|
-
)
|
|
531
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
594
532
|
|
|
595
|
-
|
|
596
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
597
|
-
raise models.APIError(
|
|
598
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
599
|
-
http_res.status_code,
|
|
600
|
-
http_res_text,
|
|
601
|
-
http_res,
|
|
602
|
-
)
|
|
533
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
@@ -192,7 +192,9 @@ def is_union(obj: object) -> bool:
|
|
|
192
192
|
"""
|
|
193
193
|
Returns True if the given object is a typing.Union or typing_extensions.Union.
|
|
194
194
|
"""
|
|
195
|
-
return any(
|
|
195
|
+
return any(
|
|
196
|
+
obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union")
|
|
197
|
+
)
|
|
196
198
|
|
|
197
199
|
|
|
198
200
|
def stream_to_text(stream: httpx.Response) -> str:
|
|
@@ -245,4 +247,3 @@ def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]:
|
|
|
245
247
|
f"Neither typing nor typing_extensions has an object called {name!r}"
|
|
246
248
|
)
|
|
247
249
|
return result
|
|
248
|
-
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from .serializers import unmarshal_json
|
|
8
|
+
from latitudesh_python_sdk import models
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def unmarshal_json_response(
|
|
12
|
+
typ: Any, http_res: httpx.Response, body: Optional[str] = None
|
|
13
|
+
) -> Any:
|
|
14
|
+
if body is None:
|
|
15
|
+
body = http_res.text
|
|
16
|
+
try:
|
|
17
|
+
return unmarshal_json(body, typ)
|
|
18
|
+
except Exception as e:
|
|
19
|
+
raise models.ResponseValidationError(
|
|
20
|
+
"Response validation failed",
|
|
21
|
+
http_res,
|
|
22
|
+
e,
|
|
23
|
+
body,
|
|
24
|
+
) from e
|
|
@@ -5,6 +5,7 @@ from latitudesh_python_sdk import models, utils
|
|
|
5
5
|
from latitudesh_python_sdk._hooks import HookContext
|
|
6
6
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
7
7
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Mapping, Optional, Union
|
|
9
10
|
|
|
10
11
|
|
|
@@ -93,26 +94,15 @@ class VirtualMachines(BaseSDK):
|
|
|
93
94
|
)
|
|
94
95
|
|
|
95
96
|
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
96
|
-
return
|
|
97
|
+
return unmarshal_json_response(models.VirtualMachine, http_res)
|
|
97
98
|
if utils.match_response(http_res, ["409", "422", "4XX"], "*"):
|
|
98
99
|
http_res_text = utils.stream_to_text(http_res)
|
|
99
|
-
raise models.APIError(
|
|
100
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
101
|
-
)
|
|
100
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
102
101
|
if utils.match_response(http_res, "5XX", "*"):
|
|
103
102
|
http_res_text = utils.stream_to_text(http_res)
|
|
104
|
-
raise models.APIError(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
content_type = http_res.headers.get("Content-Type")
|
|
109
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
110
|
-
raise models.APIError(
|
|
111
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
112
|
-
http_res.status_code,
|
|
113
|
-
http_res_text,
|
|
114
|
-
http_res,
|
|
115
|
-
)
|
|
103
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
104
|
+
|
|
105
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
116
106
|
|
|
117
107
|
async def create_async(
|
|
118
108
|
self,
|
|
@@ -198,26 +188,15 @@ class VirtualMachines(BaseSDK):
|
|
|
198
188
|
)
|
|
199
189
|
|
|
200
190
|
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
201
|
-
return
|
|
191
|
+
return unmarshal_json_response(models.VirtualMachine, http_res)
|
|
202
192
|
if utils.match_response(http_res, ["409", "422", "4XX"], "*"):
|
|
203
193
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
204
|
-
raise models.APIError(
|
|
205
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
206
|
-
)
|
|
194
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
207
195
|
if utils.match_response(http_res, "5XX", "*"):
|
|
208
196
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
209
|
-
raise models.APIError(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
content_type = http_res.headers.get("Content-Type")
|
|
214
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
215
|
-
raise models.APIError(
|
|
216
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
217
|
-
http_res.status_code,
|
|
218
|
-
http_res_text,
|
|
219
|
-
http_res,
|
|
220
|
-
)
|
|
197
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
198
|
+
|
|
199
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
221
200
|
|
|
222
201
|
def list(
|
|
223
202
|
self,
|
|
@@ -296,23 +275,12 @@ class VirtualMachines(BaseSDK):
|
|
|
296
275
|
return
|
|
297
276
|
if utils.match_response(http_res, "4XX", "*"):
|
|
298
277
|
http_res_text = utils.stream_to_text(http_res)
|
|
299
|
-
raise models.APIError(
|
|
300
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
301
|
-
)
|
|
278
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
302
279
|
if utils.match_response(http_res, "5XX", "*"):
|
|
303
280
|
http_res_text = utils.stream_to_text(http_res)
|
|
304
|
-
raise models.APIError(
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
content_type = http_res.headers.get("Content-Type")
|
|
309
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
310
|
-
raise models.APIError(
|
|
311
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
312
|
-
http_res.status_code,
|
|
313
|
-
http_res_text,
|
|
314
|
-
http_res,
|
|
315
|
-
)
|
|
281
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
282
|
+
|
|
283
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
316
284
|
|
|
317
285
|
async def list_async(
|
|
318
286
|
self,
|
|
@@ -391,23 +359,12 @@ class VirtualMachines(BaseSDK):
|
|
|
391
359
|
return
|
|
392
360
|
if utils.match_response(http_res, "4XX", "*"):
|
|
393
361
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
394
|
-
raise models.APIError(
|
|
395
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
396
|
-
)
|
|
362
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
397
363
|
if utils.match_response(http_res, "5XX", "*"):
|
|
398
364
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
399
|
-
raise models.APIError(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
content_type = http_res.headers.get("Content-Type")
|
|
404
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
405
|
-
raise models.APIError(
|
|
406
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
407
|
-
http_res.status_code,
|
|
408
|
-
http_res_text,
|
|
409
|
-
http_res,
|
|
410
|
-
)
|
|
365
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
366
|
+
|
|
367
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
411
368
|
|
|
412
369
|
def get(
|
|
413
370
|
self,
|
|
@@ -486,23 +443,12 @@ class VirtualMachines(BaseSDK):
|
|
|
486
443
|
return
|
|
487
444
|
if utils.match_response(http_res, "4XX", "*"):
|
|
488
445
|
http_res_text = utils.stream_to_text(http_res)
|
|
489
|
-
raise models.APIError(
|
|
490
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
491
|
-
)
|
|
446
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
492
447
|
if utils.match_response(http_res, "5XX", "*"):
|
|
493
448
|
http_res_text = utils.stream_to_text(http_res)
|
|
494
|
-
raise models.APIError(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
content_type = http_res.headers.get("Content-Type")
|
|
499
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
500
|
-
raise models.APIError(
|
|
501
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
502
|
-
http_res.status_code,
|
|
503
|
-
http_res_text,
|
|
504
|
-
http_res,
|
|
505
|
-
)
|
|
449
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
450
|
+
|
|
451
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
506
452
|
|
|
507
453
|
async def get_async(
|
|
508
454
|
self,
|
|
@@ -581,23 +527,12 @@ class VirtualMachines(BaseSDK):
|
|
|
581
527
|
return
|
|
582
528
|
if utils.match_response(http_res, "4XX", "*"):
|
|
583
529
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
584
|
-
raise models.APIError(
|
|
585
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
586
|
-
)
|
|
530
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
587
531
|
if utils.match_response(http_res, "5XX", "*"):
|
|
588
532
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
589
|
-
raise models.APIError(
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
content_type = http_res.headers.get("Content-Type")
|
|
594
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
595
|
-
raise models.APIError(
|
|
596
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
597
|
-
http_res.status_code,
|
|
598
|
-
http_res_text,
|
|
599
|
-
http_res,
|
|
600
|
-
)
|
|
533
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
534
|
+
|
|
535
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
601
536
|
|
|
602
537
|
def delete(
|
|
603
538
|
self,
|
|
@@ -676,23 +611,12 @@ class VirtualMachines(BaseSDK):
|
|
|
676
611
|
return
|
|
677
612
|
if utils.match_response(http_res, "4XX", "*"):
|
|
678
613
|
http_res_text = utils.stream_to_text(http_res)
|
|
679
|
-
raise models.APIError(
|
|
680
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
681
|
-
)
|
|
614
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
682
615
|
if utils.match_response(http_res, "5XX", "*"):
|
|
683
616
|
http_res_text = utils.stream_to_text(http_res)
|
|
684
|
-
raise models.APIError(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
content_type = http_res.headers.get("Content-Type")
|
|
689
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
690
|
-
raise models.APIError(
|
|
691
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
692
|
-
http_res.status_code,
|
|
693
|
-
http_res_text,
|
|
694
|
-
http_res,
|
|
695
|
-
)
|
|
617
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
618
|
+
|
|
619
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
696
620
|
|
|
697
621
|
async def delete_async(
|
|
698
622
|
self,
|
|
@@ -771,20 +695,9 @@ class VirtualMachines(BaseSDK):
|
|
|
771
695
|
return
|
|
772
696
|
if utils.match_response(http_res, "4XX", "*"):
|
|
773
697
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
774
|
-
raise models.APIError(
|
|
775
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
776
|
-
)
|
|
698
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
777
699
|
if utils.match_response(http_res, "5XX", "*"):
|
|
778
700
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
779
|
-
raise models.APIError(
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
content_type = http_res.headers.get("Content-Type")
|
|
784
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
785
|
-
raise models.APIError(
|
|
786
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
787
|
-
http_res.status_code,
|
|
788
|
-
http_res_text,
|
|
789
|
-
http_res,
|
|
790
|
-
)
|
|
701
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
702
|
+
|
|
703
|
+
raise models.APIError("Unexpected response received", http_res)
|