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 ServersSDK(BaseSDK):
@@ -118,6 +119,7 @@ class ServersSDK(BaseSDK):
118
119
 
119
120
  http_res = self.do_request(
120
121
  hook_ctx=HookContext(
122
+ config=self.sdk_configuration,
121
123
  base_url=base_url or "",
122
124
  operation_id="get-servers",
123
125
  oauth2_scopes=[],
@@ -126,7 +128,7 @@ class ServersSDK(BaseSDK):
126
128
  ),
127
129
  ),
128
130
  request=req,
129
- error_status_codes=["4XX", "5XX"],
131
+ error_status_codes=["422", "4XX", "5XX"],
130
132
  retry_config=retry_config,
131
133
  )
132
134
 
@@ -165,30 +167,22 @@ class ServersSDK(BaseSDK):
165
167
  retries=retries,
166
168
  )
167
169
 
170
+ response_data: Any = None
168
171
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
169
172
  return models.GetServersResponse(
170
- result=utils.unmarshal_json(http_res.text, models.Servers),
171
- next=next_func,
173
+ result=unmarshal_json_response(models.Servers, http_res), next=next_func
172
174
  )
175
+ if utils.match_response(http_res, "422", "application/vnd.api+json"):
176
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
177
+ raise models.ErrorObject(response_data, http_res)
173
178
  if utils.match_response(http_res, "4XX", "*"):
174
179
  http_res_text = utils.stream_to_text(http_res)
175
- raise models.APIError(
176
- "API error occurred", http_res.status_code, http_res_text, http_res
177
- )
180
+ raise models.APIError("API error occurred", http_res, http_res_text)
178
181
  if utils.match_response(http_res, "5XX", "*"):
179
182
  http_res_text = utils.stream_to_text(http_res)
180
- raise models.APIError(
181
- "API error occurred", http_res.status_code, http_res_text, http_res
182
- )
183
+ raise models.APIError("API error occurred", http_res, http_res_text)
183
184
 
184
- content_type = http_res.headers.get("Content-Type")
185
- http_res_text = utils.stream_to_text(http_res)
186
- raise models.APIError(
187
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
188
- http_res.status_code,
189
- http_res_text,
190
- http_res,
191
- )
185
+ raise models.APIError("Unexpected response received", http_res)
192
186
 
193
187
  async def list_async(
194
188
  self,
@@ -298,6 +292,7 @@ class ServersSDK(BaseSDK):
298
292
 
299
293
  http_res = await self.do_request_async(
300
294
  hook_ctx=HookContext(
295
+ config=self.sdk_configuration,
301
296
  base_url=base_url or "",
302
297
  operation_id="get-servers",
303
298
  oauth2_scopes=[],
@@ -306,7 +301,7 @@ class ServersSDK(BaseSDK):
306
301
  ),
307
302
  ),
308
303
  request=req,
309
- error_status_codes=["4XX", "5XX"],
304
+ error_status_codes=["422", "4XX", "5XX"],
310
305
  retry_config=retry_config,
311
306
  )
312
307
 
@@ -345,38 +340,31 @@ class ServersSDK(BaseSDK):
345
340
  retries=retries,
346
341
  )
347
342
 
343
+ response_data: Any = None
348
344
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
349
345
  return models.GetServersResponse(
350
- result=utils.unmarshal_json(http_res.text, models.Servers),
351
- next=next_func,
346
+ result=unmarshal_json_response(models.Servers, http_res), next=next_func
352
347
  )
348
+ if utils.match_response(http_res, "422", "application/vnd.api+json"):
349
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
350
+ raise models.ErrorObject(response_data, http_res)
353
351
  if utils.match_response(http_res, "4XX", "*"):
354
352
  http_res_text = await utils.stream_to_text_async(http_res)
355
- raise models.APIError(
356
- "API error occurred", http_res.status_code, http_res_text, http_res
357
- )
353
+ raise models.APIError("API error occurred", http_res, http_res_text)
358
354
  if utils.match_response(http_res, "5XX", "*"):
359
355
  http_res_text = await utils.stream_to_text_async(http_res)
360
- raise models.APIError(
361
- "API error occurred", http_res.status_code, http_res_text, http_res
362
- )
356
+ raise models.APIError("API error occurred", http_res, http_res_text)
363
357
 
364
- content_type = http_res.headers.get("Content-Type")
365
- http_res_text = await utils.stream_to_text_async(http_res)
366
- raise models.APIError(
367
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
368
- http_res.status_code,
369
- http_res_text,
370
- http_res,
371
- )
358
+ raise models.APIError("Unexpected response received", http_res)
372
359
 
373
360
  def create(
374
361
  self,
375
362
  *,
376
- request: Union[
377
- models.CreateServerServersRequestBody,
378
- models.CreateServerServersRequestBodyTypedDict,
379
- ] = models.CreateServerServersRequestBody(),
363
+ data: Optional[
364
+ Union[
365
+ models.CreateServerServersData, models.CreateServerServersDataTypedDict
366
+ ]
367
+ ] = None,
380
368
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
381
369
  server_url: Optional[str] = None,
382
370
  timeout_ms: Optional[int] = None,
@@ -384,7 +372,7 @@ class ServersSDK(BaseSDK):
384
372
  ) -> models.Server:
385
373
  r"""Deploy Server
386
374
 
387
- :param request: The request object to send.
375
+ :param data:
388
376
  :param retries: Override the default retry configuration for this method
389
377
  :param server_url: Override the default server URL for this method
390
378
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -400,9 +388,11 @@ class ServersSDK(BaseSDK):
400
388
  else:
401
389
  base_url = self._get_url(base_url, url_variables)
402
390
 
403
- if not isinstance(request, BaseModel):
404
- request = utils.unmarshal(request, models.CreateServerServersRequestBody)
405
- request = cast(models.CreateServerServersRequestBody, request)
391
+ request = models.CreateServerServersRequestBody(
392
+ data=utils.get_pydantic_model(
393
+ data, Optional[models.CreateServerServersData]
394
+ ),
395
+ )
406
396
 
407
397
  req = self._build_request(
408
398
  method="POST",
@@ -418,11 +408,7 @@ class ServersSDK(BaseSDK):
418
408
  http_headers=http_headers,
419
409
  security=self.sdk_configuration.security,
420
410
  get_serialized_body=lambda: utils.serialize_request_body(
421
- request,
422
- False,
423
- True,
424
- "json",
425
- Optional[models.CreateServerServersRequestBody],
411
+ request, False, False, "json", models.CreateServerServersRequestBody
426
412
  ),
427
413
  timeout_ms=timeout_ms,
428
414
  )
@@ -437,6 +423,7 @@ class ServersSDK(BaseSDK):
437
423
 
438
424
  http_res = self.do_request(
439
425
  hook_ctx=HookContext(
426
+ config=self.sdk_configuration,
440
427
  base_url=base_url or "",
441
428
  operation_id="create-server",
442
429
  oauth2_scopes=[],
@@ -451,39 +438,29 @@ class ServersSDK(BaseSDK):
451
438
 
452
439
  response_data: Any = None
453
440
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
454
- return utils.unmarshal_json(http_res.text, models.Server)
441
+ return unmarshal_json_response(models.Server, http_res)
455
442
  if utils.match_response(
456
443
  http_res, ["400", "402", "422"], "application/vnd.api+json"
457
444
  ):
458
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
459
- raise models.ErrorObject(data=response_data)
445
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
446
+ raise models.ErrorObject(response_data, http_res)
460
447
  if utils.match_response(http_res, "4XX", "*"):
461
448
  http_res_text = utils.stream_to_text(http_res)
462
- raise models.APIError(
463
- "API error occurred", http_res.status_code, http_res_text, http_res
464
- )
449
+ raise models.APIError("API error occurred", http_res, http_res_text)
465
450
  if utils.match_response(http_res, "5XX", "*"):
466
451
  http_res_text = utils.stream_to_text(http_res)
467
- raise models.APIError(
468
- "API error occurred", http_res.status_code, http_res_text, http_res
469
- )
452
+ raise models.APIError("API error occurred", http_res, http_res_text)
470
453
 
471
- content_type = http_res.headers.get("Content-Type")
472
- http_res_text = utils.stream_to_text(http_res)
473
- raise models.APIError(
474
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
475
- http_res.status_code,
476
- http_res_text,
477
- http_res,
478
- )
454
+ raise models.APIError("Unexpected response received", http_res)
479
455
 
480
456
  async def create_async(
481
457
  self,
482
458
  *,
483
- request: Union[
484
- models.CreateServerServersRequestBody,
485
- models.CreateServerServersRequestBodyTypedDict,
486
- ] = models.CreateServerServersRequestBody(),
459
+ data: Optional[
460
+ Union[
461
+ models.CreateServerServersData, models.CreateServerServersDataTypedDict
462
+ ]
463
+ ] = None,
487
464
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
488
465
  server_url: Optional[str] = None,
489
466
  timeout_ms: Optional[int] = None,
@@ -491,7 +468,7 @@ class ServersSDK(BaseSDK):
491
468
  ) -> models.Server:
492
469
  r"""Deploy Server
493
470
 
494
- :param request: The request object to send.
471
+ :param data:
495
472
  :param retries: Override the default retry configuration for this method
496
473
  :param server_url: Override the default server URL for this method
497
474
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -507,9 +484,11 @@ class ServersSDK(BaseSDK):
507
484
  else:
508
485
  base_url = self._get_url(base_url, url_variables)
509
486
 
510
- if not isinstance(request, BaseModel):
511
- request = utils.unmarshal(request, models.CreateServerServersRequestBody)
512
- request = cast(models.CreateServerServersRequestBody, request)
487
+ request = models.CreateServerServersRequestBody(
488
+ data=utils.get_pydantic_model(
489
+ data, Optional[models.CreateServerServersData]
490
+ ),
491
+ )
513
492
 
514
493
  req = self._build_request_async(
515
494
  method="POST",
@@ -525,11 +504,7 @@ class ServersSDK(BaseSDK):
525
504
  http_headers=http_headers,
526
505
  security=self.sdk_configuration.security,
527
506
  get_serialized_body=lambda: utils.serialize_request_body(
528
- request,
529
- False,
530
- True,
531
- "json",
532
- Optional[models.CreateServerServersRequestBody],
507
+ request, False, False, "json", models.CreateServerServersRequestBody
533
508
  ),
534
509
  timeout_ms=timeout_ms,
535
510
  )
@@ -544,6 +519,7 @@ class ServersSDK(BaseSDK):
544
519
 
545
520
  http_res = await self.do_request_async(
546
521
  hook_ctx=HookContext(
522
+ config=self.sdk_configuration,
547
523
  base_url=base_url or "",
548
524
  operation_id="create-server",
549
525
  oauth2_scopes=[],
@@ -558,31 +534,20 @@ class ServersSDK(BaseSDK):
558
534
 
559
535
  response_data: Any = None
560
536
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
561
- return utils.unmarshal_json(http_res.text, models.Server)
537
+ return unmarshal_json_response(models.Server, http_res)
562
538
  if utils.match_response(
563
539
  http_res, ["400", "402", "422"], "application/vnd.api+json"
564
540
  ):
565
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
566
- raise models.ErrorObject(data=response_data)
541
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
542
+ raise models.ErrorObject(response_data, http_res)
567
543
  if utils.match_response(http_res, "4XX", "*"):
568
544
  http_res_text = await utils.stream_to_text_async(http_res)
569
- raise models.APIError(
570
- "API error occurred", http_res.status_code, http_res_text, http_res
571
- )
545
+ raise models.APIError("API error occurred", http_res, http_res_text)
572
546
  if utils.match_response(http_res, "5XX", "*"):
573
547
  http_res_text = await utils.stream_to_text_async(http_res)
574
- raise models.APIError(
575
- "API error occurred", http_res.status_code, http_res_text, http_res
576
- )
548
+ raise models.APIError("API error occurred", http_res, http_res_text)
577
549
 
578
- content_type = http_res.headers.get("Content-Type")
579
- http_res_text = await utils.stream_to_text_async(http_res)
580
- raise models.APIError(
581
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
582
- http_res.status_code,
583
- http_res_text,
584
- http_res,
585
- )
550
+ raise models.APIError("Unexpected response received", http_res)
586
551
 
587
552
  def get(
588
553
  self,
@@ -647,6 +612,7 @@ class ServersSDK(BaseSDK):
647
612
 
648
613
  http_res = self.do_request(
649
614
  hook_ctx=HookContext(
615
+ config=self.sdk_configuration,
650
616
  base_url=base_url or "",
651
617
  operation_id="get-server",
652
618
  oauth2_scopes=[],
@@ -660,26 +626,15 @@ class ServersSDK(BaseSDK):
660
626
  )
661
627
 
662
628
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
663
- return utils.unmarshal_json(http_res.text, models.Server)
629
+ return unmarshal_json_response(models.Server, http_res)
664
630
  if utils.match_response(http_res, "4XX", "*"):
665
631
  http_res_text = utils.stream_to_text(http_res)
666
- raise models.APIError(
667
- "API error occurred", http_res.status_code, http_res_text, http_res
668
- )
632
+ raise models.APIError("API error occurred", http_res, http_res_text)
669
633
  if utils.match_response(http_res, "5XX", "*"):
670
634
  http_res_text = utils.stream_to_text(http_res)
671
- raise models.APIError(
672
- "API error occurred", http_res.status_code, http_res_text, http_res
673
- )
635
+ raise models.APIError("API error occurred", http_res, http_res_text)
674
636
 
675
- content_type = http_res.headers.get("Content-Type")
676
- http_res_text = utils.stream_to_text(http_res)
677
- raise models.APIError(
678
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
679
- http_res.status_code,
680
- http_res_text,
681
- http_res,
682
- )
637
+ raise models.APIError("Unexpected response received", http_res)
683
638
 
684
639
  async def get_async(
685
640
  self,
@@ -744,6 +699,7 @@ class ServersSDK(BaseSDK):
744
699
 
745
700
  http_res = await self.do_request_async(
746
701
  hook_ctx=HookContext(
702
+ config=self.sdk_configuration,
747
703
  base_url=base_url or "",
748
704
  operation_id="get-server",
749
705
  oauth2_scopes=[],
@@ -757,37 +713,31 @@ class ServersSDK(BaseSDK):
757
713
  )
758
714
 
759
715
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
760
- return utils.unmarshal_json(http_res.text, models.Server)
716
+ return unmarshal_json_response(models.Server, http_res)
761
717
  if utils.match_response(http_res, "4XX", "*"):
762
718
  http_res_text = await utils.stream_to_text_async(http_res)
763
- raise models.APIError(
764
- "API error occurred", http_res.status_code, http_res_text, http_res
765
- )
719
+ raise models.APIError("API error occurred", http_res, http_res_text)
766
720
  if utils.match_response(http_res, "5XX", "*"):
767
721
  http_res_text = await utils.stream_to_text_async(http_res)
768
- raise models.APIError(
769
- "API error occurred", http_res.status_code, http_res_text, http_res
770
- )
722
+ raise models.APIError("API error occurred", http_res, http_res_text)
771
723
 
772
- content_type = http_res.headers.get("Content-Type")
773
- http_res_text = await utils.stream_to_text_async(http_res)
774
- raise models.APIError(
775
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
776
- http_res.status_code,
777
- http_res_text,
778
- http_res,
779
- )
724
+ raise models.APIError("Unexpected response received", http_res)
780
725
 
781
726
  def update(
782
727
  self,
783
728
  *,
784
729
  server_id: str,
785
730
  id: Optional[str] = "sv_81EVOtR1N4J2Z",
786
- type_: Optional[models.UpdateServerServersType] = None,
731
+ type_: Optional[models.UpdateServerServersRequestType] = None,
787
732
  attributes: Optional[
788
733
  Union[
789
- models.UpdateServerServersAttributes,
790
- models.UpdateServerServersAttributesTypedDict,
734
+ models.UpdateServerServersRequestAttributes,
735
+ models.UpdateServerServersRequestAttributesTypedDict,
736
+ ]
737
+ ] = None,
738
+ data: Optional[
739
+ Union[
740
+ models.UpdateServerServersData, models.UpdateServerServersDataTypedDict
791
741
  ]
792
742
  ] = None,
793
743
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -801,6 +751,7 @@ class ServersSDK(BaseSDK):
801
751
  :param id:
802
752
  :param type:
803
753
  :param attributes:
754
+ :param data:
804
755
  :param retries: Override the default retry configuration for this method
805
756
  :param server_url: Override the default server URL for this method
806
757
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -822,7 +773,10 @@ class ServersSDK(BaseSDK):
822
773
  id=id,
823
774
  type=type_,
824
775
  attributes=utils.get_pydantic_model(
825
- attributes, Optional[models.UpdateServerServersAttributes]
776
+ attributes, Optional[models.UpdateServerServersRequestAttributes]
777
+ ),
778
+ data=utils.get_pydantic_model(
779
+ data, Optional[models.UpdateServerServersData]
826
780
  ),
827
781
  ),
828
782
  )
@@ -860,6 +814,7 @@ class ServersSDK(BaseSDK):
860
814
 
861
815
  http_res = self.do_request(
862
816
  hook_ctx=HookContext(
817
+ config=self.sdk_configuration,
863
818
  base_url=base_url or "",
864
819
  operation_id="update-server",
865
820
  oauth2_scopes=[],
@@ -875,44 +830,36 @@ class ServersSDK(BaseSDK):
875
830
  response_data: Any = None
876
831
  if utils.match_response(http_res, "200", "*"):
877
832
  return
878
- if utils.match_response(http_res, "400", "application/vnd.api+json"):
879
- response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
880
- raise models.ServerError(data=response_data)
881
- if utils.match_response(
882
- http_res, ["402", "422", "423"], "application/vnd.api+json"
883
- ):
884
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
885
- raise models.ErrorObject(data=response_data)
833
+ if utils.match_response(http_res, ["400", "422"], "application/vnd.api+json"):
834
+ response_data = unmarshal_json_response(models.ServerErrorData, http_res)
835
+ raise models.ServerError(response_data, http_res)
836
+ if utils.match_response(http_res, ["402", "423"], "application/vnd.api+json"):
837
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
838
+ raise models.ErrorObject(response_data, http_res)
886
839
  if utils.match_response(http_res, "4XX", "*"):
887
840
  http_res_text = utils.stream_to_text(http_res)
888
- raise models.APIError(
889
- "API error occurred", http_res.status_code, http_res_text, http_res
890
- )
841
+ raise models.APIError("API error occurred", http_res, http_res_text)
891
842
  if utils.match_response(http_res, "5XX", "*"):
892
843
  http_res_text = utils.stream_to_text(http_res)
893
- raise models.APIError(
894
- "API error occurred", http_res.status_code, http_res_text, http_res
895
- )
844
+ raise models.APIError("API error occurred", http_res, http_res_text)
896
845
 
897
- content_type = http_res.headers.get("Content-Type")
898
- http_res_text = utils.stream_to_text(http_res)
899
- raise models.APIError(
900
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
901
- http_res.status_code,
902
- http_res_text,
903
- http_res,
904
- )
846
+ raise models.APIError("Unexpected response received", http_res)
905
847
 
906
848
  async def update_async(
907
849
  self,
908
850
  *,
909
851
  server_id: str,
910
852
  id: Optional[str] = "sv_81EVOtR1N4J2Z",
911
- type_: Optional[models.UpdateServerServersType] = None,
853
+ type_: Optional[models.UpdateServerServersRequestType] = None,
912
854
  attributes: Optional[
913
855
  Union[
914
- models.UpdateServerServersAttributes,
915
- models.UpdateServerServersAttributesTypedDict,
856
+ models.UpdateServerServersRequestAttributes,
857
+ models.UpdateServerServersRequestAttributesTypedDict,
858
+ ]
859
+ ] = None,
860
+ data: Optional[
861
+ Union[
862
+ models.UpdateServerServersData, models.UpdateServerServersDataTypedDict
916
863
  ]
917
864
  ] = None,
918
865
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -926,6 +873,7 @@ class ServersSDK(BaseSDK):
926
873
  :param id:
927
874
  :param type:
928
875
  :param attributes:
876
+ :param data:
929
877
  :param retries: Override the default retry configuration for this method
930
878
  :param server_url: Override the default server URL for this method
931
879
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -947,7 +895,10 @@ class ServersSDK(BaseSDK):
947
895
  id=id,
948
896
  type=type_,
949
897
  attributes=utils.get_pydantic_model(
950
- attributes, Optional[models.UpdateServerServersAttributes]
898
+ attributes, Optional[models.UpdateServerServersRequestAttributes]
899
+ ),
900
+ data=utils.get_pydantic_model(
901
+ data, Optional[models.UpdateServerServersData]
951
902
  ),
952
903
  ),
953
904
  )
@@ -985,6 +936,7 @@ class ServersSDK(BaseSDK):
985
936
 
986
937
  http_res = await self.do_request_async(
987
938
  hook_ctx=HookContext(
939
+ config=self.sdk_configuration,
988
940
  base_url=base_url or "",
989
941
  operation_id="update-server",
990
942
  oauth2_scopes=[],
@@ -1000,33 +952,20 @@ class ServersSDK(BaseSDK):
1000
952
  response_data: Any = None
1001
953
  if utils.match_response(http_res, "200", "*"):
1002
954
  return
1003
- if utils.match_response(http_res, "400", "application/vnd.api+json"):
1004
- response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
1005
- raise models.ServerError(data=response_data)
1006
- if utils.match_response(
1007
- http_res, ["402", "422", "423"], "application/vnd.api+json"
1008
- ):
1009
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1010
- raise models.ErrorObject(data=response_data)
955
+ if utils.match_response(http_res, ["400", "422"], "application/vnd.api+json"):
956
+ response_data = unmarshal_json_response(models.ServerErrorData, http_res)
957
+ raise models.ServerError(response_data, http_res)
958
+ if utils.match_response(http_res, ["402", "423"], "application/vnd.api+json"):
959
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
960
+ raise models.ErrorObject(response_data, http_res)
1011
961
  if utils.match_response(http_res, "4XX", "*"):
1012
962
  http_res_text = await utils.stream_to_text_async(http_res)
1013
- raise models.APIError(
1014
- "API error occurred", http_res.status_code, http_res_text, http_res
1015
- )
963
+ raise models.APIError("API error occurred", http_res, http_res_text)
1016
964
  if utils.match_response(http_res, "5XX", "*"):
1017
965
  http_res_text = await utils.stream_to_text_async(http_res)
1018
- raise models.APIError(
1019
- "API error occurred", http_res.status_code, http_res_text, http_res
1020
- )
966
+ raise models.APIError("API error occurred", http_res, http_res_text)
1021
967
 
1022
- content_type = http_res.headers.get("Content-Type")
1023
- http_res_text = await utils.stream_to_text_async(http_res)
1024
- raise models.APIError(
1025
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1026
- http_res.status_code,
1027
- http_res_text,
1028
- http_res,
1029
- )
968
+ raise models.APIError("Unexpected response received", http_res)
1030
969
 
1031
970
  def delete(
1032
971
  self,
@@ -1088,6 +1027,7 @@ class ServersSDK(BaseSDK):
1088
1027
 
1089
1028
  http_res = self.do_request(
1090
1029
  hook_ctx=HookContext(
1030
+ config=self.sdk_configuration,
1091
1031
  base_url=base_url or "",
1092
1032
  operation_id="destroy-server",
1093
1033
  oauth2_scopes=[],
@@ -1106,27 +1046,16 @@ class ServersSDK(BaseSDK):
1106
1046
  if utils.match_response(
1107
1047
  http_res, ["403", "406", "422"], "application/vnd.api+json"
1108
1048
  ):
1109
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1110
- raise models.ErrorObject(data=response_data)
1049
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1050
+ raise models.ErrorObject(response_data, http_res)
1111
1051
  if utils.match_response(http_res, ["423", "4XX"], "*"):
1112
1052
  http_res_text = utils.stream_to_text(http_res)
1113
- raise models.APIError(
1114
- "API error occurred", http_res.status_code, http_res_text, http_res
1115
- )
1053
+ raise models.APIError("API error occurred", http_res, http_res_text)
1116
1054
  if utils.match_response(http_res, "5XX", "*"):
1117
1055
  http_res_text = utils.stream_to_text(http_res)
1118
- raise models.APIError(
1119
- "API error occurred", http_res.status_code, http_res_text, http_res
1120
- )
1056
+ raise models.APIError("API error occurred", http_res, http_res_text)
1121
1057
 
1122
- content_type = http_res.headers.get("Content-Type")
1123
- http_res_text = utils.stream_to_text(http_res)
1124
- raise models.APIError(
1125
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1126
- http_res.status_code,
1127
- http_res_text,
1128
- http_res,
1129
- )
1058
+ raise models.APIError("Unexpected response received", http_res)
1130
1059
 
1131
1060
  async def delete_async(
1132
1061
  self,
@@ -1188,6 +1117,7 @@ class ServersSDK(BaseSDK):
1188
1117
 
1189
1118
  http_res = await self.do_request_async(
1190
1119
  hook_ctx=HookContext(
1120
+ config=self.sdk_configuration,
1191
1121
  base_url=base_url or "",
1192
1122
  operation_id="destroy-server",
1193
1123
  oauth2_scopes=[],
@@ -1206,27 +1136,16 @@ class ServersSDK(BaseSDK):
1206
1136
  if utils.match_response(
1207
1137
  http_res, ["403", "406", "422"], "application/vnd.api+json"
1208
1138
  ):
1209
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1210
- raise models.ErrorObject(data=response_data)
1139
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1140
+ raise models.ErrorObject(response_data, http_res)
1211
1141
  if utils.match_response(http_res, ["423", "4XX"], "*"):
1212
1142
  http_res_text = await utils.stream_to_text_async(http_res)
1213
- raise models.APIError(
1214
- "API error occurred", http_res.status_code, http_res_text, http_res
1215
- )
1143
+ raise models.APIError("API error occurred", http_res, http_res_text)
1216
1144
  if utils.match_response(http_res, "5XX", "*"):
1217
1145
  http_res_text = await utils.stream_to_text_async(http_res)
1218
- raise models.APIError(
1219
- "API error occurred", http_res.status_code, http_res_text, http_res
1220
- )
1146
+ raise models.APIError("API error occurred", http_res, http_res_text)
1221
1147
 
1222
- content_type = http_res.headers.get("Content-Type")
1223
- http_res_text = await utils.stream_to_text_async(http_res)
1224
- raise models.APIError(
1225
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1226
- http_res.status_code,
1227
- http_res_text,
1228
- http_res,
1229
- )
1148
+ raise models.APIError("Unexpected response received", http_res)
1230
1149
 
1231
1150
  def get_deploy_config(
1232
1151
  self,
@@ -1285,6 +1204,7 @@ class ServersSDK(BaseSDK):
1285
1204
 
1286
1205
  http_res = self.do_request(
1287
1206
  hook_ctx=HookContext(
1207
+ config=self.sdk_configuration,
1288
1208
  base_url=base_url or "",
1289
1209
  operation_id="get-server-deploy-config",
1290
1210
  oauth2_scopes=[],
@@ -1298,26 +1218,15 @@ class ServersSDK(BaseSDK):
1298
1218
  )
1299
1219
 
1300
1220
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1301
- return utils.unmarshal_json(http_res.text, models.DeployConfig)
1221
+ return unmarshal_json_response(models.DeployConfig, http_res)
1302
1222
  if utils.match_response(http_res, "4XX", "*"):
1303
1223
  http_res_text = utils.stream_to_text(http_res)
1304
- raise models.APIError(
1305
- "API error occurred", http_res.status_code, http_res_text, http_res
1306
- )
1224
+ raise models.APIError("API error occurred", http_res, http_res_text)
1307
1225
  if utils.match_response(http_res, "5XX", "*"):
1308
1226
  http_res_text = utils.stream_to_text(http_res)
1309
- raise models.APIError(
1310
- "API error occurred", http_res.status_code, http_res_text, http_res
1311
- )
1227
+ raise models.APIError("API error occurred", http_res, http_res_text)
1312
1228
 
1313
- content_type = http_res.headers.get("Content-Type")
1314
- http_res_text = utils.stream_to_text(http_res)
1315
- raise models.APIError(
1316
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1317
- http_res.status_code,
1318
- http_res_text,
1319
- http_res,
1320
- )
1229
+ raise models.APIError("Unexpected response received", http_res)
1321
1230
 
1322
1231
  async def get_deploy_config_async(
1323
1232
  self,
@@ -1376,6 +1285,7 @@ class ServersSDK(BaseSDK):
1376
1285
 
1377
1286
  http_res = await self.do_request_async(
1378
1287
  hook_ctx=HookContext(
1288
+ config=self.sdk_configuration,
1379
1289
  base_url=base_url or "",
1380
1290
  operation_id="get-server-deploy-config",
1381
1291
  oauth2_scopes=[],
@@ -1389,26 +1299,15 @@ class ServersSDK(BaseSDK):
1389
1299
  )
1390
1300
 
1391
1301
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1392
- return utils.unmarshal_json(http_res.text, models.DeployConfig)
1302
+ return unmarshal_json_response(models.DeployConfig, http_res)
1393
1303
  if utils.match_response(http_res, "4XX", "*"):
1394
1304
  http_res_text = await utils.stream_to_text_async(http_res)
1395
- raise models.APIError(
1396
- "API error occurred", http_res.status_code, http_res_text, http_res
1397
- )
1305
+ raise models.APIError("API error occurred", http_res, http_res_text)
1398
1306
  if utils.match_response(http_res, "5XX", "*"):
1399
1307
  http_res_text = await utils.stream_to_text_async(http_res)
1400
- raise models.APIError(
1401
- "API error occurred", http_res.status_code, http_res_text, http_res
1402
- )
1308
+ raise models.APIError("API error occurred", http_res, http_res_text)
1403
1309
 
1404
- content_type = http_res.headers.get("Content-Type")
1405
- http_res_text = await utils.stream_to_text_async(http_res)
1406
- raise models.APIError(
1407
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1408
- http_res.status_code,
1409
- http_res_text,
1410
- http_res,
1411
- )
1310
+ raise models.APIError("Unexpected response received", http_res)
1412
1311
 
1413
1312
  def update_deploy_config(
1414
1313
  self,
@@ -1490,6 +1389,7 @@ class ServersSDK(BaseSDK):
1490
1389
 
1491
1390
  http_res = self.do_request(
1492
1391
  hook_ctx=HookContext(
1392
+ config=self.sdk_configuration,
1493
1393
  base_url=base_url or "",
1494
1394
  operation_id="update-server-deploy-config",
1495
1395
  oauth2_scopes=[],
@@ -1504,34 +1404,23 @@ class ServersSDK(BaseSDK):
1504
1404
 
1505
1405
  response_data: Any = None
1506
1406
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1507
- return utils.unmarshal_json(http_res.text, models.DeployConfig)
1407
+ return unmarshal_json_response(models.DeployConfig, http_res)
1508
1408
  if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
1509
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1510
- raise models.ErrorObject(data=response_data)
1409
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1410
+ raise models.ErrorObject(response_data, http_res)
1511
1411
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
1512
- response_data = utils.unmarshal_json(
1513
- http_res.text, models.DeployConfigErrorData
1412
+ response_data = unmarshal_json_response(
1413
+ models.DeployConfigErrorData, http_res
1514
1414
  )
1515
- raise models.DeployConfigError(data=response_data)
1415
+ raise models.DeployConfigError(response_data, http_res)
1516
1416
  if utils.match_response(http_res, "4XX", "*"):
1517
1417
  http_res_text = utils.stream_to_text(http_res)
1518
- raise models.APIError(
1519
- "API error occurred", http_res.status_code, http_res_text, http_res
1520
- )
1418
+ raise models.APIError("API error occurred", http_res, http_res_text)
1521
1419
  if utils.match_response(http_res, "5XX", "*"):
1522
1420
  http_res_text = utils.stream_to_text(http_res)
1523
- raise models.APIError(
1524
- "API error occurred", http_res.status_code, http_res_text, http_res
1525
- )
1421
+ raise models.APIError("API error occurred", http_res, http_res_text)
1526
1422
 
1527
- content_type = http_res.headers.get("Content-Type")
1528
- http_res_text = utils.stream_to_text(http_res)
1529
- raise models.APIError(
1530
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1531
- http_res.status_code,
1532
- http_res_text,
1533
- http_res,
1534
- )
1423
+ raise models.APIError("Unexpected response received", http_res)
1535
1424
 
1536
1425
  async def update_deploy_config_async(
1537
1426
  self,
@@ -1613,6 +1502,7 @@ class ServersSDK(BaseSDK):
1613
1502
 
1614
1503
  http_res = await self.do_request_async(
1615
1504
  hook_ctx=HookContext(
1505
+ config=self.sdk_configuration,
1616
1506
  base_url=base_url or "",
1617
1507
  operation_id="update-server-deploy-config",
1618
1508
  oauth2_scopes=[],
@@ -1627,34 +1517,23 @@ class ServersSDK(BaseSDK):
1627
1517
 
1628
1518
  response_data: Any = None
1629
1519
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1630
- return utils.unmarshal_json(http_res.text, models.DeployConfig)
1520
+ return unmarshal_json_response(models.DeployConfig, http_res)
1631
1521
  if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
1632
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
1633
- raise models.ErrorObject(data=response_data)
1522
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1523
+ raise models.ErrorObject(response_data, http_res)
1634
1524
  if utils.match_response(http_res, "422", "application/vnd.api+json"):
1635
- response_data = utils.unmarshal_json(
1636
- http_res.text, models.DeployConfigErrorData
1525
+ response_data = unmarshal_json_response(
1526
+ models.DeployConfigErrorData, http_res
1637
1527
  )
1638
- raise models.DeployConfigError(data=response_data)
1528
+ raise models.DeployConfigError(response_data, http_res)
1639
1529
  if utils.match_response(http_res, "4XX", "*"):
1640
1530
  http_res_text = await utils.stream_to_text_async(http_res)
1641
- raise models.APIError(
1642
- "API error occurred", http_res.status_code, http_res_text, http_res
1643
- )
1531
+ raise models.APIError("API error occurred", http_res, http_res_text)
1644
1532
  if utils.match_response(http_res, "5XX", "*"):
1645
1533
  http_res_text = await utils.stream_to_text_async(http_res)
1646
- raise models.APIError(
1647
- "API error occurred", http_res.status_code, http_res_text, http_res
1648
- )
1534
+ raise models.APIError("API error occurred", http_res, http_res_text)
1649
1535
 
1650
- content_type = http_res.headers.get("Content-Type")
1651
- http_res_text = await utils.stream_to_text_async(http_res)
1652
- raise models.APIError(
1653
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1654
- http_res.status_code,
1655
- http_res_text,
1656
- http_res,
1657
- )
1536
+ raise models.APIError("Unexpected response received", http_res)
1658
1537
 
1659
1538
  def lock(
1660
1539
  self,
@@ -1715,6 +1594,7 @@ class ServersSDK(BaseSDK):
1715
1594
 
1716
1595
  http_res = self.do_request(
1717
1596
  hook_ctx=HookContext(
1597
+ config=self.sdk_configuration,
1718
1598
  base_url=base_url or "",
1719
1599
  operation_id="server-lock",
1720
1600
  oauth2_scopes=[],
@@ -1728,26 +1608,15 @@ class ServersSDK(BaseSDK):
1728
1608
  )
1729
1609
 
1730
1610
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1731
- return utils.unmarshal_json(http_res.text, models.Server1)
1611
+ return unmarshal_json_response(models.Server1, http_res)
1732
1612
  if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
1733
1613
  http_res_text = utils.stream_to_text(http_res)
1734
- raise models.APIError(
1735
- "API error occurred", http_res.status_code, http_res_text, http_res
1736
- )
1614
+ raise models.APIError("API error occurred", http_res, http_res_text)
1737
1615
  if utils.match_response(http_res, "5XX", "*"):
1738
1616
  http_res_text = utils.stream_to_text(http_res)
1739
- raise models.APIError(
1740
- "API error occurred", http_res.status_code, http_res_text, http_res
1741
- )
1617
+ raise models.APIError("API error occurred", http_res, http_res_text)
1742
1618
 
1743
- content_type = http_res.headers.get("Content-Type")
1744
- http_res_text = utils.stream_to_text(http_res)
1745
- raise models.APIError(
1746
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1747
- http_res.status_code,
1748
- http_res_text,
1749
- http_res,
1750
- )
1619
+ raise models.APIError("Unexpected response received", http_res)
1751
1620
 
1752
1621
  async def lock_async(
1753
1622
  self,
@@ -1808,6 +1677,7 @@ class ServersSDK(BaseSDK):
1808
1677
 
1809
1678
  http_res = await self.do_request_async(
1810
1679
  hook_ctx=HookContext(
1680
+ config=self.sdk_configuration,
1811
1681
  base_url=base_url or "",
1812
1682
  operation_id="server-lock",
1813
1683
  oauth2_scopes=[],
@@ -1821,26 +1691,15 @@ class ServersSDK(BaseSDK):
1821
1691
  )
1822
1692
 
1823
1693
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1824
- return utils.unmarshal_json(http_res.text, models.Server1)
1694
+ return unmarshal_json_response(models.Server1, http_res)
1825
1695
  if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
1826
1696
  http_res_text = await utils.stream_to_text_async(http_res)
1827
- raise models.APIError(
1828
- "API error occurred", http_res.status_code, http_res_text, http_res
1829
- )
1697
+ raise models.APIError("API error occurred", http_res, http_res_text)
1830
1698
  if utils.match_response(http_res, "5XX", "*"):
1831
1699
  http_res_text = await utils.stream_to_text_async(http_res)
1832
- raise models.APIError(
1833
- "API error occurred", http_res.status_code, http_res_text, http_res
1834
- )
1700
+ raise models.APIError("API error occurred", http_res, http_res_text)
1835
1701
 
1836
- content_type = http_res.headers.get("Content-Type")
1837
- http_res_text = await utils.stream_to_text_async(http_res)
1838
- raise models.APIError(
1839
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1840
- http_res.status_code,
1841
- http_res_text,
1842
- http_res,
1843
- )
1702
+ raise models.APIError("Unexpected response received", http_res)
1844
1703
 
1845
1704
  def unlock(
1846
1705
  self,
@@ -1901,6 +1760,7 @@ class ServersSDK(BaseSDK):
1901
1760
 
1902
1761
  http_res = self.do_request(
1903
1762
  hook_ctx=HookContext(
1763
+ config=self.sdk_configuration,
1904
1764
  base_url=base_url or "",
1905
1765
  operation_id="server-unlock",
1906
1766
  oauth2_scopes=[],
@@ -1914,26 +1774,15 @@ class ServersSDK(BaseSDK):
1914
1774
  )
1915
1775
 
1916
1776
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
1917
- return utils.unmarshal_json(http_res.text, models.Server1)
1777
+ return unmarshal_json_response(models.Server1, http_res)
1918
1778
  if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
1919
1779
  http_res_text = utils.stream_to_text(http_res)
1920
- raise models.APIError(
1921
- "API error occurred", http_res.status_code, http_res_text, http_res
1922
- )
1780
+ raise models.APIError("API error occurred", http_res, http_res_text)
1923
1781
  if utils.match_response(http_res, "5XX", "*"):
1924
1782
  http_res_text = utils.stream_to_text(http_res)
1925
- raise models.APIError(
1926
- "API error occurred", http_res.status_code, http_res_text, http_res
1927
- )
1783
+ raise models.APIError("API error occurred", http_res, http_res_text)
1928
1784
 
1929
- content_type = http_res.headers.get("Content-Type")
1930
- http_res_text = utils.stream_to_text(http_res)
1931
- raise models.APIError(
1932
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1933
- http_res.status_code,
1934
- http_res_text,
1935
- http_res,
1936
- )
1785
+ raise models.APIError("Unexpected response received", http_res)
1937
1786
 
1938
1787
  async def unlock_async(
1939
1788
  self,
@@ -1994,6 +1843,7 @@ class ServersSDK(BaseSDK):
1994
1843
 
1995
1844
  http_res = await self.do_request_async(
1996
1845
  hook_ctx=HookContext(
1846
+ config=self.sdk_configuration,
1997
1847
  base_url=base_url or "",
1998
1848
  operation_id="server-unlock",
1999
1849
  oauth2_scopes=[],
@@ -2007,26 +1857,15 @@ class ServersSDK(BaseSDK):
2007
1857
  )
2008
1858
 
2009
1859
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
2010
- return utils.unmarshal_json(http_res.text, models.Server1)
1860
+ return unmarshal_json_response(models.Server1, http_res)
2011
1861
  if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
2012
1862
  http_res_text = await utils.stream_to_text_async(http_res)
2013
- raise models.APIError(
2014
- "API error occurred", http_res.status_code, http_res_text, http_res
2015
- )
1863
+ raise models.APIError("API error occurred", http_res, http_res_text)
2016
1864
  if utils.match_response(http_res, "5XX", "*"):
2017
1865
  http_res_text = await utils.stream_to_text_async(http_res)
2018
- raise models.APIError(
2019
- "API error occurred", http_res.status_code, http_res_text, http_res
2020
- )
1866
+ raise models.APIError("API error occurred", http_res, http_res_text)
2021
1867
 
2022
- content_type = http_res.headers.get("Content-Type")
2023
- http_res_text = await utils.stream_to_text_async(http_res)
2024
- raise models.APIError(
2025
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2026
- http_res.status_code,
2027
- http_res_text,
2028
- http_res,
2029
- )
1868
+ raise models.APIError("Unexpected response received", http_res)
2030
1869
 
2031
1870
  def create_out_of_band_connection(
2032
1871
  self,
@@ -2102,6 +1941,7 @@ class ServersSDK(BaseSDK):
2102
1941
 
2103
1942
  http_res = self.do_request(
2104
1943
  hook_ctx=HookContext(
1944
+ config=self.sdk_configuration,
2105
1945
  base_url=base_url or "",
2106
1946
  operation_id="create-server-out-of-band",
2107
1947
  oauth2_scopes=[],
@@ -2116,29 +1956,18 @@ class ServersSDK(BaseSDK):
2116
1956
 
2117
1957
  response_data: Any = None
2118
1958
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2119
- return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
1959
+ return unmarshal_json_response(models.OutOfBandConnection, http_res)
2120
1960
  if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
2121
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2122
- raise models.ErrorObject(data=response_data)
1961
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
1962
+ raise models.ErrorObject(response_data, http_res)
2123
1963
  if utils.match_response(http_res, ["406", "4XX"], "*"):
2124
1964
  http_res_text = utils.stream_to_text(http_res)
2125
- raise models.APIError(
2126
- "API error occurred", http_res.status_code, http_res_text, http_res
2127
- )
1965
+ raise models.APIError("API error occurred", http_res, http_res_text)
2128
1966
  if utils.match_response(http_res, "5XX", "*"):
2129
1967
  http_res_text = utils.stream_to_text(http_res)
2130
- raise models.APIError(
2131
- "API error occurred", http_res.status_code, http_res_text, http_res
2132
- )
1968
+ raise models.APIError("API error occurred", http_res, http_res_text)
2133
1969
 
2134
- content_type = http_res.headers.get("Content-Type")
2135
- http_res_text = utils.stream_to_text(http_res)
2136
- raise models.APIError(
2137
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2138
- http_res.status_code,
2139
- http_res_text,
2140
- http_res,
2141
- )
1970
+ raise models.APIError("Unexpected response received", http_res)
2142
1971
 
2143
1972
  async def create_out_of_band_connection_async(
2144
1973
  self,
@@ -2214,6 +2043,7 @@ class ServersSDK(BaseSDK):
2214
2043
 
2215
2044
  http_res = await self.do_request_async(
2216
2045
  hook_ctx=HookContext(
2046
+ config=self.sdk_configuration,
2217
2047
  base_url=base_url or "",
2218
2048
  operation_id="create-server-out-of-band",
2219
2049
  oauth2_scopes=[],
@@ -2228,29 +2058,18 @@ class ServersSDK(BaseSDK):
2228
2058
 
2229
2059
  response_data: Any = None
2230
2060
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2231
- return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
2061
+ return unmarshal_json_response(models.OutOfBandConnection, http_res)
2232
2062
  if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
2233
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2234
- raise models.ErrorObject(data=response_data)
2063
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2064
+ raise models.ErrorObject(response_data, http_res)
2235
2065
  if utils.match_response(http_res, ["406", "4XX"], "*"):
2236
2066
  http_res_text = await utils.stream_to_text_async(http_res)
2237
- raise models.APIError(
2238
- "API error occurred", http_res.status_code, http_res_text, http_res
2239
- )
2067
+ raise models.APIError("API error occurred", http_res, http_res_text)
2240
2068
  if utils.match_response(http_res, "5XX", "*"):
2241
2069
  http_res_text = await utils.stream_to_text_async(http_res)
2242
- raise models.APIError(
2243
- "API error occurred", http_res.status_code, http_res_text, http_res
2244
- )
2070
+ raise models.APIError("API error occurred", http_res, http_res_text)
2245
2071
 
2246
- content_type = http_res.headers.get("Content-Type")
2247
- http_res_text = await utils.stream_to_text_async(http_res)
2248
- raise models.APIError(
2249
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2250
- http_res.status_code,
2251
- http_res_text,
2252
- http_res,
2253
- )
2072
+ raise models.APIError("Unexpected response received", http_res)
2254
2073
 
2255
2074
  def list_out_of_band_connections(
2256
2075
  self,
@@ -2309,6 +2128,7 @@ class ServersSDK(BaseSDK):
2309
2128
 
2310
2129
  http_res = self.do_request(
2311
2130
  hook_ctx=HookContext(
2131
+ config=self.sdk_configuration,
2312
2132
  base_url=base_url or "",
2313
2133
  operation_id="get-server-out-of-band",
2314
2134
  oauth2_scopes=[],
@@ -2323,29 +2143,18 @@ class ServersSDK(BaseSDK):
2323
2143
 
2324
2144
  response_data: Any = None
2325
2145
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
2326
- return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
2146
+ return unmarshal_json_response(models.OutOfBandConnection, http_res)
2327
2147
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
2328
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2329
- raise models.ErrorObject(data=response_data)
2148
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2149
+ raise models.ErrorObject(response_data, http_res)
2330
2150
  if utils.match_response(http_res, "4XX", "*"):
2331
2151
  http_res_text = utils.stream_to_text(http_res)
2332
- raise models.APIError(
2333
- "API error occurred", http_res.status_code, http_res_text, http_res
2334
- )
2152
+ raise models.APIError("API error occurred", http_res, http_res_text)
2335
2153
  if utils.match_response(http_res, "5XX", "*"):
2336
2154
  http_res_text = utils.stream_to_text(http_res)
2337
- raise models.APIError(
2338
- "API error occurred", http_res.status_code, http_res_text, http_res
2339
- )
2155
+ raise models.APIError("API error occurred", http_res, http_res_text)
2340
2156
 
2341
- content_type = http_res.headers.get("Content-Type")
2342
- http_res_text = utils.stream_to_text(http_res)
2343
- raise models.APIError(
2344
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2345
- http_res.status_code,
2346
- http_res_text,
2347
- http_res,
2348
- )
2157
+ raise models.APIError("Unexpected response received", http_res)
2349
2158
 
2350
2159
  async def list_out_of_band_connections_async(
2351
2160
  self,
@@ -2404,6 +2213,7 @@ class ServersSDK(BaseSDK):
2404
2213
 
2405
2214
  http_res = await self.do_request_async(
2406
2215
  hook_ctx=HookContext(
2216
+ config=self.sdk_configuration,
2407
2217
  base_url=base_url or "",
2408
2218
  operation_id="get-server-out-of-band",
2409
2219
  oauth2_scopes=[],
@@ -2418,29 +2228,18 @@ class ServersSDK(BaseSDK):
2418
2228
 
2419
2229
  response_data: Any = None
2420
2230
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
2421
- return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
2231
+ return unmarshal_json_response(models.OutOfBandConnection, http_res)
2422
2232
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
2423
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2424
- raise models.ErrorObject(data=response_data)
2233
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2234
+ raise models.ErrorObject(response_data, http_res)
2425
2235
  if utils.match_response(http_res, "4XX", "*"):
2426
2236
  http_res_text = await utils.stream_to_text_async(http_res)
2427
- raise models.APIError(
2428
- "API error occurred", http_res.status_code, http_res_text, http_res
2429
- )
2237
+ raise models.APIError("API error occurred", http_res, http_res_text)
2430
2238
  if utils.match_response(http_res, "5XX", "*"):
2431
2239
  http_res_text = await utils.stream_to_text_async(http_res)
2432
- raise models.APIError(
2433
- "API error occurred", http_res.status_code, http_res_text, http_res
2434
- )
2240
+ raise models.APIError("API error occurred", http_res, http_res_text)
2435
2241
 
2436
- content_type = http_res.headers.get("Content-Type")
2437
- http_res_text = await utils.stream_to_text_async(http_res)
2438
- raise models.APIError(
2439
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2440
- http_res.status_code,
2441
- http_res_text,
2442
- http_res,
2443
- )
2242
+ raise models.APIError("Unexpected response received", http_res)
2444
2243
 
2445
2244
  def actions(
2446
2245
  self,
@@ -2522,6 +2321,7 @@ class ServersSDK(BaseSDK):
2522
2321
 
2523
2322
  http_res = self.do_request(
2524
2323
  hook_ctx=HookContext(
2324
+ config=self.sdk_configuration,
2525
2325
  base_url=base_url or "",
2526
2326
  operation_id="create-server-action",
2527
2327
  oauth2_scopes=[],
@@ -2536,29 +2336,18 @@ class ServersSDK(BaseSDK):
2536
2336
 
2537
2337
  response_data: Any = None
2538
2338
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2539
- return utils.unmarshal_json(http_res.text, models.ServerAction)
2339
+ return unmarshal_json_response(models.ServerAction, http_res)
2540
2340
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
2541
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2542
- raise models.ErrorObject(data=response_data)
2341
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2342
+ raise models.ErrorObject(response_data, http_res)
2543
2343
  if utils.match_response(http_res, "4XX", "*"):
2544
2344
  http_res_text = utils.stream_to_text(http_res)
2545
- raise models.APIError(
2546
- "API error occurred", http_res.status_code, http_res_text, http_res
2547
- )
2345
+ raise models.APIError("API error occurred", http_res, http_res_text)
2548
2346
  if utils.match_response(http_res, "5XX", "*"):
2549
2347
  http_res_text = utils.stream_to_text(http_res)
2550
- raise models.APIError(
2551
- "API error occurred", http_res.status_code, http_res_text, http_res
2552
- )
2348
+ raise models.APIError("API error occurred", http_res, http_res_text)
2553
2349
 
2554
- content_type = http_res.headers.get("Content-Type")
2555
- http_res_text = utils.stream_to_text(http_res)
2556
- raise models.APIError(
2557
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2558
- http_res.status_code,
2559
- http_res_text,
2560
- http_res,
2561
- )
2350
+ raise models.APIError("Unexpected response received", http_res)
2562
2351
 
2563
2352
  async def actions_async(
2564
2353
  self,
@@ -2640,6 +2429,7 @@ class ServersSDK(BaseSDK):
2640
2429
 
2641
2430
  http_res = await self.do_request_async(
2642
2431
  hook_ctx=HookContext(
2432
+ config=self.sdk_configuration,
2643
2433
  base_url=base_url or "",
2644
2434
  operation_id="create-server-action",
2645
2435
  oauth2_scopes=[],
@@ -2654,29 +2444,18 @@ class ServersSDK(BaseSDK):
2654
2444
 
2655
2445
  response_data: Any = None
2656
2446
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2657
- return utils.unmarshal_json(http_res.text, models.ServerAction)
2447
+ return unmarshal_json_response(models.ServerAction, http_res)
2658
2448
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
2659
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2660
- raise models.ErrorObject(data=response_data)
2449
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2450
+ raise models.ErrorObject(response_data, http_res)
2661
2451
  if utils.match_response(http_res, "4XX", "*"):
2662
2452
  http_res_text = await utils.stream_to_text_async(http_res)
2663
- raise models.APIError(
2664
- "API error occurred", http_res.status_code, http_res_text, http_res
2665
- )
2453
+ raise models.APIError("API error occurred", http_res, http_res_text)
2666
2454
  if utils.match_response(http_res, "5XX", "*"):
2667
2455
  http_res_text = await utils.stream_to_text_async(http_res)
2668
- raise models.APIError(
2669
- "API error occurred", http_res.status_code, http_res_text, http_res
2670
- )
2456
+ raise models.APIError("API error occurred", http_res, http_res_text)
2671
2457
 
2672
- content_type = http_res.headers.get("Content-Type")
2673
- http_res_text = await utils.stream_to_text_async(http_res)
2674
- raise models.APIError(
2675
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2676
- http_res.status_code,
2677
- http_res_text,
2678
- http_res,
2679
- )
2458
+ raise models.APIError("Unexpected response received", http_res)
2680
2459
 
2681
2460
  def create_ipmi_session(
2682
2461
  self,
@@ -2741,6 +2520,7 @@ class ServersSDK(BaseSDK):
2741
2520
 
2742
2521
  http_res = self.do_request(
2743
2522
  hook_ctx=HookContext(
2523
+ config=self.sdk_configuration,
2744
2524
  base_url=base_url or "",
2745
2525
  operation_id="create-ipmi-session",
2746
2526
  oauth2_scopes=[],
@@ -2755,31 +2535,20 @@ class ServersSDK(BaseSDK):
2755
2535
 
2756
2536
  response_data: Any = None
2757
2537
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2758
- return utils.unmarshal_json(http_res.text, models.IpmiSession)
2538
+ return unmarshal_json_response(models.IpmiSession, http_res)
2759
2539
  if utils.match_response(
2760
2540
  http_res, ["403", "404", "422"], "application/vnd.api+json"
2761
2541
  ):
2762
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2763
- raise models.ErrorObject(data=response_data)
2542
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2543
+ raise models.ErrorObject(response_data, http_res)
2764
2544
  if utils.match_response(http_res, "4XX", "*"):
2765
2545
  http_res_text = utils.stream_to_text(http_res)
2766
- raise models.APIError(
2767
- "API error occurred", http_res.status_code, http_res_text, http_res
2768
- )
2546
+ raise models.APIError("API error occurred", http_res, http_res_text)
2769
2547
  if utils.match_response(http_res, "5XX", "*"):
2770
2548
  http_res_text = utils.stream_to_text(http_res)
2771
- raise models.APIError(
2772
- "API error occurred", http_res.status_code, http_res_text, http_res
2773
- )
2549
+ raise models.APIError("API error occurred", http_res, http_res_text)
2774
2550
 
2775
- content_type = http_res.headers.get("Content-Type")
2776
- http_res_text = utils.stream_to_text(http_res)
2777
- raise models.APIError(
2778
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2779
- http_res.status_code,
2780
- http_res_text,
2781
- http_res,
2782
- )
2551
+ raise models.APIError("Unexpected response received", http_res)
2783
2552
 
2784
2553
  async def create_ipmi_session_async(
2785
2554
  self,
@@ -2844,6 +2613,7 @@ class ServersSDK(BaseSDK):
2844
2613
 
2845
2614
  http_res = await self.do_request_async(
2846
2615
  hook_ctx=HookContext(
2616
+ config=self.sdk_configuration,
2847
2617
  base_url=base_url or "",
2848
2618
  operation_id="create-ipmi-session",
2849
2619
  oauth2_scopes=[],
@@ -2858,31 +2628,20 @@ class ServersSDK(BaseSDK):
2858
2628
 
2859
2629
  response_data: Any = None
2860
2630
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2861
- return utils.unmarshal_json(http_res.text, models.IpmiSession)
2631
+ return unmarshal_json_response(models.IpmiSession, http_res)
2862
2632
  if utils.match_response(
2863
2633
  http_res, ["403", "404", "422"], "application/vnd.api+json"
2864
2634
  ):
2865
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2866
- raise models.ErrorObject(data=response_data)
2635
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2636
+ raise models.ErrorObject(response_data, http_res)
2867
2637
  if utils.match_response(http_res, "4XX", "*"):
2868
2638
  http_res_text = await utils.stream_to_text_async(http_res)
2869
- raise models.APIError(
2870
- "API error occurred", http_res.status_code, http_res_text, http_res
2871
- )
2639
+ raise models.APIError("API error occurred", http_res, http_res_text)
2872
2640
  if utils.match_response(http_res, "5XX", "*"):
2873
2641
  http_res_text = await utils.stream_to_text_async(http_res)
2874
- raise models.APIError(
2875
- "API error occurred", http_res.status_code, http_res_text, http_res
2876
- )
2642
+ raise models.APIError("API error occurred", http_res, http_res_text)
2877
2643
 
2878
- content_type = http_res.headers.get("Content-Type")
2879
- http_res_text = await utils.stream_to_text_async(http_res)
2880
- raise models.APIError(
2881
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2882
- http_res.status_code,
2883
- http_res_text,
2884
- http_res,
2885
- )
2644
+ raise models.APIError("Unexpected response received", http_res)
2886
2645
 
2887
2646
  def start_rescue_mode(
2888
2647
  self,
@@ -2943,6 +2702,7 @@ class ServersSDK(BaseSDK):
2943
2702
 
2944
2703
  http_res = self.do_request(
2945
2704
  hook_ctx=HookContext(
2705
+ config=self.sdk_configuration,
2946
2706
  base_url=base_url or "",
2947
2707
  operation_id="server-start-rescue-mode",
2948
2708
  oauth2_scopes=[],
@@ -2957,29 +2717,18 @@ class ServersSDK(BaseSDK):
2957
2717
 
2958
2718
  response_data: Any = None
2959
2719
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
2960
- return utils.unmarshal_json(http_res.text, models.ServerRescue)
2720
+ return unmarshal_json_response(models.ServerRescue, http_res)
2961
2721
  if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
2962
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
2963
- raise models.ErrorObject(data=response_data)
2722
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2723
+ raise models.ErrorObject(response_data, http_res)
2964
2724
  if utils.match_response(http_res, "4XX", "*"):
2965
2725
  http_res_text = utils.stream_to_text(http_res)
2966
- raise models.APIError(
2967
- "API error occurred", http_res.status_code, http_res_text, http_res
2968
- )
2726
+ raise models.APIError("API error occurred", http_res, http_res_text)
2969
2727
  if utils.match_response(http_res, "5XX", "*"):
2970
2728
  http_res_text = utils.stream_to_text(http_res)
2971
- raise models.APIError(
2972
- "API error occurred", http_res.status_code, http_res_text, http_res
2973
- )
2729
+ raise models.APIError("API error occurred", http_res, http_res_text)
2974
2730
 
2975
- content_type = http_res.headers.get("Content-Type")
2976
- http_res_text = utils.stream_to_text(http_res)
2977
- raise models.APIError(
2978
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2979
- http_res.status_code,
2980
- http_res_text,
2981
- http_res,
2982
- )
2731
+ raise models.APIError("Unexpected response received", http_res)
2983
2732
 
2984
2733
  async def start_rescue_mode_async(
2985
2734
  self,
@@ -3040,6 +2789,7 @@ class ServersSDK(BaseSDK):
3040
2789
 
3041
2790
  http_res = await self.do_request_async(
3042
2791
  hook_ctx=HookContext(
2792
+ config=self.sdk_configuration,
3043
2793
  base_url=base_url or "",
3044
2794
  operation_id="server-start-rescue-mode",
3045
2795
  oauth2_scopes=[],
@@ -3054,29 +2804,18 @@ class ServersSDK(BaseSDK):
3054
2804
 
3055
2805
  response_data: Any = None
3056
2806
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
3057
- return utils.unmarshal_json(http_res.text, models.ServerRescue)
2807
+ return unmarshal_json_response(models.ServerRescue, http_res)
3058
2808
  if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
3059
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3060
- raise models.ErrorObject(data=response_data)
2809
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2810
+ raise models.ErrorObject(response_data, http_res)
3061
2811
  if utils.match_response(http_res, "4XX", "*"):
3062
2812
  http_res_text = await utils.stream_to_text_async(http_res)
3063
- raise models.APIError(
3064
- "API error occurred", http_res.status_code, http_res_text, http_res
3065
- )
2813
+ raise models.APIError("API error occurred", http_res, http_res_text)
3066
2814
  if utils.match_response(http_res, "5XX", "*"):
3067
2815
  http_res_text = await utils.stream_to_text_async(http_res)
3068
- raise models.APIError(
3069
- "API error occurred", http_res.status_code, http_res_text, http_res
3070
- )
2816
+ raise models.APIError("API error occurred", http_res, http_res_text)
3071
2817
 
3072
- content_type = http_res.headers.get("Content-Type")
3073
- http_res_text = await utils.stream_to_text_async(http_res)
3074
- raise models.APIError(
3075
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3076
- http_res.status_code,
3077
- http_res_text,
3078
- http_res,
3079
- )
2818
+ raise models.APIError("Unexpected response received", http_res)
3080
2819
 
3081
2820
  def exit_rescue_mode(
3082
2821
  self,
@@ -3137,6 +2876,7 @@ class ServersSDK(BaseSDK):
3137
2876
 
3138
2877
  http_res = self.do_request(
3139
2878
  hook_ctx=HookContext(
2879
+ config=self.sdk_configuration,
3140
2880
  base_url=base_url or "",
3141
2881
  operation_id="server-exit-rescue-mode",
3142
2882
  oauth2_scopes=[],
@@ -3151,29 +2891,18 @@ class ServersSDK(BaseSDK):
3151
2891
 
3152
2892
  response_data: Any = None
3153
2893
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
3154
- return utils.unmarshal_json(http_res.text, models.ServerRescue)
2894
+ return unmarshal_json_response(models.ServerRescue, http_res)
3155
2895
  if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
3156
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3157
- raise models.ErrorObject(data=response_data)
2896
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2897
+ raise models.ErrorObject(response_data, http_res)
3158
2898
  if utils.match_response(http_res, "4XX", "*"):
3159
2899
  http_res_text = utils.stream_to_text(http_res)
3160
- raise models.APIError(
3161
- "API error occurred", http_res.status_code, http_res_text, http_res
3162
- )
2900
+ raise models.APIError("API error occurred", http_res, http_res_text)
3163
2901
  if utils.match_response(http_res, "5XX", "*"):
3164
2902
  http_res_text = utils.stream_to_text(http_res)
3165
- raise models.APIError(
3166
- "API error occurred", http_res.status_code, http_res_text, http_res
3167
- )
2903
+ raise models.APIError("API error occurred", http_res, http_res_text)
3168
2904
 
3169
- content_type = http_res.headers.get("Content-Type")
3170
- http_res_text = utils.stream_to_text(http_res)
3171
- raise models.APIError(
3172
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3173
- http_res.status_code,
3174
- http_res_text,
3175
- http_res,
3176
- )
2905
+ raise models.APIError("Unexpected response received", http_res)
3177
2906
 
3178
2907
  async def exit_rescue_mode_async(
3179
2908
  self,
@@ -3234,6 +2963,7 @@ class ServersSDK(BaseSDK):
3234
2963
 
3235
2964
  http_res = await self.do_request_async(
3236
2965
  hook_ctx=HookContext(
2966
+ config=self.sdk_configuration,
3237
2967
  base_url=base_url or "",
3238
2968
  operation_id="server-exit-rescue-mode",
3239
2969
  oauth2_scopes=[],
@@ -3248,29 +2978,18 @@ class ServersSDK(BaseSDK):
3248
2978
 
3249
2979
  response_data: Any = None
3250
2980
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
3251
- return utils.unmarshal_json(http_res.text, models.ServerRescue)
2981
+ return unmarshal_json_response(models.ServerRescue, http_res)
3252
2982
  if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
3253
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3254
- raise models.ErrorObject(data=response_data)
2983
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
2984
+ raise models.ErrorObject(response_data, http_res)
3255
2985
  if utils.match_response(http_res, "4XX", "*"):
3256
2986
  http_res_text = await utils.stream_to_text_async(http_res)
3257
- raise models.APIError(
3258
- "API error occurred", http_res.status_code, http_res_text, http_res
3259
- )
2987
+ raise models.APIError("API error occurred", http_res, http_res_text)
3260
2988
  if utils.match_response(http_res, "5XX", "*"):
3261
2989
  http_res_text = await utils.stream_to_text_async(http_res)
3262
- raise models.APIError(
3263
- "API error occurred", http_res.status_code, http_res_text, http_res
3264
- )
2990
+ raise models.APIError("API error occurred", http_res, http_res_text)
3265
2991
 
3266
- content_type = http_res.headers.get("Content-Type")
3267
- http_res_text = await utils.stream_to_text_async(http_res)
3268
- raise models.APIError(
3269
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3270
- http_res.status_code,
3271
- http_res_text,
3272
- http_res,
3273
- )
2992
+ raise models.APIError("Unexpected response received", http_res)
3274
2993
 
3275
2994
  def schedule_deletion(
3276
2995
  self,
@@ -3331,6 +3050,7 @@ class ServersSDK(BaseSDK):
3331
3050
 
3332
3051
  http_res = self.do_request(
3333
3052
  hook_ctx=HookContext(
3053
+ config=self.sdk_configuration,
3334
3054
  base_url=base_url or "",
3335
3055
  operation_id="server-schedule-deletion",
3336
3056
  oauth2_scopes=[],
@@ -3345,31 +3065,20 @@ class ServersSDK(BaseSDK):
3345
3065
 
3346
3066
  response_data: Any = None
3347
3067
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
3348
- return utils.unmarshal_json(http_res.text, models.ServerScheduleDeletion)
3068
+ return unmarshal_json_response(models.ServerScheduleDeletion, http_res)
3349
3069
  if utils.match_response(
3350
3070
  http_res, ["403", "406", "423"], "application/vnd.api+json"
3351
3071
  ):
3352
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3353
- raise models.ErrorObject(data=response_data)
3072
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
3073
+ raise models.ErrorObject(response_data, http_res)
3354
3074
  if utils.match_response(http_res, "4XX", "*"):
3355
3075
  http_res_text = utils.stream_to_text(http_res)
3356
- raise models.APIError(
3357
- "API error occurred", http_res.status_code, http_res_text, http_res
3358
- )
3076
+ raise models.APIError("API error occurred", http_res, http_res_text)
3359
3077
  if utils.match_response(http_res, "5XX", "*"):
3360
3078
  http_res_text = utils.stream_to_text(http_res)
3361
- raise models.APIError(
3362
- "API error occurred", http_res.status_code, http_res_text, http_res
3363
- )
3079
+ raise models.APIError("API error occurred", http_res, http_res_text)
3364
3080
 
3365
- content_type = http_res.headers.get("Content-Type")
3366
- http_res_text = utils.stream_to_text(http_res)
3367
- raise models.APIError(
3368
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3369
- http_res.status_code,
3370
- http_res_text,
3371
- http_res,
3372
- )
3081
+ raise models.APIError("Unexpected response received", http_res)
3373
3082
 
3374
3083
  async def schedule_deletion_async(
3375
3084
  self,
@@ -3430,6 +3139,7 @@ class ServersSDK(BaseSDK):
3430
3139
 
3431
3140
  http_res = await self.do_request_async(
3432
3141
  hook_ctx=HookContext(
3142
+ config=self.sdk_configuration,
3433
3143
  base_url=base_url or "",
3434
3144
  operation_id="server-schedule-deletion",
3435
3145
  oauth2_scopes=[],
@@ -3444,31 +3154,20 @@ class ServersSDK(BaseSDK):
3444
3154
 
3445
3155
  response_data: Any = None
3446
3156
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
3447
- return utils.unmarshal_json(http_res.text, models.ServerScheduleDeletion)
3157
+ return unmarshal_json_response(models.ServerScheduleDeletion, http_res)
3448
3158
  if utils.match_response(
3449
3159
  http_res, ["403", "406", "423"], "application/vnd.api+json"
3450
3160
  ):
3451
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3452
- raise models.ErrorObject(data=response_data)
3161
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
3162
+ raise models.ErrorObject(response_data, http_res)
3453
3163
  if utils.match_response(http_res, "4XX", "*"):
3454
3164
  http_res_text = await utils.stream_to_text_async(http_res)
3455
- raise models.APIError(
3456
- "API error occurred", http_res.status_code, http_res_text, http_res
3457
- )
3165
+ raise models.APIError("API error occurred", http_res, http_res_text)
3458
3166
  if utils.match_response(http_res, "5XX", "*"):
3459
3167
  http_res_text = await utils.stream_to_text_async(http_res)
3460
- raise models.APIError(
3461
- "API error occurred", http_res.status_code, http_res_text, http_res
3462
- )
3168
+ raise models.APIError("API error occurred", http_res, http_res_text)
3463
3169
 
3464
- content_type = http_res.headers.get("Content-Type")
3465
- http_res_text = await utils.stream_to_text_async(http_res)
3466
- raise models.APIError(
3467
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3468
- http_res.status_code,
3469
- http_res_text,
3470
- http_res,
3471
- )
3170
+ raise models.APIError("Unexpected response received", http_res)
3472
3171
 
3473
3172
  def unschedule_deletion(
3474
3173
  self,
@@ -3529,6 +3228,7 @@ class ServersSDK(BaseSDK):
3529
3228
 
3530
3229
  http_res = self.do_request(
3531
3230
  hook_ctx=HookContext(
3231
+ config=self.sdk_configuration,
3532
3232
  base_url=base_url or "",
3533
3233
  operation_id="server-unschedule-deletion",
3534
3234
  oauth2_scopes=[],
@@ -3545,27 +3245,16 @@ class ServersSDK(BaseSDK):
3545
3245
  if utils.match_response(http_res, "204", "*"):
3546
3246
  return
3547
3247
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
3548
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3549
- raise models.ErrorObject(data=response_data)
3248
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
3249
+ raise models.ErrorObject(response_data, http_res)
3550
3250
  if utils.match_response(http_res, "4XX", "*"):
3551
3251
  http_res_text = utils.stream_to_text(http_res)
3552
- raise models.APIError(
3553
- "API error occurred", http_res.status_code, http_res_text, http_res
3554
- )
3252
+ raise models.APIError("API error occurred", http_res, http_res_text)
3555
3253
  if utils.match_response(http_res, "5XX", "*"):
3556
3254
  http_res_text = utils.stream_to_text(http_res)
3557
- raise models.APIError(
3558
- "API error occurred", http_res.status_code, http_res_text, http_res
3559
- )
3255
+ raise models.APIError("API error occurred", http_res, http_res_text)
3560
3256
 
3561
- content_type = http_res.headers.get("Content-Type")
3562
- http_res_text = utils.stream_to_text(http_res)
3563
- raise models.APIError(
3564
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3565
- http_res.status_code,
3566
- http_res_text,
3567
- http_res,
3568
- )
3257
+ raise models.APIError("Unexpected response received", http_res)
3569
3258
 
3570
3259
  async def unschedule_deletion_async(
3571
3260
  self,
@@ -3626,6 +3315,7 @@ class ServersSDK(BaseSDK):
3626
3315
 
3627
3316
  http_res = await self.do_request_async(
3628
3317
  hook_ctx=HookContext(
3318
+ config=self.sdk_configuration,
3629
3319
  base_url=base_url or "",
3630
3320
  operation_id="server-unschedule-deletion",
3631
3321
  oauth2_scopes=[],
@@ -3642,27 +3332,16 @@ class ServersSDK(BaseSDK):
3642
3332
  if utils.match_response(http_res, "204", "*"):
3643
3333
  return
3644
3334
  if utils.match_response(http_res, "403", "application/vnd.api+json"):
3645
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3646
- raise models.ErrorObject(data=response_data)
3335
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
3336
+ raise models.ErrorObject(response_data, http_res)
3647
3337
  if utils.match_response(http_res, "4XX", "*"):
3648
3338
  http_res_text = await utils.stream_to_text_async(http_res)
3649
- raise models.APIError(
3650
- "API error occurred", http_res.status_code, http_res_text, http_res
3651
- )
3339
+ raise models.APIError("API error occurred", http_res, http_res_text)
3652
3340
  if utils.match_response(http_res, "5XX", "*"):
3653
3341
  http_res_text = await utils.stream_to_text_async(http_res)
3654
- raise models.APIError(
3655
- "API error occurred", http_res.status_code, http_res_text, http_res
3656
- )
3342
+ raise models.APIError("API error occurred", http_res, http_res_text)
3657
3343
 
3658
- content_type = http_res.headers.get("Content-Type")
3659
- http_res_text = await utils.stream_to_text_async(http_res)
3660
- raise models.APIError(
3661
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3662
- http_res.status_code,
3663
- http_res_text,
3664
- http_res,
3665
- )
3344
+ raise models.APIError("Unexpected response received", http_res)
3666
3345
 
3667
3346
  def reinstall(
3668
3347
  self,
@@ -3738,6 +3417,7 @@ class ServersSDK(BaseSDK):
3738
3417
 
3739
3418
  http_res = self.do_request(
3740
3419
  hook_ctx=HookContext(
3420
+ config=self.sdk_configuration,
3741
3421
  base_url=base_url or "",
3742
3422
  operation_id="create-server-reinstall",
3743
3423
  oauth2_scopes=[],
@@ -3756,30 +3436,19 @@ class ServersSDK(BaseSDK):
3756
3436
  if utils.match_response(
3757
3437
  http_res, ["403", "404", "422"], "application/vnd.api+json"
3758
3438
  ):
3759
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3760
- raise models.ErrorObject(data=response_data)
3439
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
3440
+ raise models.ErrorObject(response_data, http_res)
3761
3441
  if utils.match_response(http_res, "423", "application/vnd.api+json"):
3762
- response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
3763
- raise models.ServerError(data=response_data)
3442
+ response_data = unmarshal_json_response(models.ServerErrorData, http_res)
3443
+ raise models.ServerError(response_data, http_res)
3764
3444
  if utils.match_response(http_res, "4XX", "*"):
3765
3445
  http_res_text = utils.stream_to_text(http_res)
3766
- raise models.APIError(
3767
- "API error occurred", http_res.status_code, http_res_text, http_res
3768
- )
3446
+ raise models.APIError("API error occurred", http_res, http_res_text)
3769
3447
  if utils.match_response(http_res, "5XX", "*"):
3770
3448
  http_res_text = utils.stream_to_text(http_res)
3771
- raise models.APIError(
3772
- "API error occurred", http_res.status_code, http_res_text, http_res
3773
- )
3449
+ raise models.APIError("API error occurred", http_res, http_res_text)
3774
3450
 
3775
- content_type = http_res.headers.get("Content-Type")
3776
- http_res_text = utils.stream_to_text(http_res)
3777
- raise models.APIError(
3778
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3779
- http_res.status_code,
3780
- http_res_text,
3781
- http_res,
3782
- )
3451
+ raise models.APIError("Unexpected response received", http_res)
3783
3452
 
3784
3453
  async def reinstall_async(
3785
3454
  self,
@@ -3855,6 +3524,7 @@ class ServersSDK(BaseSDK):
3855
3524
 
3856
3525
  http_res = await self.do_request_async(
3857
3526
  hook_ctx=HookContext(
3527
+ config=self.sdk_configuration,
3858
3528
  base_url=base_url or "",
3859
3529
  operation_id="create-server-reinstall",
3860
3530
  oauth2_scopes=[],
@@ -3873,27 +3543,16 @@ class ServersSDK(BaseSDK):
3873
3543
  if utils.match_response(
3874
3544
  http_res, ["403", "404", "422"], "application/vnd.api+json"
3875
3545
  ):
3876
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
3877
- raise models.ErrorObject(data=response_data)
3546
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
3547
+ raise models.ErrorObject(response_data, http_res)
3878
3548
  if utils.match_response(http_res, "423", "application/vnd.api+json"):
3879
- response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
3880
- raise models.ServerError(data=response_data)
3549
+ response_data = unmarshal_json_response(models.ServerErrorData, http_res)
3550
+ raise models.ServerError(response_data, http_res)
3881
3551
  if utils.match_response(http_res, "4XX", "*"):
3882
3552
  http_res_text = await utils.stream_to_text_async(http_res)
3883
- raise models.APIError(
3884
- "API error occurred", http_res.status_code, http_res_text, http_res
3885
- )
3553
+ raise models.APIError("API error occurred", http_res, http_res_text)
3886
3554
  if utils.match_response(http_res, "5XX", "*"):
3887
3555
  http_res_text = await utils.stream_to_text_async(http_res)
3888
- raise models.APIError(
3889
- "API error occurred", http_res.status_code, http_res_text, http_res
3890
- )
3556
+ raise models.APIError("API error occurred", http_res, http_res_text)
3891
3557
 
3892
- content_type = http_res.headers.get("Content-Type")
3893
- http_res_text = await utils.stream_to_text_async(http_res)
3894
- raise models.APIError(
3895
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3896
- http_res.status_code,
3897
- http_res_text,
3898
- http_res,
3899
- )
3558
+ raise models.APIError("Unexpected response received", http_res)