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
@@ -4,9 +4,10 @@ from .basesdk import BaseSDK
4
4
  from jsonpath import JSONPath
5
5
  from latitudesh_python_sdk import models, utils
6
6
  from latitudesh_python_sdk._hooks import HookContext
7
- from latitudesh_python_sdk.types import BaseModel, OptionalNullable, UNSET
7
+ from latitudesh_python_sdk.types import OptionalNullable, UNSET
8
8
  from latitudesh_python_sdk.utils import get_security_from_env
9
- from typing import Any, Dict, List, Mapping, Optional, Union, cast
9
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
10
+ from typing import Any, Dict, List, Mapping, Optional, Union
10
11
 
11
12
 
12
13
  class Plans(BaseSDK):
@@ -91,6 +92,7 @@ class Plans(BaseSDK):
91
92
 
92
93
  http_res = self.do_request(
93
94
  hook_ctx=HookContext(
95
+ config=self.sdk_configuration,
94
96
  base_url=base_url or "",
95
97
  operation_id="get-plans",
96
98
  oauth2_scopes=[],
@@ -104,26 +106,15 @@ class Plans(BaseSDK):
104
106
  )
105
107
 
106
108
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
107
- return utils.unmarshal_json(http_res.text, models.GetPlansResponseBody)
109
+ return unmarshal_json_response(models.GetPlansResponseBody, http_res)
108
110
  if utils.match_response(http_res, "4XX", "*"):
109
111
  http_res_text = utils.stream_to_text(http_res)
110
- raise models.APIError(
111
- "API error occurred", http_res.status_code, http_res_text, http_res
112
- )
112
+ raise models.APIError("API error occurred", http_res, http_res_text)
113
113
  if utils.match_response(http_res, "5XX", "*"):
114
114
  http_res_text = utils.stream_to_text(http_res)
115
- raise models.APIError(
116
- "API error occurred", http_res.status_code, http_res_text, http_res
117
- )
115
+ raise models.APIError("API error occurred", http_res, http_res_text)
118
116
 
119
- content_type = http_res.headers.get("Content-Type")
120
- http_res_text = utils.stream_to_text(http_res)
121
- raise models.APIError(
122
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
123
- http_res.status_code,
124
- http_res_text,
125
- http_res,
126
- )
117
+ raise models.APIError("Unexpected response received", http_res)
127
118
 
128
119
  async def list_async(
129
120
  self,
@@ -206,6 +197,7 @@ class Plans(BaseSDK):
206
197
 
207
198
  http_res = await self.do_request_async(
208
199
  hook_ctx=HookContext(
200
+ config=self.sdk_configuration,
209
201
  base_url=base_url or "",
210
202
  operation_id="get-plans",
211
203
  oauth2_scopes=[],
@@ -219,26 +211,15 @@ class Plans(BaseSDK):
219
211
  )
220
212
 
221
213
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
222
- return utils.unmarshal_json(http_res.text, models.GetPlansResponseBody)
214
+ return unmarshal_json_response(models.GetPlansResponseBody, http_res)
223
215
  if utils.match_response(http_res, "4XX", "*"):
224
216
  http_res_text = await utils.stream_to_text_async(http_res)
225
- raise models.APIError(
226
- "API error occurred", http_res.status_code, http_res_text, http_res
227
- )
217
+ raise models.APIError("API error occurred", http_res, http_res_text)
228
218
  if utils.match_response(http_res, "5XX", "*"):
229
219
  http_res_text = await utils.stream_to_text_async(http_res)
230
- raise models.APIError(
231
- "API error occurred", http_res.status_code, http_res_text, http_res
232
- )
220
+ raise models.APIError("API error occurred", http_res, http_res_text)
233
221
 
234
- content_type = http_res.headers.get("Content-Type")
235
- http_res_text = await utils.stream_to_text_async(http_res)
236
- raise models.APIError(
237
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
238
- http_res.status_code,
239
- http_res_text,
240
- http_res,
241
- )
222
+ raise models.APIError("Unexpected response received", http_res)
242
223
 
243
224
  def get(
244
225
  self,
@@ -297,6 +278,7 @@ class Plans(BaseSDK):
297
278
 
298
279
  http_res = self.do_request(
299
280
  hook_ctx=HookContext(
281
+ config=self.sdk_configuration,
300
282
  base_url=base_url or "",
301
283
  operation_id="get-plan",
302
284
  oauth2_scopes=[],
@@ -311,29 +293,18 @@ class Plans(BaseSDK):
311
293
 
312
294
  response_data: Any = None
313
295
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
314
- return utils.unmarshal_json(http_res.text, models.Plan)
296
+ return unmarshal_json_response(models.Plan, http_res)
315
297
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
316
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
317
- raise models.ErrorObject(data=response_data)
298
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
299
+ raise models.ErrorObject(response_data, http_res)
318
300
  if utils.match_response(http_res, "4XX", "*"):
319
301
  http_res_text = utils.stream_to_text(http_res)
320
- raise models.APIError(
321
- "API error occurred", http_res.status_code, http_res_text, http_res
322
- )
302
+ raise models.APIError("API error occurred", http_res, http_res_text)
323
303
  if utils.match_response(http_res, "5XX", "*"):
324
304
  http_res_text = utils.stream_to_text(http_res)
325
- raise models.APIError(
326
- "API error occurred", http_res.status_code, http_res_text, http_res
327
- )
305
+ raise models.APIError("API error occurred", http_res, http_res_text)
328
306
 
329
- content_type = http_res.headers.get("Content-Type")
330
- http_res_text = utils.stream_to_text(http_res)
331
- raise models.APIError(
332
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
333
- http_res.status_code,
334
- http_res_text,
335
- http_res,
336
- )
307
+ raise models.APIError("Unexpected response received", http_res)
337
308
 
338
309
  async def get_async(
339
310
  self,
@@ -392,6 +363,7 @@ class Plans(BaseSDK):
392
363
 
393
364
  http_res = await self.do_request_async(
394
365
  hook_ctx=HookContext(
366
+ config=self.sdk_configuration,
395
367
  base_url=base_url or "",
396
368
  operation_id="get-plan",
397
369
  oauth2_scopes=[],
@@ -406,29 +378,18 @@ class Plans(BaseSDK):
406
378
 
407
379
  response_data: Any = None
408
380
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
409
- return utils.unmarshal_json(http_res.text, models.Plan)
381
+ return unmarshal_json_response(models.Plan, http_res)
410
382
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
411
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
412
- raise models.ErrorObject(data=response_data)
383
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
384
+ raise models.ErrorObject(response_data, http_res)
413
385
  if utils.match_response(http_res, "4XX", "*"):
414
386
  http_res_text = await utils.stream_to_text_async(http_res)
415
- raise models.APIError(
416
- "API error occurred", http_res.status_code, http_res_text, http_res
417
- )
387
+ raise models.APIError("API error occurred", http_res, http_res_text)
418
388
  if utils.match_response(http_res, "5XX", "*"):
419
389
  http_res_text = await utils.stream_to_text_async(http_res)
420
- raise models.APIError(
421
- "API error occurred", http_res.status_code, http_res_text, http_res
422
- )
390
+ raise models.APIError("API error occurred", http_res, http_res_text)
423
391
 
424
- content_type = http_res.headers.get("Content-Type")
425
- http_res_text = await utils.stream_to_text_async(http_res)
426
- raise models.APIError(
427
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
428
- http_res.status_code,
429
- http_res_text,
430
- http_res,
431
- )
392
+ raise models.APIError("Unexpected response received", http_res)
432
393
 
433
394
  def list_bandwidth(
434
395
  self,
@@ -498,6 +459,7 @@ class Plans(BaseSDK):
498
459
 
499
460
  http_res = self.do_request(
500
461
  hook_ctx=HookContext(
462
+ config=self.sdk_configuration,
501
463
  base_url=base_url or "",
502
464
  operation_id="get-bandwidth-plans",
503
465
  oauth2_scopes=[],
@@ -534,28 +496,17 @@ class Plans(BaseSDK):
534
496
 
535
497
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
536
498
  return models.GetBandwidthPlansResponse(
537
- result=utils.unmarshal_json(http_res.text, models.BandwidthPlans),
499
+ result=unmarshal_json_response(models.BandwidthPlans, http_res),
538
500
  next=next_func,
539
501
  )
540
502
  if utils.match_response(http_res, "4XX", "*"):
541
503
  http_res_text = utils.stream_to_text(http_res)
542
- raise models.APIError(
543
- "API error occurred", http_res.status_code, http_res_text, http_res
544
- )
504
+ raise models.APIError("API error occurred", http_res, http_res_text)
545
505
  if utils.match_response(http_res, "5XX", "*"):
546
506
  http_res_text = utils.stream_to_text(http_res)
547
- raise models.APIError(
548
- "API error occurred", http_res.status_code, http_res_text, http_res
549
- )
507
+ raise models.APIError("API error occurred", http_res, http_res_text)
550
508
 
551
- content_type = http_res.headers.get("Content-Type")
552
- http_res_text = utils.stream_to_text(http_res)
553
- raise models.APIError(
554
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
555
- http_res.status_code,
556
- http_res_text,
557
- http_res,
558
- )
509
+ raise models.APIError("Unexpected response received", http_res)
559
510
 
560
511
  async def list_bandwidth_async(
561
512
  self,
@@ -625,6 +576,7 @@ class Plans(BaseSDK):
625
576
 
626
577
  http_res = await self.do_request_async(
627
578
  hook_ctx=HookContext(
579
+ config=self.sdk_configuration,
628
580
  base_url=base_url or "",
629
581
  operation_id="get-bandwidth-plans",
630
582
  oauth2_scopes=[],
@@ -661,36 +613,27 @@ class Plans(BaseSDK):
661
613
 
662
614
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
663
615
  return models.GetBandwidthPlansResponse(
664
- result=utils.unmarshal_json(http_res.text, models.BandwidthPlans),
616
+ result=unmarshal_json_response(models.BandwidthPlans, http_res),
665
617
  next=next_func,
666
618
  )
667
619
  if utils.match_response(http_res, "4XX", "*"):
668
620
  http_res_text = await utils.stream_to_text_async(http_res)
669
- raise models.APIError(
670
- "API error occurred", http_res.status_code, http_res_text, http_res
671
- )
621
+ raise models.APIError("API error occurred", http_res, http_res_text)
672
622
  if utils.match_response(http_res, "5XX", "*"):
673
623
  http_res_text = await utils.stream_to_text_async(http_res)
674
- raise models.APIError(
675
- "API error occurred", http_res.status_code, http_res_text, http_res
676
- )
624
+ raise models.APIError("API error occurred", http_res, http_res_text)
677
625
 
678
- content_type = http_res.headers.get("Content-Type")
679
- http_res_text = await utils.stream_to_text_async(http_res)
680
- raise models.APIError(
681
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
682
- http_res.status_code,
683
- http_res_text,
684
- http_res,
685
- )
626
+ raise models.APIError("Unexpected response received", http_res)
686
627
 
687
628
  def update_bandwidth(
688
629
  self,
689
630
  *,
690
- request: Union[
691
- models.UpdatePlansBandwidthPlansRequestBody,
692
- models.UpdatePlansBandwidthPlansRequestBodyTypedDict,
693
- ] = models.UpdatePlansBandwidthPlansRequestBody(),
631
+ data: Optional[
632
+ Union[
633
+ models.UpdatePlansBandwidthPlansData,
634
+ models.UpdatePlansBandwidthPlansDataTypedDict,
635
+ ]
636
+ ] = None,
694
637
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
695
638
  server_url: Optional[str] = None,
696
639
  timeout_ms: Optional[int] = None,
@@ -701,7 +644,7 @@ class Plans(BaseSDK):
701
644
  Allow to increase or decrease bandwidth packages. Only admins and owners can request.
702
645
 
703
646
 
704
- :param request: The request object to send.
647
+ :param data:
705
648
  :param retries: Override the default retry configuration for this method
706
649
  :param server_url: Override the default server URL for this method
707
650
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -717,11 +660,11 @@ class Plans(BaseSDK):
717
660
  else:
718
661
  base_url = self._get_url(base_url, url_variables)
719
662
 
720
- if not isinstance(request, BaseModel):
721
- request = utils.unmarshal(
722
- request, models.UpdatePlansBandwidthPlansRequestBody
723
- )
724
- request = cast(models.UpdatePlansBandwidthPlansRequestBody, request)
663
+ request = models.UpdatePlansBandwidthPlansRequestBody(
664
+ data=utils.get_pydantic_model(
665
+ data, Optional[models.UpdatePlansBandwidthPlansData]
666
+ ),
667
+ )
725
668
 
726
669
  req = self._build_request(
727
670
  method="POST",
@@ -739,9 +682,9 @@ class Plans(BaseSDK):
739
682
  get_serialized_body=lambda: utils.serialize_request_body(
740
683
  request,
741
684
  False,
742
- True,
685
+ False,
743
686
  "json",
744
- Optional[models.UpdatePlansBandwidthPlansRequestBody],
687
+ models.UpdatePlansBandwidthPlansRequestBody,
745
688
  ),
746
689
  timeout_ms=timeout_ms,
747
690
  )
@@ -756,6 +699,7 @@ class Plans(BaseSDK):
756
699
 
757
700
  http_res = self.do_request(
758
701
  hook_ctx=HookContext(
702
+ config=self.sdk_configuration,
759
703
  base_url=base_url or "",
760
704
  operation_id="update-plans-bandwidth",
761
705
  oauth2_scopes=[],
@@ -770,37 +714,28 @@ class Plans(BaseSDK):
770
714
 
771
715
  response_data: Any = None
772
716
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
773
- return utils.unmarshal_json(http_res.text, models.BandwidthPackages)
717
+ return unmarshal_json_response(models.BandwidthPackages, http_res)
774
718
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
775
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
776
- raise models.ErrorObject(data=response_data)
719
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
720
+ raise models.ErrorObject(response_data, http_res)
777
721
  if utils.match_response(http_res, "4XX", "*"):
778
722
  http_res_text = utils.stream_to_text(http_res)
779
- raise models.APIError(
780
- "API error occurred", http_res.status_code, http_res_text, http_res
781
- )
723
+ raise models.APIError("API error occurred", http_res, http_res_text)
782
724
  if utils.match_response(http_res, "5XX", "*"):
783
725
  http_res_text = utils.stream_to_text(http_res)
784
- raise models.APIError(
785
- "API error occurred", http_res.status_code, http_res_text, http_res
786
- )
726
+ raise models.APIError("API error occurred", http_res, http_res_text)
787
727
 
788
- content_type = http_res.headers.get("Content-Type")
789
- http_res_text = utils.stream_to_text(http_res)
790
- raise models.APIError(
791
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
792
- http_res.status_code,
793
- http_res_text,
794
- http_res,
795
- )
728
+ raise models.APIError("Unexpected response received", http_res)
796
729
 
797
730
  async def update_bandwidth_async(
798
731
  self,
799
732
  *,
800
- request: Union[
801
- models.UpdatePlansBandwidthPlansRequestBody,
802
- models.UpdatePlansBandwidthPlansRequestBodyTypedDict,
803
- ] = models.UpdatePlansBandwidthPlansRequestBody(),
733
+ data: Optional[
734
+ Union[
735
+ models.UpdatePlansBandwidthPlansData,
736
+ models.UpdatePlansBandwidthPlansDataTypedDict,
737
+ ]
738
+ ] = None,
804
739
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
805
740
  server_url: Optional[str] = None,
806
741
  timeout_ms: Optional[int] = None,
@@ -811,7 +746,7 @@ class Plans(BaseSDK):
811
746
  Allow to increase or decrease bandwidth packages. Only admins and owners can request.
812
747
 
813
748
 
814
- :param request: The request object to send.
749
+ :param data:
815
750
  :param retries: Override the default retry configuration for this method
816
751
  :param server_url: Override the default server URL for this method
817
752
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -827,11 +762,11 @@ class Plans(BaseSDK):
827
762
  else:
828
763
  base_url = self._get_url(base_url, url_variables)
829
764
 
830
- if not isinstance(request, BaseModel):
831
- request = utils.unmarshal(
832
- request, models.UpdatePlansBandwidthPlansRequestBody
833
- )
834
- request = cast(models.UpdatePlansBandwidthPlansRequestBody, request)
765
+ request = models.UpdatePlansBandwidthPlansRequestBody(
766
+ data=utils.get_pydantic_model(
767
+ data, Optional[models.UpdatePlansBandwidthPlansData]
768
+ ),
769
+ )
835
770
 
836
771
  req = self._build_request_async(
837
772
  method="POST",
@@ -849,9 +784,9 @@ class Plans(BaseSDK):
849
784
  get_serialized_body=lambda: utils.serialize_request_body(
850
785
  request,
851
786
  False,
852
- True,
787
+ False,
853
788
  "json",
854
- Optional[models.UpdatePlansBandwidthPlansRequestBody],
789
+ models.UpdatePlansBandwidthPlansRequestBody,
855
790
  ),
856
791
  timeout_ms=timeout_ms,
857
792
  )
@@ -866,6 +801,7 @@ class Plans(BaseSDK):
866
801
 
867
802
  http_res = await self.do_request_async(
868
803
  hook_ctx=HookContext(
804
+ config=self.sdk_configuration,
869
805
  base_url=base_url or "",
870
806
  operation_id="update-plans-bandwidth",
871
807
  oauth2_scopes=[],
@@ -880,29 +816,18 @@ class Plans(BaseSDK):
880
816
 
881
817
  response_data: Any = None
882
818
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
883
- return utils.unmarshal_json(http_res.text, models.BandwidthPackages)
819
+ return unmarshal_json_response(models.BandwidthPackages, http_res)
884
820
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
885
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
886
- raise models.ErrorObject(data=response_data)
821
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
822
+ raise models.ErrorObject(response_data, http_res)
887
823
  if utils.match_response(http_res, "4XX", "*"):
888
824
  http_res_text = await utils.stream_to_text_async(http_res)
889
- raise models.APIError(
890
- "API error occurred", http_res.status_code, http_res_text, http_res
891
- )
825
+ raise models.APIError("API error occurred", http_res, http_res_text)
892
826
  if utils.match_response(http_res, "5XX", "*"):
893
827
  http_res_text = await utils.stream_to_text_async(http_res)
894
- raise models.APIError(
895
- "API error occurred", http_res.status_code, http_res_text, http_res
896
- )
828
+ raise models.APIError("API error occurred", http_res, http_res_text)
897
829
 
898
- content_type = http_res.headers.get("Content-Type")
899
- http_res_text = await utils.stream_to_text_async(http_res)
900
- raise models.APIError(
901
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
902
- http_res.status_code,
903
- http_res_text,
904
- http_res,
905
- )
830
+ raise models.APIError("Unexpected response received", http_res)
906
831
 
907
832
  def list_storage(
908
833
  self,
@@ -954,6 +879,7 @@ class Plans(BaseSDK):
954
879
 
955
880
  http_res = self.do_request(
956
881
  hook_ctx=HookContext(
882
+ config=self.sdk_configuration,
957
883
  base_url=base_url or "",
958
884
  operation_id="get-storage-plans",
959
885
  oauth2_scopes=[],
@@ -967,26 +893,15 @@ class Plans(BaseSDK):
967
893
  )
968
894
 
969
895
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
970
- return utils.unmarshal_json(http_res.text, models.StoragePlans)
896
+ return unmarshal_json_response(models.StoragePlans, http_res)
971
897
  if utils.match_response(http_res, "4XX", "*"):
972
898
  http_res_text = utils.stream_to_text(http_res)
973
- raise models.APIError(
974
- "API error occurred", http_res.status_code, http_res_text, http_res
975
- )
899
+ raise models.APIError("API error occurred", http_res, http_res_text)
976
900
  if utils.match_response(http_res, "5XX", "*"):
977
901
  http_res_text = utils.stream_to_text(http_res)
978
- raise models.APIError(
979
- "API error occurred", http_res.status_code, http_res_text, http_res
980
- )
902
+ raise models.APIError("API error occurred", http_res, http_res_text)
981
903
 
982
- content_type = http_res.headers.get("Content-Type")
983
- http_res_text = utils.stream_to_text(http_res)
984
- raise models.APIError(
985
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
986
- http_res.status_code,
987
- http_res_text,
988
- http_res,
989
- )
904
+ raise models.APIError("Unexpected response received", http_res)
990
905
 
991
906
  async def list_storage_async(
992
907
  self,
@@ -1038,6 +953,7 @@ class Plans(BaseSDK):
1038
953
 
1039
954
  http_res = await self.do_request_async(
1040
955
  hook_ctx=HookContext(
956
+ config=self.sdk_configuration,
1041
957
  base_url=base_url or "",
1042
958
  operation_id="get-storage-plans",
1043
959
  oauth2_scopes=[],
@@ -1051,26 +967,15 @@ class Plans(BaseSDK):
1051
967
  )
1052
968
 
1053
969
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1054
- return utils.unmarshal_json(http_res.text, models.StoragePlans)
970
+ return unmarshal_json_response(models.StoragePlans, http_res)
1055
971
  if utils.match_response(http_res, "4XX", "*"):
1056
972
  http_res_text = await utils.stream_to_text_async(http_res)
1057
- raise models.APIError(
1058
- "API error occurred", http_res.status_code, http_res_text, http_res
1059
- )
973
+ raise models.APIError("API error occurred", http_res, http_res_text)
1060
974
  if utils.match_response(http_res, "5XX", "*"):
1061
975
  http_res_text = await utils.stream_to_text_async(http_res)
1062
- raise models.APIError(
1063
- "API error occurred", http_res.status_code, http_res_text, http_res
1064
- )
976
+ raise models.APIError("API error occurred", http_res, http_res_text)
1065
977
 
1066
- content_type = http_res.headers.get("Content-Type")
1067
- http_res_text = await utils.stream_to_text_async(http_res)
1068
- raise models.APIError(
1069
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1070
- http_res.status_code,
1071
- http_res_text,
1072
- http_res,
1073
- )
978
+ raise models.APIError("Unexpected response received", http_res)
1074
979
 
1075
980
  def list_vm_plans(
1076
981
  self,
@@ -1122,6 +1027,7 @@ class Plans(BaseSDK):
1122
1027
 
1123
1028
  http_res = self.do_request(
1124
1029
  hook_ctx=HookContext(
1030
+ config=self.sdk_configuration,
1125
1031
  base_url=base_url or "",
1126
1032
  operation_id="get-vm-plans",
1127
1033
  oauth2_scopes=[],
@@ -1135,26 +1041,15 @@ class Plans(BaseSDK):
1135
1041
  )
1136
1042
 
1137
1043
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1138
- return utils.unmarshal_json(http_res.text, models.VirtualMachinePlans)
1044
+ return unmarshal_json_response(models.VirtualMachinePlans, http_res)
1139
1045
  if utils.match_response(http_res, "4XX", "*"):
1140
1046
  http_res_text = utils.stream_to_text(http_res)
1141
- raise models.APIError(
1142
- "API error occurred", http_res.status_code, http_res_text, http_res
1143
- )
1047
+ raise models.APIError("API error occurred", http_res, http_res_text)
1144
1048
  if utils.match_response(http_res, "5XX", "*"):
1145
1049
  http_res_text = utils.stream_to_text(http_res)
1146
- raise models.APIError(
1147
- "API error occurred", http_res.status_code, http_res_text, http_res
1148
- )
1050
+ raise models.APIError("API error occurred", http_res, http_res_text)
1149
1051
 
1150
- content_type = http_res.headers.get("Content-Type")
1151
- http_res_text = utils.stream_to_text(http_res)
1152
- raise models.APIError(
1153
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1154
- http_res.status_code,
1155
- http_res_text,
1156
- http_res,
1157
- )
1052
+ raise models.APIError("Unexpected response received", http_res)
1158
1053
 
1159
1054
  async def list_vm_plans_async(
1160
1055
  self,
@@ -1206,6 +1101,7 @@ class Plans(BaseSDK):
1206
1101
 
1207
1102
  http_res = await self.do_request_async(
1208
1103
  hook_ctx=HookContext(
1104
+ config=self.sdk_configuration,
1209
1105
  base_url=base_url or "",
1210
1106
  operation_id="get-vm-plans",
1211
1107
  oauth2_scopes=[],
@@ -1219,23 +1115,12 @@ class Plans(BaseSDK):
1219
1115
  )
1220
1116
 
1221
1117
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1222
- return utils.unmarshal_json(http_res.text, models.VirtualMachinePlans)
1118
+ return unmarshal_json_response(models.VirtualMachinePlans, http_res)
1223
1119
  if utils.match_response(http_res, "4XX", "*"):
1224
1120
  http_res_text = await utils.stream_to_text_async(http_res)
1225
- raise models.APIError(
1226
- "API error occurred", http_res.status_code, http_res_text, http_res
1227
- )
1121
+ raise models.APIError("API error occurred", http_res, http_res_text)
1228
1122
  if utils.match_response(http_res, "5XX", "*"):
1229
1123
  http_res_text = await utils.stream_to_text_async(http_res)
1230
- raise models.APIError(
1231
- "API error occurred", http_res.status_code, http_res_text, http_res
1232
- )
1124
+ raise models.APIError("API error occurred", http_res, http_res_text)
1233
1125
 
1234
- content_type = http_res.headers.get("Content-Type")
1235
- http_res_text = await utils.stream_to_text_async(http_res)
1236
- raise models.APIError(
1237
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1238
- http_res.status_code,
1239
- http_res_text,
1240
- http_res,
1241
- )
1126
+ raise models.APIError("Unexpected response received", http_res)