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
 
@@ -120,28 +121,17 @@ class PrivateNetworks(BaseSDK):
120
121
 
121
122
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
122
123
  return models.GetVirtualNetworksResponse(
123
- result=utils.unmarshal_json(http_res.text, models.VirtualNetworks),
124
+ result=unmarshal_json_response(models.VirtualNetworks, http_res),
124
125
  next=next_func,
125
126
  )
126
127
  if utils.match_response(http_res, "4XX", "*"):
127
128
  http_res_text = utils.stream_to_text(http_res)
128
- raise models.APIError(
129
- "API error occurred", http_res.status_code, http_res_text, http_res
130
- )
129
+ raise models.APIError("API error occurred", http_res, http_res_text)
131
130
  if utils.match_response(http_res, "5XX", "*"):
132
131
  http_res_text = utils.stream_to_text(http_res)
133
- raise models.APIError(
134
- "API error occurred", http_res.status_code, http_res_text, http_res
135
- )
132
+ raise models.APIError("API error occurred", http_res, http_res_text)
136
133
 
137
- content_type = http_res.headers.get("Content-Type")
138
- http_res_text = utils.stream_to_text(http_res)
139
- raise models.APIError(
140
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
141
- http_res.status_code,
142
- http_res_text,
143
- http_res,
144
- )
134
+ raise models.APIError("Unexpected response received", http_res)
145
135
 
146
136
  async def list_async(
147
137
  self,
@@ -253,28 +243,17 @@ class PrivateNetworks(BaseSDK):
253
243
 
254
244
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
255
245
  return models.GetVirtualNetworksResponse(
256
- result=utils.unmarshal_json(http_res.text, models.VirtualNetworks),
246
+ result=unmarshal_json_response(models.VirtualNetworks, http_res),
257
247
  next=next_func,
258
248
  )
259
249
  if utils.match_response(http_res, "4XX", "*"):
260
250
  http_res_text = await utils.stream_to_text_async(http_res)
261
- raise models.APIError(
262
- "API error occurred", http_res.status_code, http_res_text, http_res
263
- )
251
+ raise models.APIError("API error occurred", http_res, http_res_text)
264
252
  if utils.match_response(http_res, "5XX", "*"):
265
253
  http_res_text = await utils.stream_to_text_async(http_res)
266
- raise models.APIError(
267
- "API error occurred", http_res.status_code, http_res_text, http_res
268
- )
254
+ raise models.APIError("API error occurred", http_res, http_res_text)
269
255
 
270
- content_type = http_res.headers.get("Content-Type")
271
- http_res_text = await utils.stream_to_text_async(http_res)
272
- raise models.APIError(
273
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
274
- http_res.status_code,
275
- http_res_text,
276
- http_res,
277
- )
256
+ raise models.APIError("Unexpected response received", http_res)
278
257
 
279
258
  def create(
280
259
  self,
@@ -363,29 +342,18 @@ class PrivateNetworks(BaseSDK):
363
342
 
364
343
  response_data: Any = None
365
344
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
366
- return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
345
+ return unmarshal_json_response(models.VirtualNetwork, http_res)
367
346
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
368
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
369
- raise models.ErrorObject(data=response_data)
347
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
348
+ raise models.ErrorObject(response_data, http_res)
370
349
  if utils.match_response(http_res, "4XX", "*"):
371
350
  http_res_text = utils.stream_to_text(http_res)
372
- raise models.APIError(
373
- "API error occurred", http_res.status_code, http_res_text, http_res
374
- )
351
+ raise models.APIError("API error occurred", http_res, http_res_text)
375
352
  if utils.match_response(http_res, "5XX", "*"):
376
353
  http_res_text = utils.stream_to_text(http_res)
377
- raise models.APIError(
378
- "API error occurred", http_res.status_code, http_res_text, http_res
379
- )
354
+ raise models.APIError("API error occurred", http_res, http_res_text)
380
355
 
381
- content_type = http_res.headers.get("Content-Type")
382
- http_res_text = utils.stream_to_text(http_res)
383
- raise models.APIError(
384
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
385
- http_res.status_code,
386
- http_res_text,
387
- http_res,
388
- )
356
+ raise models.APIError("Unexpected response received", http_res)
389
357
 
390
358
  async def create_async(
391
359
  self,
@@ -474,29 +442,18 @@ class PrivateNetworks(BaseSDK):
474
442
 
475
443
  response_data: Any = None
476
444
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
477
- return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
445
+ return unmarshal_json_response(models.VirtualNetwork, http_res)
478
446
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
479
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
480
- raise models.ErrorObject(data=response_data)
447
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
448
+ raise models.ErrorObject(response_data, http_res)
481
449
  if utils.match_response(http_res, "4XX", "*"):
482
450
  http_res_text = await utils.stream_to_text_async(http_res)
483
- raise models.APIError(
484
- "API error occurred", http_res.status_code, http_res_text, http_res
485
- )
451
+ raise models.APIError("API error occurred", http_res, http_res_text)
486
452
  if utils.match_response(http_res, "5XX", "*"):
487
453
  http_res_text = await utils.stream_to_text_async(http_res)
488
- raise models.APIError(
489
- "API error occurred", http_res.status_code, http_res_text, http_res
490
- )
454
+ raise models.APIError("API error occurred", http_res, http_res_text)
491
455
 
492
- content_type = http_res.headers.get("Content-Type")
493
- http_res_text = await utils.stream_to_text_async(http_res)
494
- raise models.APIError(
495
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
496
- http_res.status_code,
497
- http_res_text,
498
- http_res,
499
- )
456
+ raise models.APIError("Unexpected response received", http_res)
500
457
 
501
458
  def update(
502
459
  self,
@@ -593,31 +550,20 @@ class PrivateNetworks(BaseSDK):
593
550
 
594
551
  response_data: Any = None
595
552
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
596
- return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
553
+ return unmarshal_json_response(models.VirtualNetwork, http_res)
597
554
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
598
- response_data = utils.unmarshal_json(
599
- http_res.text, models.VirtualNetworkErrorData
555
+ response_data = unmarshal_json_response(
556
+ models.VirtualNetworkErrorData, http_res
600
557
  )
601
- raise models.VirtualNetworkError(data=response_data)
558
+ raise models.VirtualNetworkError(response_data, http_res)
602
559
  if utils.match_response(http_res, "4XX", "*"):
603
560
  http_res_text = utils.stream_to_text(http_res)
604
- raise models.APIError(
605
- "API error occurred", http_res.status_code, http_res_text, http_res
606
- )
561
+ raise models.APIError("API error occurred", http_res, http_res_text)
607
562
  if utils.match_response(http_res, "5XX", "*"):
608
563
  http_res_text = utils.stream_to_text(http_res)
609
- raise models.APIError(
610
- "API error occurred", http_res.status_code, http_res_text, http_res
611
- )
564
+ raise models.APIError("API error occurred", http_res, http_res_text)
612
565
 
613
- content_type = http_res.headers.get("Content-Type")
614
- http_res_text = utils.stream_to_text(http_res)
615
- raise models.APIError(
616
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
617
- http_res.status_code,
618
- http_res_text,
619
- http_res,
620
- )
566
+ raise models.APIError("Unexpected response received", http_res)
621
567
 
622
568
  async def update_async(
623
569
  self,
@@ -714,31 +660,20 @@ class PrivateNetworks(BaseSDK):
714
660
 
715
661
  response_data: Any = None
716
662
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
717
- return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
663
+ return unmarshal_json_response(models.VirtualNetwork, http_res)
718
664
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
719
- response_data = utils.unmarshal_json(
720
- http_res.text, models.VirtualNetworkErrorData
665
+ response_data = unmarshal_json_response(
666
+ models.VirtualNetworkErrorData, http_res
721
667
  )
722
- raise models.VirtualNetworkError(data=response_data)
668
+ raise models.VirtualNetworkError(response_data, http_res)
723
669
  if utils.match_response(http_res, "4XX", "*"):
724
670
  http_res_text = await utils.stream_to_text_async(http_res)
725
- raise models.APIError(
726
- "API error occurred", http_res.status_code, http_res_text, http_res
727
- )
671
+ raise models.APIError("API error occurred", http_res, http_res_text)
728
672
  if utils.match_response(http_res, "5XX", "*"):
729
673
  http_res_text = await utils.stream_to_text_async(http_res)
730
- raise models.APIError(
731
- "API error occurred", http_res.status_code, http_res_text, http_res
732
- )
674
+ raise models.APIError("API error occurred", http_res, http_res_text)
733
675
 
734
- content_type = http_res.headers.get("Content-Type")
735
- http_res_text = await utils.stream_to_text_async(http_res)
736
- raise models.APIError(
737
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
738
- http_res.status_code,
739
- http_res_text,
740
- http_res,
741
- )
676
+ raise models.APIError("Unexpected response received", http_res)
742
677
 
743
678
  def delete_virtual_network(
744
679
  self,
@@ -817,27 +752,16 @@ class PrivateNetworks(BaseSDK):
817
752
  if utils.match_response(http_res, "204", "*"):
818
753
  return
819
754
  if utils.match_response(http_res, "406", "application/vnd.api+json"):
820
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
821
- raise models.ErrorObject(data=response_data)
755
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
756
+ raise models.ErrorObject(response_data, http_res)
822
757
  if utils.match_response(http_res, "4XX", "*"):
823
758
  http_res_text = utils.stream_to_text(http_res)
824
- raise models.APIError(
825
- "API error occurred", http_res.status_code, http_res_text, http_res
826
- )
759
+ raise models.APIError("API error occurred", http_res, http_res_text)
827
760
  if utils.match_response(http_res, "5XX", "*"):
828
761
  http_res_text = utils.stream_to_text(http_res)
829
- raise models.APIError(
830
- "API error occurred", http_res.status_code, http_res_text, http_res
831
- )
762
+ raise models.APIError("API error occurred", http_res, http_res_text)
832
763
 
833
- content_type = http_res.headers.get("Content-Type")
834
- http_res_text = utils.stream_to_text(http_res)
835
- raise models.APIError(
836
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
837
- http_res.status_code,
838
- http_res_text,
839
- http_res,
840
- )
764
+ raise models.APIError("Unexpected response received", http_res)
841
765
 
842
766
  async def delete_virtual_network_async(
843
767
  self,
@@ -916,27 +840,16 @@ class PrivateNetworks(BaseSDK):
916
840
  if utils.match_response(http_res, "204", "*"):
917
841
  return
918
842
  if utils.match_response(http_res, "406", "application/vnd.api+json"):
919
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
920
- raise models.ErrorObject(data=response_data)
843
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
844
+ raise models.ErrorObject(response_data, http_res)
921
845
  if utils.match_response(http_res, "4XX", "*"):
922
846
  http_res_text = await utils.stream_to_text_async(http_res)
923
- raise models.APIError(
924
- "API error occurred", http_res.status_code, http_res_text, http_res
925
- )
847
+ raise models.APIError("API error occurred", http_res, http_res_text)
926
848
  if utils.match_response(http_res, "5XX", "*"):
927
849
  http_res_text = await utils.stream_to_text_async(http_res)
928
- raise models.APIError(
929
- "API error occurred", http_res.status_code, http_res_text, http_res
930
- )
850
+ raise models.APIError("API error occurred", http_res, http_res_text)
931
851
 
932
- content_type = http_res.headers.get("Content-Type")
933
- http_res_text = await utils.stream_to_text_async(http_res)
934
- raise models.APIError(
935
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
936
- http_res.status_code,
937
- http_res_text,
938
- http_res,
939
- )
852
+ raise models.APIError("Unexpected response received", http_res)
940
853
 
941
854
  def get(
942
855
  self,
@@ -1012,28 +925,17 @@ class PrivateNetworks(BaseSDK):
1012
925
  )
1013
926
 
1014
927
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1015
- return utils.unmarshal_json(
1016
- http_res.text, models.GetVirtualNetworkResponseBody
928
+ return unmarshal_json_response(
929
+ models.GetVirtualNetworkResponseBody, http_res
1017
930
  )
1018
931
  if utils.match_response(http_res, "4XX", "*"):
1019
932
  http_res_text = utils.stream_to_text(http_res)
1020
- raise models.APIError(
1021
- "API error occurred", http_res.status_code, http_res_text, http_res
1022
- )
933
+ raise models.APIError("API error occurred", http_res, http_res_text)
1023
934
  if utils.match_response(http_res, "5XX", "*"):
1024
935
  http_res_text = utils.stream_to_text(http_res)
1025
- raise models.APIError(
1026
- "API error occurred", http_res.status_code, http_res_text, http_res
1027
- )
936
+ raise models.APIError("API error occurred", http_res, http_res_text)
1028
937
 
1029
- content_type = http_res.headers.get("Content-Type")
1030
- http_res_text = utils.stream_to_text(http_res)
1031
- raise models.APIError(
1032
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1033
- http_res.status_code,
1034
- http_res_text,
1035
- http_res,
1036
- )
938
+ raise models.APIError("Unexpected response received", http_res)
1037
939
 
1038
940
  async def get_async(
1039
941
  self,
@@ -1109,28 +1011,17 @@ class PrivateNetworks(BaseSDK):
1109
1011
  )
1110
1012
 
1111
1013
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1112
- return utils.unmarshal_json(
1113
- http_res.text, models.GetVirtualNetworkResponseBody
1014
+ return unmarshal_json_response(
1015
+ models.GetVirtualNetworkResponseBody, http_res
1114
1016
  )
1115
1017
  if utils.match_response(http_res, "4XX", "*"):
1116
1018
  http_res_text = await utils.stream_to_text_async(http_res)
1117
- raise models.APIError(
1118
- "API error occurred", http_res.status_code, http_res_text, http_res
1119
- )
1019
+ raise models.APIError("API error occurred", http_res, http_res_text)
1120
1020
  if utils.match_response(http_res, "5XX", "*"):
1121
1021
  http_res_text = await utils.stream_to_text_async(http_res)
1122
- raise models.APIError(
1123
- "API error occurred", http_res.status_code, http_res_text, http_res
1124
- )
1022
+ raise models.APIError("API error occurred", http_res, http_res_text)
1125
1023
 
1126
- content_type = http_res.headers.get("Content-Type")
1127
- http_res_text = await utils.stream_to_text_async(http_res)
1128
- raise models.APIError(
1129
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1130
- http_res.status_code,
1131
- http_res_text,
1132
- http_res,
1133
- )
1024
+ raise models.APIError("Unexpected response received", http_res)
1134
1025
 
1135
1026
  def list_assignments(
1136
1027
  self,
@@ -1242,30 +1133,19 @@ class PrivateNetworks(BaseSDK):
1242
1133
 
1243
1134
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1244
1135
  return models.GetVirtualNetworksAssignmentsResponse(
1245
- result=utils.unmarshal_json(
1246
- http_res.text, models.VirtualNetworkAssignments
1136
+ result=unmarshal_json_response(
1137
+ models.VirtualNetworkAssignments, http_res
1247
1138
  ),
1248
1139
  next=next_func,
1249
1140
  )
1250
1141
  if utils.match_response(http_res, "4XX", "*"):
1251
1142
  http_res_text = utils.stream_to_text(http_res)
1252
- raise models.APIError(
1253
- "API error occurred", http_res.status_code, http_res_text, http_res
1254
- )
1143
+ raise models.APIError("API error occurred", http_res, http_res_text)
1255
1144
  if utils.match_response(http_res, "5XX", "*"):
1256
1145
  http_res_text = utils.stream_to_text(http_res)
1257
- raise models.APIError(
1258
- "API error occurred", http_res.status_code, http_res_text, http_res
1259
- )
1146
+ raise models.APIError("API error occurred", http_res, http_res_text)
1260
1147
 
1261
- content_type = http_res.headers.get("Content-Type")
1262
- http_res_text = utils.stream_to_text(http_res)
1263
- raise models.APIError(
1264
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1265
- http_res.status_code,
1266
- http_res_text,
1267
- http_res,
1268
- )
1148
+ raise models.APIError("Unexpected response received", http_res)
1269
1149
 
1270
1150
  async def list_assignments_async(
1271
1151
  self,
@@ -1377,30 +1257,19 @@ class PrivateNetworks(BaseSDK):
1377
1257
 
1378
1258
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1379
1259
  return models.GetVirtualNetworksAssignmentsResponse(
1380
- result=utils.unmarshal_json(
1381
- http_res.text, models.VirtualNetworkAssignments
1260
+ result=unmarshal_json_response(
1261
+ models.VirtualNetworkAssignments, http_res
1382
1262
  ),
1383
1263
  next=next_func,
1384
1264
  )
1385
1265
  if utils.match_response(http_res, "4XX", "*"):
1386
1266
  http_res_text = await utils.stream_to_text_async(http_res)
1387
- raise models.APIError(
1388
- "API error occurred", http_res.status_code, http_res_text, http_res
1389
- )
1267
+ raise models.APIError("API error occurred", http_res, http_res_text)
1390
1268
  if utils.match_response(http_res, "5XX", "*"):
1391
1269
  http_res_text = await utils.stream_to_text_async(http_res)
1392
- raise models.APIError(
1393
- "API error occurred", http_res.status_code, http_res_text, http_res
1394
- )
1270
+ raise models.APIError("API error occurred", http_res, http_res_text)
1395
1271
 
1396
- content_type = http_res.headers.get("Content-Type")
1397
- http_res_text = await utils.stream_to_text_async(http_res)
1398
- raise models.APIError(
1399
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1400
- http_res.status_code,
1401
- http_res_text,
1402
- http_res,
1403
- )
1272
+ raise models.APIError("Unexpected response received", http_res)
1404
1273
 
1405
1274
  def assign(
1406
1275
  self,
@@ -1488,29 +1357,18 @@ class PrivateNetworks(BaseSDK):
1488
1357
 
1489
1358
  response_data: Any = None
1490
1359
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
1491
- return utils.unmarshal_json(http_res.text, models.VirtualNetworkAssignment)
1360
+ return unmarshal_json_response(models.VirtualNetworkAssignment, http_res)
1492
1361
  if utils.match_response(http_res, ["403", "422"], "application/vnd.api+json"):
1493
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1494
- raise models.ErrorObject(data=response_data)
1362
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1363
+ raise models.ErrorObject(response_data, http_res)
1495
1364
  if utils.match_response(http_res, "4XX", "*"):
1496
1365
  http_res_text = utils.stream_to_text(http_res)
1497
- raise models.APIError(
1498
- "API error occurred", http_res.status_code, http_res_text, http_res
1499
- )
1366
+ raise models.APIError("API error occurred", http_res, http_res_text)
1500
1367
  if utils.match_response(http_res, "5XX", "*"):
1501
1368
  http_res_text = utils.stream_to_text(http_res)
1502
- raise models.APIError(
1503
- "API error occurred", http_res.status_code, http_res_text, http_res
1504
- )
1369
+ raise models.APIError("API error occurred", http_res, http_res_text)
1505
1370
 
1506
- content_type = http_res.headers.get("Content-Type")
1507
- http_res_text = utils.stream_to_text(http_res)
1508
- raise models.APIError(
1509
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1510
- http_res.status_code,
1511
- http_res_text,
1512
- http_res,
1513
- )
1371
+ raise models.APIError("Unexpected response received", http_res)
1514
1372
 
1515
1373
  async def assign_async(
1516
1374
  self,
@@ -1598,29 +1456,18 @@ class PrivateNetworks(BaseSDK):
1598
1456
 
1599
1457
  response_data: Any = None
1600
1458
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
1601
- return utils.unmarshal_json(http_res.text, models.VirtualNetworkAssignment)
1459
+ return unmarshal_json_response(models.VirtualNetworkAssignment, http_res)
1602
1460
  if utils.match_response(http_res, ["403", "422"], "application/vnd.api+json"):
1603
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1604
- raise models.ErrorObject(data=response_data)
1461
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1462
+ raise models.ErrorObject(response_data, http_res)
1605
1463
  if utils.match_response(http_res, "4XX", "*"):
1606
1464
  http_res_text = await utils.stream_to_text_async(http_res)
1607
- raise models.APIError(
1608
- "API error occurred", http_res.status_code, http_res_text, http_res
1609
- )
1465
+ raise models.APIError("API error occurred", http_res, http_res_text)
1610
1466
  if utils.match_response(http_res, "5XX", "*"):
1611
1467
  http_res_text = await utils.stream_to_text_async(http_res)
1612
- raise models.APIError(
1613
- "API error occurred", http_res.status_code, http_res_text, http_res
1614
- )
1468
+ raise models.APIError("API error occurred", http_res, http_res_text)
1615
1469
 
1616
- content_type = http_res.headers.get("Content-Type")
1617
- http_res_text = await utils.stream_to_text_async(http_res)
1618
- raise models.APIError(
1619
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1620
- http_res.status_code,
1621
- http_res_text,
1622
- http_res,
1623
- )
1470
+ raise models.APIError("Unexpected response received", http_res)
1624
1471
 
1625
1472
  def remove_assignment(
1626
1473
  self,
@@ -1699,27 +1546,16 @@ class PrivateNetworks(BaseSDK):
1699
1546
  if utils.match_response(http_res, "204", "*"):
1700
1547
  return
1701
1548
  if utils.match_response(http_res, ["403", "423"], "application/vnd.api+json"):
1702
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1703
- raise models.ErrorObject(data=response_data)
1549
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1550
+ raise models.ErrorObject(response_data, http_res)
1704
1551
  if utils.match_response(http_res, "4XX", "*"):
1705
1552
  http_res_text = utils.stream_to_text(http_res)
1706
- raise models.APIError(
1707
- "API error occurred", http_res.status_code, http_res_text, http_res
1708
- )
1553
+ raise models.APIError("API error occurred", http_res, http_res_text)
1709
1554
  if utils.match_response(http_res, "5XX", "*"):
1710
1555
  http_res_text = utils.stream_to_text(http_res)
1711
- raise models.APIError(
1712
- "API error occurred", http_res.status_code, http_res_text, http_res
1713
- )
1556
+ raise models.APIError("API error occurred", http_res, http_res_text)
1714
1557
 
1715
- content_type = http_res.headers.get("Content-Type")
1716
- http_res_text = utils.stream_to_text(http_res)
1717
- raise models.APIError(
1718
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1719
- http_res.status_code,
1720
- http_res_text,
1721
- http_res,
1722
- )
1558
+ raise models.APIError("Unexpected response received", http_res)
1723
1559
 
1724
1560
  async def remove_assignment_async(
1725
1561
  self,
@@ -1798,24 +1634,13 @@ class PrivateNetworks(BaseSDK):
1798
1634
  if utils.match_response(http_res, "204", "*"):
1799
1635
  return
1800
1636
  if utils.match_response(http_res, ["403", "423"], "application/vnd.api+json"):
1801
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1802
- raise models.ErrorObject(data=response_data)
1637
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1638
+ raise models.ErrorObject(response_data, http_res)
1803
1639
  if utils.match_response(http_res, "4XX", "*"):
1804
1640
  http_res_text = await utils.stream_to_text_async(http_res)
1805
- raise models.APIError(
1806
- "API error occurred", http_res.status_code, http_res_text, http_res
1807
- )
1641
+ raise models.APIError("API error occurred", http_res, http_res_text)
1808
1642
  if utils.match_response(http_res, "5XX", "*"):
1809
1643
  http_res_text = await utils.stream_to_text_async(http_res)
1810
- raise models.APIError(
1811
- "API error occurred", http_res.status_code, http_res_text, http_res
1812
- )
1644
+ raise models.APIError("API error occurred", http_res, http_res_text)
1813
1645
 
1814
- content_type = http_res.headers.get("Content-Type")
1815
- http_res_text = await utils.stream_to_text_async(http_res)
1816
- raise models.APIError(
1817
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1818
- http_res.status_code,
1819
- http_res_text,
1820
- http_res,
1821
- )
1646
+ raise models.APIError("Unexpected response received", http_res)