latitudesh-python-sdk 0.0.6__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.
- latitudesh_python_sdk/__init__.py +18 -0
- latitudesh_python_sdk/_hooks/__init__.py +5 -0
- latitudesh_python_sdk/_hooks/registration.py +13 -0
- latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
- latitudesh_python_sdk/_hooks/types.py +106 -0
- latitudesh_python_sdk/_version.py +15 -0
- latitudesh_python_sdk/apikeys.py +802 -0
- latitudesh_python_sdk/basesdk.py +366 -0
- latitudesh_python_sdk/billing.py +210 -0
- latitudesh_python_sdk/events_sdk.py +240 -0
- latitudesh_python_sdk/firewalls_sdk.py +1640 -0
- latitudesh_python_sdk/httpclient.py +136 -0
- latitudesh_python_sdk/ipaddresses_sdk.py +448 -0
- latitudesh_python_sdk/models/__init__.py +1927 -0
- latitudesh_python_sdk/models/api_key.py +81 -0
- latitudesh_python_sdk/models/apierror.py +22 -0
- latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
- latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
- latitudesh_python_sdk/models/bandwidth_plan.py +72 -0
- latitudesh_python_sdk/models/bandwidth_plans.py +15 -0
- latitudesh_python_sdk/models/billing_usage.py +158 -0
- latitudesh_python_sdk/models/create_api_key.py +40 -0
- latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
- latitudesh_python_sdk/models/create_firewallop.py +69 -0
- latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
- latitudesh_python_sdk/models/create_projectop.py +79 -0
- latitudesh_python_sdk/models/create_server_actionop.py +69 -0
- latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
- latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
- latitudesh_python_sdk/models/create_serverop.py +173 -0
- latitudesh_python_sdk/models/create_tagop.py +50 -0
- latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
- latitudesh_python_sdk/models/custom_tag.py +54 -0
- latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
- latitudesh_python_sdk/models/delete_firewallop.py +18 -0
- latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
- latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
- latitudesh_python_sdk/models/delete_projectop.py +18 -0
- latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
- latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
- latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/deploy_config.py +74 -0
- latitudesh_python_sdk/models/destroy_serverop.py +31 -0
- latitudesh_python_sdk/models/destroy_tagop.py +16 -0
- latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
- latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
- latitudesh_python_sdk/models/error_object.py +49 -0
- latitudesh_python_sdk/models/events.py +90 -0
- latitudesh_python_sdk/models/filesystem_data.py +53 -0
- latitudesh_python_sdk/models/firewall.py +71 -0
- latitudesh_python_sdk/models/firewall_server.py +50 -0
- latitudesh_python_sdk/models/firewalls.py +26 -0
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +33 -0
- latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
- latitudesh_python_sdk/models/get_eventsop.py +98 -0
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +18 -0
- latitudesh_python_sdk/models/get_firewallop.py +18 -0
- latitudesh_python_sdk/models/get_ipop.py +33 -0
- latitudesh_python_sdk/models/get_ipsop.py +91 -0
- latitudesh_python_sdk/models/get_planop.py +16 -0
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +19 -0
- latitudesh_python_sdk/models/get_plansop.py +125 -0
- latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
- latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
- latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
- latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
- latitudesh_python_sdk/models/get_projectsop.py +76 -0
- latitudesh_python_sdk/models/get_regionop.py +18 -0
- latitudesh_python_sdk/models/get_role_idop.py +16 -0
- latitudesh_python_sdk/models/get_rolesop.py +19 -0
- latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
- latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
- latitudesh_python_sdk/models/get_serverop.py +33 -0
- latitudesh_python_sdk/models/get_serversop.py +156 -0
- latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +45 -0
- latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
- latitudesh_python_sdk/models/get_user_profileop.py +19 -0
- latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +40 -0
- latitudesh_python_sdk/models/get_virtual_networksop.py +40 -0
- latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
- latitudesh_python_sdk/models/index_virtual_machineop.py +22 -0
- latitudesh_python_sdk/models/ip_address.py +122 -0
- latitudesh_python_sdk/models/ip_addresses.py +15 -0
- latitudesh_python_sdk/models/ipmi_session.py +53 -0
- latitudesh_python_sdk/models/list_firewallsop.py +20 -0
- latitudesh_python_sdk/models/membership.py +63 -0
- latitudesh_python_sdk/models/operating_systems.py +57 -0
- latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
- latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
- latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
- latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
- latitudesh_python_sdk/models/plan.py +15 -0
- latitudesh_python_sdk/models/plan_data.py +206 -0
- latitudesh_python_sdk/models/post_api_keyop.py +19 -0
- latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
- latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
- latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
- latitudesh_python_sdk/models/post_team_membersop.py +54 -0
- latitudesh_python_sdk/models/post_teamop.py +67 -0
- latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
- latitudesh_python_sdk/models/project.py +130 -0
- latitudesh_python_sdk/models/project_include.py +72 -0
- latitudesh_python_sdk/models/projects.py +15 -0
- latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
- latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
- latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/region.py +50 -0
- latitudesh_python_sdk/models/region_resource_data.py +37 -0
- latitudesh_python_sdk/models/regions.py +50 -0
- latitudesh_python_sdk/models/role.py +15 -0
- latitudesh_python_sdk/models/role_data.py +35 -0
- latitudesh_python_sdk/models/security.py +25 -0
- latitudesh_python_sdk/models/server.py +54 -0
- latitudesh_python_sdk/models/server_action.py +52 -0
- latitudesh_python_sdk/models/server_data.py +219 -0
- latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_lockop.py +16 -0
- latitudesh_python_sdk/models/server_rescue.py +22 -0
- latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
- latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_unlockop.py +16 -0
- latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/servers.py +26 -0
- latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/ssh_key.py +15 -0
- latitudesh_python_sdk/models/ssh_key_data.py +55 -0
- latitudesh_python_sdk/models/storage_plan.py +36 -0
- latitudesh_python_sdk/models/storage_plans.py +15 -0
- latitudesh_python_sdk/models/team.py +74 -0
- latitudesh_python_sdk/models/team_include.py +43 -0
- latitudesh_python_sdk/models/team_members.py +51 -0
- latitudesh_python_sdk/models/teams.py +26 -0
- latitudesh_python_sdk/models/traffic.py +133 -0
- latitudesh_python_sdk/models/traffic_quota.py +106 -0
- latitudesh_python_sdk/models/update_api_key.py +48 -0
- latitudesh_python_sdk/models/update_api_keyop.py +41 -0
- latitudesh_python_sdk/models/update_firewallop.py +89 -0
- latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
- latitudesh_python_sdk/models/update_projectop.py +95 -0
- latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
- latitudesh_python_sdk/models/update_serverop.py +69 -0
- latitudesh_python_sdk/models/update_tagop.py +74 -0
- latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
- latitudesh_python_sdk/models/user.py +59 -0
- latitudesh_python_sdk/models/user_data.py +15 -0
- latitudesh_python_sdk/models/user_data_properties.py +46 -0
- latitudesh_python_sdk/models/user_include.py +52 -0
- latitudesh_python_sdk/models/user_team.py +61 -0
- latitudesh_python_sdk/models/user_teams.py +26 -0
- latitudesh_python_sdk/models/user_update.py +37 -0
- latitudesh_python_sdk/models/virtual_machine.py +25 -0
- latitudesh_python_sdk/models/virtual_machine_payload.py +41 -0
- latitudesh_python_sdk/models/virtual_machine_plans.py +180 -0
- latitudesh_python_sdk/models/virtual_network.py +103 -0
- latitudesh_python_sdk/models/virtual_network1.py +84 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +37 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
- latitudesh_python_sdk/models/virtual_networks.py +26 -0
- latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
- latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
- latitudesh_python_sdk/operatingsystems_sdk.py +188 -0
- latitudesh_python_sdk/plans.py +1178 -0
- latitudesh_python_sdk/privatenetworks.py +1672 -0
- latitudesh_python_sdk/projects_sdk.py +864 -0
- latitudesh_python_sdk/py.typed +1 -0
- latitudesh_python_sdk/regions_sdk.py +376 -0
- latitudesh_python_sdk/roles.py +374 -0
- latitudesh_python_sdk/sdk.py +214 -0
- latitudesh_python_sdk/sdkconfiguration.py +57 -0
- latitudesh_python_sdk/servers_sdk.py +3810 -0
- latitudesh_python_sdk/sshkeys.py +1050 -0
- latitudesh_python_sdk/storage.py +820 -0
- latitudesh_python_sdk/tags.py +786 -0
- latitudesh_python_sdk/teams_sdk.py +596 -0
- latitudesh_python_sdk/teamsmembers.py +578 -0
- latitudesh_python_sdk/traffic_sdk.py +400 -0
- latitudesh_python_sdk/types/__init__.py +21 -0
- latitudesh_python_sdk/types/basemodel.py +39 -0
- latitudesh_python_sdk/userdata_sdk.py +1052 -0
- latitudesh_python_sdk/userprofile.py +596 -0
- latitudesh_python_sdk/utils/__init__.py +101 -0
- latitudesh_python_sdk/utils/annotations.py +55 -0
- latitudesh_python_sdk/utils/enums.py +34 -0
- latitudesh_python_sdk/utils/eventstreaming.py +238 -0
- latitudesh_python_sdk/utils/forms.py +202 -0
- latitudesh_python_sdk/utils/headers.py +136 -0
- latitudesh_python_sdk/utils/logger.py +27 -0
- latitudesh_python_sdk/utils/metadata.py +118 -0
- latitudesh_python_sdk/utils/queryparams.py +205 -0
- latitudesh_python_sdk/utils/requestbodies.py +66 -0
- latitudesh_python_sdk/utils/retries.py +217 -0
- latitudesh_python_sdk/utils/security.py +192 -0
- latitudesh_python_sdk/utils/serializers.py +219 -0
- latitudesh_python_sdk/utils/url.py +155 -0
- latitudesh_python_sdk/utils/values.py +137 -0
- latitudesh_python_sdk/virtualmachines.py +772 -0
- latitudesh_python_sdk/vpnsessions.py +818 -0
- latitudesh_python_sdk-0.0.6.dist-info/LICENSE +21 -0
- latitudesh_python_sdk-0.0.6.dist-info/METADATA +730 -0
- latitudesh_python_sdk-0.0.6.dist-info/RECORD +206 -0
- latitudesh_python_sdk-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from latitudesh_python_sdk import models, utils
|
|
5
|
+
from latitudesh_python_sdk._hooks import HookContext
|
|
6
|
+
from latitudesh_python_sdk.types import BaseModel, OptionalNullable, UNSET
|
|
7
|
+
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
+
from typing import Mapping, Optional, Union, cast
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class VirtualMachines(BaseSDK):
|
|
12
|
+
def create(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
request: Union[
|
|
16
|
+
models.VirtualMachinePayload, models.VirtualMachinePayloadTypedDict
|
|
17
|
+
] = models.VirtualMachinePayload(),
|
|
18
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
19
|
+
server_url: Optional[str] = None,
|
|
20
|
+
timeout_ms: Optional[int] = None,
|
|
21
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
22
|
+
) -> models.VirtualMachine:
|
|
23
|
+
r"""Create a Virtual Machine
|
|
24
|
+
|
|
25
|
+
Creates a new Virtual Machine.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
:param request: The request object to send.
|
|
29
|
+
:param retries: Override the default retry configuration for this method
|
|
30
|
+
:param server_url: Override the default server URL for this method
|
|
31
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
32
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
33
|
+
"""
|
|
34
|
+
base_url = None
|
|
35
|
+
url_variables = None
|
|
36
|
+
if timeout_ms is None:
|
|
37
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
38
|
+
|
|
39
|
+
if server_url is not None:
|
|
40
|
+
base_url = server_url
|
|
41
|
+
else:
|
|
42
|
+
base_url = self._get_url(base_url, url_variables)
|
|
43
|
+
|
|
44
|
+
if not isinstance(request, BaseModel):
|
|
45
|
+
request = utils.unmarshal(request, models.VirtualMachinePayload)
|
|
46
|
+
request = cast(models.VirtualMachinePayload, request)
|
|
47
|
+
|
|
48
|
+
req = self._build_request(
|
|
49
|
+
method="POST",
|
|
50
|
+
path="/virtual_machines",
|
|
51
|
+
base_url=base_url,
|
|
52
|
+
url_variables=url_variables,
|
|
53
|
+
request=request,
|
|
54
|
+
request_body_required=True,
|
|
55
|
+
request_has_path_params=False,
|
|
56
|
+
request_has_query_params=True,
|
|
57
|
+
user_agent_header="user-agent",
|
|
58
|
+
accept_header_value="application/vnd.api+json",
|
|
59
|
+
http_headers=http_headers,
|
|
60
|
+
security=self.sdk_configuration.security,
|
|
61
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
62
|
+
request, False, True, "json", Optional[models.VirtualMachinePayload]
|
|
63
|
+
),
|
|
64
|
+
timeout_ms=timeout_ms,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
if retries == UNSET:
|
|
68
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
69
|
+
retries = self.sdk_configuration.retry_config
|
|
70
|
+
|
|
71
|
+
retry_config = None
|
|
72
|
+
if isinstance(retries, utils.RetryConfig):
|
|
73
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
74
|
+
|
|
75
|
+
http_res = self.do_request(
|
|
76
|
+
hook_ctx=HookContext(
|
|
77
|
+
base_url=base_url or "",
|
|
78
|
+
operation_id="create-virtual-machine",
|
|
79
|
+
oauth2_scopes=[],
|
|
80
|
+
security_source=get_security_from_env(
|
|
81
|
+
self.sdk_configuration.security, models.Security
|
|
82
|
+
),
|
|
83
|
+
),
|
|
84
|
+
request=req,
|
|
85
|
+
error_status_codes=["409", "422", "4XX", "5XX"],
|
|
86
|
+
retry_config=retry_config,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
90
|
+
return utils.unmarshal_json(http_res.text, models.VirtualMachine)
|
|
91
|
+
if utils.match_response(http_res, ["409", "422", "4XX"], "*"):
|
|
92
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
93
|
+
raise models.APIError(
|
|
94
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
95
|
+
)
|
|
96
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
97
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
98
|
+
raise models.APIError(
|
|
99
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
content_type = http_res.headers.get("Content-Type")
|
|
103
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
104
|
+
raise models.APIError(
|
|
105
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
106
|
+
http_res.status_code,
|
|
107
|
+
http_res_text,
|
|
108
|
+
http_res,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
async def create_async(
|
|
112
|
+
self,
|
|
113
|
+
*,
|
|
114
|
+
request: Union[
|
|
115
|
+
models.VirtualMachinePayload, models.VirtualMachinePayloadTypedDict
|
|
116
|
+
] = models.VirtualMachinePayload(),
|
|
117
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
118
|
+
server_url: Optional[str] = None,
|
|
119
|
+
timeout_ms: Optional[int] = None,
|
|
120
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
121
|
+
) -> models.VirtualMachine:
|
|
122
|
+
r"""Create a Virtual Machine
|
|
123
|
+
|
|
124
|
+
Creates a new Virtual Machine.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
:param request: The request object to send.
|
|
128
|
+
:param retries: Override the default retry configuration for this method
|
|
129
|
+
:param server_url: Override the default server URL for this method
|
|
130
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
131
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
132
|
+
"""
|
|
133
|
+
base_url = None
|
|
134
|
+
url_variables = None
|
|
135
|
+
if timeout_ms is None:
|
|
136
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
137
|
+
|
|
138
|
+
if server_url is not None:
|
|
139
|
+
base_url = server_url
|
|
140
|
+
else:
|
|
141
|
+
base_url = self._get_url(base_url, url_variables)
|
|
142
|
+
|
|
143
|
+
if not isinstance(request, BaseModel):
|
|
144
|
+
request = utils.unmarshal(request, models.VirtualMachinePayload)
|
|
145
|
+
request = cast(models.VirtualMachinePayload, request)
|
|
146
|
+
|
|
147
|
+
req = self._build_request_async(
|
|
148
|
+
method="POST",
|
|
149
|
+
path="/virtual_machines",
|
|
150
|
+
base_url=base_url,
|
|
151
|
+
url_variables=url_variables,
|
|
152
|
+
request=request,
|
|
153
|
+
request_body_required=True,
|
|
154
|
+
request_has_path_params=False,
|
|
155
|
+
request_has_query_params=True,
|
|
156
|
+
user_agent_header="user-agent",
|
|
157
|
+
accept_header_value="application/vnd.api+json",
|
|
158
|
+
http_headers=http_headers,
|
|
159
|
+
security=self.sdk_configuration.security,
|
|
160
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
161
|
+
request, False, True, "json", Optional[models.VirtualMachinePayload]
|
|
162
|
+
),
|
|
163
|
+
timeout_ms=timeout_ms,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
if retries == UNSET:
|
|
167
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
168
|
+
retries = self.sdk_configuration.retry_config
|
|
169
|
+
|
|
170
|
+
retry_config = None
|
|
171
|
+
if isinstance(retries, utils.RetryConfig):
|
|
172
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
173
|
+
|
|
174
|
+
http_res = await self.do_request_async(
|
|
175
|
+
hook_ctx=HookContext(
|
|
176
|
+
base_url=base_url or "",
|
|
177
|
+
operation_id="create-virtual-machine",
|
|
178
|
+
oauth2_scopes=[],
|
|
179
|
+
security_source=get_security_from_env(
|
|
180
|
+
self.sdk_configuration.security, models.Security
|
|
181
|
+
),
|
|
182
|
+
),
|
|
183
|
+
request=req,
|
|
184
|
+
error_status_codes=["409", "422", "4XX", "5XX"],
|
|
185
|
+
retry_config=retry_config,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
189
|
+
return utils.unmarshal_json(http_res.text, models.VirtualMachine)
|
|
190
|
+
if utils.match_response(http_res, ["409", "422", "4XX"], "*"):
|
|
191
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
192
|
+
raise models.APIError(
|
|
193
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
194
|
+
)
|
|
195
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
196
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
197
|
+
raise models.APIError(
|
|
198
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
content_type = http_res.headers.get("Content-Type")
|
|
202
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
203
|
+
raise models.APIError(
|
|
204
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
205
|
+
http_res.status_code,
|
|
206
|
+
http_res_text,
|
|
207
|
+
http_res,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
def list(
|
|
211
|
+
self,
|
|
212
|
+
*,
|
|
213
|
+
filter_project: Optional[str] = None,
|
|
214
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
215
|
+
server_url: Optional[str] = None,
|
|
216
|
+
timeout_ms: Optional[int] = None,
|
|
217
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
218
|
+
):
|
|
219
|
+
r"""Get Teams Virtual Machines
|
|
220
|
+
|
|
221
|
+
Show all Team's Virtual Machines.
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
:param filter_project: The project ID or Slug to filter by
|
|
225
|
+
:param retries: Override the default retry configuration for this method
|
|
226
|
+
:param server_url: Override the default server URL for this method
|
|
227
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
228
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
229
|
+
"""
|
|
230
|
+
base_url = None
|
|
231
|
+
url_variables = None
|
|
232
|
+
if timeout_ms is None:
|
|
233
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
234
|
+
|
|
235
|
+
if server_url is not None:
|
|
236
|
+
base_url = server_url
|
|
237
|
+
else:
|
|
238
|
+
base_url = self._get_url(base_url, url_variables)
|
|
239
|
+
|
|
240
|
+
request = models.IndexVirtualMachineRequest(
|
|
241
|
+
filter_project=filter_project,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
req = self._build_request(
|
|
245
|
+
method="GET",
|
|
246
|
+
path="/virtual_machines",
|
|
247
|
+
base_url=base_url,
|
|
248
|
+
url_variables=url_variables,
|
|
249
|
+
request=request,
|
|
250
|
+
request_body_required=False,
|
|
251
|
+
request_has_path_params=False,
|
|
252
|
+
request_has_query_params=True,
|
|
253
|
+
user_agent_header="user-agent",
|
|
254
|
+
accept_header_value="*/*",
|
|
255
|
+
http_headers=http_headers,
|
|
256
|
+
security=self.sdk_configuration.security,
|
|
257
|
+
timeout_ms=timeout_ms,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
if retries == UNSET:
|
|
261
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
262
|
+
retries = self.sdk_configuration.retry_config
|
|
263
|
+
|
|
264
|
+
retry_config = None
|
|
265
|
+
if isinstance(retries, utils.RetryConfig):
|
|
266
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
267
|
+
|
|
268
|
+
http_res = self.do_request(
|
|
269
|
+
hook_ctx=HookContext(
|
|
270
|
+
base_url=base_url or "",
|
|
271
|
+
operation_id="index-virtual-machine",
|
|
272
|
+
oauth2_scopes=[],
|
|
273
|
+
security_source=get_security_from_env(
|
|
274
|
+
self.sdk_configuration.security, models.Security
|
|
275
|
+
),
|
|
276
|
+
),
|
|
277
|
+
request=req,
|
|
278
|
+
error_status_codes=["4XX", "5XX"],
|
|
279
|
+
retry_config=retry_config,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
if utils.match_response(http_res, "200", "*"):
|
|
283
|
+
return
|
|
284
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
285
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
286
|
+
raise models.APIError(
|
|
287
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
288
|
+
)
|
|
289
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
290
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
291
|
+
raise models.APIError(
|
|
292
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
content_type = http_res.headers.get("Content-Type")
|
|
296
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
297
|
+
raise models.APIError(
|
|
298
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
299
|
+
http_res.status_code,
|
|
300
|
+
http_res_text,
|
|
301
|
+
http_res,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
async def list_async(
|
|
305
|
+
self,
|
|
306
|
+
*,
|
|
307
|
+
filter_project: Optional[str] = None,
|
|
308
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
309
|
+
server_url: Optional[str] = None,
|
|
310
|
+
timeout_ms: Optional[int] = None,
|
|
311
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
312
|
+
):
|
|
313
|
+
r"""Get Teams Virtual Machines
|
|
314
|
+
|
|
315
|
+
Show all Team's Virtual Machines.
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
:param filter_project: The project ID or Slug to filter by
|
|
319
|
+
:param retries: Override the default retry configuration for this method
|
|
320
|
+
:param server_url: Override the default server URL for this method
|
|
321
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
322
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
323
|
+
"""
|
|
324
|
+
base_url = None
|
|
325
|
+
url_variables = None
|
|
326
|
+
if timeout_ms is None:
|
|
327
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
328
|
+
|
|
329
|
+
if server_url is not None:
|
|
330
|
+
base_url = server_url
|
|
331
|
+
else:
|
|
332
|
+
base_url = self._get_url(base_url, url_variables)
|
|
333
|
+
|
|
334
|
+
request = models.IndexVirtualMachineRequest(
|
|
335
|
+
filter_project=filter_project,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
req = self._build_request_async(
|
|
339
|
+
method="GET",
|
|
340
|
+
path="/virtual_machines",
|
|
341
|
+
base_url=base_url,
|
|
342
|
+
url_variables=url_variables,
|
|
343
|
+
request=request,
|
|
344
|
+
request_body_required=False,
|
|
345
|
+
request_has_path_params=False,
|
|
346
|
+
request_has_query_params=True,
|
|
347
|
+
user_agent_header="user-agent",
|
|
348
|
+
accept_header_value="*/*",
|
|
349
|
+
http_headers=http_headers,
|
|
350
|
+
security=self.sdk_configuration.security,
|
|
351
|
+
timeout_ms=timeout_ms,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
if retries == UNSET:
|
|
355
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
356
|
+
retries = self.sdk_configuration.retry_config
|
|
357
|
+
|
|
358
|
+
retry_config = None
|
|
359
|
+
if isinstance(retries, utils.RetryConfig):
|
|
360
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
361
|
+
|
|
362
|
+
http_res = await self.do_request_async(
|
|
363
|
+
hook_ctx=HookContext(
|
|
364
|
+
base_url=base_url or "",
|
|
365
|
+
operation_id="index-virtual-machine",
|
|
366
|
+
oauth2_scopes=[],
|
|
367
|
+
security_source=get_security_from_env(
|
|
368
|
+
self.sdk_configuration.security, models.Security
|
|
369
|
+
),
|
|
370
|
+
),
|
|
371
|
+
request=req,
|
|
372
|
+
error_status_codes=["4XX", "5XX"],
|
|
373
|
+
retry_config=retry_config,
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
if utils.match_response(http_res, "200", "*"):
|
|
377
|
+
return
|
|
378
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
379
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
380
|
+
raise models.APIError(
|
|
381
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
382
|
+
)
|
|
383
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
384
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
385
|
+
raise models.APIError(
|
|
386
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
content_type = http_res.headers.get("Content-Type")
|
|
390
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
391
|
+
raise models.APIError(
|
|
392
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
393
|
+
http_res.status_code,
|
|
394
|
+
http_res_text,
|
|
395
|
+
http_res,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
def get(
|
|
399
|
+
self,
|
|
400
|
+
*,
|
|
401
|
+
virtual_machine_id: str,
|
|
402
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
403
|
+
server_url: Optional[str] = None,
|
|
404
|
+
timeout_ms: Optional[int] = None,
|
|
405
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
406
|
+
):
|
|
407
|
+
r"""Get a Virtual Machine
|
|
408
|
+
|
|
409
|
+
Show a Virtual Machine.
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
:param virtual_machine_id:
|
|
413
|
+
:param retries: Override the default retry configuration for this method
|
|
414
|
+
:param server_url: Override the default server URL for this method
|
|
415
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
416
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
417
|
+
"""
|
|
418
|
+
base_url = None
|
|
419
|
+
url_variables = None
|
|
420
|
+
if timeout_ms is None:
|
|
421
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
422
|
+
|
|
423
|
+
if server_url is not None:
|
|
424
|
+
base_url = server_url
|
|
425
|
+
else:
|
|
426
|
+
base_url = self._get_url(base_url, url_variables)
|
|
427
|
+
|
|
428
|
+
request = models.ShowVirtualMachineRequest(
|
|
429
|
+
virtual_machine_id=virtual_machine_id,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
req = self._build_request(
|
|
433
|
+
method="GET",
|
|
434
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
435
|
+
base_url=base_url,
|
|
436
|
+
url_variables=url_variables,
|
|
437
|
+
request=request,
|
|
438
|
+
request_body_required=False,
|
|
439
|
+
request_has_path_params=True,
|
|
440
|
+
request_has_query_params=True,
|
|
441
|
+
user_agent_header="user-agent",
|
|
442
|
+
accept_header_value="*/*",
|
|
443
|
+
http_headers=http_headers,
|
|
444
|
+
security=self.sdk_configuration.security,
|
|
445
|
+
timeout_ms=timeout_ms,
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
if retries == UNSET:
|
|
449
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
450
|
+
retries = self.sdk_configuration.retry_config
|
|
451
|
+
|
|
452
|
+
retry_config = None
|
|
453
|
+
if isinstance(retries, utils.RetryConfig):
|
|
454
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
455
|
+
|
|
456
|
+
http_res = self.do_request(
|
|
457
|
+
hook_ctx=HookContext(
|
|
458
|
+
base_url=base_url or "",
|
|
459
|
+
operation_id="show-virtual-machine",
|
|
460
|
+
oauth2_scopes=[],
|
|
461
|
+
security_source=get_security_from_env(
|
|
462
|
+
self.sdk_configuration.security, models.Security
|
|
463
|
+
),
|
|
464
|
+
),
|
|
465
|
+
request=req,
|
|
466
|
+
error_status_codes=["4XX", "5XX"],
|
|
467
|
+
retry_config=retry_config,
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
if utils.match_response(http_res, "200", "*"):
|
|
471
|
+
return
|
|
472
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
473
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
474
|
+
raise models.APIError(
|
|
475
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
476
|
+
)
|
|
477
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
478
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
479
|
+
raise models.APIError(
|
|
480
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
content_type = http_res.headers.get("Content-Type")
|
|
484
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
485
|
+
raise models.APIError(
|
|
486
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
487
|
+
http_res.status_code,
|
|
488
|
+
http_res_text,
|
|
489
|
+
http_res,
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
async def get_async(
|
|
493
|
+
self,
|
|
494
|
+
*,
|
|
495
|
+
virtual_machine_id: str,
|
|
496
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
497
|
+
server_url: Optional[str] = None,
|
|
498
|
+
timeout_ms: Optional[int] = None,
|
|
499
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
500
|
+
):
|
|
501
|
+
r"""Get a Virtual Machine
|
|
502
|
+
|
|
503
|
+
Show a Virtual Machine.
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
:param virtual_machine_id:
|
|
507
|
+
:param retries: Override the default retry configuration for this method
|
|
508
|
+
:param server_url: Override the default server URL for this method
|
|
509
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
510
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
511
|
+
"""
|
|
512
|
+
base_url = None
|
|
513
|
+
url_variables = None
|
|
514
|
+
if timeout_ms is None:
|
|
515
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
516
|
+
|
|
517
|
+
if server_url is not None:
|
|
518
|
+
base_url = server_url
|
|
519
|
+
else:
|
|
520
|
+
base_url = self._get_url(base_url, url_variables)
|
|
521
|
+
|
|
522
|
+
request = models.ShowVirtualMachineRequest(
|
|
523
|
+
virtual_machine_id=virtual_machine_id,
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
req = self._build_request_async(
|
|
527
|
+
method="GET",
|
|
528
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
529
|
+
base_url=base_url,
|
|
530
|
+
url_variables=url_variables,
|
|
531
|
+
request=request,
|
|
532
|
+
request_body_required=False,
|
|
533
|
+
request_has_path_params=True,
|
|
534
|
+
request_has_query_params=True,
|
|
535
|
+
user_agent_header="user-agent",
|
|
536
|
+
accept_header_value="*/*",
|
|
537
|
+
http_headers=http_headers,
|
|
538
|
+
security=self.sdk_configuration.security,
|
|
539
|
+
timeout_ms=timeout_ms,
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
if retries == UNSET:
|
|
543
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
544
|
+
retries = self.sdk_configuration.retry_config
|
|
545
|
+
|
|
546
|
+
retry_config = None
|
|
547
|
+
if isinstance(retries, utils.RetryConfig):
|
|
548
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
549
|
+
|
|
550
|
+
http_res = await self.do_request_async(
|
|
551
|
+
hook_ctx=HookContext(
|
|
552
|
+
base_url=base_url or "",
|
|
553
|
+
operation_id="show-virtual-machine",
|
|
554
|
+
oauth2_scopes=[],
|
|
555
|
+
security_source=get_security_from_env(
|
|
556
|
+
self.sdk_configuration.security, models.Security
|
|
557
|
+
),
|
|
558
|
+
),
|
|
559
|
+
request=req,
|
|
560
|
+
error_status_codes=["4XX", "5XX"],
|
|
561
|
+
retry_config=retry_config,
|
|
562
|
+
)
|
|
563
|
+
|
|
564
|
+
if utils.match_response(http_res, "200", "*"):
|
|
565
|
+
return
|
|
566
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
567
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
568
|
+
raise models.APIError(
|
|
569
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
570
|
+
)
|
|
571
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
572
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
573
|
+
raise models.APIError(
|
|
574
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
575
|
+
)
|
|
576
|
+
|
|
577
|
+
content_type = http_res.headers.get("Content-Type")
|
|
578
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
579
|
+
raise models.APIError(
|
|
580
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
581
|
+
http_res.status_code,
|
|
582
|
+
http_res_text,
|
|
583
|
+
http_res,
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
def delete(
|
|
587
|
+
self,
|
|
588
|
+
*,
|
|
589
|
+
virtual_machine_id: str,
|
|
590
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
591
|
+
server_url: Optional[str] = None,
|
|
592
|
+
timeout_ms: Optional[int] = None,
|
|
593
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
594
|
+
):
|
|
595
|
+
r"""Destroy a Virtual Machine
|
|
596
|
+
|
|
597
|
+
Destroys a Virtual Machine.
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
:param virtual_machine_id:
|
|
601
|
+
:param retries: Override the default retry configuration for this method
|
|
602
|
+
:param server_url: Override the default server URL for this method
|
|
603
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
604
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
605
|
+
"""
|
|
606
|
+
base_url = None
|
|
607
|
+
url_variables = None
|
|
608
|
+
if timeout_ms is None:
|
|
609
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
610
|
+
|
|
611
|
+
if server_url is not None:
|
|
612
|
+
base_url = server_url
|
|
613
|
+
else:
|
|
614
|
+
base_url = self._get_url(base_url, url_variables)
|
|
615
|
+
|
|
616
|
+
request = models.DestroyVirtualMachineRequest(
|
|
617
|
+
virtual_machine_id=virtual_machine_id,
|
|
618
|
+
)
|
|
619
|
+
|
|
620
|
+
req = self._build_request(
|
|
621
|
+
method="DELETE",
|
|
622
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
623
|
+
base_url=base_url,
|
|
624
|
+
url_variables=url_variables,
|
|
625
|
+
request=request,
|
|
626
|
+
request_body_required=False,
|
|
627
|
+
request_has_path_params=True,
|
|
628
|
+
request_has_query_params=True,
|
|
629
|
+
user_agent_header="user-agent",
|
|
630
|
+
accept_header_value="*/*",
|
|
631
|
+
http_headers=http_headers,
|
|
632
|
+
security=self.sdk_configuration.security,
|
|
633
|
+
timeout_ms=timeout_ms,
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
if retries == UNSET:
|
|
637
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
638
|
+
retries = self.sdk_configuration.retry_config
|
|
639
|
+
|
|
640
|
+
retry_config = None
|
|
641
|
+
if isinstance(retries, utils.RetryConfig):
|
|
642
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
643
|
+
|
|
644
|
+
http_res = self.do_request(
|
|
645
|
+
hook_ctx=HookContext(
|
|
646
|
+
base_url=base_url or "",
|
|
647
|
+
operation_id="destroy-virtual-machine",
|
|
648
|
+
oauth2_scopes=[],
|
|
649
|
+
security_source=get_security_from_env(
|
|
650
|
+
self.sdk_configuration.security, models.Security
|
|
651
|
+
),
|
|
652
|
+
),
|
|
653
|
+
request=req,
|
|
654
|
+
error_status_codes=["4XX", "5XX"],
|
|
655
|
+
retry_config=retry_config,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
if utils.match_response(http_res, "204", "*"):
|
|
659
|
+
return
|
|
660
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
661
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
662
|
+
raise models.APIError(
|
|
663
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
664
|
+
)
|
|
665
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
666
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
667
|
+
raise models.APIError(
|
|
668
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
669
|
+
)
|
|
670
|
+
|
|
671
|
+
content_type = http_res.headers.get("Content-Type")
|
|
672
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
673
|
+
raise models.APIError(
|
|
674
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
675
|
+
http_res.status_code,
|
|
676
|
+
http_res_text,
|
|
677
|
+
http_res,
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
async def delete_async(
|
|
681
|
+
self,
|
|
682
|
+
*,
|
|
683
|
+
virtual_machine_id: str,
|
|
684
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
685
|
+
server_url: Optional[str] = None,
|
|
686
|
+
timeout_ms: Optional[int] = None,
|
|
687
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
688
|
+
):
|
|
689
|
+
r"""Destroy a Virtual Machine
|
|
690
|
+
|
|
691
|
+
Destroys a Virtual Machine.
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
:param virtual_machine_id:
|
|
695
|
+
:param retries: Override the default retry configuration for this method
|
|
696
|
+
:param server_url: Override the default server URL for this method
|
|
697
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
698
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
699
|
+
"""
|
|
700
|
+
base_url = None
|
|
701
|
+
url_variables = None
|
|
702
|
+
if timeout_ms is None:
|
|
703
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
704
|
+
|
|
705
|
+
if server_url is not None:
|
|
706
|
+
base_url = server_url
|
|
707
|
+
else:
|
|
708
|
+
base_url = self._get_url(base_url, url_variables)
|
|
709
|
+
|
|
710
|
+
request = models.DestroyVirtualMachineRequest(
|
|
711
|
+
virtual_machine_id=virtual_machine_id,
|
|
712
|
+
)
|
|
713
|
+
|
|
714
|
+
req = self._build_request_async(
|
|
715
|
+
method="DELETE",
|
|
716
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
717
|
+
base_url=base_url,
|
|
718
|
+
url_variables=url_variables,
|
|
719
|
+
request=request,
|
|
720
|
+
request_body_required=False,
|
|
721
|
+
request_has_path_params=True,
|
|
722
|
+
request_has_query_params=True,
|
|
723
|
+
user_agent_header="user-agent",
|
|
724
|
+
accept_header_value="*/*",
|
|
725
|
+
http_headers=http_headers,
|
|
726
|
+
security=self.sdk_configuration.security,
|
|
727
|
+
timeout_ms=timeout_ms,
|
|
728
|
+
)
|
|
729
|
+
|
|
730
|
+
if retries == UNSET:
|
|
731
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
732
|
+
retries = self.sdk_configuration.retry_config
|
|
733
|
+
|
|
734
|
+
retry_config = None
|
|
735
|
+
if isinstance(retries, utils.RetryConfig):
|
|
736
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
737
|
+
|
|
738
|
+
http_res = await self.do_request_async(
|
|
739
|
+
hook_ctx=HookContext(
|
|
740
|
+
base_url=base_url or "",
|
|
741
|
+
operation_id="destroy-virtual-machine",
|
|
742
|
+
oauth2_scopes=[],
|
|
743
|
+
security_source=get_security_from_env(
|
|
744
|
+
self.sdk_configuration.security, models.Security
|
|
745
|
+
),
|
|
746
|
+
),
|
|
747
|
+
request=req,
|
|
748
|
+
error_status_codes=["4XX", "5XX"],
|
|
749
|
+
retry_config=retry_config,
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
if utils.match_response(http_res, "204", "*"):
|
|
753
|
+
return
|
|
754
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
755
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
756
|
+
raise models.APIError(
|
|
757
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
758
|
+
)
|
|
759
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
760
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
761
|
+
raise models.APIError(
|
|
762
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
763
|
+
)
|
|
764
|
+
|
|
765
|
+
content_type = http_res.headers.get("Content-Type")
|
|
766
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
767
|
+
raise models.APIError(
|
|
768
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
769
|
+
http_res.status_code,
|
|
770
|
+
http_res_text,
|
|
771
|
+
http_res,
|
|
772
|
+
)
|