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.

Files changed (43) hide show
  1. latitudesh_python_sdk/_version.py +3 -3
  2. latitudesh_python_sdk/apikeys.py +51 -138
  3. latitudesh_python_sdk/basesdk.py +4 -4
  4. latitudesh_python_sdk/billing.py +11 -32
  5. latitudesh_python_sdk/events_sdk.py +9 -34
  6. latitudesh_python_sdk/firewalls_sdk.py +89 -264
  7. latitudesh_python_sdk/ipaddresses_sdk.py +25 -68
  8. latitudesh_python_sdk/models/__init__.py +27 -4
  9. latitudesh_python_sdk/models/apierror.py +30 -14
  10. latitudesh_python_sdk/models/deploy_config.py +11 -6
  11. latitudesh_python_sdk/models/error_object.py +11 -6
  12. latitudesh_python_sdk/models/latitudesherror.py +26 -0
  13. latitudesh_python_sdk/models/no_response_error.py +13 -0
  14. latitudesh_python_sdk/models/region_resource_data.py +4 -4
  15. latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
  16. latitudesh_python_sdk/models/server.py +11 -6
  17. latitudesh_python_sdk/models/server_data.py +6 -3
  18. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  19. latitudesh_python_sdk/models/update_serverop.py +1 -3
  20. latitudesh_python_sdk/models/virtual_network.py +11 -6
  21. latitudesh_python_sdk/operatingsystems_sdk.py +11 -32
  22. latitudesh_python_sdk/plans.py +57 -188
  23. latitudesh_python_sdk/privatenetworks.py +87 -262
  24. latitudesh_python_sdk/projects_sdk.py +43 -130
  25. latitudesh_python_sdk/regions_sdk.py +21 -66
  26. latitudesh_python_sdk/roles.py +21 -64
  27. latitudesh_python_sdk/servers_sdk.py +207 -604
  28. latitudesh_python_sdk/sshkeys_sdk.py +85 -304
  29. latitudesh_python_sdk/storage.py +33 -120
  30. latitudesh_python_sdk/tags.py +39 -126
  31. latitudesh_python_sdk/teams_sdk.py +35 -100
  32. latitudesh_python_sdk/teamsmembers.py +31 -96
  33. latitudesh_python_sdk/traffic_sdk.py +25 -68
  34. latitudesh_python_sdk/userdata_sdk.py +79 -298
  35. latitudesh_python_sdk/userprofile.py +31 -100
  36. latitudesh_python_sdk/utils/serializers.py +3 -2
  37. latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
  38. latitudesh_python_sdk/virtualmachines.py +35 -122
  39. latitudesh_python_sdk/vpnsessions.py +55 -146
  40. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +47 -24
  41. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +43 -38
  42. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +0 -0
  43. {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
 
@@ -90,29 +91,18 @@ class FirewallsSDK(BaseSDK):
90
91
 
91
92
  response_data: Any = None
92
93
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
93
- return utils.unmarshal_json(http_res.text, models.Firewall)
94
+ return unmarshal_json_response(models.Firewall, http_res)
94
95
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
95
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
96
- raise models.ErrorObject(data=response_data)
96
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
97
+ raise models.ErrorObject(response_data, http_res)
97
98
  if utils.match_response(http_res, "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
- "API error occurred", http_res.status_code, http_res_text, http_res
106
- )
103
+ raise models.APIError("API error occurred", http_res, http_res_text)
107
104
 
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
- )
105
+ raise models.APIError("Unexpected response received", http_res)
116
106
 
117
107
  async def create_async(
118
108
  self,
@@ -194,29 +184,18 @@ class FirewallsSDK(BaseSDK):
194
184
 
195
185
  response_data: Any = None
196
186
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
197
- return utils.unmarshal_json(http_res.text, models.Firewall)
187
+ return unmarshal_json_response(models.Firewall, http_res)
198
188
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
199
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
200
- raise models.ErrorObject(data=response_data)
189
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
190
+ raise models.ErrorObject(response_data, http_res)
201
191
  if utils.match_response(http_res, "4XX", "*"):
202
192
  http_res_text = await utils.stream_to_text_async(http_res)
203
- raise models.APIError(
204
- "API error occurred", http_res.status_code, http_res_text, http_res
205
- )
193
+ raise models.APIError("API error occurred", http_res, http_res_text)
206
194
  if utils.match_response(http_res, "5XX", "*"):
207
195
  http_res_text = await utils.stream_to_text_async(http_res)
208
- raise models.APIError(
209
- "API error occurred", http_res.status_code, http_res_text, http_res
210
- )
196
+ raise models.APIError("API error occurred", http_res, http_res_text)
211
197
 
212
- content_type = http_res.headers.get("Content-Type")
213
- http_res_text = await utils.stream_to_text_async(http_res)
214
- raise models.APIError(
215
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
216
- http_res.status_code,
217
- http_res_text,
218
- http_res,
219
- )
198
+ raise models.APIError("Unexpected response received", http_res)
220
199
 
221
200
  def list(
222
201
  self,
@@ -319,28 +298,17 @@ class FirewallsSDK(BaseSDK):
319
298
 
320
299
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
321
300
  return models.ListFirewallsResponse(
322
- result=utils.unmarshal_json(http_res.text, models.Firewalls),
301
+ result=unmarshal_json_response(models.Firewalls, http_res),
323
302
  next=next_func,
324
303
  )
325
304
  if utils.match_response(http_res, "4XX", "*"):
326
305
  http_res_text = utils.stream_to_text(http_res)
327
- raise models.APIError(
328
- "API error occurred", http_res.status_code, http_res_text, http_res
329
- )
306
+ raise models.APIError("API error occurred", http_res, http_res_text)
330
307
  if utils.match_response(http_res, "5XX", "*"):
331
308
  http_res_text = utils.stream_to_text(http_res)
332
- raise models.APIError(
333
- "API error occurred", http_res.status_code, http_res_text, http_res
334
- )
309
+ raise models.APIError("API error occurred", http_res, http_res_text)
335
310
 
336
- content_type = http_res.headers.get("Content-Type")
337
- http_res_text = utils.stream_to_text(http_res)
338
- raise models.APIError(
339
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
340
- http_res.status_code,
341
- http_res_text,
342
- http_res,
343
- )
311
+ raise models.APIError("Unexpected response received", http_res)
344
312
 
345
313
  async def list_async(
346
314
  self,
@@ -443,28 +411,17 @@ class FirewallsSDK(BaseSDK):
443
411
 
444
412
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
445
413
  return models.ListFirewallsResponse(
446
- result=utils.unmarshal_json(http_res.text, models.Firewalls),
414
+ result=unmarshal_json_response(models.Firewalls, http_res),
447
415
  next=next_func,
448
416
  )
449
417
  if utils.match_response(http_res, "4XX", "*"):
450
418
  http_res_text = await utils.stream_to_text_async(http_res)
451
- raise models.APIError(
452
- "API error occurred", http_res.status_code, http_res_text, http_res
453
- )
419
+ raise models.APIError("API error occurred", http_res, http_res_text)
454
420
  if utils.match_response(http_res, "5XX", "*"):
455
421
  http_res_text = await utils.stream_to_text_async(http_res)
456
- raise models.APIError(
457
- "API error occurred", http_res.status_code, http_res_text, http_res
458
- )
422
+ raise models.APIError("API error occurred", http_res, http_res_text)
459
423
 
460
- content_type = http_res.headers.get("Content-Type")
461
- http_res_text = await utils.stream_to_text_async(http_res)
462
- raise models.APIError(
463
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
464
- http_res.status_code,
465
- http_res_text,
466
- http_res,
467
- )
424
+ raise models.APIError("Unexpected response received", http_res)
468
425
 
469
426
  def get(
470
427
  self,
@@ -540,29 +497,18 @@ class FirewallsSDK(BaseSDK):
540
497
 
541
498
  response_data: Any = None
542
499
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
543
- return utils.unmarshal_json(http_res.text, models.Firewall)
500
+ return unmarshal_json_response(models.Firewall, http_res)
544
501
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
545
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
546
- raise models.ErrorObject(data=response_data)
502
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
503
+ raise models.ErrorObject(response_data, http_res)
547
504
  if utils.match_response(http_res, "4XX", "*"):
548
505
  http_res_text = utils.stream_to_text(http_res)
549
- raise models.APIError(
550
- "API error occurred", http_res.status_code, http_res_text, http_res
551
- )
506
+ raise models.APIError("API error occurred", http_res, http_res_text)
552
507
  if utils.match_response(http_res, "5XX", "*"):
553
508
  http_res_text = utils.stream_to_text(http_res)
554
- raise models.APIError(
555
- "API error occurred", http_res.status_code, http_res_text, http_res
556
- )
509
+ raise models.APIError("API error occurred", http_res, http_res_text)
557
510
 
558
- content_type = http_res.headers.get("Content-Type")
559
- http_res_text = utils.stream_to_text(http_res)
560
- raise models.APIError(
561
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
562
- http_res.status_code,
563
- http_res_text,
564
- http_res,
565
- )
511
+ raise models.APIError("Unexpected response received", http_res)
566
512
 
567
513
  async def get_async(
568
514
  self,
@@ -638,29 +584,18 @@ class FirewallsSDK(BaseSDK):
638
584
 
639
585
  response_data: Any = None
640
586
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
641
- return utils.unmarshal_json(http_res.text, models.Firewall)
587
+ return unmarshal_json_response(models.Firewall, http_res)
642
588
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
643
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
644
- raise models.ErrorObject(data=response_data)
589
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
590
+ raise models.ErrorObject(response_data, http_res)
645
591
  if utils.match_response(http_res, "4XX", "*"):
646
592
  http_res_text = await utils.stream_to_text_async(http_res)
647
- raise models.APIError(
648
- "API error occurred", http_res.status_code, http_res_text, http_res
649
- )
593
+ raise models.APIError("API error occurred", http_res, http_res_text)
650
594
  if utils.match_response(http_res, "5XX", "*"):
651
595
  http_res_text = await utils.stream_to_text_async(http_res)
652
- raise models.APIError(
653
- "API error occurred", http_res.status_code, http_res_text, http_res
654
- )
596
+ raise models.APIError("API error occurred", http_res, http_res_text)
655
597
 
656
- content_type = http_res.headers.get("Content-Type")
657
- http_res_text = await utils.stream_to_text_async(http_res)
658
- raise models.APIError(
659
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
660
- http_res.status_code,
661
- http_res_text,
662
- http_res,
663
- )
598
+ raise models.APIError("Unexpected response received", http_res)
664
599
 
665
600
  def update(
666
601
  self,
@@ -751,29 +686,18 @@ class FirewallsSDK(BaseSDK):
751
686
 
752
687
  response_data: Any = None
753
688
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
754
- return utils.unmarshal_json(http_res.text, models.Firewall)
689
+ return unmarshal_json_response(models.Firewall, http_res)
755
690
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
756
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
757
- raise models.ErrorObject(data=response_data)
691
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
692
+ raise models.ErrorObject(response_data, http_res)
758
693
  if utils.match_response(http_res, "4XX", "*"):
759
694
  http_res_text = utils.stream_to_text(http_res)
760
- raise models.APIError(
761
- "API error occurred", http_res.status_code, http_res_text, http_res
762
- )
695
+ raise models.APIError("API error occurred", http_res, http_res_text)
763
696
  if utils.match_response(http_res, "5XX", "*"):
764
697
  http_res_text = utils.stream_to_text(http_res)
765
- raise models.APIError(
766
- "API error occurred", http_res.status_code, http_res_text, http_res
767
- )
698
+ raise models.APIError("API error occurred", http_res, http_res_text)
768
699
 
769
- content_type = http_res.headers.get("Content-Type")
770
- http_res_text = utils.stream_to_text(http_res)
771
- raise models.APIError(
772
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
773
- http_res.status_code,
774
- http_res_text,
775
- http_res,
776
- )
700
+ raise models.APIError("Unexpected response received", http_res)
777
701
 
778
702
  async def update_async(
779
703
  self,
@@ -864,29 +788,18 @@ class FirewallsSDK(BaseSDK):
864
788
 
865
789
  response_data: Any = None
866
790
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
867
- return utils.unmarshal_json(http_res.text, models.Firewall)
791
+ return unmarshal_json_response(models.Firewall, http_res)
868
792
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
869
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
870
- raise models.ErrorObject(data=response_data)
793
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
794
+ raise models.ErrorObject(response_data, http_res)
871
795
  if utils.match_response(http_res, "4XX", "*"):
872
796
  http_res_text = await utils.stream_to_text_async(http_res)
873
- raise models.APIError(
874
- "API error occurred", http_res.status_code, http_res_text, http_res
875
- )
797
+ raise models.APIError("API error occurred", http_res, http_res_text)
876
798
  if utils.match_response(http_res, "5XX", "*"):
877
799
  http_res_text = await utils.stream_to_text_async(http_res)
878
- raise models.APIError(
879
- "API error occurred", http_res.status_code, http_res_text, http_res
880
- )
800
+ raise models.APIError("API error occurred", http_res, http_res_text)
881
801
 
882
- content_type = http_res.headers.get("Content-Type")
883
- http_res_text = await utils.stream_to_text_async(http_res)
884
- raise models.APIError(
885
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
886
- http_res.status_code,
887
- http_res_text,
888
- http_res,
889
- )
802
+ raise models.APIError("Unexpected response received", http_res)
890
803
 
891
804
  def delete(
892
805
  self,
@@ -964,27 +877,16 @@ class FirewallsSDK(BaseSDK):
964
877
  if utils.match_response(http_res, "204", "*"):
965
878
  return
966
879
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
967
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
968
- raise models.ErrorObject(data=response_data)
880
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
881
+ raise models.ErrorObject(response_data, http_res)
969
882
  if utils.match_response(http_res, "4XX", "*"):
970
883
  http_res_text = utils.stream_to_text(http_res)
971
- raise models.APIError(
972
- "API error occurred", http_res.status_code, http_res_text, http_res
973
- )
884
+ raise models.APIError("API error occurred", http_res, http_res_text)
974
885
  if utils.match_response(http_res, "5XX", "*"):
975
886
  http_res_text = utils.stream_to_text(http_res)
976
- raise models.APIError(
977
- "API error occurred", http_res.status_code, http_res_text, http_res
978
- )
887
+ raise models.APIError("API error occurred", http_res, http_res_text)
979
888
 
980
- content_type = http_res.headers.get("Content-Type")
981
- http_res_text = utils.stream_to_text(http_res)
982
- raise models.APIError(
983
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
984
- http_res.status_code,
985
- http_res_text,
986
- http_res,
987
- )
889
+ raise models.APIError("Unexpected response received", http_res)
988
890
 
989
891
  async def delete_async(
990
892
  self,
@@ -1062,27 +964,16 @@ class FirewallsSDK(BaseSDK):
1062
964
  if utils.match_response(http_res, "204", "*"):
1063
965
  return
1064
966
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
1065
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1066
- raise models.ErrorObject(data=response_data)
967
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
968
+ raise models.ErrorObject(response_data, http_res)
1067
969
  if utils.match_response(http_res, "4XX", "*"):
1068
970
  http_res_text = await utils.stream_to_text_async(http_res)
1069
- raise models.APIError(
1070
- "API error occurred", http_res.status_code, http_res_text, http_res
1071
- )
971
+ raise models.APIError("API error occurred", http_res, http_res_text)
1072
972
  if utils.match_response(http_res, "5XX", "*"):
1073
973
  http_res_text = await utils.stream_to_text_async(http_res)
1074
- raise models.APIError(
1075
- "API error occurred", http_res.status_code, http_res_text, http_res
1076
- )
974
+ raise models.APIError("API error occurred", http_res, http_res_text)
1077
975
 
1078
- content_type = http_res.headers.get("Content-Type")
1079
- http_res_text = await utils.stream_to_text_async(http_res)
1080
- raise models.APIError(
1081
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1082
- http_res.status_code,
1083
- http_res_text,
1084
- http_res,
1085
- )
976
+ raise models.APIError("Unexpected response received", http_res)
1086
977
 
1087
978
  def assign(
1088
979
  self,
@@ -1175,31 +1066,20 @@ class FirewallsSDK(BaseSDK):
1175
1066
 
1176
1067
  response_data: Any = None
1177
1068
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
1178
- return utils.unmarshal_json(http_res.text, models.FirewallServer)
1069
+ return unmarshal_json_response(models.FirewallServer, http_res)
1179
1070
  if utils.match_response(
1180
1071
  http_res, ["403", "404", "409", "422"], "application/vnd.api+json"
1181
1072
  ):
1182
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1183
- raise models.ErrorObject(data=response_data)
1073
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1074
+ raise models.ErrorObject(response_data, http_res)
1184
1075
  if utils.match_response(http_res, "4XX", "*"):
1185
1076
  http_res_text = utils.stream_to_text(http_res)
1186
- raise models.APIError(
1187
- "API error occurred", http_res.status_code, http_res_text, http_res
1188
- )
1077
+ raise models.APIError("API error occurred", http_res, http_res_text)
1189
1078
  if utils.match_response(http_res, "5XX", "*"):
1190
1079
  http_res_text = utils.stream_to_text(http_res)
1191
- raise models.APIError(
1192
- "API error occurred", http_res.status_code, http_res_text, http_res
1193
- )
1080
+ raise models.APIError("API error occurred", http_res, http_res_text)
1194
1081
 
1195
- content_type = http_res.headers.get("Content-Type")
1196
- http_res_text = utils.stream_to_text(http_res)
1197
- raise models.APIError(
1198
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1199
- http_res.status_code,
1200
- http_res_text,
1201
- http_res,
1202
- )
1082
+ raise models.APIError("Unexpected response received", http_res)
1203
1083
 
1204
1084
  async def assign_async(
1205
1085
  self,
@@ -1292,31 +1172,20 @@ class FirewallsSDK(BaseSDK):
1292
1172
 
1293
1173
  response_data: Any = None
1294
1174
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
1295
- return utils.unmarshal_json(http_res.text, models.FirewallServer)
1175
+ return unmarshal_json_response(models.FirewallServer, http_res)
1296
1176
  if utils.match_response(
1297
1177
  http_res, ["403", "404", "409", "422"], "application/vnd.api+json"
1298
1178
  ):
1299
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1300
- raise models.ErrorObject(data=response_data)
1179
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1180
+ raise models.ErrorObject(response_data, http_res)
1301
1181
  if utils.match_response(http_res, "4XX", "*"):
1302
1182
  http_res_text = await utils.stream_to_text_async(http_res)
1303
- raise models.APIError(
1304
- "API error occurred", http_res.status_code, http_res_text, http_res
1305
- )
1183
+ raise models.APIError("API error occurred", http_res, http_res_text)
1306
1184
  if utils.match_response(http_res, "5XX", "*"):
1307
1185
  http_res_text = await utils.stream_to_text_async(http_res)
1308
- raise models.APIError(
1309
- "API error occurred", http_res.status_code, http_res_text, http_res
1310
- )
1186
+ raise models.APIError("API error occurred", http_res, http_res_text)
1311
1187
 
1312
- content_type = http_res.headers.get("Content-Type")
1313
- http_res_text = await utils.stream_to_text_async(http_res)
1314
- raise models.APIError(
1315
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1316
- http_res.status_code,
1317
- http_res_text,
1318
- http_res,
1319
- )
1188
+ raise models.APIError("Unexpected response received", http_res)
1320
1189
 
1321
1190
  def list_assignments(
1322
1191
  self,
@@ -1420,31 +1289,20 @@ class FirewallsSDK(BaseSDK):
1420
1289
  response_data: Any = None
1421
1290
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1422
1291
  return models.GetFirewallAssignmentsResponse(
1423
- result=utils.unmarshal_json(http_res.text, models.FirewallAssignments),
1292
+ result=unmarshal_json_response(models.FirewallAssignments, http_res),
1424
1293
  next=next_func,
1425
1294
  )
1426
1295
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
1427
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1428
- raise models.ErrorObject(data=response_data)
1296
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1297
+ raise models.ErrorObject(response_data, http_res)
1429
1298
  if utils.match_response(http_res, "4XX", "*"):
1430
1299
  http_res_text = utils.stream_to_text(http_res)
1431
- raise models.APIError(
1432
- "API error occurred", http_res.status_code, http_res_text, http_res
1433
- )
1300
+ raise models.APIError("API error occurred", http_res, http_res_text)
1434
1301
  if utils.match_response(http_res, "5XX", "*"):
1435
1302
  http_res_text = utils.stream_to_text(http_res)
1436
- raise models.APIError(
1437
- "API error occurred", http_res.status_code, http_res_text, http_res
1438
- )
1303
+ raise models.APIError("API error occurred", http_res, http_res_text)
1439
1304
 
1440
- content_type = http_res.headers.get("Content-Type")
1441
- http_res_text = utils.stream_to_text(http_res)
1442
- raise models.APIError(
1443
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1444
- http_res.status_code,
1445
- http_res_text,
1446
- http_res,
1447
- )
1305
+ raise models.APIError("Unexpected response received", http_res)
1448
1306
 
1449
1307
  async def list_assignments_async(
1450
1308
  self,
@@ -1548,31 +1406,20 @@ class FirewallsSDK(BaseSDK):
1548
1406
  response_data: Any = None
1549
1407
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1550
1408
  return models.GetFirewallAssignmentsResponse(
1551
- result=utils.unmarshal_json(http_res.text, models.FirewallAssignments),
1409
+ result=unmarshal_json_response(models.FirewallAssignments, http_res),
1552
1410
  next=next_func,
1553
1411
  )
1554
1412
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
1555
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1556
- raise models.ErrorObject(data=response_data)
1413
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1414
+ raise models.ErrorObject(response_data, http_res)
1557
1415
  if utils.match_response(http_res, "4XX", "*"):
1558
1416
  http_res_text = await utils.stream_to_text_async(http_res)
1559
- raise models.APIError(
1560
- "API error occurred", http_res.status_code, http_res_text, http_res
1561
- )
1417
+ raise models.APIError("API error occurred", http_res, http_res_text)
1562
1418
  if utils.match_response(http_res, "5XX", "*"):
1563
1419
  http_res_text = await utils.stream_to_text_async(http_res)
1564
- raise models.APIError(
1565
- "API error occurred", http_res.status_code, http_res_text, http_res
1566
- )
1420
+ raise models.APIError("API error occurred", http_res, http_res_text)
1567
1421
 
1568
- content_type = http_res.headers.get("Content-Type")
1569
- http_res_text = await utils.stream_to_text_async(http_res)
1570
- raise models.APIError(
1571
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1572
- http_res.status_code,
1573
- http_res_text,
1574
- http_res,
1575
- )
1422
+ raise models.APIError("Unexpected response received", http_res)
1576
1423
 
1577
1424
  def delete_assignment(
1578
1425
  self,
@@ -1653,27 +1500,16 @@ class FirewallsSDK(BaseSDK):
1653
1500
  if utils.match_response(http_res, "204", "*"):
1654
1501
  return
1655
1502
  if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
1656
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1657
- raise models.ErrorObject(data=response_data)
1503
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1504
+ raise models.ErrorObject(response_data, http_res)
1658
1505
  if utils.match_response(http_res, "4XX", "*"):
1659
1506
  http_res_text = utils.stream_to_text(http_res)
1660
- raise models.APIError(
1661
- "API error occurred", http_res.status_code, http_res_text, http_res
1662
- )
1507
+ raise models.APIError("API error occurred", http_res, http_res_text)
1663
1508
  if utils.match_response(http_res, "5XX", "*"):
1664
1509
  http_res_text = utils.stream_to_text(http_res)
1665
- raise models.APIError(
1666
- "API error occurred", http_res.status_code, http_res_text, http_res
1667
- )
1510
+ raise models.APIError("API error occurred", http_res, http_res_text)
1668
1511
 
1669
- content_type = http_res.headers.get("Content-Type")
1670
- http_res_text = utils.stream_to_text(http_res)
1671
- raise models.APIError(
1672
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1673
- http_res.status_code,
1674
- http_res_text,
1675
- http_res,
1676
- )
1512
+ raise models.APIError("Unexpected response received", http_res)
1677
1513
 
1678
1514
  async def delete_assignment_async(
1679
1515
  self,
@@ -1754,24 +1590,13 @@ class FirewallsSDK(BaseSDK):
1754
1590
  if utils.match_response(http_res, "204", "*"):
1755
1591
  return
1756
1592
  if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
1757
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1758
- raise models.ErrorObject(data=response_data)
1593
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1594
+ raise models.ErrorObject(response_data, http_res)
1759
1595
  if utils.match_response(http_res, "4XX", "*"):
1760
1596
  http_res_text = await utils.stream_to_text_async(http_res)
1761
- raise models.APIError(
1762
- "API error occurred", http_res.status_code, http_res_text, http_res
1763
- )
1597
+ raise models.APIError("API error occurred", http_res, http_res_text)
1764
1598
  if utils.match_response(http_res, "5XX", "*"):
1765
1599
  http_res_text = await utils.stream_to_text_async(http_res)
1766
- raise models.APIError(
1767
- "API error occurred", http_res.status_code, http_res_text, http_res
1768
- )
1600
+ raise models.APIError("API error occurred", http_res, http_res_text)
1769
1601
 
1770
- content_type = http_res.headers.get("Content-Type")
1771
- http_res_text = await utils.stream_to_text_async(http_res)
1772
- raise models.APIError(
1773
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1774
- http_res.status_code,
1775
- http_res_text,
1776
- http_res,
1777
- )
1602
+ raise models.APIError("Unexpected response received", http_res)