latitudesh-python-sdk 1.1.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 (93) hide show
  1. latitudesh_python_sdk/_hooks/types.py +7 -0
  2. latitudesh_python_sdk/_version.py +6 -4
  3. latitudesh_python_sdk/apikeys.py +73 -156
  4. latitudesh_python_sdk/basesdk.py +16 -24
  5. latitudesh_python_sdk/billing.py +13 -32
  6. latitudesh_python_sdk/events_sdk.py +11 -34
  7. latitudesh_python_sdk/firewalls_sdk.py +105 -264
  8. latitudesh_python_sdk/httpclient.py +6 -16
  9. latitudesh_python_sdk/ipaddresses_sdk.py +29 -68
  10. latitudesh_python_sdk/models/__init__.py +2586 -1126
  11. latitudesh_python_sdk/models/apierror.py +30 -14
  12. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +2 -2
  13. latitudesh_python_sdk/models/{bandwidth_plan.py → bandwidth_plan_data.py} +9 -9
  14. latitudesh_python_sdk/models/bandwidth_plans.py +14 -3
  15. latitudesh_python_sdk/models/custom_tag.py +15 -0
  16. latitudesh_python_sdk/models/custom_tag_data.py +54 -0
  17. latitudesh_python_sdk/models/custom_tags.py +26 -0
  18. latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
  19. latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
  20. latitudesh_python_sdk/models/deploy_config.py +11 -6
  21. latitudesh_python_sdk/models/error_object.py +11 -6
  22. latitudesh_python_sdk/models/event_data.py +98 -0
  23. latitudesh_python_sdk/models/events.py +16 -1
  24. latitudesh_python_sdk/models/filesystem_data.py +4 -0
  25. latitudesh_python_sdk/models/firewall.py +15 -0
  26. latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
  27. latitudesh_python_sdk/models/firewall_assignments.py +29 -0
  28. latitudesh_python_sdk/models/firewall_data.py +71 -0
  29. latitudesh_python_sdk/models/firewall_server.py +4 -1
  30. latitudesh_python_sdk/models/firewalls.py +7 -7
  31. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +3 -3
  32. latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
  33. latitudesh_python_sdk/models/get_ssh_keysop.py +22 -0
  34. latitudesh_python_sdk/models/get_traffic_consumptionop.py +8 -4
  35. latitudesh_python_sdk/models/get_user_dataop.py +31 -0
  36. latitudesh_python_sdk/models/get_users_dataop.py +35 -0
  37. latitudesh_python_sdk/models/latitudesherror.py +26 -0
  38. latitudesh_python_sdk/models/no_response_error.py +13 -0
  39. latitudesh_python_sdk/models/operating_system_data.py +65 -0
  40. latitudesh_python_sdk/models/operating_systems.py +15 -0
  41. latitudesh_python_sdk/models/out_of_band_connection.py +4 -4
  42. latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
  43. latitudesh_python_sdk/models/post_ssh_keyop.py +58 -0
  44. latitudesh_python_sdk/models/post_user_dataop.py +45 -0
  45. latitudesh_python_sdk/models/project_include.py +3 -0
  46. latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
  47. latitudesh_python_sdk/models/region_resource_data.py +4 -4
  48. latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
  49. latitudesh_python_sdk/models/role.py +11 -0
  50. latitudesh_python_sdk/models/server.py +11 -6
  51. latitudesh_python_sdk/models/server_data.py +14 -3
  52. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  53. latitudesh_python_sdk/models/{ssh_key.py → ssh_keys.py} +13 -2
  54. latitudesh_python_sdk/models/storage_plan_data.py +47 -0
  55. latitudesh_python_sdk/models/storage_plans.py +14 -3
  56. latitudesh_python_sdk/models/update_serverop.py +58 -10
  57. latitudesh_python_sdk/models/user_data.py +11 -0
  58. latitudesh_python_sdk/models/virtual_network.py +30 -6
  59. latitudesh_python_sdk/models/virtual_network1.py +15 -0
  60. latitudesh_python_sdk/models/virtual_network_assignment.py +41 -0
  61. latitudesh_python_sdk/models/virtual_network_assignment_data.py +68 -0
  62. latitudesh_python_sdk/models/virtual_network_assignments.py +5 -5
  63. latitudesh_python_sdk/models/virtual_network_data.py +88 -0
  64. latitudesh_python_sdk/models/virtual_networks.py +3 -3
  65. latitudesh_python_sdk/operatingsystems_sdk.py +13 -32
  66. latitudesh_python_sdk/plans.py +99 -214
  67. latitudesh_python_sdk/privatenetworks.py +131 -290
  68. latitudesh_python_sdk/projects_sdk.py +79 -158
  69. latitudesh_python_sdk/regions_sdk.py +25 -66
  70. latitudesh_python_sdk/roles.py +25 -64
  71. latitudesh_python_sdk/sdk.py +110 -73
  72. latitudesh_python_sdk/sdkconfiguration.py +0 -7
  73. latitudesh_python_sdk/servers_sdk.py +305 -646
  74. latitudesh_python_sdk/sshkeys_sdk.py +1856 -0
  75. latitudesh_python_sdk/storage.py +41 -120
  76. latitudesh_python_sdk/tags.py +67 -146
  77. latitudesh_python_sdk/teams_sdk.py +41 -100
  78. latitudesh_python_sdk/teamsmembers.py +37 -96
  79. latitudesh_python_sdk/traffic_sdk.py +37 -76
  80. latitudesh_python_sdk/userdata_sdk.py +959 -149
  81. latitudesh_python_sdk/userprofile.py +37 -100
  82. latitudesh_python_sdk/utils/__init__.py +131 -46
  83. latitudesh_python_sdk/utils/forms.py +49 -28
  84. latitudesh_python_sdk/utils/serializers.py +3 -2
  85. latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
  86. latitudesh_python_sdk/virtualmachines.py +71 -140
  87. latitudesh_python_sdk/vpnsessions.py +93 -172
  88. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +76 -43
  89. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +91 -67
  90. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/WHEEL +1 -1
  91. latitudesh_python_sdk/models/storage_plan.py +0 -36
  92. latitudesh_python_sdk/sshkeys.py +0 -1050
  93. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +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
 
@@ -75,6 +76,7 @@ class FirewallsSDK(BaseSDK):
75
76
 
76
77
  http_res = self.do_request(
77
78
  hook_ctx=HookContext(
79
+ config=self.sdk_configuration,
78
80
  base_url=base_url or "",
79
81
  operation_id="create-firewall",
80
82
  oauth2_scopes=[],
@@ -89,29 +91,18 @@ class FirewallsSDK(BaseSDK):
89
91
 
90
92
  response_data: Any = None
91
93
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
92
- return utils.unmarshal_json(http_res.text, models.Firewall)
94
+ return unmarshal_json_response(models.Firewall, http_res)
93
95
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
94
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
95
- raise models.ErrorObject(data=response_data)
96
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
97
+ raise models.ErrorObject(response_data, http_res)
96
98
  if utils.match_response(http_res, "4XX", "*"):
97
99
  http_res_text = utils.stream_to_text(http_res)
98
- raise models.APIError(
99
- "API error occurred", http_res.status_code, http_res_text, http_res
100
- )
100
+ raise models.APIError("API error occurred", http_res, http_res_text)
101
101
  if utils.match_response(http_res, "5XX", "*"):
102
102
  http_res_text = utils.stream_to_text(http_res)
103
- raise models.APIError(
104
- "API error occurred", http_res.status_code, http_res_text, http_res
105
- )
103
+ raise models.APIError("API error occurred", http_res, http_res_text)
106
104
 
107
- content_type = http_res.headers.get("Content-Type")
108
- http_res_text = utils.stream_to_text(http_res)
109
- raise models.APIError(
110
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
111
- http_res.status_code,
112
- http_res_text,
113
- http_res,
114
- )
105
+ raise models.APIError("Unexpected response received", http_res)
115
106
 
116
107
  async def create_async(
117
108
  self,
@@ -178,6 +169,7 @@ class FirewallsSDK(BaseSDK):
178
169
 
179
170
  http_res = await self.do_request_async(
180
171
  hook_ctx=HookContext(
172
+ config=self.sdk_configuration,
181
173
  base_url=base_url or "",
182
174
  operation_id="create-firewall",
183
175
  oauth2_scopes=[],
@@ -192,29 +184,18 @@ class FirewallsSDK(BaseSDK):
192
184
 
193
185
  response_data: Any = None
194
186
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
195
- return utils.unmarshal_json(http_res.text, models.Firewall)
187
+ return unmarshal_json_response(models.Firewall, http_res)
196
188
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
197
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
198
- raise models.ErrorObject(data=response_data)
189
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
190
+ raise models.ErrorObject(response_data, http_res)
199
191
  if utils.match_response(http_res, "4XX", "*"):
200
192
  http_res_text = await utils.stream_to_text_async(http_res)
201
- raise models.APIError(
202
- "API error occurred", http_res.status_code, http_res_text, http_res
203
- )
193
+ raise models.APIError("API error occurred", http_res, http_res_text)
204
194
  if utils.match_response(http_res, "5XX", "*"):
205
195
  http_res_text = await utils.stream_to_text_async(http_res)
206
- raise models.APIError(
207
- "API error occurred", http_res.status_code, http_res_text, http_res
208
- )
196
+ raise models.APIError("API error occurred", http_res, http_res_text)
209
197
 
210
- content_type = http_res.headers.get("Content-Type")
211
- http_res_text = await utils.stream_to_text_async(http_res)
212
- raise models.APIError(
213
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
214
- http_res.status_code,
215
- http_res_text,
216
- http_res,
217
- )
198
+ raise models.APIError("Unexpected response received", http_res)
218
199
 
219
200
  def list(
220
201
  self,
@@ -281,6 +262,7 @@ class FirewallsSDK(BaseSDK):
281
262
 
282
263
  http_res = self.do_request(
283
264
  hook_ctx=HookContext(
265
+ config=self.sdk_configuration,
284
266
  base_url=base_url or "",
285
267
  operation_id="list-firewalls",
286
268
  oauth2_scopes=[],
@@ -316,28 +298,17 @@ class FirewallsSDK(BaseSDK):
316
298
 
317
299
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
318
300
  return models.ListFirewallsResponse(
319
- result=utils.unmarshal_json(http_res.text, models.Firewalls),
301
+ result=unmarshal_json_response(models.Firewalls, http_res),
320
302
  next=next_func,
321
303
  )
322
304
  if utils.match_response(http_res, "4XX", "*"):
323
305
  http_res_text = utils.stream_to_text(http_res)
324
- raise models.APIError(
325
- "API error occurred", http_res.status_code, http_res_text, http_res
326
- )
306
+ raise models.APIError("API error occurred", http_res, http_res_text)
327
307
  if utils.match_response(http_res, "5XX", "*"):
328
308
  http_res_text = utils.stream_to_text(http_res)
329
- raise models.APIError(
330
- "API error occurred", http_res.status_code, http_res_text, http_res
331
- )
309
+ raise models.APIError("API error occurred", http_res, http_res_text)
332
310
 
333
- content_type = http_res.headers.get("Content-Type")
334
- http_res_text = utils.stream_to_text(http_res)
335
- raise models.APIError(
336
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
337
- http_res.status_code,
338
- http_res_text,
339
- http_res,
340
- )
311
+ raise models.APIError("Unexpected response received", http_res)
341
312
 
342
313
  async def list_async(
343
314
  self,
@@ -404,6 +375,7 @@ class FirewallsSDK(BaseSDK):
404
375
 
405
376
  http_res = await self.do_request_async(
406
377
  hook_ctx=HookContext(
378
+ config=self.sdk_configuration,
407
379
  base_url=base_url or "",
408
380
  operation_id="list-firewalls",
409
381
  oauth2_scopes=[],
@@ -439,28 +411,17 @@ class FirewallsSDK(BaseSDK):
439
411
 
440
412
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
441
413
  return models.ListFirewallsResponse(
442
- result=utils.unmarshal_json(http_res.text, models.Firewalls),
414
+ result=unmarshal_json_response(models.Firewalls, http_res),
443
415
  next=next_func,
444
416
  )
445
417
  if utils.match_response(http_res, "4XX", "*"):
446
418
  http_res_text = await utils.stream_to_text_async(http_res)
447
- raise models.APIError(
448
- "API error occurred", http_res.status_code, http_res_text, http_res
449
- )
419
+ raise models.APIError("API error occurred", http_res, http_res_text)
450
420
  if utils.match_response(http_res, "5XX", "*"):
451
421
  http_res_text = await utils.stream_to_text_async(http_res)
452
- raise models.APIError(
453
- "API error occurred", http_res.status_code, http_res_text, http_res
454
- )
422
+ raise models.APIError("API error occurred", http_res, http_res_text)
455
423
 
456
- content_type = http_res.headers.get("Content-Type")
457
- http_res_text = await utils.stream_to_text_async(http_res)
458
- raise models.APIError(
459
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
460
- http_res.status_code,
461
- http_res_text,
462
- http_res,
463
- )
424
+ raise models.APIError("Unexpected response received", http_res)
464
425
 
465
426
  def get(
466
427
  self,
@@ -521,6 +482,7 @@ class FirewallsSDK(BaseSDK):
521
482
 
522
483
  http_res = self.do_request(
523
484
  hook_ctx=HookContext(
485
+ config=self.sdk_configuration,
524
486
  base_url=base_url or "",
525
487
  operation_id="get-firewall",
526
488
  oauth2_scopes=[],
@@ -535,29 +497,18 @@ class FirewallsSDK(BaseSDK):
535
497
 
536
498
  response_data: Any = None
537
499
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
538
- return utils.unmarshal_json(http_res.text, models.Firewall)
500
+ return unmarshal_json_response(models.Firewall, http_res)
539
501
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
540
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
541
- raise models.ErrorObject(data=response_data)
502
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
503
+ raise models.ErrorObject(response_data, http_res)
542
504
  if utils.match_response(http_res, "4XX", "*"):
543
505
  http_res_text = utils.stream_to_text(http_res)
544
- raise models.APIError(
545
- "API error occurred", http_res.status_code, http_res_text, http_res
546
- )
506
+ raise models.APIError("API error occurred", http_res, http_res_text)
547
507
  if utils.match_response(http_res, "5XX", "*"):
548
508
  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
- )
509
+ raise models.APIError("API error occurred", http_res, http_res_text)
552
510
 
553
- content_type = http_res.headers.get("Content-Type")
554
- http_res_text = utils.stream_to_text(http_res)
555
- raise models.APIError(
556
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
557
- http_res.status_code,
558
- http_res_text,
559
- http_res,
560
- )
511
+ raise models.APIError("Unexpected response received", http_res)
561
512
 
562
513
  async def get_async(
563
514
  self,
@@ -618,6 +569,7 @@ class FirewallsSDK(BaseSDK):
618
569
 
619
570
  http_res = await self.do_request_async(
620
571
  hook_ctx=HookContext(
572
+ config=self.sdk_configuration,
621
573
  base_url=base_url or "",
622
574
  operation_id="get-firewall",
623
575
  oauth2_scopes=[],
@@ -632,29 +584,18 @@ class FirewallsSDK(BaseSDK):
632
584
 
633
585
  response_data: Any = None
634
586
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
635
- return utils.unmarshal_json(http_res.text, models.Firewall)
587
+ return unmarshal_json_response(models.Firewall, http_res)
636
588
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
637
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
638
- raise models.ErrorObject(data=response_data)
589
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
590
+ raise models.ErrorObject(response_data, http_res)
639
591
  if utils.match_response(http_res, "4XX", "*"):
640
592
  http_res_text = await utils.stream_to_text_async(http_res)
641
- raise models.APIError(
642
- "API error occurred", http_res.status_code, http_res_text, http_res
643
- )
593
+ raise models.APIError("API error occurred", http_res, http_res_text)
644
594
  if utils.match_response(http_res, "5XX", "*"):
645
595
  http_res_text = await utils.stream_to_text_async(http_res)
646
- raise models.APIError(
647
- "API error occurred", http_res.status_code, http_res_text, http_res
648
- )
596
+ raise models.APIError("API error occurred", http_res, http_res_text)
649
597
 
650
- content_type = http_res.headers.get("Content-Type")
651
- http_res_text = await utils.stream_to_text_async(http_res)
652
- raise models.APIError(
653
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
654
- http_res.status_code,
655
- http_res_text,
656
- http_res,
657
- )
598
+ raise models.APIError("Unexpected response received", http_res)
658
599
 
659
600
  def update(
660
601
  self,
@@ -730,6 +671,7 @@ class FirewallsSDK(BaseSDK):
730
671
 
731
672
  http_res = self.do_request(
732
673
  hook_ctx=HookContext(
674
+ config=self.sdk_configuration,
733
675
  base_url=base_url or "",
734
676
  operation_id="update-firewall",
735
677
  oauth2_scopes=[],
@@ -744,29 +686,18 @@ class FirewallsSDK(BaseSDK):
744
686
 
745
687
  response_data: Any = None
746
688
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
747
- return utils.unmarshal_json(http_res.text, models.Firewall)
689
+ return unmarshal_json_response(models.Firewall, http_res)
748
690
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
749
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
750
- raise models.ErrorObject(data=response_data)
691
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
692
+ raise models.ErrorObject(response_data, http_res)
751
693
  if utils.match_response(http_res, "4XX", "*"):
752
694
  http_res_text = utils.stream_to_text(http_res)
753
- raise models.APIError(
754
- "API error occurred", http_res.status_code, http_res_text, http_res
755
- )
695
+ raise models.APIError("API error occurred", http_res, http_res_text)
756
696
  if utils.match_response(http_res, "5XX", "*"):
757
697
  http_res_text = utils.stream_to_text(http_res)
758
- raise models.APIError(
759
- "API error occurred", http_res.status_code, http_res_text, http_res
760
- )
698
+ raise models.APIError("API error occurred", http_res, http_res_text)
761
699
 
762
- content_type = http_res.headers.get("Content-Type")
763
- http_res_text = utils.stream_to_text(http_res)
764
- raise models.APIError(
765
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
766
- http_res.status_code,
767
- http_res_text,
768
- http_res,
769
- )
700
+ raise models.APIError("Unexpected response received", http_res)
770
701
 
771
702
  async def update_async(
772
703
  self,
@@ -842,6 +773,7 @@ class FirewallsSDK(BaseSDK):
842
773
 
843
774
  http_res = await self.do_request_async(
844
775
  hook_ctx=HookContext(
776
+ config=self.sdk_configuration,
845
777
  base_url=base_url or "",
846
778
  operation_id="update-firewall",
847
779
  oauth2_scopes=[],
@@ -856,29 +788,18 @@ class FirewallsSDK(BaseSDK):
856
788
 
857
789
  response_data: Any = None
858
790
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
859
- return utils.unmarshal_json(http_res.text, models.Firewall)
791
+ return unmarshal_json_response(models.Firewall, http_res)
860
792
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
861
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
862
- raise models.ErrorObject(data=response_data)
793
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
794
+ raise models.ErrorObject(response_data, http_res)
863
795
  if utils.match_response(http_res, "4XX", "*"):
864
796
  http_res_text = await utils.stream_to_text_async(http_res)
865
- raise models.APIError(
866
- "API error occurred", http_res.status_code, http_res_text, http_res
867
- )
797
+ raise models.APIError("API error occurred", http_res, http_res_text)
868
798
  if utils.match_response(http_res, "5XX", "*"):
869
799
  http_res_text = await utils.stream_to_text_async(http_res)
870
- raise models.APIError(
871
- "API error occurred", http_res.status_code, http_res_text, http_res
872
- )
800
+ raise models.APIError("API error occurred", http_res, http_res_text)
873
801
 
874
- content_type = http_res.headers.get("Content-Type")
875
- http_res_text = await utils.stream_to_text_async(http_res)
876
- raise models.APIError(
877
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
878
- http_res.status_code,
879
- http_res_text,
880
- http_res,
881
- )
802
+ raise models.APIError("Unexpected response received", http_res)
882
803
 
883
804
  def delete(
884
805
  self,
@@ -939,6 +860,7 @@ class FirewallsSDK(BaseSDK):
939
860
 
940
861
  http_res = self.do_request(
941
862
  hook_ctx=HookContext(
863
+ config=self.sdk_configuration,
942
864
  base_url=base_url or "",
943
865
  operation_id="delete-firewall",
944
866
  oauth2_scopes=[],
@@ -955,27 +877,16 @@ class FirewallsSDK(BaseSDK):
955
877
  if utils.match_response(http_res, "204", "*"):
956
878
  return
957
879
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
958
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
959
- raise models.ErrorObject(data=response_data)
880
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
881
+ raise models.ErrorObject(response_data, http_res)
960
882
  if utils.match_response(http_res, "4XX", "*"):
961
883
  http_res_text = utils.stream_to_text(http_res)
962
- raise models.APIError(
963
- "API error occurred", http_res.status_code, http_res_text, http_res
964
- )
884
+ raise models.APIError("API error occurred", http_res, http_res_text)
965
885
  if utils.match_response(http_res, "5XX", "*"):
966
886
  http_res_text = utils.stream_to_text(http_res)
967
- raise models.APIError(
968
- "API error occurred", http_res.status_code, http_res_text, http_res
969
- )
887
+ raise models.APIError("API error occurred", http_res, http_res_text)
970
888
 
971
- content_type = http_res.headers.get("Content-Type")
972
- http_res_text = utils.stream_to_text(http_res)
973
- raise models.APIError(
974
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
975
- http_res.status_code,
976
- http_res_text,
977
- http_res,
978
- )
889
+ raise models.APIError("Unexpected response received", http_res)
979
890
 
980
891
  async def delete_async(
981
892
  self,
@@ -1036,6 +947,7 @@ class FirewallsSDK(BaseSDK):
1036
947
 
1037
948
  http_res = await self.do_request_async(
1038
949
  hook_ctx=HookContext(
950
+ config=self.sdk_configuration,
1039
951
  base_url=base_url or "",
1040
952
  operation_id="delete-firewall",
1041
953
  oauth2_scopes=[],
@@ -1052,27 +964,16 @@ class FirewallsSDK(BaseSDK):
1052
964
  if utils.match_response(http_res, "204", "*"):
1053
965
  return
1054
966
  if utils.match_response(http_res, ["404", "422"], "application/vnd.api+json"):
1055
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1056
- raise models.ErrorObject(data=response_data)
967
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
968
+ raise models.ErrorObject(response_data, http_res)
1057
969
  if utils.match_response(http_res, "4XX", "*"):
1058
970
  http_res_text = await utils.stream_to_text_async(http_res)
1059
- raise models.APIError(
1060
- "API error occurred", http_res.status_code, http_res_text, http_res
1061
- )
971
+ raise models.APIError("API error occurred", http_res, http_res_text)
1062
972
  if utils.match_response(http_res, "5XX", "*"):
1063
973
  http_res_text = await utils.stream_to_text_async(http_res)
1064
- raise models.APIError(
1065
- "API error occurred", http_res.status_code, http_res_text, http_res
1066
- )
974
+ raise models.APIError("API error occurred", http_res, http_res_text)
1067
975
 
1068
- content_type = http_res.headers.get("Content-Type")
1069
- http_res_text = await utils.stream_to_text_async(http_res)
1070
- raise models.APIError(
1071
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1072
- http_res.status_code,
1073
- http_res_text,
1074
- http_res,
1075
- )
976
+ raise models.APIError("Unexpected response received", http_res)
1076
977
 
1077
978
  def assign(
1078
979
  self,
@@ -1150,6 +1051,7 @@ class FirewallsSDK(BaseSDK):
1150
1051
 
1151
1052
  http_res = self.do_request(
1152
1053
  hook_ctx=HookContext(
1054
+ config=self.sdk_configuration,
1153
1055
  base_url=base_url or "",
1154
1056
  operation_id="create-firewall-assignment",
1155
1057
  oauth2_scopes=[],
@@ -1164,31 +1066,20 @@ class FirewallsSDK(BaseSDK):
1164
1066
 
1165
1067
  response_data: Any = None
1166
1068
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
1167
- return utils.unmarshal_json(http_res.text, models.FirewallServer)
1069
+ return unmarshal_json_response(models.FirewallServer, http_res)
1168
1070
  if utils.match_response(
1169
1071
  http_res, ["403", "404", "409", "422"], "application/vnd.api+json"
1170
1072
  ):
1171
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1172
- raise models.ErrorObject(data=response_data)
1073
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1074
+ raise models.ErrorObject(response_data, http_res)
1173
1075
  if utils.match_response(http_res, "4XX", "*"):
1174
1076
  http_res_text = utils.stream_to_text(http_res)
1175
- raise models.APIError(
1176
- "API error occurred", http_res.status_code, http_res_text, http_res
1177
- )
1077
+ raise models.APIError("API error occurred", http_res, http_res_text)
1178
1078
  if utils.match_response(http_res, "5XX", "*"):
1179
1079
  http_res_text = utils.stream_to_text(http_res)
1180
- raise models.APIError(
1181
- "API error occurred", http_res.status_code, http_res_text, http_res
1182
- )
1080
+ raise models.APIError("API error occurred", http_res, http_res_text)
1183
1081
 
1184
- content_type = http_res.headers.get("Content-Type")
1185
- http_res_text = utils.stream_to_text(http_res)
1186
- raise models.APIError(
1187
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1188
- http_res.status_code,
1189
- http_res_text,
1190
- http_res,
1191
- )
1082
+ raise models.APIError("Unexpected response received", http_res)
1192
1083
 
1193
1084
  async def assign_async(
1194
1085
  self,
@@ -1266,6 +1157,7 @@ class FirewallsSDK(BaseSDK):
1266
1157
 
1267
1158
  http_res = await self.do_request_async(
1268
1159
  hook_ctx=HookContext(
1160
+ config=self.sdk_configuration,
1269
1161
  base_url=base_url or "",
1270
1162
  operation_id="create-firewall-assignment",
1271
1163
  oauth2_scopes=[],
@@ -1280,31 +1172,20 @@ class FirewallsSDK(BaseSDK):
1280
1172
 
1281
1173
  response_data: Any = None
1282
1174
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
1283
- return utils.unmarshal_json(http_res.text, models.FirewallServer)
1175
+ return unmarshal_json_response(models.FirewallServer, http_res)
1284
1176
  if utils.match_response(
1285
1177
  http_res, ["403", "404", "409", "422"], "application/vnd.api+json"
1286
1178
  ):
1287
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1288
- raise models.ErrorObject(data=response_data)
1179
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1180
+ raise models.ErrorObject(response_data, http_res)
1289
1181
  if utils.match_response(http_res, "4XX", "*"):
1290
1182
  http_res_text = await utils.stream_to_text_async(http_res)
1291
- raise models.APIError(
1292
- "API error occurred", http_res.status_code, http_res_text, http_res
1293
- )
1183
+ raise models.APIError("API error occurred", http_res, http_res_text)
1294
1184
  if utils.match_response(http_res, "5XX", "*"):
1295
1185
  http_res_text = await utils.stream_to_text_async(http_res)
1296
- raise models.APIError(
1297
- "API error occurred", http_res.status_code, http_res_text, http_res
1298
- )
1186
+ raise models.APIError("API error occurred", http_res, http_res_text)
1299
1187
 
1300
- content_type = http_res.headers.get("Content-Type")
1301
- http_res_text = await utils.stream_to_text_async(http_res)
1302
- raise models.APIError(
1303
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1304
- http_res.status_code,
1305
- http_res_text,
1306
- http_res,
1307
- )
1188
+ raise models.APIError("Unexpected response received", http_res)
1308
1189
 
1309
1190
  def list_assignments(
1310
1191
  self,
@@ -1371,6 +1252,7 @@ class FirewallsSDK(BaseSDK):
1371
1252
 
1372
1253
  http_res = self.do_request(
1373
1254
  hook_ctx=HookContext(
1255
+ config=self.sdk_configuration,
1374
1256
  base_url=base_url or "",
1375
1257
  operation_id="get-firewall-assignments",
1376
1258
  oauth2_scopes=[],
@@ -1407,31 +1289,20 @@ class FirewallsSDK(BaseSDK):
1407
1289
  response_data: Any = None
1408
1290
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1409
1291
  return models.GetFirewallAssignmentsResponse(
1410
- result=utils.unmarshal_json(http_res.text, models.FirewallServer),
1292
+ result=unmarshal_json_response(models.FirewallAssignments, http_res),
1411
1293
  next=next_func,
1412
1294
  )
1413
1295
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
1414
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1415
- raise models.ErrorObject(data=response_data)
1296
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1297
+ raise models.ErrorObject(response_data, http_res)
1416
1298
  if utils.match_response(http_res, "4XX", "*"):
1417
1299
  http_res_text = utils.stream_to_text(http_res)
1418
- raise models.APIError(
1419
- "API error occurred", http_res.status_code, http_res_text, http_res
1420
- )
1300
+ raise models.APIError("API error occurred", http_res, http_res_text)
1421
1301
  if utils.match_response(http_res, "5XX", "*"):
1422
1302
  http_res_text = utils.stream_to_text(http_res)
1423
- raise models.APIError(
1424
- "API error occurred", http_res.status_code, http_res_text, http_res
1425
- )
1303
+ raise models.APIError("API error occurred", http_res, http_res_text)
1426
1304
 
1427
- content_type = http_res.headers.get("Content-Type")
1428
- http_res_text = utils.stream_to_text(http_res)
1429
- raise models.APIError(
1430
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1431
- http_res.status_code,
1432
- http_res_text,
1433
- http_res,
1434
- )
1305
+ raise models.APIError("Unexpected response received", http_res)
1435
1306
 
1436
1307
  async def list_assignments_async(
1437
1308
  self,
@@ -1498,6 +1369,7 @@ class FirewallsSDK(BaseSDK):
1498
1369
 
1499
1370
  http_res = await self.do_request_async(
1500
1371
  hook_ctx=HookContext(
1372
+ config=self.sdk_configuration,
1501
1373
  base_url=base_url or "",
1502
1374
  operation_id="get-firewall-assignments",
1503
1375
  oauth2_scopes=[],
@@ -1534,31 +1406,20 @@ class FirewallsSDK(BaseSDK):
1534
1406
  response_data: Any = None
1535
1407
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1536
1408
  return models.GetFirewallAssignmentsResponse(
1537
- result=utils.unmarshal_json(http_res.text, models.FirewallServer),
1409
+ result=unmarshal_json_response(models.FirewallAssignments, http_res),
1538
1410
  next=next_func,
1539
1411
  )
1540
1412
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
1541
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1542
- raise models.ErrorObject(data=response_data)
1413
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1414
+ raise models.ErrorObject(response_data, http_res)
1543
1415
  if utils.match_response(http_res, "4XX", "*"):
1544
1416
  http_res_text = await utils.stream_to_text_async(http_res)
1545
- raise models.APIError(
1546
- "API error occurred", http_res.status_code, http_res_text, http_res
1547
- )
1417
+ raise models.APIError("API error occurred", http_res, http_res_text)
1548
1418
  if utils.match_response(http_res, "5XX", "*"):
1549
1419
  http_res_text = await utils.stream_to_text_async(http_res)
1550
- raise models.APIError(
1551
- "API error occurred", http_res.status_code, http_res_text, http_res
1552
- )
1420
+ raise models.APIError("API error occurred", http_res, http_res_text)
1553
1421
 
1554
- content_type = http_res.headers.get("Content-Type")
1555
- http_res_text = await utils.stream_to_text_async(http_res)
1556
- raise models.APIError(
1557
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1558
- http_res.status_code,
1559
- http_res_text,
1560
- http_res,
1561
- )
1422
+ raise models.APIError("Unexpected response received", http_res)
1562
1423
 
1563
1424
  def delete_assignment(
1564
1425
  self,
@@ -1622,6 +1483,7 @@ class FirewallsSDK(BaseSDK):
1622
1483
 
1623
1484
  http_res = self.do_request(
1624
1485
  hook_ctx=HookContext(
1486
+ config=self.sdk_configuration,
1625
1487
  base_url=base_url or "",
1626
1488
  operation_id="delete-firewall-assignment",
1627
1489
  oauth2_scopes=[],
@@ -1638,27 +1500,16 @@ class FirewallsSDK(BaseSDK):
1638
1500
  if utils.match_response(http_res, "204", "*"):
1639
1501
  return
1640
1502
  if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
1641
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1642
- raise models.ErrorObject(data=response_data)
1503
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1504
+ raise models.ErrorObject(response_data, http_res)
1643
1505
  if utils.match_response(http_res, "4XX", "*"):
1644
1506
  http_res_text = utils.stream_to_text(http_res)
1645
- raise models.APIError(
1646
- "API error occurred", http_res.status_code, http_res_text, http_res
1647
- )
1507
+ raise models.APIError("API error occurred", http_res, http_res_text)
1648
1508
  if utils.match_response(http_res, "5XX", "*"):
1649
1509
  http_res_text = utils.stream_to_text(http_res)
1650
- raise models.APIError(
1651
- "API error occurred", http_res.status_code, http_res_text, http_res
1652
- )
1510
+ raise models.APIError("API error occurred", http_res, http_res_text)
1653
1511
 
1654
- content_type = http_res.headers.get("Content-Type")
1655
- http_res_text = utils.stream_to_text(http_res)
1656
- raise models.APIError(
1657
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1658
- http_res.status_code,
1659
- http_res_text,
1660
- http_res,
1661
- )
1512
+ raise models.APIError("Unexpected response received", http_res)
1662
1513
 
1663
1514
  async def delete_assignment_async(
1664
1515
  self,
@@ -1722,6 +1573,7 @@ class FirewallsSDK(BaseSDK):
1722
1573
 
1723
1574
  http_res = await self.do_request_async(
1724
1575
  hook_ctx=HookContext(
1576
+ config=self.sdk_configuration,
1725
1577
  base_url=base_url or "",
1726
1578
  operation_id="delete-firewall-assignment",
1727
1579
  oauth2_scopes=[],
@@ -1738,24 +1590,13 @@ class FirewallsSDK(BaseSDK):
1738
1590
  if utils.match_response(http_res, "204", "*"):
1739
1591
  return
1740
1592
  if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
1741
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1742
- raise models.ErrorObject(data=response_data)
1593
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1594
+ raise models.ErrorObject(response_data, http_res)
1743
1595
  if utils.match_response(http_res, "4XX", "*"):
1744
1596
  http_res_text = await utils.stream_to_text_async(http_res)
1745
- raise models.APIError(
1746
- "API error occurred", http_res.status_code, http_res_text, http_res
1747
- )
1597
+ raise models.APIError("API error occurred", http_res, http_res_text)
1748
1598
  if utils.match_response(http_res, "5XX", "*"):
1749
1599
  http_res_text = await utils.stream_to_text_async(http_res)
1750
- raise models.APIError(
1751
- "API error occurred", http_res.status_code, http_res_text, http_res
1752
- )
1600
+ raise models.APIError("API error occurred", http_res, http_res_text)
1753
1601
 
1754
- content_type = http_res.headers.get("Content-Type")
1755
- http_res_text = await utils.stream_to_text_async(http_res)
1756
- raise models.APIError(
1757
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1758
- http_res.status_code,
1759
- http_res_text,
1760
- http_res,
1761
- )
1602
+ raise models.APIError("Unexpected response received", http_res)