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
|
@@ -6,6 +6,7 @@ from latitudesh_python_sdk import models, utils
|
|
|
6
6
|
from latitudesh_python_sdk._hooks import HookContext
|
|
7
7
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
8
8
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
9
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
10
|
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
10
11
|
|
|
11
12
|
|
|
@@ -136,28 +137,17 @@ class ProjectsSDK(BaseSDK):
|
|
|
136
137
|
|
|
137
138
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
138
139
|
return models.GetProjectsResponse(
|
|
139
|
-
result=
|
|
140
|
+
result=unmarshal_json_response(models.Projects, http_res),
|
|
140
141
|
next=next_func,
|
|
141
142
|
)
|
|
142
143
|
if utils.match_response(http_res, "4XX", "*"):
|
|
143
144
|
http_res_text = utils.stream_to_text(http_res)
|
|
144
|
-
raise models.APIError(
|
|
145
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
146
|
-
)
|
|
145
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
147
146
|
if utils.match_response(http_res, "5XX", "*"):
|
|
148
147
|
http_res_text = utils.stream_to_text(http_res)
|
|
149
|
-
raise models.APIError(
|
|
150
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
151
|
-
)
|
|
148
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
152
149
|
|
|
153
|
-
|
|
154
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
155
|
-
raise models.APIError(
|
|
156
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
157
|
-
http_res.status_code,
|
|
158
|
-
http_res_text,
|
|
159
|
-
http_res,
|
|
160
|
-
)
|
|
150
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
161
151
|
|
|
162
152
|
async def list_async(
|
|
163
153
|
self,
|
|
@@ -285,28 +275,17 @@ class ProjectsSDK(BaseSDK):
|
|
|
285
275
|
|
|
286
276
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
287
277
|
return models.GetProjectsResponse(
|
|
288
|
-
result=
|
|
278
|
+
result=unmarshal_json_response(models.Projects, http_res),
|
|
289
279
|
next=next_func,
|
|
290
280
|
)
|
|
291
281
|
if utils.match_response(http_res, "4XX", "*"):
|
|
292
282
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
293
|
-
raise models.APIError(
|
|
294
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
295
|
-
)
|
|
283
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
296
284
|
if utils.match_response(http_res, "5XX", "*"):
|
|
297
285
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
298
|
-
raise models.APIError(
|
|
299
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
300
|
-
)
|
|
286
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
301
287
|
|
|
302
|
-
|
|
303
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
304
|
-
raise models.APIError(
|
|
305
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
306
|
-
http_res.status_code,
|
|
307
|
-
http_res_text,
|
|
308
|
-
http_res,
|
|
309
|
-
)
|
|
288
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
310
289
|
|
|
311
290
|
def create(
|
|
312
291
|
self,
|
|
@@ -390,31 +369,20 @@ class ProjectsSDK(BaseSDK):
|
|
|
390
369
|
|
|
391
370
|
response_data: Any = None
|
|
392
371
|
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
393
|
-
return
|
|
372
|
+
return unmarshal_json_response(models.CreateProjectResponseBody, http_res)
|
|
394
373
|
if utils.match_response(
|
|
395
374
|
http_res, ["400", "403", "422"], "application/vnd.api+json"
|
|
396
375
|
):
|
|
397
|
-
response_data =
|
|
398
|
-
raise models.ErrorObject(
|
|
376
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
377
|
+
raise models.ErrorObject(response_data, http_res)
|
|
399
378
|
if utils.match_response(http_res, "4XX", "*"):
|
|
400
379
|
http_res_text = utils.stream_to_text(http_res)
|
|
401
|
-
raise models.APIError(
|
|
402
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
403
|
-
)
|
|
380
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
404
381
|
if utils.match_response(http_res, "5XX", "*"):
|
|
405
382
|
http_res_text = utils.stream_to_text(http_res)
|
|
406
|
-
raise models.APIError(
|
|
407
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
408
|
-
)
|
|
383
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
409
384
|
|
|
410
|
-
|
|
411
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
412
|
-
raise models.APIError(
|
|
413
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
414
|
-
http_res.status_code,
|
|
415
|
-
http_res_text,
|
|
416
|
-
http_res,
|
|
417
|
-
)
|
|
385
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
418
386
|
|
|
419
387
|
async def create_async(
|
|
420
388
|
self,
|
|
@@ -498,31 +466,20 @@ class ProjectsSDK(BaseSDK):
|
|
|
498
466
|
|
|
499
467
|
response_data: Any = None
|
|
500
468
|
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
501
|
-
return
|
|
469
|
+
return unmarshal_json_response(models.CreateProjectResponseBody, http_res)
|
|
502
470
|
if utils.match_response(
|
|
503
471
|
http_res, ["400", "403", "422"], "application/vnd.api+json"
|
|
504
472
|
):
|
|
505
|
-
response_data =
|
|
506
|
-
raise models.ErrorObject(
|
|
473
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
474
|
+
raise models.ErrorObject(response_data, http_res)
|
|
507
475
|
if utils.match_response(http_res, "4XX", "*"):
|
|
508
476
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
509
|
-
raise models.APIError(
|
|
510
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
511
|
-
)
|
|
477
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
512
478
|
if utils.match_response(http_res, "5XX", "*"):
|
|
513
479
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
514
|
-
raise models.APIError(
|
|
515
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
516
|
-
)
|
|
480
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
517
481
|
|
|
518
|
-
|
|
519
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
520
|
-
raise models.APIError(
|
|
521
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
522
|
-
http_res.status_code,
|
|
523
|
-
http_res_text,
|
|
524
|
-
http_res,
|
|
525
|
-
)
|
|
482
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
526
483
|
|
|
527
484
|
def update(
|
|
528
485
|
self,
|
|
@@ -610,31 +567,20 @@ class ProjectsSDK(BaseSDK):
|
|
|
610
567
|
|
|
611
568
|
response_data: Any = None
|
|
612
569
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
613
|
-
return
|
|
570
|
+
return unmarshal_json_response(models.UpdateProjectResponseBody, http_res)
|
|
614
571
|
if utils.match_response(
|
|
615
572
|
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
616
573
|
):
|
|
617
|
-
response_data =
|
|
618
|
-
raise models.ErrorObject(
|
|
574
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
575
|
+
raise models.ErrorObject(response_data, http_res)
|
|
619
576
|
if utils.match_response(http_res, "4XX", "*"):
|
|
620
577
|
http_res_text = utils.stream_to_text(http_res)
|
|
621
|
-
raise models.APIError(
|
|
622
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
623
|
-
)
|
|
578
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
624
579
|
if utils.match_response(http_res, "5XX", "*"):
|
|
625
580
|
http_res_text = utils.stream_to_text(http_res)
|
|
626
|
-
raise models.APIError(
|
|
627
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
628
|
-
)
|
|
581
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
629
582
|
|
|
630
|
-
|
|
631
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
632
|
-
raise models.APIError(
|
|
633
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
634
|
-
http_res.status_code,
|
|
635
|
-
http_res_text,
|
|
636
|
-
http_res,
|
|
637
|
-
)
|
|
583
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
638
584
|
|
|
639
585
|
async def update_async(
|
|
640
586
|
self,
|
|
@@ -722,31 +668,20 @@ class ProjectsSDK(BaseSDK):
|
|
|
722
668
|
|
|
723
669
|
response_data: Any = None
|
|
724
670
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
725
|
-
return
|
|
671
|
+
return unmarshal_json_response(models.UpdateProjectResponseBody, http_res)
|
|
726
672
|
if utils.match_response(
|
|
727
673
|
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
728
674
|
):
|
|
729
|
-
response_data =
|
|
730
|
-
raise models.ErrorObject(
|
|
675
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
676
|
+
raise models.ErrorObject(response_data, http_res)
|
|
731
677
|
if utils.match_response(http_res, "4XX", "*"):
|
|
732
678
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
733
|
-
raise models.APIError(
|
|
734
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
735
|
-
)
|
|
679
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
736
680
|
if utils.match_response(http_res, "5XX", "*"):
|
|
737
681
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
738
|
-
raise models.APIError(
|
|
739
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
740
|
-
)
|
|
682
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
741
683
|
|
|
742
|
-
|
|
743
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
744
|
-
raise models.APIError(
|
|
745
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
746
|
-
http_res.status_code,
|
|
747
|
-
http_res_text,
|
|
748
|
-
http_res,
|
|
749
|
-
)
|
|
684
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
750
685
|
|
|
751
686
|
def delete(
|
|
752
687
|
self,
|
|
@@ -824,27 +759,16 @@ class ProjectsSDK(BaseSDK):
|
|
|
824
759
|
if utils.match_response(
|
|
825
760
|
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
826
761
|
):
|
|
827
|
-
response_data =
|
|
828
|
-
raise models.ErrorObject(
|
|
762
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
763
|
+
raise models.ErrorObject(response_data, http_res)
|
|
829
764
|
if utils.match_response(http_res, "4XX", "*"):
|
|
830
765
|
http_res_text = utils.stream_to_text(http_res)
|
|
831
|
-
raise models.APIError(
|
|
832
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
833
|
-
)
|
|
766
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
834
767
|
if utils.match_response(http_res, "5XX", "*"):
|
|
835
768
|
http_res_text = utils.stream_to_text(http_res)
|
|
836
|
-
raise models.APIError(
|
|
837
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
838
|
-
)
|
|
769
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
839
770
|
|
|
840
|
-
|
|
841
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
842
|
-
raise models.APIError(
|
|
843
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
844
|
-
http_res.status_code,
|
|
845
|
-
http_res_text,
|
|
846
|
-
http_res,
|
|
847
|
-
)
|
|
771
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
848
772
|
|
|
849
773
|
async def delete_async(
|
|
850
774
|
self,
|
|
@@ -922,24 +846,13 @@ class ProjectsSDK(BaseSDK):
|
|
|
922
846
|
if utils.match_response(
|
|
923
847
|
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
924
848
|
):
|
|
925
|
-
response_data =
|
|
926
|
-
raise models.ErrorObject(
|
|
849
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
850
|
+
raise models.ErrorObject(response_data, http_res)
|
|
927
851
|
if utils.match_response(http_res, "4XX", "*"):
|
|
928
852
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
929
|
-
raise models.APIError(
|
|
930
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
931
|
-
)
|
|
853
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
932
854
|
if utils.match_response(http_res, "5XX", "*"):
|
|
933
855
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
934
|
-
raise models.APIError(
|
|
935
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
936
|
-
)
|
|
856
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
937
857
|
|
|
938
|
-
|
|
939
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
940
|
-
raise models.APIError(
|
|
941
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
942
|
-
http_res.status_code,
|
|
943
|
-
http_res_text,
|
|
944
|
-
http_res,
|
|
945
|
-
)
|
|
858
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
@@ -6,6 +6,7 @@ from latitudesh_python_sdk import models, utils
|
|
|
6
6
|
from latitudesh_python_sdk._hooks import HookContext
|
|
7
7
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
8
8
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
9
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
10
|
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
10
11
|
|
|
11
12
|
|
|
@@ -109,28 +110,16 @@ class RegionsSDK(BaseSDK):
|
|
|
109
110
|
|
|
110
111
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
111
112
|
return models.GetRegionsResponse(
|
|
112
|
-
result=
|
|
113
|
-
next=next_func,
|
|
113
|
+
result=unmarshal_json_response(models.Regions, http_res), next=next_func
|
|
114
114
|
)
|
|
115
115
|
if utils.match_response(http_res, "4XX", "*"):
|
|
116
116
|
http_res_text = utils.stream_to_text(http_res)
|
|
117
|
-
raise models.APIError(
|
|
118
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
119
|
-
)
|
|
117
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
120
118
|
if utils.match_response(http_res, "5XX", "*"):
|
|
121
119
|
http_res_text = utils.stream_to_text(http_res)
|
|
122
|
-
raise models.APIError(
|
|
123
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
124
|
-
)
|
|
120
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
128
|
-
raise models.APIError(
|
|
129
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
130
|
-
http_res.status_code,
|
|
131
|
-
http_res_text,
|
|
132
|
-
http_res,
|
|
133
|
-
)
|
|
122
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
134
123
|
|
|
135
124
|
async def list_async(
|
|
136
125
|
self,
|
|
@@ -231,28 +220,16 @@ class RegionsSDK(BaseSDK):
|
|
|
231
220
|
|
|
232
221
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
233
222
|
return models.GetRegionsResponse(
|
|
234
|
-
result=
|
|
235
|
-
next=next_func,
|
|
223
|
+
result=unmarshal_json_response(models.Regions, http_res), next=next_func
|
|
236
224
|
)
|
|
237
225
|
if utils.match_response(http_res, "4XX", "*"):
|
|
238
226
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
239
|
-
raise models.APIError(
|
|
240
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
241
|
-
)
|
|
227
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
242
228
|
if utils.match_response(http_res, "5XX", "*"):
|
|
243
229
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
244
|
-
raise models.APIError(
|
|
245
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
246
|
-
)
|
|
230
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
247
231
|
|
|
248
|
-
|
|
249
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
250
|
-
raise models.APIError(
|
|
251
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
252
|
-
http_res.status_code,
|
|
253
|
-
http_res_text,
|
|
254
|
-
http_res,
|
|
255
|
-
)
|
|
232
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
256
233
|
|
|
257
234
|
def get(
|
|
258
235
|
self,
|
|
@@ -326,29 +303,18 @@ class RegionsSDK(BaseSDK):
|
|
|
326
303
|
|
|
327
304
|
response_data: Any = None
|
|
328
305
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
329
|
-
return
|
|
306
|
+
return unmarshal_json_response(models.Region, http_res)
|
|
330
307
|
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
331
|
-
response_data =
|
|
332
|
-
raise models.ErrorObject(
|
|
308
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
309
|
+
raise models.ErrorObject(response_data, http_res)
|
|
333
310
|
if utils.match_response(http_res, "4XX", "*"):
|
|
334
311
|
http_res_text = utils.stream_to_text(http_res)
|
|
335
|
-
raise models.APIError(
|
|
336
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
337
|
-
)
|
|
312
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
338
313
|
if utils.match_response(http_res, "5XX", "*"):
|
|
339
314
|
http_res_text = utils.stream_to_text(http_res)
|
|
340
|
-
raise models.APIError(
|
|
341
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
342
|
-
)
|
|
315
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
343
316
|
|
|
344
|
-
|
|
345
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
346
|
-
raise models.APIError(
|
|
347
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
348
|
-
http_res.status_code,
|
|
349
|
-
http_res_text,
|
|
350
|
-
http_res,
|
|
351
|
-
)
|
|
317
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
352
318
|
|
|
353
319
|
async def get_async(
|
|
354
320
|
self,
|
|
@@ -422,26 +388,15 @@ class RegionsSDK(BaseSDK):
|
|
|
422
388
|
|
|
423
389
|
response_data: Any = None
|
|
424
390
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
425
|
-
return
|
|
391
|
+
return unmarshal_json_response(models.Region, http_res)
|
|
426
392
|
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
427
|
-
response_data =
|
|
428
|
-
raise models.ErrorObject(
|
|
393
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
394
|
+
raise models.ErrorObject(response_data, http_res)
|
|
429
395
|
if utils.match_response(http_res, "4XX", "*"):
|
|
430
396
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
431
|
-
raise models.APIError(
|
|
432
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
433
|
-
)
|
|
397
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
434
398
|
if utils.match_response(http_res, "5XX", "*"):
|
|
435
399
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
436
|
-
raise models.APIError(
|
|
437
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
438
|
-
)
|
|
400
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
439
401
|
|
|
440
|
-
|
|
441
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
442
|
-
raise models.APIError(
|
|
443
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
444
|
-
http_res.status_code,
|
|
445
|
-
http_res_text,
|
|
446
|
-
http_res,
|
|
447
|
-
)
|
|
402
|
+
raise models.APIError("Unexpected response received", http_res)
|
latitudesh_python_sdk/roles.py
CHANGED
|
@@ -6,6 +6,7 @@ from latitudesh_python_sdk import models, utils
|
|
|
6
6
|
from latitudesh_python_sdk._hooks import HookContext
|
|
7
7
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
8
8
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
9
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
10
|
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
10
11
|
|
|
11
12
|
|
|
@@ -108,28 +109,17 @@ class Roles(BaseSDK):
|
|
|
108
109
|
|
|
109
110
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
110
111
|
return models.GetRolesResponse(
|
|
111
|
-
result=
|
|
112
|
+
result=unmarshal_json_response(models.GetRolesResponseBody, http_res),
|
|
112
113
|
next=next_func,
|
|
113
114
|
)
|
|
114
115
|
if utils.match_response(http_res, "4XX", "*"):
|
|
115
116
|
http_res_text = utils.stream_to_text(http_res)
|
|
116
|
-
raise models.APIError(
|
|
117
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
118
|
-
)
|
|
117
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
119
118
|
if utils.match_response(http_res, "5XX", "*"):
|
|
120
119
|
http_res_text = utils.stream_to_text(http_res)
|
|
121
|
-
raise models.APIError(
|
|
122
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
123
|
-
)
|
|
120
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
127
|
-
raise models.APIError(
|
|
128
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
129
|
-
http_res.status_code,
|
|
130
|
-
http_res_text,
|
|
131
|
-
http_res,
|
|
132
|
-
)
|
|
122
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
133
123
|
|
|
134
124
|
async def list_async(
|
|
135
125
|
self,
|
|
@@ -229,28 +219,17 @@ class Roles(BaseSDK):
|
|
|
229
219
|
|
|
230
220
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
231
221
|
return models.GetRolesResponse(
|
|
232
|
-
result=
|
|
222
|
+
result=unmarshal_json_response(models.GetRolesResponseBody, http_res),
|
|
233
223
|
next=next_func,
|
|
234
224
|
)
|
|
235
225
|
if utils.match_response(http_res, "4XX", "*"):
|
|
236
226
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
237
|
-
raise models.APIError(
|
|
238
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
239
|
-
)
|
|
227
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
240
228
|
if utils.match_response(http_res, "5XX", "*"):
|
|
241
229
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
242
|
-
raise models.APIError(
|
|
243
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
244
|
-
)
|
|
230
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
245
231
|
|
|
246
|
-
|
|
247
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
248
|
-
raise models.APIError(
|
|
249
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
250
|
-
http_res.status_code,
|
|
251
|
-
http_res_text,
|
|
252
|
-
http_res,
|
|
253
|
-
)
|
|
232
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
254
233
|
|
|
255
234
|
def get(
|
|
256
235
|
self,
|
|
@@ -324,29 +303,18 @@ class Roles(BaseSDK):
|
|
|
324
303
|
|
|
325
304
|
response_data: Any = None
|
|
326
305
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
327
|
-
return
|
|
306
|
+
return unmarshal_json_response(models.Role, http_res)
|
|
328
307
|
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
329
|
-
response_data =
|
|
330
|
-
raise models.ErrorObject(
|
|
308
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
309
|
+
raise models.ErrorObject(response_data, http_res)
|
|
331
310
|
if utils.match_response(http_res, "4XX", "*"):
|
|
332
311
|
http_res_text = utils.stream_to_text(http_res)
|
|
333
|
-
raise models.APIError(
|
|
334
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
335
|
-
)
|
|
312
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
336
313
|
if utils.match_response(http_res, "5XX", "*"):
|
|
337
314
|
http_res_text = utils.stream_to_text(http_res)
|
|
338
|
-
raise models.APIError(
|
|
339
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
340
|
-
)
|
|
315
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
341
316
|
|
|
342
|
-
|
|
343
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
344
|
-
raise models.APIError(
|
|
345
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
346
|
-
http_res.status_code,
|
|
347
|
-
http_res_text,
|
|
348
|
-
http_res,
|
|
349
|
-
)
|
|
317
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
350
318
|
|
|
351
319
|
async def get_async(
|
|
352
320
|
self,
|
|
@@ -420,26 +388,15 @@ class Roles(BaseSDK):
|
|
|
420
388
|
|
|
421
389
|
response_data: Any = None
|
|
422
390
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
423
|
-
return
|
|
391
|
+
return unmarshal_json_response(models.Role, http_res)
|
|
424
392
|
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
425
|
-
response_data =
|
|
426
|
-
raise models.ErrorObject(
|
|
393
|
+
response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
|
|
394
|
+
raise models.ErrorObject(response_data, http_res)
|
|
427
395
|
if utils.match_response(http_res, "4XX", "*"):
|
|
428
396
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
429
|
-
raise models.APIError(
|
|
430
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
431
|
-
)
|
|
397
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
432
398
|
if utils.match_response(http_res, "5XX", "*"):
|
|
433
399
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
434
|
-
raise models.APIError(
|
|
435
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
436
|
-
)
|
|
400
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
437
401
|
|
|
438
|
-
|
|
439
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
440
|
-
raise models.APIError(
|
|
441
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
442
|
-
http_res.status_code,
|
|
443
|
-
http_res_text,
|
|
444
|
-
http_res,
|
|
445
|
-
)
|
|
402
|
+
raise models.APIError("Unexpected response received", http_res)
|