latitudesh-python-sdk 2.3.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.
- 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 +113 -0
- latitudesh_python_sdk/_version.py +17 -0
- latitudesh_python_sdk/apikeys.py +703 -0
- latitudesh_python_sdk/basesdk.py +374 -0
- latitudesh_python_sdk/billing.py +197 -0
- latitudesh_python_sdk/events_sdk.py +298 -0
- latitudesh_python_sdk/firewalls_sdk.py +1786 -0
- latitudesh_python_sdk/httpclient.py +125 -0
- latitudesh_python_sdk/ipaddresses_sdk.py +470 -0
- latitudesh_python_sdk/models/__init__.py +3581 -0
- latitudesh_python_sdk/models/api_key.py +81 -0
- latitudesh_python_sdk/models/apierror.py +40 -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_data.py +72 -0
- latitudesh_python_sdk/models/bandwidth_plans.py +26 -0
- latitudesh_python_sdk/models/billing_usage.py +249 -0
- latitudesh_python_sdk/models/container_plan_data.py +163 -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 +73 -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_machine_actionop.py +63 -0
- latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
- latitudesh_python_sdk/models/custom_tag.py +26 -0
- latitudesh_python_sdk/models/custom_tag_data.py +54 -0
- latitudesh_python_sdk/models/custom_tags.py +26 -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_ssh_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
- latitudesh_python_sdk/models/delete_storage_volumesop.py +16 -0
- latitudesh_python_sdk/models/delete_user_dataop.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 +62 -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/event_data.py +98 -0
- latitudesh_python_sdk/models/events.py +26 -0
- latitudesh_python_sdk/models/filesystem_data.py +57 -0
- latitudesh_python_sdk/models/firewall.py +26 -0
- latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
- latitudesh_python_sdk/models/firewall_assignments.py +29 -0
- latitudesh_python_sdk/models/firewall_data.py +75 -0
- latitudesh_python_sdk/models/firewall_server.py +36 -0
- latitudesh_python_sdk/models/firewalls.py +26 -0
- latitudesh_python_sdk/models/get_all_firewall_assignmentsop.py +51 -0
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +62 -0
- latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
- latitudesh_python_sdk/models/get_containers_planop.py +18 -0
- latitudesh_python_sdk/models/get_eventsop.py +126 -0
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +53 -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 +120 -0
- latitudesh_python_sdk/models/get_planop.py +16 -0
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +54 -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 +105 -0
- latitudesh_python_sdk/models/get_regionop.py +18 -0
- latitudesh_python_sdk/models/get_regionsop.py +42 -0
- latitudesh_python_sdk/models/get_role_idop.py +16 -0
- latitudesh_python_sdk/models/get_rolesop.py +54 -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 +185 -0
- latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
- latitudesh_python_sdk/models/get_ssh_keysop.py +31 -0
- latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
- latitudesh_python_sdk/models/get_storage_volumeop.py +32 -0
- latitudesh_python_sdk/models/get_storage_volumesop.py +35 -0
- latitudesh_python_sdk/models/get_team_membersop.py +42 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +49 -0
- latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
- latitudesh_python_sdk/models/get_user_dataop.py +31 -0
- latitudesh_python_sdk/models/get_user_profileop.py +19 -0
- latitudesh_python_sdk/models/get_users_dataop.py +44 -0
- latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +72 -0
- latitudesh_python_sdk/models/get_virtual_networksop.py +69 -0
- latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
- latitudesh_python_sdk/models/index_virtual_machineop.py +31 -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/latitudesherror.py +30 -0
- latitudesh_python_sdk/models/list_firewallsop.py +49 -0
- latitudesh_python_sdk/models/membership.py +63 -0
- latitudesh_python_sdk/models/no_response_error.py +17 -0
- latitudesh_python_sdk/models/operating_system_data.py +65 -0
- latitudesh_python_sdk/models/operating_systems.py +26 -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_dataop.py +69 -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 +210 -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_ssh_keyop.py +63 -0
- latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
- latitudesh_python_sdk/models/post_storage_volumes_mountop.py +62 -0
- latitudesh_python_sdk/models/post_storage_volumesop.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_user_dataop.py +50 -0
- latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
- latitudesh_python_sdk/models/project.py +131 -0
- latitudesh_python_sdk/models/project_include.py +75 -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_ssh_keyop.py +80 -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/responsevalidationerror.py +27 -0
- latitudesh_python_sdk/models/role.py +26 -0
- latitudesh_python_sdk/models/role_data.py +35 -0
- latitudesh_python_sdk/models/security.py +25 -0
- latitudesh_python_sdk/models/server.py +26 -0
- latitudesh_python_sdk/models/server_action.py +52 -0
- latitudesh_python_sdk/models/server_data.py +280 -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_region_resource_data.py +40 -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_data.py +55 -0
- latitudesh_python_sdk/models/ssh_keys.py +26 -0
- latitudesh_python_sdk/models/storage_plan_data.py +47 -0
- latitudesh_python_sdk/models/storage_plans.py +26 -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 +85 -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 +26 -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 +29 -0
- latitudesh_python_sdk/models/virtual_machine_attributes.py +115 -0
- latitudesh_python_sdk/models/virtual_machine_payload.py +47 -0
- latitudesh_python_sdk/models/virtual_machine_plans.py +181 -0
- latitudesh_python_sdk/models/virtual_network.py +26 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +29 -0
- latitudesh_python_sdk/models/virtual_network_assignment_data.py +65 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
- latitudesh_python_sdk/models/virtual_network_data.py +114 -0
- latitudesh_python_sdk/models/virtual_networks.py +26 -0
- latitudesh_python_sdk/models/volume_data.py +111 -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 +238 -0
- latitudesh_python_sdk/plans.py +1304 -0
- latitudesh_python_sdk/privatenetworks.py +1612 -0
- latitudesh_python_sdk/projects_sdk.py +830 -0
- latitudesh_python_sdk/py.typed +1 -0
- latitudesh_python_sdk/regions_sdk.py +398 -0
- latitudesh_python_sdk/roles.py +398 -0
- latitudesh_python_sdk/sdk.py +264 -0
- latitudesh_python_sdk/sdkconfiguration.py +50 -0
- latitudesh_python_sdk/servers_sdk.py +3414 -0
- latitudesh_python_sdk/sshkeys_sdk.py +1882 -0
- latitudesh_python_sdk/storage.py +1651 -0
- latitudesh_python_sdk/tags.py +715 -0
- latitudesh_python_sdk/teams_sdk.py +527 -0
- latitudesh_python_sdk/teamsmembers.py +576 -0
- latitudesh_python_sdk/traffic_sdk.py +357 -0
- latitudesh_python_sdk/types/__init__.py +21 -0
- latitudesh_python_sdk/types/basemodel.py +39 -0
- latitudesh_python_sdk/userdata_sdk.py +1888 -0
- latitudesh_python_sdk/userprofile.py +531 -0
- latitudesh_python_sdk/utils/__init__.py +200 -0
- latitudesh_python_sdk/utils/annotations.py +79 -0
- latitudesh_python_sdk/utils/datetimes.py +23 -0
- latitudesh_python_sdk/utils/enums.py +74 -0
- latitudesh_python_sdk/utils/eventstreaming.py +248 -0
- latitudesh_python_sdk/utils/forms.py +234 -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 +217 -0
- latitudesh_python_sdk/utils/requestbodies.py +66 -0
- latitudesh_python_sdk/utils/retries.py +281 -0
- latitudesh_python_sdk/utils/security.py +192 -0
- latitudesh_python_sdk/utils/serializers.py +249 -0
- latitudesh_python_sdk/utils/unmarshal_json_response.py +38 -0
- latitudesh_python_sdk/utils/url.py +155 -0
- latitudesh_python_sdk/utils/values.py +137 -0
- latitudesh_python_sdk/virtualmachines.py +941 -0
- latitudesh_python_sdk/vpnsessions.py +715 -0
- latitudesh_python_sdk-2.3.0.dist-info/METADATA +787 -0
- latitudesh_python_sdk-2.3.0.dist-info/RECORD +242 -0
- latitudesh_python_sdk-2.3.0.dist-info/WHEEL +4 -0
- latitudesh_python_sdk-2.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,941 @@
|
|
|
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 OptionalNullable, UNSET
|
|
7
|
+
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
+
from typing import Mapping, Optional, Union
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class VirtualMachines(BaseSDK):
|
|
13
|
+
def create(
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
|
+
data: Optional[
|
|
17
|
+
Union[
|
|
18
|
+
models.VirtualMachinePayloadData,
|
|
19
|
+
models.VirtualMachinePayloadDataTypedDict,
|
|
20
|
+
]
|
|
21
|
+
] = None,
|
|
22
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
23
|
+
server_url: Optional[str] = None,
|
|
24
|
+
timeout_ms: Optional[int] = None,
|
|
25
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
26
|
+
) -> models.VirtualMachine:
|
|
27
|
+
r"""Create a Virtual Machine
|
|
28
|
+
|
|
29
|
+
Creates a new Virtual Machine.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
:param data:
|
|
33
|
+
:param retries: Override the default retry configuration for this method
|
|
34
|
+
:param server_url: Override the default server URL for this method
|
|
35
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
36
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
37
|
+
"""
|
|
38
|
+
base_url = None
|
|
39
|
+
url_variables = None
|
|
40
|
+
if timeout_ms is None:
|
|
41
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
42
|
+
|
|
43
|
+
if server_url is not None:
|
|
44
|
+
base_url = server_url
|
|
45
|
+
else:
|
|
46
|
+
base_url = self._get_url(base_url, url_variables)
|
|
47
|
+
|
|
48
|
+
request = models.VirtualMachinePayload(
|
|
49
|
+
data=utils.get_pydantic_model(
|
|
50
|
+
data, Optional[models.VirtualMachinePayloadData]
|
|
51
|
+
),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
req = self._build_request(
|
|
55
|
+
method="POST",
|
|
56
|
+
path="/virtual_machines",
|
|
57
|
+
base_url=base_url,
|
|
58
|
+
url_variables=url_variables,
|
|
59
|
+
request=request,
|
|
60
|
+
request_body_required=True,
|
|
61
|
+
request_has_path_params=False,
|
|
62
|
+
request_has_query_params=True,
|
|
63
|
+
user_agent_header="user-agent",
|
|
64
|
+
accept_header_value="application/vnd.api+json",
|
|
65
|
+
http_headers=http_headers,
|
|
66
|
+
security=self.sdk_configuration.security,
|
|
67
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
68
|
+
request, False, False, "json", models.VirtualMachinePayload
|
|
69
|
+
),
|
|
70
|
+
allow_empty_value=None,
|
|
71
|
+
timeout_ms=timeout_ms,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
if retries == UNSET:
|
|
75
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
76
|
+
retries = self.sdk_configuration.retry_config
|
|
77
|
+
|
|
78
|
+
retry_config = None
|
|
79
|
+
if isinstance(retries, utils.RetryConfig):
|
|
80
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
81
|
+
|
|
82
|
+
http_res = self.do_request(
|
|
83
|
+
hook_ctx=HookContext(
|
|
84
|
+
config=self.sdk_configuration,
|
|
85
|
+
base_url=base_url or "",
|
|
86
|
+
operation_id="create-virtual-machine",
|
|
87
|
+
oauth2_scopes=None,
|
|
88
|
+
security_source=get_security_from_env(
|
|
89
|
+
self.sdk_configuration.security, models.Security
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
request=req,
|
|
93
|
+
error_status_codes=["4XX", "5XX"],
|
|
94
|
+
retry_config=retry_config,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
98
|
+
return unmarshal_json_response(models.VirtualMachine, http_res)
|
|
99
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
100
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
101
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
102
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
103
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
104
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
105
|
+
|
|
106
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
107
|
+
|
|
108
|
+
async def create_async(
|
|
109
|
+
self,
|
|
110
|
+
*,
|
|
111
|
+
data: Optional[
|
|
112
|
+
Union[
|
|
113
|
+
models.VirtualMachinePayloadData,
|
|
114
|
+
models.VirtualMachinePayloadDataTypedDict,
|
|
115
|
+
]
|
|
116
|
+
] = None,
|
|
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 data:
|
|
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
|
+
request = models.VirtualMachinePayload(
|
|
144
|
+
data=utils.get_pydantic_model(
|
|
145
|
+
data, Optional[models.VirtualMachinePayloadData]
|
|
146
|
+
),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
req = self._build_request_async(
|
|
150
|
+
method="POST",
|
|
151
|
+
path="/virtual_machines",
|
|
152
|
+
base_url=base_url,
|
|
153
|
+
url_variables=url_variables,
|
|
154
|
+
request=request,
|
|
155
|
+
request_body_required=True,
|
|
156
|
+
request_has_path_params=False,
|
|
157
|
+
request_has_query_params=True,
|
|
158
|
+
user_agent_header="user-agent",
|
|
159
|
+
accept_header_value="application/vnd.api+json",
|
|
160
|
+
http_headers=http_headers,
|
|
161
|
+
security=self.sdk_configuration.security,
|
|
162
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
163
|
+
request, False, False, "json", models.VirtualMachinePayload
|
|
164
|
+
),
|
|
165
|
+
allow_empty_value=None,
|
|
166
|
+
timeout_ms=timeout_ms,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
if retries == UNSET:
|
|
170
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
171
|
+
retries = self.sdk_configuration.retry_config
|
|
172
|
+
|
|
173
|
+
retry_config = None
|
|
174
|
+
if isinstance(retries, utils.RetryConfig):
|
|
175
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
176
|
+
|
|
177
|
+
http_res = await self.do_request_async(
|
|
178
|
+
hook_ctx=HookContext(
|
|
179
|
+
config=self.sdk_configuration,
|
|
180
|
+
base_url=base_url or "",
|
|
181
|
+
operation_id="create-virtual-machine",
|
|
182
|
+
oauth2_scopes=None,
|
|
183
|
+
security_source=get_security_from_env(
|
|
184
|
+
self.sdk_configuration.security, models.Security
|
|
185
|
+
),
|
|
186
|
+
),
|
|
187
|
+
request=req,
|
|
188
|
+
error_status_codes=["4XX", "5XX"],
|
|
189
|
+
retry_config=retry_config,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
193
|
+
return unmarshal_json_response(models.VirtualMachine, http_res)
|
|
194
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
195
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
196
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
197
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
198
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
199
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
200
|
+
|
|
201
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
202
|
+
|
|
203
|
+
def list(
|
|
204
|
+
self,
|
|
205
|
+
*,
|
|
206
|
+
filter_project: Optional[str] = None,
|
|
207
|
+
extra_fields_virtual_machines: Optional[str] = None,
|
|
208
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
209
|
+
server_url: Optional[str] = None,
|
|
210
|
+
timeout_ms: Optional[int] = None,
|
|
211
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
212
|
+
):
|
|
213
|
+
r"""Get Teams Virtual Machines
|
|
214
|
+
|
|
215
|
+
Show all Team's Virtual Machines.
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
:param filter_project: The project ID or Slug to filter by
|
|
219
|
+
:param extra_fields_virtual_machines: The `credentials` are provided as extra attributes that are lazy loaded. To request it, just set `extra_fields[virtual_machines]=credentials` in the query string.
|
|
220
|
+
:param retries: Override the default retry configuration for this method
|
|
221
|
+
:param server_url: Override the default server URL for this method
|
|
222
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
223
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
224
|
+
"""
|
|
225
|
+
base_url = None
|
|
226
|
+
url_variables = None
|
|
227
|
+
if timeout_ms is None:
|
|
228
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
229
|
+
|
|
230
|
+
if server_url is not None:
|
|
231
|
+
base_url = server_url
|
|
232
|
+
else:
|
|
233
|
+
base_url = self._get_url(base_url, url_variables)
|
|
234
|
+
|
|
235
|
+
request = models.IndexVirtualMachineRequest(
|
|
236
|
+
filter_project=filter_project,
|
|
237
|
+
extra_fields_virtual_machines=extra_fields_virtual_machines,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
req = self._build_request(
|
|
241
|
+
method="GET",
|
|
242
|
+
path="/virtual_machines",
|
|
243
|
+
base_url=base_url,
|
|
244
|
+
url_variables=url_variables,
|
|
245
|
+
request=request,
|
|
246
|
+
request_body_required=False,
|
|
247
|
+
request_has_path_params=False,
|
|
248
|
+
request_has_query_params=True,
|
|
249
|
+
user_agent_header="user-agent",
|
|
250
|
+
accept_header_value="*/*",
|
|
251
|
+
http_headers=http_headers,
|
|
252
|
+
security=self.sdk_configuration.security,
|
|
253
|
+
allow_empty_value=None,
|
|
254
|
+
timeout_ms=timeout_ms,
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
if retries == UNSET:
|
|
258
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
259
|
+
retries = self.sdk_configuration.retry_config
|
|
260
|
+
|
|
261
|
+
retry_config = None
|
|
262
|
+
if isinstance(retries, utils.RetryConfig):
|
|
263
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
264
|
+
|
|
265
|
+
http_res = self.do_request(
|
|
266
|
+
hook_ctx=HookContext(
|
|
267
|
+
config=self.sdk_configuration,
|
|
268
|
+
base_url=base_url or "",
|
|
269
|
+
operation_id="index-virtual-machine",
|
|
270
|
+
oauth2_scopes=None,
|
|
271
|
+
security_source=get_security_from_env(
|
|
272
|
+
self.sdk_configuration.security, models.Security
|
|
273
|
+
),
|
|
274
|
+
),
|
|
275
|
+
request=req,
|
|
276
|
+
error_status_codes=["4XX", "5XX"],
|
|
277
|
+
retry_config=retry_config,
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
if utils.match_response(http_res, "200", "*"):
|
|
281
|
+
return
|
|
282
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
283
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
284
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
285
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
286
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
287
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
288
|
+
|
|
289
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
290
|
+
|
|
291
|
+
async def list_async(
|
|
292
|
+
self,
|
|
293
|
+
*,
|
|
294
|
+
filter_project: Optional[str] = None,
|
|
295
|
+
extra_fields_virtual_machines: Optional[str] = None,
|
|
296
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
297
|
+
server_url: Optional[str] = None,
|
|
298
|
+
timeout_ms: Optional[int] = None,
|
|
299
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
300
|
+
):
|
|
301
|
+
r"""Get Teams Virtual Machines
|
|
302
|
+
|
|
303
|
+
Show all Team's Virtual Machines.
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
:param filter_project: The project ID or Slug to filter by
|
|
307
|
+
:param extra_fields_virtual_machines: The `credentials` are provided as extra attributes that are lazy loaded. To request it, just set `extra_fields[virtual_machines]=credentials` in the query string.
|
|
308
|
+
:param retries: Override the default retry configuration for this method
|
|
309
|
+
:param server_url: Override the default server URL for this method
|
|
310
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
311
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
312
|
+
"""
|
|
313
|
+
base_url = None
|
|
314
|
+
url_variables = None
|
|
315
|
+
if timeout_ms is None:
|
|
316
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
317
|
+
|
|
318
|
+
if server_url is not None:
|
|
319
|
+
base_url = server_url
|
|
320
|
+
else:
|
|
321
|
+
base_url = self._get_url(base_url, url_variables)
|
|
322
|
+
|
|
323
|
+
request = models.IndexVirtualMachineRequest(
|
|
324
|
+
filter_project=filter_project,
|
|
325
|
+
extra_fields_virtual_machines=extra_fields_virtual_machines,
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
req = self._build_request_async(
|
|
329
|
+
method="GET",
|
|
330
|
+
path="/virtual_machines",
|
|
331
|
+
base_url=base_url,
|
|
332
|
+
url_variables=url_variables,
|
|
333
|
+
request=request,
|
|
334
|
+
request_body_required=False,
|
|
335
|
+
request_has_path_params=False,
|
|
336
|
+
request_has_query_params=True,
|
|
337
|
+
user_agent_header="user-agent",
|
|
338
|
+
accept_header_value="*/*",
|
|
339
|
+
http_headers=http_headers,
|
|
340
|
+
security=self.sdk_configuration.security,
|
|
341
|
+
allow_empty_value=None,
|
|
342
|
+
timeout_ms=timeout_ms,
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
if retries == UNSET:
|
|
346
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
347
|
+
retries = self.sdk_configuration.retry_config
|
|
348
|
+
|
|
349
|
+
retry_config = None
|
|
350
|
+
if isinstance(retries, utils.RetryConfig):
|
|
351
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
352
|
+
|
|
353
|
+
http_res = await self.do_request_async(
|
|
354
|
+
hook_ctx=HookContext(
|
|
355
|
+
config=self.sdk_configuration,
|
|
356
|
+
base_url=base_url or "",
|
|
357
|
+
operation_id="index-virtual-machine",
|
|
358
|
+
oauth2_scopes=None,
|
|
359
|
+
security_source=get_security_from_env(
|
|
360
|
+
self.sdk_configuration.security, models.Security
|
|
361
|
+
),
|
|
362
|
+
),
|
|
363
|
+
request=req,
|
|
364
|
+
error_status_codes=["4XX", "5XX"],
|
|
365
|
+
retry_config=retry_config,
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
if utils.match_response(http_res, "200", "*"):
|
|
369
|
+
return
|
|
370
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
371
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
372
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
373
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
374
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
375
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
376
|
+
|
|
377
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
378
|
+
|
|
379
|
+
def get(
|
|
380
|
+
self,
|
|
381
|
+
*,
|
|
382
|
+
virtual_machine_id: str,
|
|
383
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
384
|
+
server_url: Optional[str] = None,
|
|
385
|
+
timeout_ms: Optional[int] = None,
|
|
386
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
387
|
+
):
|
|
388
|
+
r"""Get a Virtual Machine
|
|
389
|
+
|
|
390
|
+
Show a Virtual Machine.
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
:param virtual_machine_id:
|
|
394
|
+
:param retries: Override the default retry configuration for this method
|
|
395
|
+
:param server_url: Override the default server URL for this method
|
|
396
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
397
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
398
|
+
"""
|
|
399
|
+
base_url = None
|
|
400
|
+
url_variables = None
|
|
401
|
+
if timeout_ms is None:
|
|
402
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
403
|
+
|
|
404
|
+
if server_url is not None:
|
|
405
|
+
base_url = server_url
|
|
406
|
+
else:
|
|
407
|
+
base_url = self._get_url(base_url, url_variables)
|
|
408
|
+
|
|
409
|
+
request = models.ShowVirtualMachineRequest(
|
|
410
|
+
virtual_machine_id=virtual_machine_id,
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
req = self._build_request(
|
|
414
|
+
method="GET",
|
|
415
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
416
|
+
base_url=base_url,
|
|
417
|
+
url_variables=url_variables,
|
|
418
|
+
request=request,
|
|
419
|
+
request_body_required=False,
|
|
420
|
+
request_has_path_params=True,
|
|
421
|
+
request_has_query_params=True,
|
|
422
|
+
user_agent_header="user-agent",
|
|
423
|
+
accept_header_value="*/*",
|
|
424
|
+
http_headers=http_headers,
|
|
425
|
+
security=self.sdk_configuration.security,
|
|
426
|
+
allow_empty_value=None,
|
|
427
|
+
timeout_ms=timeout_ms,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
if retries == UNSET:
|
|
431
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
432
|
+
retries = self.sdk_configuration.retry_config
|
|
433
|
+
|
|
434
|
+
retry_config = None
|
|
435
|
+
if isinstance(retries, utils.RetryConfig):
|
|
436
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
437
|
+
|
|
438
|
+
http_res = self.do_request(
|
|
439
|
+
hook_ctx=HookContext(
|
|
440
|
+
config=self.sdk_configuration,
|
|
441
|
+
base_url=base_url or "",
|
|
442
|
+
operation_id="show-virtual-machine",
|
|
443
|
+
oauth2_scopes=None,
|
|
444
|
+
security_source=get_security_from_env(
|
|
445
|
+
self.sdk_configuration.security, models.Security
|
|
446
|
+
),
|
|
447
|
+
),
|
|
448
|
+
request=req,
|
|
449
|
+
error_status_codes=["4XX", "5XX"],
|
|
450
|
+
retry_config=retry_config,
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
if utils.match_response(http_res, "200", "*"):
|
|
454
|
+
return
|
|
455
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
456
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
457
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
458
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
459
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
460
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
461
|
+
|
|
462
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
463
|
+
|
|
464
|
+
async def get_async(
|
|
465
|
+
self,
|
|
466
|
+
*,
|
|
467
|
+
virtual_machine_id: str,
|
|
468
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
469
|
+
server_url: Optional[str] = None,
|
|
470
|
+
timeout_ms: Optional[int] = None,
|
|
471
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
472
|
+
):
|
|
473
|
+
r"""Get a Virtual Machine
|
|
474
|
+
|
|
475
|
+
Show a Virtual Machine.
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
:param virtual_machine_id:
|
|
479
|
+
:param retries: Override the default retry configuration for this method
|
|
480
|
+
:param server_url: Override the default server URL for this method
|
|
481
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
482
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
483
|
+
"""
|
|
484
|
+
base_url = None
|
|
485
|
+
url_variables = None
|
|
486
|
+
if timeout_ms is None:
|
|
487
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
488
|
+
|
|
489
|
+
if server_url is not None:
|
|
490
|
+
base_url = server_url
|
|
491
|
+
else:
|
|
492
|
+
base_url = self._get_url(base_url, url_variables)
|
|
493
|
+
|
|
494
|
+
request = models.ShowVirtualMachineRequest(
|
|
495
|
+
virtual_machine_id=virtual_machine_id,
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
req = self._build_request_async(
|
|
499
|
+
method="GET",
|
|
500
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
501
|
+
base_url=base_url,
|
|
502
|
+
url_variables=url_variables,
|
|
503
|
+
request=request,
|
|
504
|
+
request_body_required=False,
|
|
505
|
+
request_has_path_params=True,
|
|
506
|
+
request_has_query_params=True,
|
|
507
|
+
user_agent_header="user-agent",
|
|
508
|
+
accept_header_value="*/*",
|
|
509
|
+
http_headers=http_headers,
|
|
510
|
+
security=self.sdk_configuration.security,
|
|
511
|
+
allow_empty_value=None,
|
|
512
|
+
timeout_ms=timeout_ms,
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
if retries == UNSET:
|
|
516
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
517
|
+
retries = self.sdk_configuration.retry_config
|
|
518
|
+
|
|
519
|
+
retry_config = None
|
|
520
|
+
if isinstance(retries, utils.RetryConfig):
|
|
521
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
522
|
+
|
|
523
|
+
http_res = await self.do_request_async(
|
|
524
|
+
hook_ctx=HookContext(
|
|
525
|
+
config=self.sdk_configuration,
|
|
526
|
+
base_url=base_url or "",
|
|
527
|
+
operation_id="show-virtual-machine",
|
|
528
|
+
oauth2_scopes=None,
|
|
529
|
+
security_source=get_security_from_env(
|
|
530
|
+
self.sdk_configuration.security, models.Security
|
|
531
|
+
),
|
|
532
|
+
),
|
|
533
|
+
request=req,
|
|
534
|
+
error_status_codes=["4XX", "5XX"],
|
|
535
|
+
retry_config=retry_config,
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
if utils.match_response(http_res, "200", "*"):
|
|
539
|
+
return
|
|
540
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
541
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
542
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
543
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
544
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
545
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
546
|
+
|
|
547
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
548
|
+
|
|
549
|
+
def delete(
|
|
550
|
+
self,
|
|
551
|
+
*,
|
|
552
|
+
virtual_machine_id: str,
|
|
553
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
554
|
+
server_url: Optional[str] = None,
|
|
555
|
+
timeout_ms: Optional[int] = None,
|
|
556
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
557
|
+
):
|
|
558
|
+
r"""Destroy a Virtual Machine
|
|
559
|
+
|
|
560
|
+
Destroys a Virtual Machine.
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
:param virtual_machine_id:
|
|
564
|
+
:param retries: Override the default retry configuration for this method
|
|
565
|
+
:param server_url: Override the default server URL for this method
|
|
566
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
567
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
568
|
+
"""
|
|
569
|
+
base_url = None
|
|
570
|
+
url_variables = None
|
|
571
|
+
if timeout_ms is None:
|
|
572
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
573
|
+
|
|
574
|
+
if server_url is not None:
|
|
575
|
+
base_url = server_url
|
|
576
|
+
else:
|
|
577
|
+
base_url = self._get_url(base_url, url_variables)
|
|
578
|
+
|
|
579
|
+
request = models.DestroyVirtualMachineRequest(
|
|
580
|
+
virtual_machine_id=virtual_machine_id,
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
req = self._build_request(
|
|
584
|
+
method="DELETE",
|
|
585
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
586
|
+
base_url=base_url,
|
|
587
|
+
url_variables=url_variables,
|
|
588
|
+
request=request,
|
|
589
|
+
request_body_required=False,
|
|
590
|
+
request_has_path_params=True,
|
|
591
|
+
request_has_query_params=True,
|
|
592
|
+
user_agent_header="user-agent",
|
|
593
|
+
accept_header_value="*/*",
|
|
594
|
+
http_headers=http_headers,
|
|
595
|
+
security=self.sdk_configuration.security,
|
|
596
|
+
allow_empty_value=None,
|
|
597
|
+
timeout_ms=timeout_ms,
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
if retries == UNSET:
|
|
601
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
602
|
+
retries = self.sdk_configuration.retry_config
|
|
603
|
+
|
|
604
|
+
retry_config = None
|
|
605
|
+
if isinstance(retries, utils.RetryConfig):
|
|
606
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
607
|
+
|
|
608
|
+
http_res = self.do_request(
|
|
609
|
+
hook_ctx=HookContext(
|
|
610
|
+
config=self.sdk_configuration,
|
|
611
|
+
base_url=base_url or "",
|
|
612
|
+
operation_id="destroy-virtual-machine",
|
|
613
|
+
oauth2_scopes=None,
|
|
614
|
+
security_source=get_security_from_env(
|
|
615
|
+
self.sdk_configuration.security, models.Security
|
|
616
|
+
),
|
|
617
|
+
),
|
|
618
|
+
request=req,
|
|
619
|
+
error_status_codes=["4XX", "5XX"],
|
|
620
|
+
retry_config=retry_config,
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
if utils.match_response(http_res, "204", "*"):
|
|
624
|
+
return
|
|
625
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
626
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
627
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
628
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
629
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
630
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
631
|
+
|
|
632
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
633
|
+
|
|
634
|
+
async def delete_async(
|
|
635
|
+
self,
|
|
636
|
+
*,
|
|
637
|
+
virtual_machine_id: str,
|
|
638
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
639
|
+
server_url: Optional[str] = None,
|
|
640
|
+
timeout_ms: Optional[int] = None,
|
|
641
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
642
|
+
):
|
|
643
|
+
r"""Destroy a Virtual Machine
|
|
644
|
+
|
|
645
|
+
Destroys a Virtual Machine.
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
:param virtual_machine_id:
|
|
649
|
+
:param retries: Override the default retry configuration for this method
|
|
650
|
+
:param server_url: Override the default server URL for this method
|
|
651
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
652
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
653
|
+
"""
|
|
654
|
+
base_url = None
|
|
655
|
+
url_variables = None
|
|
656
|
+
if timeout_ms is None:
|
|
657
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
658
|
+
|
|
659
|
+
if server_url is not None:
|
|
660
|
+
base_url = server_url
|
|
661
|
+
else:
|
|
662
|
+
base_url = self._get_url(base_url, url_variables)
|
|
663
|
+
|
|
664
|
+
request = models.DestroyVirtualMachineRequest(
|
|
665
|
+
virtual_machine_id=virtual_machine_id,
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
req = self._build_request_async(
|
|
669
|
+
method="DELETE",
|
|
670
|
+
path="/virtual_machines/{virtual_machine_id}",
|
|
671
|
+
base_url=base_url,
|
|
672
|
+
url_variables=url_variables,
|
|
673
|
+
request=request,
|
|
674
|
+
request_body_required=False,
|
|
675
|
+
request_has_path_params=True,
|
|
676
|
+
request_has_query_params=True,
|
|
677
|
+
user_agent_header="user-agent",
|
|
678
|
+
accept_header_value="*/*",
|
|
679
|
+
http_headers=http_headers,
|
|
680
|
+
security=self.sdk_configuration.security,
|
|
681
|
+
allow_empty_value=None,
|
|
682
|
+
timeout_ms=timeout_ms,
|
|
683
|
+
)
|
|
684
|
+
|
|
685
|
+
if retries == UNSET:
|
|
686
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
687
|
+
retries = self.sdk_configuration.retry_config
|
|
688
|
+
|
|
689
|
+
retry_config = None
|
|
690
|
+
if isinstance(retries, utils.RetryConfig):
|
|
691
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
692
|
+
|
|
693
|
+
http_res = await self.do_request_async(
|
|
694
|
+
hook_ctx=HookContext(
|
|
695
|
+
config=self.sdk_configuration,
|
|
696
|
+
base_url=base_url or "",
|
|
697
|
+
operation_id="destroy-virtual-machine",
|
|
698
|
+
oauth2_scopes=None,
|
|
699
|
+
security_source=get_security_from_env(
|
|
700
|
+
self.sdk_configuration.security, models.Security
|
|
701
|
+
),
|
|
702
|
+
),
|
|
703
|
+
request=req,
|
|
704
|
+
error_status_codes=["4XX", "5XX"],
|
|
705
|
+
retry_config=retry_config,
|
|
706
|
+
)
|
|
707
|
+
|
|
708
|
+
if utils.match_response(http_res, "204", "*"):
|
|
709
|
+
return
|
|
710
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
711
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
712
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
713
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
714
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
715
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
716
|
+
|
|
717
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
718
|
+
|
|
719
|
+
def create_virtual_machine_action(
|
|
720
|
+
self,
|
|
721
|
+
*,
|
|
722
|
+
virtual_machine_id: str,
|
|
723
|
+
id: str,
|
|
724
|
+
type_: models.CreateVirtualMachineActionVirtualMachinesType,
|
|
725
|
+
attributes: Union[
|
|
726
|
+
models.CreateVirtualMachineActionVirtualMachinesAttributes,
|
|
727
|
+
models.CreateVirtualMachineActionVirtualMachinesAttributesTypedDict,
|
|
728
|
+
],
|
|
729
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
730
|
+
server_url: Optional[str] = None,
|
|
731
|
+
timeout_ms: Optional[int] = None,
|
|
732
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
733
|
+
):
|
|
734
|
+
r"""Run Virtual Machine Action
|
|
735
|
+
|
|
736
|
+
Performs a power action on a given virtual machine:
|
|
737
|
+
- `power_on` - Starts the virtual machine
|
|
738
|
+
- `power_off` - Stops the virtual machine
|
|
739
|
+
- `reboot` - Restarts the virtual machine
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
:param virtual_machine_id:
|
|
743
|
+
:param id:
|
|
744
|
+
:param type:
|
|
745
|
+
:param attributes:
|
|
746
|
+
:param retries: Override the default retry configuration for this method
|
|
747
|
+
:param server_url: Override the default server URL for this method
|
|
748
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
749
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
750
|
+
"""
|
|
751
|
+
base_url = None
|
|
752
|
+
url_variables = None
|
|
753
|
+
if timeout_ms is None:
|
|
754
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
755
|
+
|
|
756
|
+
if server_url is not None:
|
|
757
|
+
base_url = server_url
|
|
758
|
+
else:
|
|
759
|
+
base_url = self._get_url(base_url, url_variables)
|
|
760
|
+
|
|
761
|
+
request = models.CreateVirtualMachineActionRequest(
|
|
762
|
+
virtual_machine_id=virtual_machine_id,
|
|
763
|
+
request_body=models.CreateVirtualMachineActionVirtualMachinesRequestBody(
|
|
764
|
+
id=id,
|
|
765
|
+
type=type_,
|
|
766
|
+
attributes=utils.get_pydantic_model(
|
|
767
|
+
attributes,
|
|
768
|
+
models.CreateVirtualMachineActionVirtualMachinesAttributes,
|
|
769
|
+
),
|
|
770
|
+
),
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
req = self._build_request(
|
|
774
|
+
method="POST",
|
|
775
|
+
path="/virtual_machines/{virtual_machine_id}/actions",
|
|
776
|
+
base_url=base_url,
|
|
777
|
+
url_variables=url_variables,
|
|
778
|
+
request=request,
|
|
779
|
+
request_body_required=True,
|
|
780
|
+
request_has_path_params=True,
|
|
781
|
+
request_has_query_params=True,
|
|
782
|
+
user_agent_header="user-agent",
|
|
783
|
+
accept_header_value="*/*",
|
|
784
|
+
http_headers=http_headers,
|
|
785
|
+
security=self.sdk_configuration.security,
|
|
786
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
787
|
+
request.request_body,
|
|
788
|
+
False,
|
|
789
|
+
False,
|
|
790
|
+
"json",
|
|
791
|
+
models.CreateVirtualMachineActionVirtualMachinesRequestBody,
|
|
792
|
+
),
|
|
793
|
+
allow_empty_value=None,
|
|
794
|
+
timeout_ms=timeout_ms,
|
|
795
|
+
)
|
|
796
|
+
|
|
797
|
+
if retries == UNSET:
|
|
798
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
799
|
+
retries = self.sdk_configuration.retry_config
|
|
800
|
+
|
|
801
|
+
retry_config = None
|
|
802
|
+
if isinstance(retries, utils.RetryConfig):
|
|
803
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
804
|
+
|
|
805
|
+
http_res = self.do_request(
|
|
806
|
+
hook_ctx=HookContext(
|
|
807
|
+
config=self.sdk_configuration,
|
|
808
|
+
base_url=base_url or "",
|
|
809
|
+
operation_id="create-virtual-machine-action",
|
|
810
|
+
oauth2_scopes=None,
|
|
811
|
+
security_source=get_security_from_env(
|
|
812
|
+
self.sdk_configuration.security, models.Security
|
|
813
|
+
),
|
|
814
|
+
),
|
|
815
|
+
request=req,
|
|
816
|
+
error_status_codes=["4XX", "5XX"],
|
|
817
|
+
retry_config=retry_config,
|
|
818
|
+
)
|
|
819
|
+
|
|
820
|
+
if utils.match_response(http_res, "201", "*"):
|
|
821
|
+
return
|
|
822
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
823
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
824
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
825
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
826
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
827
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
828
|
+
|
|
829
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
830
|
+
|
|
831
|
+
async def create_virtual_machine_action_async(
|
|
832
|
+
self,
|
|
833
|
+
*,
|
|
834
|
+
virtual_machine_id: str,
|
|
835
|
+
id: str,
|
|
836
|
+
type_: models.CreateVirtualMachineActionVirtualMachinesType,
|
|
837
|
+
attributes: Union[
|
|
838
|
+
models.CreateVirtualMachineActionVirtualMachinesAttributes,
|
|
839
|
+
models.CreateVirtualMachineActionVirtualMachinesAttributesTypedDict,
|
|
840
|
+
],
|
|
841
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
842
|
+
server_url: Optional[str] = None,
|
|
843
|
+
timeout_ms: Optional[int] = None,
|
|
844
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
845
|
+
):
|
|
846
|
+
r"""Run Virtual Machine Action
|
|
847
|
+
|
|
848
|
+
Performs a power action on a given virtual machine:
|
|
849
|
+
- `power_on` - Starts the virtual machine
|
|
850
|
+
- `power_off` - Stops the virtual machine
|
|
851
|
+
- `reboot` - Restarts the virtual machine
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
:param virtual_machine_id:
|
|
855
|
+
:param id:
|
|
856
|
+
:param type:
|
|
857
|
+
:param attributes:
|
|
858
|
+
:param retries: Override the default retry configuration for this method
|
|
859
|
+
:param server_url: Override the default server URL for this method
|
|
860
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
861
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
862
|
+
"""
|
|
863
|
+
base_url = None
|
|
864
|
+
url_variables = None
|
|
865
|
+
if timeout_ms is None:
|
|
866
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
867
|
+
|
|
868
|
+
if server_url is not None:
|
|
869
|
+
base_url = server_url
|
|
870
|
+
else:
|
|
871
|
+
base_url = self._get_url(base_url, url_variables)
|
|
872
|
+
|
|
873
|
+
request = models.CreateVirtualMachineActionRequest(
|
|
874
|
+
virtual_machine_id=virtual_machine_id,
|
|
875
|
+
request_body=models.CreateVirtualMachineActionVirtualMachinesRequestBody(
|
|
876
|
+
id=id,
|
|
877
|
+
type=type_,
|
|
878
|
+
attributes=utils.get_pydantic_model(
|
|
879
|
+
attributes,
|
|
880
|
+
models.CreateVirtualMachineActionVirtualMachinesAttributes,
|
|
881
|
+
),
|
|
882
|
+
),
|
|
883
|
+
)
|
|
884
|
+
|
|
885
|
+
req = self._build_request_async(
|
|
886
|
+
method="POST",
|
|
887
|
+
path="/virtual_machines/{virtual_machine_id}/actions",
|
|
888
|
+
base_url=base_url,
|
|
889
|
+
url_variables=url_variables,
|
|
890
|
+
request=request,
|
|
891
|
+
request_body_required=True,
|
|
892
|
+
request_has_path_params=True,
|
|
893
|
+
request_has_query_params=True,
|
|
894
|
+
user_agent_header="user-agent",
|
|
895
|
+
accept_header_value="*/*",
|
|
896
|
+
http_headers=http_headers,
|
|
897
|
+
security=self.sdk_configuration.security,
|
|
898
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
899
|
+
request.request_body,
|
|
900
|
+
False,
|
|
901
|
+
False,
|
|
902
|
+
"json",
|
|
903
|
+
models.CreateVirtualMachineActionVirtualMachinesRequestBody,
|
|
904
|
+
),
|
|
905
|
+
allow_empty_value=None,
|
|
906
|
+
timeout_ms=timeout_ms,
|
|
907
|
+
)
|
|
908
|
+
|
|
909
|
+
if retries == UNSET:
|
|
910
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
911
|
+
retries = self.sdk_configuration.retry_config
|
|
912
|
+
|
|
913
|
+
retry_config = None
|
|
914
|
+
if isinstance(retries, utils.RetryConfig):
|
|
915
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
916
|
+
|
|
917
|
+
http_res = await self.do_request_async(
|
|
918
|
+
hook_ctx=HookContext(
|
|
919
|
+
config=self.sdk_configuration,
|
|
920
|
+
base_url=base_url or "",
|
|
921
|
+
operation_id="create-virtual-machine-action",
|
|
922
|
+
oauth2_scopes=None,
|
|
923
|
+
security_source=get_security_from_env(
|
|
924
|
+
self.sdk_configuration.security, models.Security
|
|
925
|
+
),
|
|
926
|
+
),
|
|
927
|
+
request=req,
|
|
928
|
+
error_status_codes=["4XX", "5XX"],
|
|
929
|
+
retry_config=retry_config,
|
|
930
|
+
)
|
|
931
|
+
|
|
932
|
+
if utils.match_response(http_res, "201", "*"):
|
|
933
|
+
return
|
|
934
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
935
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
936
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
937
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
938
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
939
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
940
|
+
|
|
941
|
+
raise models.APIError("Unexpected response received", http_res)
|