latitudesh-python-sdk 1.0.0__py3-none-any.whl → 2.0.0__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 (96) 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 +22 -18
  4. latitudesh_python_sdk/basesdk.py +12 -20
  5. latitudesh_python_sdk/billing.py +2 -0
  6. latitudesh_python_sdk/events_sdk.py +86 -5
  7. latitudesh_python_sdk/firewalls_sdk.py +146 -9
  8. latitudesh_python_sdk/httpclient.py +6 -16
  9. latitudesh_python_sdk/ipaddresses_sdk.py +82 -5
  10. latitudesh_python_sdk/models/__init__.py +2597 -1071
  11. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +2 -2
  12. latitudesh_python_sdk/models/{bandwidth_plan.py → bandwidth_plan_data.py} +9 -9
  13. latitudesh_python_sdk/models/bandwidth_plans.py +14 -3
  14. latitudesh_python_sdk/models/billing_usage.py +3 -0
  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/event_data.py +98 -0
  21. latitudesh_python_sdk/models/events.py +16 -1
  22. latitudesh_python_sdk/models/filesystem_data.py +4 -0
  23. latitudesh_python_sdk/models/firewall.py +15 -0
  24. latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
  25. latitudesh_python_sdk/models/firewall_assignments.py +29 -0
  26. latitudesh_python_sdk/models/firewall_data.py +71 -0
  27. latitudesh_python_sdk/models/firewall_server.py +4 -1
  28. latitudesh_python_sdk/models/firewalls.py +7 -7
  29. latitudesh_python_sdk/models/get_bandwidth_plansop.py +30 -1
  30. latitudesh_python_sdk/models/get_eventsop.py +29 -1
  31. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +37 -2
  32. latitudesh_python_sdk/models/get_ipsop.py +30 -1
  33. latitudesh_python_sdk/models/get_plans_operating_systemop.py +37 -2
  34. latitudesh_python_sdk/models/get_projectsop.py +30 -1
  35. latitudesh_python_sdk/models/get_regionsop.py +42 -0
  36. latitudesh_python_sdk/models/get_rolesop.py +37 -2
  37. latitudesh_python_sdk/models/get_serversop.py +30 -1
  38. latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
  39. latitudesh_python_sdk/models/get_ssh_keysop.py +22 -0
  40. latitudesh_python_sdk/models/get_team_membersop.py +42 -0
  41. latitudesh_python_sdk/models/get_traffic_consumptionop.py +8 -4
  42. latitudesh_python_sdk/models/get_user_dataop.py +31 -0
  43. latitudesh_python_sdk/models/get_users_dataop.py +35 -0
  44. latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +33 -1
  45. latitudesh_python_sdk/models/get_virtual_networksop.py +30 -1
  46. latitudesh_python_sdk/models/list_firewallsop.py +30 -1
  47. latitudesh_python_sdk/models/operating_system_data.py +65 -0
  48. latitudesh_python_sdk/models/operating_systems.py +15 -0
  49. latitudesh_python_sdk/models/out_of_band_connection.py +4 -4
  50. latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
  51. latitudesh_python_sdk/models/post_ssh_keyop.py +58 -0
  52. latitudesh_python_sdk/models/post_user_dataop.py +45 -0
  53. latitudesh_python_sdk/models/project_include.py +3 -0
  54. latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
  55. latitudesh_python_sdk/models/role.py +11 -0
  56. latitudesh_python_sdk/models/server_data.py +8 -0
  57. latitudesh_python_sdk/models/{ssh_key.py → ssh_keys.py} +13 -2
  58. latitudesh_python_sdk/models/storage_plan_data.py +47 -0
  59. latitudesh_python_sdk/models/storage_plans.py +14 -3
  60. latitudesh_python_sdk/models/update_serverop.py +60 -10
  61. latitudesh_python_sdk/models/user_data.py +11 -0
  62. latitudesh_python_sdk/models/virtual_network.py +19 -1
  63. latitudesh_python_sdk/models/virtual_network1.py +15 -0
  64. latitudesh_python_sdk/models/virtual_network_assignment.py +41 -0
  65. latitudesh_python_sdk/models/virtual_network_assignment_data.py +68 -0
  66. latitudesh_python_sdk/models/virtual_network_assignments.py +5 -5
  67. latitudesh_python_sdk/models/virtual_network_data.py +88 -0
  68. latitudesh_python_sdk/models/virtual_networks.py +3 -3
  69. latitudesh_python_sdk/operatingsystems_sdk.py +78 -9
  70. latitudesh_python_sdk/plans.py +109 -30
  71. latitudesh_python_sdk/privatenetworks.py +185 -36
  72. latitudesh_python_sdk/projects_sdk.py +113 -32
  73. latitudesh_python_sdk/regions_sdk.py +78 -7
  74. latitudesh_python_sdk/roles.py +78 -7
  75. latitudesh_python_sdk/sdk.py +110 -73
  76. latitudesh_python_sdk/sdkconfiguration.py +0 -7
  77. latitudesh_python_sdk/servers_sdk.py +195 -50
  78. latitudesh_python_sdk/{sshkeys.py → sshkeys_sdk.py} +1030 -5
  79. latitudesh_python_sdk/storage.py +8 -0
  80. latitudesh_python_sdk/tags.py +30 -22
  81. latitudesh_python_sdk/teams_sdk.py +6 -0
  82. latitudesh_python_sdk/teamsmembers.py +80 -7
  83. latitudesh_python_sdk/traffic_sdk.py +12 -8
  84. latitudesh_python_sdk/userdata_sdk.py +1029 -0
  85. latitudesh_python_sdk/userprofile.py +6 -0
  86. latitudesh_python_sdk/utils/__init__.py +131 -45
  87. latitudesh_python_sdk/utils/datetimes.py +23 -0
  88. latitudesh_python_sdk/utils/forms.py +49 -28
  89. latitudesh_python_sdk/utils/serializers.py +32 -3
  90. latitudesh_python_sdk/virtualmachines.py +36 -18
  91. latitudesh_python_sdk/vpnsessions.py +38 -26
  92. {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/METADATA +58 -22
  93. {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/RECORD +95 -73
  94. {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/WHEEL +1 -1
  95. latitudesh_python_sdk/models/storage_plan.py +0 -36
  96. {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/LICENSE +0 -0
@@ -62,6 +62,7 @@ class UserProfile(BaseSDK):
62
62
 
63
63
  http_res = self.do_request(
64
64
  hook_ctx=HookContext(
65
+ config=self.sdk_configuration,
65
66
  base_url=base_url or "",
66
67
  operation_id="get-user-profile",
67
68
  oauth2_scopes=[],
@@ -151,6 +152,7 @@ class UserProfile(BaseSDK):
151
152
 
152
153
  http_res = await self.do_request_async(
153
154
  hook_ctx=HookContext(
155
+ config=self.sdk_configuration,
154
156
  base_url=base_url or "",
155
157
  operation_id="get-user-profile",
156
158
  oauth2_scopes=[],
@@ -264,6 +266,7 @@ class UserProfile(BaseSDK):
264
266
 
265
267
  http_res = self.do_request(
266
268
  hook_ctx=HookContext(
269
+ config=self.sdk_configuration,
267
270
  base_url=base_url or "",
268
271
  operation_id="patch-user-profile",
269
272
  oauth2_scopes=[],
@@ -381,6 +384,7 @@ class UserProfile(BaseSDK):
381
384
 
382
385
  http_res = await self.do_request_async(
383
386
  hook_ctx=HookContext(
387
+ config=self.sdk_configuration,
384
388
  base_url=base_url or "",
385
389
  operation_id="patch-user-profile",
386
390
  oauth2_scopes=[],
@@ -474,6 +478,7 @@ class UserProfile(BaseSDK):
474
478
 
475
479
  http_res = self.do_request(
476
480
  hook_ctx=HookContext(
481
+ config=self.sdk_configuration,
477
482
  base_url=base_url or "",
478
483
  operation_id="get-user-teams",
479
484
  oauth2_scopes=[],
@@ -561,6 +566,7 @@ class UserProfile(BaseSDK):
561
566
 
562
567
  http_res = await self.do_request_async(
563
568
  hook_ctx=HookContext(
569
+ config=self.sdk_configuration,
564
570
  base_url=base_url or "",
565
571
  operation_id="get-user-teams",
566
572
  oauth2_scopes=[],
@@ -1,51 +1,56 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
- from .annotations import get_discriminator
4
- from .enums import OpenEnumMeta
5
- from .headers import get_headers, get_response_headers
6
- from .metadata import (
7
- FieldMetadata,
8
- find_metadata,
9
- FormMetadata,
10
- HeaderMetadata,
11
- MultipartFormMetadata,
12
- PathParamMetadata,
13
- QueryParamMetadata,
14
- RequestMetadata,
15
- SecurityMetadata,
16
- )
17
- from .queryparams import get_query_params
18
- from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
19
- from .requestbodies import serialize_request_body, SerializedRequestBody
20
- from .security import get_security, get_security_from_env
3
+ from typing import TYPE_CHECKING
4
+ from importlib import import_module
21
5
 
22
- from .serializers import (
23
- get_pydantic_model,
24
- marshal_json,
25
- unmarshal,
26
- unmarshal_json,
27
- serialize_decimal,
28
- serialize_float,
29
- serialize_int,
30
- stream_to_text,
31
- stream_to_text_async,
32
- stream_to_bytes,
33
- stream_to_bytes_async,
34
- validate_const,
35
- validate_decimal,
36
- validate_float,
37
- validate_int,
38
- validate_open_enum,
39
- )
40
- from .url import generate_url, template_url, remove_suffix
41
- from .values import (
42
- get_global_from_env,
43
- match_content_type,
44
- match_status_codes,
45
- match_response,
46
- cast_partial,
47
- )
48
- from .logger import Logger, get_body_content, get_default_logger
6
+ if TYPE_CHECKING:
7
+ from .annotations import get_discriminator
8
+ from .datetimes import parse_datetime
9
+ from .enums import OpenEnumMeta
10
+ from .headers import get_headers, get_response_headers
11
+ from .metadata import (
12
+ FieldMetadata,
13
+ find_metadata,
14
+ FormMetadata,
15
+ HeaderMetadata,
16
+ MultipartFormMetadata,
17
+ PathParamMetadata,
18
+ QueryParamMetadata,
19
+ RequestMetadata,
20
+ SecurityMetadata,
21
+ )
22
+ from .queryparams import get_query_params
23
+ from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
24
+ from .requestbodies import serialize_request_body, SerializedRequestBody
25
+ from .security import get_security, get_security_from_env
26
+
27
+ from .serializers import (
28
+ get_pydantic_model,
29
+ marshal_json,
30
+ unmarshal,
31
+ unmarshal_json,
32
+ serialize_decimal,
33
+ serialize_float,
34
+ serialize_int,
35
+ stream_to_text,
36
+ stream_to_text_async,
37
+ stream_to_bytes,
38
+ stream_to_bytes_async,
39
+ validate_const,
40
+ validate_decimal,
41
+ validate_float,
42
+ validate_int,
43
+ validate_open_enum,
44
+ )
45
+ from .url import generate_url, template_url, remove_suffix
46
+ from .values import (
47
+ get_global_from_env,
48
+ match_content_type,
49
+ match_status_codes,
50
+ match_response,
51
+ cast_partial,
52
+ )
53
+ from .logger import Logger, get_body_content, get_default_logger
49
54
 
50
55
  __all__ = [
51
56
  "BackoffStrategy",
@@ -56,6 +61,7 @@ __all__ = [
56
61
  "get_body_content",
57
62
  "get_default_logger",
58
63
  "get_discriminator",
64
+ "parse_datetime",
59
65
  "get_global_from_env",
60
66
  "get_headers",
61
67
  "get_pydantic_model",
@@ -99,3 +105,83 @@ __all__ = [
99
105
  "validate_open_enum",
100
106
  "cast_partial",
101
107
  ]
108
+
109
+ _dynamic_imports: dict[str, str] = {
110
+ "BackoffStrategy": ".retries",
111
+ "FieldMetadata": ".metadata",
112
+ "find_metadata": ".metadata",
113
+ "FormMetadata": ".metadata",
114
+ "generate_url": ".url",
115
+ "get_body_content": ".logger",
116
+ "get_default_logger": ".logger",
117
+ "get_discriminator": ".annotations",
118
+ "parse_datetime": ".datetimes",
119
+ "get_global_from_env": ".values",
120
+ "get_headers": ".headers",
121
+ "get_pydantic_model": ".serializers",
122
+ "get_query_params": ".queryparams",
123
+ "get_response_headers": ".headers",
124
+ "get_security": ".security",
125
+ "get_security_from_env": ".security",
126
+ "HeaderMetadata": ".metadata",
127
+ "Logger": ".logger",
128
+ "marshal_json": ".serializers",
129
+ "match_content_type": ".values",
130
+ "match_status_codes": ".values",
131
+ "match_response": ".values",
132
+ "MultipartFormMetadata": ".metadata",
133
+ "OpenEnumMeta": ".enums",
134
+ "PathParamMetadata": ".metadata",
135
+ "QueryParamMetadata": ".metadata",
136
+ "remove_suffix": ".url",
137
+ "Retries": ".retries",
138
+ "retry": ".retries",
139
+ "retry_async": ".retries",
140
+ "RetryConfig": ".retries",
141
+ "RequestMetadata": ".metadata",
142
+ "SecurityMetadata": ".metadata",
143
+ "serialize_decimal": ".serializers",
144
+ "serialize_float": ".serializers",
145
+ "serialize_int": ".serializers",
146
+ "serialize_request_body": ".requestbodies",
147
+ "SerializedRequestBody": ".requestbodies",
148
+ "stream_to_text": ".serializers",
149
+ "stream_to_text_async": ".serializers",
150
+ "stream_to_bytes": ".serializers",
151
+ "stream_to_bytes_async": ".serializers",
152
+ "template_url": ".url",
153
+ "unmarshal": ".serializers",
154
+ "unmarshal_json": ".serializers",
155
+ "validate_decimal": ".serializers",
156
+ "validate_const": ".serializers",
157
+ "validate_float": ".serializers",
158
+ "validate_int": ".serializers",
159
+ "validate_open_enum": ".serializers",
160
+ "cast_partial": ".values",
161
+ }
162
+
163
+
164
+ def __getattr__(attr_name: str) -> object:
165
+ module_name = _dynamic_imports.get(attr_name)
166
+ if module_name is None:
167
+ raise AttributeError(
168
+ f"no {attr_name} found in _dynamic_imports, module name -> {__name__} "
169
+ )
170
+
171
+ try:
172
+ module = import_module(module_name, __package__)
173
+ result = getattr(module, attr_name)
174
+ return result
175
+ except ImportError as e:
176
+ raise ImportError(
177
+ f"Failed to import {attr_name} from {module_name}: {e}"
178
+ ) from e
179
+ except AttributeError as e:
180
+ raise AttributeError(
181
+ f"Failed to get {attr_name} from {module_name}: {e}"
182
+ ) from e
183
+
184
+
185
+ def __dir__():
186
+ lazy_attrs = list(_dynamic_imports.keys())
187
+ return sorted(lazy_attrs)
@@ -0,0 +1,23 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from datetime import datetime
4
+ import sys
5
+
6
+
7
+ def parse_datetime(datetime_string: str) -> datetime:
8
+ """
9
+ Convert a RFC 3339 / ISO 8601 formatted string into a datetime object.
10
+ Python versions 3.11 and later support parsing RFC 3339 directly with
11
+ datetime.fromisoformat(), but for earlier versions, this function
12
+ encapsulates the necessary extra logic.
13
+ """
14
+ # Python 3.11 and later can parse RFC 3339 directly
15
+ if sys.version_info >= (3, 11):
16
+ return datetime.fromisoformat(datetime_string)
17
+
18
+ # For Python 3.10 and earlier, a common ValueError is trailing 'Z' suffix,
19
+ # so fix that upfront.
20
+ if datetime_string.endswith("Z"):
21
+ datetime_string = datetime_string[:-1] + "+00:00"
22
+
23
+ return datetime.fromisoformat(datetime_string)
@@ -86,11 +86,39 @@ def _populate_form(
86
86
  return form
87
87
 
88
88
 
89
+ def _extract_file_properties(file_obj: Any) -> Tuple[str, Any, Any]:
90
+ """Extract file name, content, and content type from a file object."""
91
+ file_fields: Dict[str, FieldInfo] = file_obj.__class__.model_fields
92
+
93
+ file_name = ""
94
+ content = None
95
+ content_type = None
96
+
97
+ for file_field_name in file_fields:
98
+ file_field = file_fields[file_field_name]
99
+
100
+ file_metadata = find_field_metadata(file_field, MultipartFormMetadata)
101
+ if file_metadata is None:
102
+ continue
103
+
104
+ if file_metadata.content:
105
+ content = getattr(file_obj, file_field_name, None)
106
+ elif file_field_name == "content_type":
107
+ content_type = getattr(file_obj, file_field_name, None)
108
+ else:
109
+ file_name = getattr(file_obj, file_field_name)
110
+
111
+ if file_name == "" or content is None:
112
+ raise ValueError("invalid multipart/form-data file")
113
+
114
+ return file_name, content, content_type
115
+
116
+
89
117
  def serialize_multipart_form(
90
118
  media_type: str, request: Any
91
- ) -> Tuple[str, Dict[str, Any], Dict[str, Any]]:
119
+ ) -> Tuple[str, Dict[str, Any], List[Tuple[str, Any]]]:
92
120
  form: Dict[str, Any] = {}
93
- files: Dict[str, Any] = {}
121
+ files: List[Tuple[str, Any]] = []
94
122
 
95
123
  if not isinstance(request, BaseModel):
96
124
  raise TypeError("invalid request body type")
@@ -112,39 +140,32 @@ def serialize_multipart_form(
112
140
  f_name = field.alias if field.alias else name
113
141
 
114
142
  if field_metadata.file:
115
- file_fields: Dict[str, FieldInfo] = val.__class__.model_fields
116
-
117
- file_name = ""
118
- content = None
119
- content_type = None
120
-
121
- for file_field_name in file_fields:
122
- file_field = file_fields[file_field_name]
143
+ if isinstance(val, List):
144
+ # Handle array of files
145
+ for file_obj in val:
146
+ if not _is_set(file_obj):
147
+ continue
148
+
149
+ file_name, content, content_type = _extract_file_properties(file_obj)
123
150
 
124
- file_metadata = find_field_metadata(file_field, MultipartFormMetadata)
125
- if file_metadata is None:
126
- continue
151
+ if content_type is not None:
152
+ files.append((f_name + "[]", (file_name, content, content_type)))
153
+ else:
154
+ files.append((f_name + "[]", (file_name, content)))
155
+ else:
156
+ # Handle single file
157
+ file_name, content, content_type = _extract_file_properties(val)
127
158
 
128
- if file_metadata.content:
129
- content = getattr(val, file_field_name, None)
130
- elif file_field_name == "content_type":
131
- content_type = getattr(val, file_field_name, None)
159
+ if content_type is not None:
160
+ files.append((f_name, (file_name, content, content_type)))
132
161
  else:
133
- file_name = getattr(val, file_field_name)
134
-
135
- if file_name == "" or content is None:
136
- raise ValueError("invalid multipart/form-data file")
137
-
138
- if content_type is not None:
139
- files[f_name] = (file_name, content, content_type)
140
- else:
141
- files[f_name] = (file_name, content)
162
+ files.append((f_name, (file_name, content)))
142
163
  elif field_metadata.json:
143
- files[f_name] = (
164
+ files.append((f_name, (
144
165
  None,
145
166
  marshal_json(val, request_field_types[name]),
146
167
  "application/json",
147
- )
168
+ )))
148
169
  else:
149
170
  if isinstance(val, List):
150
171
  values = []
@@ -1,13 +1,16 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from decimal import Decimal
4
+ import functools
4
5
  import json
5
- from typing import Any, Dict, List, Union, get_args
6
- import httpx
6
+ import typing
7
+ from typing import Any, Dict, List, Tuple, Union, get_args
8
+ import typing_extensions
7
9
  from typing_extensions import get_origin
10
+
11
+ import httpx
8
12
  from pydantic import ConfigDict, create_model
9
13
  from pydantic_core import from_json
10
- from typing_inspection.typing_objects import is_union
11
14
 
12
15
  from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset
13
16
 
@@ -185,6 +188,13 @@ def is_nullable(field):
185
188
  return False
186
189
 
187
190
 
191
+ def is_union(obj: object) -> bool:
192
+ """
193
+ Returns True if the given object is a typing.Union or typing_extensions.Union.
194
+ """
195
+ return any(obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union"))
196
+
197
+
188
198
  def stream_to_text(stream: httpx.Response) -> str:
189
199
  return "".join(stream.iter_text())
190
200
 
@@ -217,3 +227,22 @@ def _contains_pydantic_model(data: Any) -> bool:
217
227
  return any(_contains_pydantic_model(value) for value in data.values())
218
228
 
219
229
  return False
230
+
231
+
232
+ @functools.cache
233
+ def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]:
234
+ """
235
+ Get typing objects by name from typing and typing_extensions.
236
+ Reference: https://typing-extensions.readthedocs.io/en/latest/#runtime-use-of-types
237
+ """
238
+ result = tuple(
239
+ getattr(module, name)
240
+ for module in (typing, typing_extensions)
241
+ if hasattr(module, name)
242
+ )
243
+ if not result:
244
+ raise ValueError(
245
+ f"Neither typing nor typing_extensions has an object called {name!r}"
246
+ )
247
+ return result
248
+
@@ -3,18 +3,21 @@
3
3
  from .basesdk import BaseSDK
4
4
  from latitudesh_python_sdk import models, utils
5
5
  from latitudesh_python_sdk._hooks import HookContext
6
- from latitudesh_python_sdk.types import BaseModel, OptionalNullable, UNSET
6
+ from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
7
  from latitudesh_python_sdk.utils import get_security_from_env
8
- from typing import Mapping, Optional, Union, cast
8
+ from typing import Mapping, Optional, Union
9
9
 
10
10
 
11
11
  class VirtualMachines(BaseSDK):
12
12
  def create(
13
13
  self,
14
14
  *,
15
- request: Union[
16
- models.VirtualMachinePayload, models.VirtualMachinePayloadTypedDict
17
- ] = models.VirtualMachinePayload(),
15
+ data: Optional[
16
+ Union[
17
+ models.VirtualMachinePayloadData,
18
+ models.VirtualMachinePayloadDataTypedDict,
19
+ ]
20
+ ] = None,
18
21
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
22
  server_url: Optional[str] = None,
20
23
  timeout_ms: Optional[int] = None,
@@ -25,7 +28,7 @@ class VirtualMachines(BaseSDK):
25
28
  Creates a new Virtual Machine.
26
29
 
27
30
 
28
- :param request: The request object to send.
31
+ :param data:
29
32
  :param retries: Override the default retry configuration for this method
30
33
  :param server_url: Override the default server URL for this method
31
34
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -41,9 +44,11 @@ class VirtualMachines(BaseSDK):
41
44
  else:
42
45
  base_url = self._get_url(base_url, url_variables)
43
46
 
44
- if not isinstance(request, BaseModel):
45
- request = utils.unmarshal(request, models.VirtualMachinePayload)
46
- request = cast(models.VirtualMachinePayload, request)
47
+ request = models.VirtualMachinePayload(
48
+ data=utils.get_pydantic_model(
49
+ data, Optional[models.VirtualMachinePayloadData]
50
+ ),
51
+ )
47
52
 
48
53
  req = self._build_request(
49
54
  method="POST",
@@ -59,7 +64,7 @@ class VirtualMachines(BaseSDK):
59
64
  http_headers=http_headers,
60
65
  security=self.sdk_configuration.security,
61
66
  get_serialized_body=lambda: utils.serialize_request_body(
62
- request, False, True, "json", Optional[models.VirtualMachinePayload]
67
+ request, False, False, "json", models.VirtualMachinePayload
63
68
  ),
64
69
  timeout_ms=timeout_ms,
65
70
  )
@@ -74,6 +79,7 @@ class VirtualMachines(BaseSDK):
74
79
 
75
80
  http_res = self.do_request(
76
81
  hook_ctx=HookContext(
82
+ config=self.sdk_configuration,
77
83
  base_url=base_url or "",
78
84
  operation_id="create-virtual-machine",
79
85
  oauth2_scopes=[],
@@ -111,9 +117,12 @@ class VirtualMachines(BaseSDK):
111
117
  async def create_async(
112
118
  self,
113
119
  *,
114
- request: Union[
115
- models.VirtualMachinePayload, models.VirtualMachinePayloadTypedDict
116
- ] = models.VirtualMachinePayload(),
120
+ data: Optional[
121
+ Union[
122
+ models.VirtualMachinePayloadData,
123
+ models.VirtualMachinePayloadDataTypedDict,
124
+ ]
125
+ ] = None,
117
126
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
118
127
  server_url: Optional[str] = None,
119
128
  timeout_ms: Optional[int] = None,
@@ -124,7 +133,7 @@ class VirtualMachines(BaseSDK):
124
133
  Creates a new Virtual Machine.
125
134
 
126
135
 
127
- :param request: The request object to send.
136
+ :param data:
128
137
  :param retries: Override the default retry configuration for this method
129
138
  :param server_url: Override the default server URL for this method
130
139
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -140,9 +149,11 @@ class VirtualMachines(BaseSDK):
140
149
  else:
141
150
  base_url = self._get_url(base_url, url_variables)
142
151
 
143
- if not isinstance(request, BaseModel):
144
- request = utils.unmarshal(request, models.VirtualMachinePayload)
145
- request = cast(models.VirtualMachinePayload, request)
152
+ request = models.VirtualMachinePayload(
153
+ data=utils.get_pydantic_model(
154
+ data, Optional[models.VirtualMachinePayloadData]
155
+ ),
156
+ )
146
157
 
147
158
  req = self._build_request_async(
148
159
  method="POST",
@@ -158,7 +169,7 @@ class VirtualMachines(BaseSDK):
158
169
  http_headers=http_headers,
159
170
  security=self.sdk_configuration.security,
160
171
  get_serialized_body=lambda: utils.serialize_request_body(
161
- request, False, True, "json", Optional[models.VirtualMachinePayload]
172
+ request, False, False, "json", models.VirtualMachinePayload
162
173
  ),
163
174
  timeout_ms=timeout_ms,
164
175
  )
@@ -173,6 +184,7 @@ class VirtualMachines(BaseSDK):
173
184
 
174
185
  http_res = await self.do_request_async(
175
186
  hook_ctx=HookContext(
187
+ config=self.sdk_configuration,
176
188
  base_url=base_url or "",
177
189
  operation_id="create-virtual-machine",
178
190
  oauth2_scopes=[],
@@ -267,6 +279,7 @@ class VirtualMachines(BaseSDK):
267
279
 
268
280
  http_res = self.do_request(
269
281
  hook_ctx=HookContext(
282
+ config=self.sdk_configuration,
270
283
  base_url=base_url or "",
271
284
  operation_id="index-virtual-machine",
272
285
  oauth2_scopes=[],
@@ -361,6 +374,7 @@ class VirtualMachines(BaseSDK):
361
374
 
362
375
  http_res = await self.do_request_async(
363
376
  hook_ctx=HookContext(
377
+ config=self.sdk_configuration,
364
378
  base_url=base_url or "",
365
379
  operation_id="index-virtual-machine",
366
380
  oauth2_scopes=[],
@@ -455,6 +469,7 @@ class VirtualMachines(BaseSDK):
455
469
 
456
470
  http_res = self.do_request(
457
471
  hook_ctx=HookContext(
472
+ config=self.sdk_configuration,
458
473
  base_url=base_url or "",
459
474
  operation_id="show-virtual-machine",
460
475
  oauth2_scopes=[],
@@ -549,6 +564,7 @@ class VirtualMachines(BaseSDK):
549
564
 
550
565
  http_res = await self.do_request_async(
551
566
  hook_ctx=HookContext(
567
+ config=self.sdk_configuration,
552
568
  base_url=base_url or "",
553
569
  operation_id="show-virtual-machine",
554
570
  oauth2_scopes=[],
@@ -643,6 +659,7 @@ class VirtualMachines(BaseSDK):
643
659
 
644
660
  http_res = self.do_request(
645
661
  hook_ctx=HookContext(
662
+ config=self.sdk_configuration,
646
663
  base_url=base_url or "",
647
664
  operation_id="destroy-virtual-machine",
648
665
  oauth2_scopes=[],
@@ -737,6 +754,7 @@ class VirtualMachines(BaseSDK):
737
754
 
738
755
  http_res = await self.do_request_async(
739
756
  hook_ctx=HookContext(
757
+ config=self.sdk_configuration,
740
758
  base_url=base_url or "",
741
759
  operation_id="destroy-virtual-machine",
742
760
  oauth2_scopes=[],