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,3810 @@
|
|
|
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 Any, Mapping, Optional, Union, cast
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ServersSDK(BaseSDK):
|
|
12
|
+
def list(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
filter_project: Optional[str] = None,
|
|
16
|
+
filter_region: Optional[str] = None,
|
|
17
|
+
filter_hostname: Optional[str] = None,
|
|
18
|
+
filter_created_at_gte: Optional[str] = None,
|
|
19
|
+
filter_created_at_lte: Optional[str] = None,
|
|
20
|
+
filter_label: Optional[str] = None,
|
|
21
|
+
filter_status: Optional[str] = None,
|
|
22
|
+
filter_plan: Optional[str] = None,
|
|
23
|
+
filter_gpu: Optional[bool] = None,
|
|
24
|
+
filter_ram_eql: Optional[int] = None,
|
|
25
|
+
filter_ram_gte: Optional[int] = None,
|
|
26
|
+
filter_ram_lte: Optional[int] = None,
|
|
27
|
+
filter_disk: Optional[int] = None,
|
|
28
|
+
filter_tags: Optional[str] = None,
|
|
29
|
+
extra_fields_servers: Optional[str] = None,
|
|
30
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
31
|
+
server_url: Optional[str] = None,
|
|
32
|
+
timeout_ms: Optional[int] = None,
|
|
33
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
34
|
+
) -> models.Servers:
|
|
35
|
+
r"""List all Servers
|
|
36
|
+
|
|
37
|
+
Returns a list of all servers belonging to the team.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
:param filter_project: The project ID or Slug to filter by
|
|
41
|
+
:param filter_region: The region Slug to filter by
|
|
42
|
+
:param filter_hostname: The hostname of server to filter by
|
|
43
|
+
:param filter_created_at_gte: The created at greater than equal date to filter by
|
|
44
|
+
:param filter_created_at_lte: The created at less than equal date to filter by
|
|
45
|
+
:param filter_label: The label of server to filter by
|
|
46
|
+
:param filter_status: The status of server to filter by
|
|
47
|
+
:param filter_plan: The platform/plan name of the server to filter by
|
|
48
|
+
:param filter_gpu: Filter by the existence of an associated GPU
|
|
49
|
+
:param filter_ram_eql: Filter servers with RAM size (in GB) equals the provided value.
|
|
50
|
+
:param filter_ram_gte: Filter servers with RAM size (in GB) greater than or equal the provided value.
|
|
51
|
+
:param filter_ram_lte: Filter servers with RAM size (in GB) less than or equal the provided value.
|
|
52
|
+
:param filter_disk: The disk size in Gigabytes to filter by, should be used with the following options: [eql] to filter for values equal to the provided value. [gte] to filter for values greater or equal to the provided value. [lte] to filter by values lower or equal to the provided value.
|
|
53
|
+
:param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return servers with `tag_1` AND `tag_2`
|
|
54
|
+
:param extra_fields_servers: The `credentials` are provided as extra attributes that is lazy loaded. To request it, just set `extra_fields[servers]=credentials` in the query string.
|
|
55
|
+
:param retries: Override the default retry configuration for this method
|
|
56
|
+
:param server_url: Override the default server URL for this method
|
|
57
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
58
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
59
|
+
"""
|
|
60
|
+
base_url = None
|
|
61
|
+
url_variables = None
|
|
62
|
+
if timeout_ms is None:
|
|
63
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
64
|
+
|
|
65
|
+
if server_url is not None:
|
|
66
|
+
base_url = server_url
|
|
67
|
+
else:
|
|
68
|
+
base_url = self._get_url(base_url, url_variables)
|
|
69
|
+
|
|
70
|
+
request = models.GetServersRequest(
|
|
71
|
+
filter_project=filter_project,
|
|
72
|
+
filter_region=filter_region,
|
|
73
|
+
filter_hostname=filter_hostname,
|
|
74
|
+
filter_created_at_gte=filter_created_at_gte,
|
|
75
|
+
filter_created_at_lte=filter_created_at_lte,
|
|
76
|
+
filter_label=filter_label,
|
|
77
|
+
filter_status=filter_status,
|
|
78
|
+
filter_plan=filter_plan,
|
|
79
|
+
filter_gpu=filter_gpu,
|
|
80
|
+
filter_ram_eql=filter_ram_eql,
|
|
81
|
+
filter_ram_gte=filter_ram_gte,
|
|
82
|
+
filter_ram_lte=filter_ram_lte,
|
|
83
|
+
filter_disk=filter_disk,
|
|
84
|
+
filter_tags=filter_tags,
|
|
85
|
+
extra_fields_servers=extra_fields_servers,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
req = self._build_request(
|
|
89
|
+
method="GET",
|
|
90
|
+
path="/servers",
|
|
91
|
+
base_url=base_url,
|
|
92
|
+
url_variables=url_variables,
|
|
93
|
+
request=request,
|
|
94
|
+
request_body_required=False,
|
|
95
|
+
request_has_path_params=False,
|
|
96
|
+
request_has_query_params=True,
|
|
97
|
+
user_agent_header="user-agent",
|
|
98
|
+
accept_header_value="application/vnd.api+json",
|
|
99
|
+
http_headers=http_headers,
|
|
100
|
+
security=self.sdk_configuration.security,
|
|
101
|
+
timeout_ms=timeout_ms,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
if retries == UNSET:
|
|
105
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
106
|
+
retries = self.sdk_configuration.retry_config
|
|
107
|
+
|
|
108
|
+
retry_config = None
|
|
109
|
+
if isinstance(retries, utils.RetryConfig):
|
|
110
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
111
|
+
|
|
112
|
+
http_res = self.do_request(
|
|
113
|
+
hook_ctx=HookContext(
|
|
114
|
+
base_url=base_url or "",
|
|
115
|
+
operation_id="get-servers",
|
|
116
|
+
oauth2_scopes=[],
|
|
117
|
+
security_source=get_security_from_env(
|
|
118
|
+
self.sdk_configuration.security, models.Security
|
|
119
|
+
),
|
|
120
|
+
),
|
|
121
|
+
request=req,
|
|
122
|
+
error_status_codes=["4XX", "5XX"],
|
|
123
|
+
retry_config=retry_config,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
127
|
+
return utils.unmarshal_json(http_res.text, models.Servers)
|
|
128
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
129
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
130
|
+
raise models.APIError(
|
|
131
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
132
|
+
)
|
|
133
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
134
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
135
|
+
raise models.APIError(
|
|
136
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
content_type = http_res.headers.get("Content-Type")
|
|
140
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
141
|
+
raise models.APIError(
|
|
142
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
143
|
+
http_res.status_code,
|
|
144
|
+
http_res_text,
|
|
145
|
+
http_res,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
async def list_async(
|
|
149
|
+
self,
|
|
150
|
+
*,
|
|
151
|
+
filter_project: Optional[str] = None,
|
|
152
|
+
filter_region: Optional[str] = None,
|
|
153
|
+
filter_hostname: Optional[str] = None,
|
|
154
|
+
filter_created_at_gte: Optional[str] = None,
|
|
155
|
+
filter_created_at_lte: Optional[str] = None,
|
|
156
|
+
filter_label: Optional[str] = None,
|
|
157
|
+
filter_status: Optional[str] = None,
|
|
158
|
+
filter_plan: Optional[str] = None,
|
|
159
|
+
filter_gpu: Optional[bool] = None,
|
|
160
|
+
filter_ram_eql: Optional[int] = None,
|
|
161
|
+
filter_ram_gte: Optional[int] = None,
|
|
162
|
+
filter_ram_lte: Optional[int] = None,
|
|
163
|
+
filter_disk: Optional[int] = None,
|
|
164
|
+
filter_tags: Optional[str] = None,
|
|
165
|
+
extra_fields_servers: Optional[str] = None,
|
|
166
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
167
|
+
server_url: Optional[str] = None,
|
|
168
|
+
timeout_ms: Optional[int] = None,
|
|
169
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
170
|
+
) -> models.Servers:
|
|
171
|
+
r"""List all Servers
|
|
172
|
+
|
|
173
|
+
Returns a list of all servers belonging to the team.
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
:param filter_project: The project ID or Slug to filter by
|
|
177
|
+
:param filter_region: The region Slug to filter by
|
|
178
|
+
:param filter_hostname: The hostname of server to filter by
|
|
179
|
+
:param filter_created_at_gte: The created at greater than equal date to filter by
|
|
180
|
+
:param filter_created_at_lte: The created at less than equal date to filter by
|
|
181
|
+
:param filter_label: The label of server to filter by
|
|
182
|
+
:param filter_status: The status of server to filter by
|
|
183
|
+
:param filter_plan: The platform/plan name of the server to filter by
|
|
184
|
+
:param filter_gpu: Filter by the existence of an associated GPU
|
|
185
|
+
:param filter_ram_eql: Filter servers with RAM size (in GB) equals the provided value.
|
|
186
|
+
:param filter_ram_gte: Filter servers with RAM size (in GB) greater than or equal the provided value.
|
|
187
|
+
:param filter_ram_lte: Filter servers with RAM size (in GB) less than or equal the provided value.
|
|
188
|
+
:param filter_disk: The disk size in Gigabytes to filter by, should be used with the following options: [eql] to filter for values equal to the provided value. [gte] to filter for values greater or equal to the provided value. [lte] to filter by values lower or equal to the provided value.
|
|
189
|
+
:param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return servers with `tag_1` AND `tag_2`
|
|
190
|
+
:param extra_fields_servers: The `credentials` are provided as extra attributes that is lazy loaded. To request it, just set `extra_fields[servers]=credentials` in the query string.
|
|
191
|
+
:param retries: Override the default retry configuration for this method
|
|
192
|
+
:param server_url: Override the default server URL for this method
|
|
193
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
194
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
195
|
+
"""
|
|
196
|
+
base_url = None
|
|
197
|
+
url_variables = None
|
|
198
|
+
if timeout_ms is None:
|
|
199
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
200
|
+
|
|
201
|
+
if server_url is not None:
|
|
202
|
+
base_url = server_url
|
|
203
|
+
else:
|
|
204
|
+
base_url = self._get_url(base_url, url_variables)
|
|
205
|
+
|
|
206
|
+
request = models.GetServersRequest(
|
|
207
|
+
filter_project=filter_project,
|
|
208
|
+
filter_region=filter_region,
|
|
209
|
+
filter_hostname=filter_hostname,
|
|
210
|
+
filter_created_at_gte=filter_created_at_gte,
|
|
211
|
+
filter_created_at_lte=filter_created_at_lte,
|
|
212
|
+
filter_label=filter_label,
|
|
213
|
+
filter_status=filter_status,
|
|
214
|
+
filter_plan=filter_plan,
|
|
215
|
+
filter_gpu=filter_gpu,
|
|
216
|
+
filter_ram_eql=filter_ram_eql,
|
|
217
|
+
filter_ram_gte=filter_ram_gte,
|
|
218
|
+
filter_ram_lte=filter_ram_lte,
|
|
219
|
+
filter_disk=filter_disk,
|
|
220
|
+
filter_tags=filter_tags,
|
|
221
|
+
extra_fields_servers=extra_fields_servers,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
req = self._build_request_async(
|
|
225
|
+
method="GET",
|
|
226
|
+
path="/servers",
|
|
227
|
+
base_url=base_url,
|
|
228
|
+
url_variables=url_variables,
|
|
229
|
+
request=request,
|
|
230
|
+
request_body_required=False,
|
|
231
|
+
request_has_path_params=False,
|
|
232
|
+
request_has_query_params=True,
|
|
233
|
+
user_agent_header="user-agent",
|
|
234
|
+
accept_header_value="application/vnd.api+json",
|
|
235
|
+
http_headers=http_headers,
|
|
236
|
+
security=self.sdk_configuration.security,
|
|
237
|
+
timeout_ms=timeout_ms,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
if retries == UNSET:
|
|
241
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
242
|
+
retries = self.sdk_configuration.retry_config
|
|
243
|
+
|
|
244
|
+
retry_config = None
|
|
245
|
+
if isinstance(retries, utils.RetryConfig):
|
|
246
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
247
|
+
|
|
248
|
+
http_res = await self.do_request_async(
|
|
249
|
+
hook_ctx=HookContext(
|
|
250
|
+
base_url=base_url or "",
|
|
251
|
+
operation_id="get-servers",
|
|
252
|
+
oauth2_scopes=[],
|
|
253
|
+
security_source=get_security_from_env(
|
|
254
|
+
self.sdk_configuration.security, models.Security
|
|
255
|
+
),
|
|
256
|
+
),
|
|
257
|
+
request=req,
|
|
258
|
+
error_status_codes=["4XX", "5XX"],
|
|
259
|
+
retry_config=retry_config,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
263
|
+
return utils.unmarshal_json(http_res.text, models.Servers)
|
|
264
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
265
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
266
|
+
raise models.APIError(
|
|
267
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
268
|
+
)
|
|
269
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
270
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
271
|
+
raise models.APIError(
|
|
272
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
content_type = http_res.headers.get("Content-Type")
|
|
276
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
277
|
+
raise models.APIError(
|
|
278
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
279
|
+
http_res.status_code,
|
|
280
|
+
http_res_text,
|
|
281
|
+
http_res,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
def create(
|
|
285
|
+
self,
|
|
286
|
+
*,
|
|
287
|
+
request: Union[
|
|
288
|
+
models.CreateServerServersRequestBody,
|
|
289
|
+
models.CreateServerServersRequestBodyTypedDict,
|
|
290
|
+
] = models.CreateServerServersRequestBody(),
|
|
291
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
292
|
+
server_url: Optional[str] = None,
|
|
293
|
+
timeout_ms: Optional[int] = None,
|
|
294
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
295
|
+
) -> models.Server:
|
|
296
|
+
r"""Deploy Server
|
|
297
|
+
|
|
298
|
+
:param request: The request object to send.
|
|
299
|
+
:param retries: Override the default retry configuration for this method
|
|
300
|
+
:param server_url: Override the default server URL for this method
|
|
301
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
302
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
303
|
+
"""
|
|
304
|
+
base_url = None
|
|
305
|
+
url_variables = None
|
|
306
|
+
if timeout_ms is None:
|
|
307
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
308
|
+
|
|
309
|
+
if server_url is not None:
|
|
310
|
+
base_url = server_url
|
|
311
|
+
else:
|
|
312
|
+
base_url = self._get_url(base_url, url_variables)
|
|
313
|
+
|
|
314
|
+
if not isinstance(request, BaseModel):
|
|
315
|
+
request = utils.unmarshal(request, models.CreateServerServersRequestBody)
|
|
316
|
+
request = cast(models.CreateServerServersRequestBody, request)
|
|
317
|
+
|
|
318
|
+
req = self._build_request(
|
|
319
|
+
method="POST",
|
|
320
|
+
path="/servers",
|
|
321
|
+
base_url=base_url,
|
|
322
|
+
url_variables=url_variables,
|
|
323
|
+
request=request,
|
|
324
|
+
request_body_required=True,
|
|
325
|
+
request_has_path_params=False,
|
|
326
|
+
request_has_query_params=True,
|
|
327
|
+
user_agent_header="user-agent",
|
|
328
|
+
accept_header_value="application/vnd.api+json",
|
|
329
|
+
http_headers=http_headers,
|
|
330
|
+
security=self.sdk_configuration.security,
|
|
331
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
332
|
+
request,
|
|
333
|
+
False,
|
|
334
|
+
True,
|
|
335
|
+
"json",
|
|
336
|
+
Optional[models.CreateServerServersRequestBody],
|
|
337
|
+
),
|
|
338
|
+
timeout_ms=timeout_ms,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
if retries == UNSET:
|
|
342
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
343
|
+
retries = self.sdk_configuration.retry_config
|
|
344
|
+
|
|
345
|
+
retry_config = None
|
|
346
|
+
if isinstance(retries, utils.RetryConfig):
|
|
347
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
348
|
+
|
|
349
|
+
http_res = self.do_request(
|
|
350
|
+
hook_ctx=HookContext(
|
|
351
|
+
base_url=base_url or "",
|
|
352
|
+
operation_id="create-server",
|
|
353
|
+
oauth2_scopes=[],
|
|
354
|
+
security_source=get_security_from_env(
|
|
355
|
+
self.sdk_configuration.security, models.Security
|
|
356
|
+
),
|
|
357
|
+
),
|
|
358
|
+
request=req,
|
|
359
|
+
error_status_codes=["400", "402", "422", "4XX", "5XX"],
|
|
360
|
+
retry_config=retry_config,
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
response_data: Any = None
|
|
364
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
365
|
+
return utils.unmarshal_json(http_res.text, models.Server)
|
|
366
|
+
if utils.match_response(
|
|
367
|
+
http_res, ["400", "402", "422"], "application/vnd.api+json"
|
|
368
|
+
):
|
|
369
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
370
|
+
raise models.ErrorObject(data=response_data)
|
|
371
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
372
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
373
|
+
raise models.APIError(
|
|
374
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
375
|
+
)
|
|
376
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
377
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
378
|
+
raise models.APIError(
|
|
379
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
content_type = http_res.headers.get("Content-Type")
|
|
383
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
384
|
+
raise models.APIError(
|
|
385
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
386
|
+
http_res.status_code,
|
|
387
|
+
http_res_text,
|
|
388
|
+
http_res,
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
async def create_async(
|
|
392
|
+
self,
|
|
393
|
+
*,
|
|
394
|
+
request: Union[
|
|
395
|
+
models.CreateServerServersRequestBody,
|
|
396
|
+
models.CreateServerServersRequestBodyTypedDict,
|
|
397
|
+
] = models.CreateServerServersRequestBody(),
|
|
398
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
399
|
+
server_url: Optional[str] = None,
|
|
400
|
+
timeout_ms: Optional[int] = None,
|
|
401
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
402
|
+
) -> models.Server:
|
|
403
|
+
r"""Deploy Server
|
|
404
|
+
|
|
405
|
+
:param request: The request object to send.
|
|
406
|
+
:param retries: Override the default retry configuration for this method
|
|
407
|
+
:param server_url: Override the default server URL for this method
|
|
408
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
409
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
410
|
+
"""
|
|
411
|
+
base_url = None
|
|
412
|
+
url_variables = None
|
|
413
|
+
if timeout_ms is None:
|
|
414
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
415
|
+
|
|
416
|
+
if server_url is not None:
|
|
417
|
+
base_url = server_url
|
|
418
|
+
else:
|
|
419
|
+
base_url = self._get_url(base_url, url_variables)
|
|
420
|
+
|
|
421
|
+
if not isinstance(request, BaseModel):
|
|
422
|
+
request = utils.unmarshal(request, models.CreateServerServersRequestBody)
|
|
423
|
+
request = cast(models.CreateServerServersRequestBody, request)
|
|
424
|
+
|
|
425
|
+
req = self._build_request_async(
|
|
426
|
+
method="POST",
|
|
427
|
+
path="/servers",
|
|
428
|
+
base_url=base_url,
|
|
429
|
+
url_variables=url_variables,
|
|
430
|
+
request=request,
|
|
431
|
+
request_body_required=True,
|
|
432
|
+
request_has_path_params=False,
|
|
433
|
+
request_has_query_params=True,
|
|
434
|
+
user_agent_header="user-agent",
|
|
435
|
+
accept_header_value="application/vnd.api+json",
|
|
436
|
+
http_headers=http_headers,
|
|
437
|
+
security=self.sdk_configuration.security,
|
|
438
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
439
|
+
request,
|
|
440
|
+
False,
|
|
441
|
+
True,
|
|
442
|
+
"json",
|
|
443
|
+
Optional[models.CreateServerServersRequestBody],
|
|
444
|
+
),
|
|
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 = await self.do_request_async(
|
|
457
|
+
hook_ctx=HookContext(
|
|
458
|
+
base_url=base_url or "",
|
|
459
|
+
operation_id="create-server",
|
|
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=["400", "402", "422", "4XX", "5XX"],
|
|
467
|
+
retry_config=retry_config,
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
response_data: Any = None
|
|
471
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
472
|
+
return utils.unmarshal_json(http_res.text, models.Server)
|
|
473
|
+
if utils.match_response(
|
|
474
|
+
http_res, ["400", "402", "422"], "application/vnd.api+json"
|
|
475
|
+
):
|
|
476
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
477
|
+
raise models.ErrorObject(data=response_data)
|
|
478
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
479
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
480
|
+
raise models.APIError(
|
|
481
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
482
|
+
)
|
|
483
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
484
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
485
|
+
raise models.APIError(
|
|
486
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
content_type = http_res.headers.get("Content-Type")
|
|
490
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
491
|
+
raise models.APIError(
|
|
492
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
493
|
+
http_res.status_code,
|
|
494
|
+
http_res_text,
|
|
495
|
+
http_res,
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
def get(
|
|
499
|
+
self,
|
|
500
|
+
*,
|
|
501
|
+
server_id: str,
|
|
502
|
+
extra_fields_servers: Optional[str] = None,
|
|
503
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
504
|
+
server_url: Optional[str] = None,
|
|
505
|
+
timeout_ms: Optional[int] = None,
|
|
506
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
507
|
+
) -> models.Server:
|
|
508
|
+
r"""Retrieve a Server
|
|
509
|
+
|
|
510
|
+
Returns a server that belongs to the team.
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
:param server_id: The Server ID
|
|
514
|
+
:param extra_fields_servers: The `credentials` are provided as extra attributes that is lazy loaded. To request it, just set `extra_fields[servers]=credentials` in the query string.
|
|
515
|
+
:param retries: Override the default retry configuration for this method
|
|
516
|
+
:param server_url: Override the default server URL for this method
|
|
517
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
518
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
519
|
+
"""
|
|
520
|
+
base_url = None
|
|
521
|
+
url_variables = None
|
|
522
|
+
if timeout_ms is None:
|
|
523
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
524
|
+
|
|
525
|
+
if server_url is not None:
|
|
526
|
+
base_url = server_url
|
|
527
|
+
else:
|
|
528
|
+
base_url = self._get_url(base_url, url_variables)
|
|
529
|
+
|
|
530
|
+
request = models.GetServerRequest(
|
|
531
|
+
server_id=server_id,
|
|
532
|
+
extra_fields_servers=extra_fields_servers,
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
req = self._build_request(
|
|
536
|
+
method="GET",
|
|
537
|
+
path="/servers/{server_id}",
|
|
538
|
+
base_url=base_url,
|
|
539
|
+
url_variables=url_variables,
|
|
540
|
+
request=request,
|
|
541
|
+
request_body_required=False,
|
|
542
|
+
request_has_path_params=True,
|
|
543
|
+
request_has_query_params=True,
|
|
544
|
+
user_agent_header="user-agent",
|
|
545
|
+
accept_header_value="application/vnd.api+json",
|
|
546
|
+
http_headers=http_headers,
|
|
547
|
+
security=self.sdk_configuration.security,
|
|
548
|
+
timeout_ms=timeout_ms,
|
|
549
|
+
)
|
|
550
|
+
|
|
551
|
+
if retries == UNSET:
|
|
552
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
553
|
+
retries = self.sdk_configuration.retry_config
|
|
554
|
+
|
|
555
|
+
retry_config = None
|
|
556
|
+
if isinstance(retries, utils.RetryConfig):
|
|
557
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
558
|
+
|
|
559
|
+
http_res = self.do_request(
|
|
560
|
+
hook_ctx=HookContext(
|
|
561
|
+
base_url=base_url or "",
|
|
562
|
+
operation_id="get-server",
|
|
563
|
+
oauth2_scopes=[],
|
|
564
|
+
security_source=get_security_from_env(
|
|
565
|
+
self.sdk_configuration.security, models.Security
|
|
566
|
+
),
|
|
567
|
+
),
|
|
568
|
+
request=req,
|
|
569
|
+
error_status_codes=["4XX", "5XX"],
|
|
570
|
+
retry_config=retry_config,
|
|
571
|
+
)
|
|
572
|
+
|
|
573
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
574
|
+
return utils.unmarshal_json(http_res.text, models.Server)
|
|
575
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
576
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
577
|
+
raise models.APIError(
|
|
578
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
579
|
+
)
|
|
580
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
581
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
582
|
+
raise models.APIError(
|
|
583
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
content_type = http_res.headers.get("Content-Type")
|
|
587
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
588
|
+
raise models.APIError(
|
|
589
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
590
|
+
http_res.status_code,
|
|
591
|
+
http_res_text,
|
|
592
|
+
http_res,
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
async def get_async(
|
|
596
|
+
self,
|
|
597
|
+
*,
|
|
598
|
+
server_id: str,
|
|
599
|
+
extra_fields_servers: Optional[str] = None,
|
|
600
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
601
|
+
server_url: Optional[str] = None,
|
|
602
|
+
timeout_ms: Optional[int] = None,
|
|
603
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
604
|
+
) -> models.Server:
|
|
605
|
+
r"""Retrieve a Server
|
|
606
|
+
|
|
607
|
+
Returns a server that belongs to the team.
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
:param server_id: The Server ID
|
|
611
|
+
:param extra_fields_servers: The `credentials` are provided as extra attributes that is lazy loaded. To request it, just set `extra_fields[servers]=credentials` in the query string.
|
|
612
|
+
:param retries: Override the default retry configuration for this method
|
|
613
|
+
:param server_url: Override the default server URL for this method
|
|
614
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
615
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
616
|
+
"""
|
|
617
|
+
base_url = None
|
|
618
|
+
url_variables = None
|
|
619
|
+
if timeout_ms is None:
|
|
620
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
621
|
+
|
|
622
|
+
if server_url is not None:
|
|
623
|
+
base_url = server_url
|
|
624
|
+
else:
|
|
625
|
+
base_url = self._get_url(base_url, url_variables)
|
|
626
|
+
|
|
627
|
+
request = models.GetServerRequest(
|
|
628
|
+
server_id=server_id,
|
|
629
|
+
extra_fields_servers=extra_fields_servers,
|
|
630
|
+
)
|
|
631
|
+
|
|
632
|
+
req = self._build_request_async(
|
|
633
|
+
method="GET",
|
|
634
|
+
path="/servers/{server_id}",
|
|
635
|
+
base_url=base_url,
|
|
636
|
+
url_variables=url_variables,
|
|
637
|
+
request=request,
|
|
638
|
+
request_body_required=False,
|
|
639
|
+
request_has_path_params=True,
|
|
640
|
+
request_has_query_params=True,
|
|
641
|
+
user_agent_header="user-agent",
|
|
642
|
+
accept_header_value="application/vnd.api+json",
|
|
643
|
+
http_headers=http_headers,
|
|
644
|
+
security=self.sdk_configuration.security,
|
|
645
|
+
timeout_ms=timeout_ms,
|
|
646
|
+
)
|
|
647
|
+
|
|
648
|
+
if retries == UNSET:
|
|
649
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
650
|
+
retries = self.sdk_configuration.retry_config
|
|
651
|
+
|
|
652
|
+
retry_config = None
|
|
653
|
+
if isinstance(retries, utils.RetryConfig):
|
|
654
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
655
|
+
|
|
656
|
+
http_res = await self.do_request_async(
|
|
657
|
+
hook_ctx=HookContext(
|
|
658
|
+
base_url=base_url or "",
|
|
659
|
+
operation_id="get-server",
|
|
660
|
+
oauth2_scopes=[],
|
|
661
|
+
security_source=get_security_from_env(
|
|
662
|
+
self.sdk_configuration.security, models.Security
|
|
663
|
+
),
|
|
664
|
+
),
|
|
665
|
+
request=req,
|
|
666
|
+
error_status_codes=["4XX", "5XX"],
|
|
667
|
+
retry_config=retry_config,
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
671
|
+
return utils.unmarshal_json(http_res.text, models.Server)
|
|
672
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
673
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
674
|
+
raise models.APIError(
|
|
675
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
676
|
+
)
|
|
677
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
678
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
679
|
+
raise models.APIError(
|
|
680
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
681
|
+
)
|
|
682
|
+
|
|
683
|
+
content_type = http_res.headers.get("Content-Type")
|
|
684
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
685
|
+
raise models.APIError(
|
|
686
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
687
|
+
http_res.status_code,
|
|
688
|
+
http_res_text,
|
|
689
|
+
http_res,
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
def update(
|
|
693
|
+
self,
|
|
694
|
+
*,
|
|
695
|
+
server_id: str,
|
|
696
|
+
id: Optional[str] = "sv_81EVOtR1N4J2Z",
|
|
697
|
+
type_: Optional[models.UpdateServerServersType] = None,
|
|
698
|
+
attributes: Optional[
|
|
699
|
+
Union[
|
|
700
|
+
models.UpdateServerServersAttributes,
|
|
701
|
+
models.UpdateServerServersAttributesTypedDict,
|
|
702
|
+
]
|
|
703
|
+
] = None,
|
|
704
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
705
|
+
server_url: Optional[str] = None,
|
|
706
|
+
timeout_ms: Optional[int] = None,
|
|
707
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
708
|
+
):
|
|
709
|
+
r"""Update Server
|
|
710
|
+
|
|
711
|
+
:param server_id:
|
|
712
|
+
:param id:
|
|
713
|
+
:param type:
|
|
714
|
+
:param attributes:
|
|
715
|
+
:param retries: Override the default retry configuration for this method
|
|
716
|
+
:param server_url: Override the default server URL for this method
|
|
717
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
718
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
719
|
+
"""
|
|
720
|
+
base_url = None
|
|
721
|
+
url_variables = None
|
|
722
|
+
if timeout_ms is None:
|
|
723
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
724
|
+
|
|
725
|
+
if server_url is not None:
|
|
726
|
+
base_url = server_url
|
|
727
|
+
else:
|
|
728
|
+
base_url = self._get_url(base_url, url_variables)
|
|
729
|
+
|
|
730
|
+
request = models.UpdateServerRequest(
|
|
731
|
+
server_id=server_id,
|
|
732
|
+
request_body=models.UpdateServerServersRequestBody(
|
|
733
|
+
id=id,
|
|
734
|
+
type=type_,
|
|
735
|
+
attributes=utils.get_pydantic_model(
|
|
736
|
+
attributes, Optional[models.UpdateServerServersAttributes]
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
)
|
|
740
|
+
|
|
741
|
+
req = self._build_request(
|
|
742
|
+
method="PATCH",
|
|
743
|
+
path="/servers/{server_id}",
|
|
744
|
+
base_url=base_url,
|
|
745
|
+
url_variables=url_variables,
|
|
746
|
+
request=request,
|
|
747
|
+
request_body_required=True,
|
|
748
|
+
request_has_path_params=True,
|
|
749
|
+
request_has_query_params=True,
|
|
750
|
+
user_agent_header="user-agent",
|
|
751
|
+
accept_header_value="application/vnd.api+json",
|
|
752
|
+
http_headers=http_headers,
|
|
753
|
+
security=self.sdk_configuration.security,
|
|
754
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
755
|
+
request.request_body,
|
|
756
|
+
False,
|
|
757
|
+
False,
|
|
758
|
+
"json",
|
|
759
|
+
models.UpdateServerServersRequestBody,
|
|
760
|
+
),
|
|
761
|
+
timeout_ms=timeout_ms,
|
|
762
|
+
)
|
|
763
|
+
|
|
764
|
+
if retries == UNSET:
|
|
765
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
766
|
+
retries = self.sdk_configuration.retry_config
|
|
767
|
+
|
|
768
|
+
retry_config = None
|
|
769
|
+
if isinstance(retries, utils.RetryConfig):
|
|
770
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
771
|
+
|
|
772
|
+
http_res = self.do_request(
|
|
773
|
+
hook_ctx=HookContext(
|
|
774
|
+
base_url=base_url or "",
|
|
775
|
+
operation_id="update-server",
|
|
776
|
+
oauth2_scopes=[],
|
|
777
|
+
security_source=get_security_from_env(
|
|
778
|
+
self.sdk_configuration.security, models.Security
|
|
779
|
+
),
|
|
780
|
+
),
|
|
781
|
+
request=req,
|
|
782
|
+
error_status_codes=["400", "402", "422", "423", "4XX", "5XX"],
|
|
783
|
+
retry_config=retry_config,
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
response_data: Any = None
|
|
787
|
+
if utils.match_response(http_res, "200", "*"):
|
|
788
|
+
return
|
|
789
|
+
if utils.match_response(http_res, "400", "application/vnd.api+json"):
|
|
790
|
+
response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
|
|
791
|
+
raise models.ServerError(data=response_data)
|
|
792
|
+
if utils.match_response(
|
|
793
|
+
http_res, ["402", "422", "423"], "application/vnd.api+json"
|
|
794
|
+
):
|
|
795
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
796
|
+
raise models.ErrorObject(data=response_data)
|
|
797
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
798
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
799
|
+
raise models.APIError(
|
|
800
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
801
|
+
)
|
|
802
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
803
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
804
|
+
raise models.APIError(
|
|
805
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
806
|
+
)
|
|
807
|
+
|
|
808
|
+
content_type = http_res.headers.get("Content-Type")
|
|
809
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
810
|
+
raise models.APIError(
|
|
811
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
812
|
+
http_res.status_code,
|
|
813
|
+
http_res_text,
|
|
814
|
+
http_res,
|
|
815
|
+
)
|
|
816
|
+
|
|
817
|
+
async def update_async(
|
|
818
|
+
self,
|
|
819
|
+
*,
|
|
820
|
+
server_id: str,
|
|
821
|
+
id: Optional[str] = "sv_81EVOtR1N4J2Z",
|
|
822
|
+
type_: Optional[models.UpdateServerServersType] = None,
|
|
823
|
+
attributes: Optional[
|
|
824
|
+
Union[
|
|
825
|
+
models.UpdateServerServersAttributes,
|
|
826
|
+
models.UpdateServerServersAttributesTypedDict,
|
|
827
|
+
]
|
|
828
|
+
] = None,
|
|
829
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
830
|
+
server_url: Optional[str] = None,
|
|
831
|
+
timeout_ms: Optional[int] = None,
|
|
832
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
833
|
+
):
|
|
834
|
+
r"""Update Server
|
|
835
|
+
|
|
836
|
+
:param server_id:
|
|
837
|
+
:param id:
|
|
838
|
+
:param type:
|
|
839
|
+
:param attributes:
|
|
840
|
+
:param retries: Override the default retry configuration for this method
|
|
841
|
+
:param server_url: Override the default server URL for this method
|
|
842
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
843
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
844
|
+
"""
|
|
845
|
+
base_url = None
|
|
846
|
+
url_variables = None
|
|
847
|
+
if timeout_ms is None:
|
|
848
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
849
|
+
|
|
850
|
+
if server_url is not None:
|
|
851
|
+
base_url = server_url
|
|
852
|
+
else:
|
|
853
|
+
base_url = self._get_url(base_url, url_variables)
|
|
854
|
+
|
|
855
|
+
request = models.UpdateServerRequest(
|
|
856
|
+
server_id=server_id,
|
|
857
|
+
request_body=models.UpdateServerServersRequestBody(
|
|
858
|
+
id=id,
|
|
859
|
+
type=type_,
|
|
860
|
+
attributes=utils.get_pydantic_model(
|
|
861
|
+
attributes, Optional[models.UpdateServerServersAttributes]
|
|
862
|
+
),
|
|
863
|
+
),
|
|
864
|
+
)
|
|
865
|
+
|
|
866
|
+
req = self._build_request_async(
|
|
867
|
+
method="PATCH",
|
|
868
|
+
path="/servers/{server_id}",
|
|
869
|
+
base_url=base_url,
|
|
870
|
+
url_variables=url_variables,
|
|
871
|
+
request=request,
|
|
872
|
+
request_body_required=True,
|
|
873
|
+
request_has_path_params=True,
|
|
874
|
+
request_has_query_params=True,
|
|
875
|
+
user_agent_header="user-agent",
|
|
876
|
+
accept_header_value="application/vnd.api+json",
|
|
877
|
+
http_headers=http_headers,
|
|
878
|
+
security=self.sdk_configuration.security,
|
|
879
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
880
|
+
request.request_body,
|
|
881
|
+
False,
|
|
882
|
+
False,
|
|
883
|
+
"json",
|
|
884
|
+
models.UpdateServerServersRequestBody,
|
|
885
|
+
),
|
|
886
|
+
timeout_ms=timeout_ms,
|
|
887
|
+
)
|
|
888
|
+
|
|
889
|
+
if retries == UNSET:
|
|
890
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
891
|
+
retries = self.sdk_configuration.retry_config
|
|
892
|
+
|
|
893
|
+
retry_config = None
|
|
894
|
+
if isinstance(retries, utils.RetryConfig):
|
|
895
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
896
|
+
|
|
897
|
+
http_res = await self.do_request_async(
|
|
898
|
+
hook_ctx=HookContext(
|
|
899
|
+
base_url=base_url or "",
|
|
900
|
+
operation_id="update-server",
|
|
901
|
+
oauth2_scopes=[],
|
|
902
|
+
security_source=get_security_from_env(
|
|
903
|
+
self.sdk_configuration.security, models.Security
|
|
904
|
+
),
|
|
905
|
+
),
|
|
906
|
+
request=req,
|
|
907
|
+
error_status_codes=["400", "402", "422", "423", "4XX", "5XX"],
|
|
908
|
+
retry_config=retry_config,
|
|
909
|
+
)
|
|
910
|
+
|
|
911
|
+
response_data: Any = None
|
|
912
|
+
if utils.match_response(http_res, "200", "*"):
|
|
913
|
+
return
|
|
914
|
+
if utils.match_response(http_res, "400", "application/vnd.api+json"):
|
|
915
|
+
response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
|
|
916
|
+
raise models.ServerError(data=response_data)
|
|
917
|
+
if utils.match_response(
|
|
918
|
+
http_res, ["402", "422", "423"], "application/vnd.api+json"
|
|
919
|
+
):
|
|
920
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
921
|
+
raise models.ErrorObject(data=response_data)
|
|
922
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
923
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
924
|
+
raise models.APIError(
|
|
925
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
926
|
+
)
|
|
927
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
928
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
929
|
+
raise models.APIError(
|
|
930
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
931
|
+
)
|
|
932
|
+
|
|
933
|
+
content_type = http_res.headers.get("Content-Type")
|
|
934
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
935
|
+
raise models.APIError(
|
|
936
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
937
|
+
http_res.status_code,
|
|
938
|
+
http_res_text,
|
|
939
|
+
http_res,
|
|
940
|
+
)
|
|
941
|
+
|
|
942
|
+
def delete(
|
|
943
|
+
self,
|
|
944
|
+
*,
|
|
945
|
+
server_id: str,
|
|
946
|
+
reason: Optional[str] = None,
|
|
947
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
948
|
+
server_url: Optional[str] = None,
|
|
949
|
+
timeout_ms: Optional[int] = None,
|
|
950
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
951
|
+
):
|
|
952
|
+
r"""Remove Server
|
|
953
|
+
|
|
954
|
+
:param server_id: The server ID
|
|
955
|
+
:param reason: The reason for deleting the server
|
|
956
|
+
:param retries: Override the default retry configuration for this method
|
|
957
|
+
:param server_url: Override the default server URL for this method
|
|
958
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
959
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
960
|
+
"""
|
|
961
|
+
base_url = None
|
|
962
|
+
url_variables = None
|
|
963
|
+
if timeout_ms is None:
|
|
964
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
965
|
+
|
|
966
|
+
if server_url is not None:
|
|
967
|
+
base_url = server_url
|
|
968
|
+
else:
|
|
969
|
+
base_url = self._get_url(base_url, url_variables)
|
|
970
|
+
|
|
971
|
+
request = models.DestroyServerRequest(
|
|
972
|
+
server_id=server_id,
|
|
973
|
+
reason=reason,
|
|
974
|
+
)
|
|
975
|
+
|
|
976
|
+
req = self._build_request(
|
|
977
|
+
method="DELETE",
|
|
978
|
+
path="/servers/{server_id}",
|
|
979
|
+
base_url=base_url,
|
|
980
|
+
url_variables=url_variables,
|
|
981
|
+
request=request,
|
|
982
|
+
request_body_required=False,
|
|
983
|
+
request_has_path_params=True,
|
|
984
|
+
request_has_query_params=True,
|
|
985
|
+
user_agent_header="user-agent",
|
|
986
|
+
accept_header_value="application/vnd.api+json",
|
|
987
|
+
http_headers=http_headers,
|
|
988
|
+
security=self.sdk_configuration.security,
|
|
989
|
+
timeout_ms=timeout_ms,
|
|
990
|
+
)
|
|
991
|
+
|
|
992
|
+
if retries == UNSET:
|
|
993
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
994
|
+
retries = self.sdk_configuration.retry_config
|
|
995
|
+
|
|
996
|
+
retry_config = None
|
|
997
|
+
if isinstance(retries, utils.RetryConfig):
|
|
998
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
999
|
+
|
|
1000
|
+
http_res = self.do_request(
|
|
1001
|
+
hook_ctx=HookContext(
|
|
1002
|
+
base_url=base_url or "",
|
|
1003
|
+
operation_id="destroy-server",
|
|
1004
|
+
oauth2_scopes=[],
|
|
1005
|
+
security_source=get_security_from_env(
|
|
1006
|
+
self.sdk_configuration.security, models.Security
|
|
1007
|
+
),
|
|
1008
|
+
),
|
|
1009
|
+
request=req,
|
|
1010
|
+
error_status_codes=["403", "406", "422", "423", "4XX", "5XX"],
|
|
1011
|
+
retry_config=retry_config,
|
|
1012
|
+
)
|
|
1013
|
+
|
|
1014
|
+
response_data: Any = None
|
|
1015
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1016
|
+
return
|
|
1017
|
+
if utils.match_response(
|
|
1018
|
+
http_res, ["403", "406", "422"], "application/vnd.api+json"
|
|
1019
|
+
):
|
|
1020
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1021
|
+
raise models.ErrorObject(data=response_data)
|
|
1022
|
+
if utils.match_response(http_res, ["423", "4XX"], "*"):
|
|
1023
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1024
|
+
raise models.APIError(
|
|
1025
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1026
|
+
)
|
|
1027
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1028
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1029
|
+
raise models.APIError(
|
|
1030
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1031
|
+
)
|
|
1032
|
+
|
|
1033
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1034
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1035
|
+
raise models.APIError(
|
|
1036
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1037
|
+
http_res.status_code,
|
|
1038
|
+
http_res_text,
|
|
1039
|
+
http_res,
|
|
1040
|
+
)
|
|
1041
|
+
|
|
1042
|
+
async def delete_async(
|
|
1043
|
+
self,
|
|
1044
|
+
*,
|
|
1045
|
+
server_id: str,
|
|
1046
|
+
reason: Optional[str] = None,
|
|
1047
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1048
|
+
server_url: Optional[str] = None,
|
|
1049
|
+
timeout_ms: Optional[int] = None,
|
|
1050
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1051
|
+
):
|
|
1052
|
+
r"""Remove Server
|
|
1053
|
+
|
|
1054
|
+
:param server_id: The server ID
|
|
1055
|
+
:param reason: The reason for deleting the server
|
|
1056
|
+
:param retries: Override the default retry configuration for this method
|
|
1057
|
+
:param server_url: Override the default server URL for this method
|
|
1058
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1059
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1060
|
+
"""
|
|
1061
|
+
base_url = None
|
|
1062
|
+
url_variables = None
|
|
1063
|
+
if timeout_ms is None:
|
|
1064
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1065
|
+
|
|
1066
|
+
if server_url is not None:
|
|
1067
|
+
base_url = server_url
|
|
1068
|
+
else:
|
|
1069
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1070
|
+
|
|
1071
|
+
request = models.DestroyServerRequest(
|
|
1072
|
+
server_id=server_id,
|
|
1073
|
+
reason=reason,
|
|
1074
|
+
)
|
|
1075
|
+
|
|
1076
|
+
req = self._build_request_async(
|
|
1077
|
+
method="DELETE",
|
|
1078
|
+
path="/servers/{server_id}",
|
|
1079
|
+
base_url=base_url,
|
|
1080
|
+
url_variables=url_variables,
|
|
1081
|
+
request=request,
|
|
1082
|
+
request_body_required=False,
|
|
1083
|
+
request_has_path_params=True,
|
|
1084
|
+
request_has_query_params=True,
|
|
1085
|
+
user_agent_header="user-agent",
|
|
1086
|
+
accept_header_value="application/vnd.api+json",
|
|
1087
|
+
http_headers=http_headers,
|
|
1088
|
+
security=self.sdk_configuration.security,
|
|
1089
|
+
timeout_ms=timeout_ms,
|
|
1090
|
+
)
|
|
1091
|
+
|
|
1092
|
+
if retries == UNSET:
|
|
1093
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1094
|
+
retries = self.sdk_configuration.retry_config
|
|
1095
|
+
|
|
1096
|
+
retry_config = None
|
|
1097
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1098
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1099
|
+
|
|
1100
|
+
http_res = await self.do_request_async(
|
|
1101
|
+
hook_ctx=HookContext(
|
|
1102
|
+
base_url=base_url or "",
|
|
1103
|
+
operation_id="destroy-server",
|
|
1104
|
+
oauth2_scopes=[],
|
|
1105
|
+
security_source=get_security_from_env(
|
|
1106
|
+
self.sdk_configuration.security, models.Security
|
|
1107
|
+
),
|
|
1108
|
+
),
|
|
1109
|
+
request=req,
|
|
1110
|
+
error_status_codes=["403", "406", "422", "423", "4XX", "5XX"],
|
|
1111
|
+
retry_config=retry_config,
|
|
1112
|
+
)
|
|
1113
|
+
|
|
1114
|
+
response_data: Any = None
|
|
1115
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1116
|
+
return
|
|
1117
|
+
if utils.match_response(
|
|
1118
|
+
http_res, ["403", "406", "422"], "application/vnd.api+json"
|
|
1119
|
+
):
|
|
1120
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1121
|
+
raise models.ErrorObject(data=response_data)
|
|
1122
|
+
if utils.match_response(http_res, ["423", "4XX"], "*"):
|
|
1123
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1124
|
+
raise models.APIError(
|
|
1125
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1126
|
+
)
|
|
1127
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1128
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1129
|
+
raise models.APIError(
|
|
1130
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1131
|
+
)
|
|
1132
|
+
|
|
1133
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1134
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1135
|
+
raise models.APIError(
|
|
1136
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1137
|
+
http_res.status_code,
|
|
1138
|
+
http_res_text,
|
|
1139
|
+
http_res,
|
|
1140
|
+
)
|
|
1141
|
+
|
|
1142
|
+
def get_deploy_config(
|
|
1143
|
+
self,
|
|
1144
|
+
*,
|
|
1145
|
+
server_id: str,
|
|
1146
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1147
|
+
server_url: Optional[str] = None,
|
|
1148
|
+
timeout_ms: Optional[int] = None,
|
|
1149
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1150
|
+
) -> models.DeployConfig:
|
|
1151
|
+
r"""Retrieve Deploy Config
|
|
1152
|
+
|
|
1153
|
+
:param server_id: The Server ID
|
|
1154
|
+
:param retries: Override the default retry configuration for this method
|
|
1155
|
+
:param server_url: Override the default server URL for this method
|
|
1156
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1157
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1158
|
+
"""
|
|
1159
|
+
base_url = None
|
|
1160
|
+
url_variables = None
|
|
1161
|
+
if timeout_ms is None:
|
|
1162
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1163
|
+
|
|
1164
|
+
if server_url is not None:
|
|
1165
|
+
base_url = server_url
|
|
1166
|
+
else:
|
|
1167
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1168
|
+
|
|
1169
|
+
request = models.GetServerDeployConfigRequest(
|
|
1170
|
+
server_id=server_id,
|
|
1171
|
+
)
|
|
1172
|
+
|
|
1173
|
+
req = self._build_request(
|
|
1174
|
+
method="GET",
|
|
1175
|
+
path="/servers/{server_id}/deploy_config",
|
|
1176
|
+
base_url=base_url,
|
|
1177
|
+
url_variables=url_variables,
|
|
1178
|
+
request=request,
|
|
1179
|
+
request_body_required=False,
|
|
1180
|
+
request_has_path_params=True,
|
|
1181
|
+
request_has_query_params=True,
|
|
1182
|
+
user_agent_header="user-agent",
|
|
1183
|
+
accept_header_value="application/vnd.api+json",
|
|
1184
|
+
http_headers=http_headers,
|
|
1185
|
+
security=self.sdk_configuration.security,
|
|
1186
|
+
timeout_ms=timeout_ms,
|
|
1187
|
+
)
|
|
1188
|
+
|
|
1189
|
+
if retries == UNSET:
|
|
1190
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1191
|
+
retries = self.sdk_configuration.retry_config
|
|
1192
|
+
|
|
1193
|
+
retry_config = None
|
|
1194
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1195
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1196
|
+
|
|
1197
|
+
http_res = self.do_request(
|
|
1198
|
+
hook_ctx=HookContext(
|
|
1199
|
+
base_url=base_url or "",
|
|
1200
|
+
operation_id="get-server-deploy-config",
|
|
1201
|
+
oauth2_scopes=[],
|
|
1202
|
+
security_source=get_security_from_env(
|
|
1203
|
+
self.sdk_configuration.security, models.Security
|
|
1204
|
+
),
|
|
1205
|
+
),
|
|
1206
|
+
request=req,
|
|
1207
|
+
error_status_codes=["4XX", "5XX"],
|
|
1208
|
+
retry_config=retry_config,
|
|
1209
|
+
)
|
|
1210
|
+
|
|
1211
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1212
|
+
return utils.unmarshal_json(http_res.text, models.DeployConfig)
|
|
1213
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1214
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1215
|
+
raise models.APIError(
|
|
1216
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1217
|
+
)
|
|
1218
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1219
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1220
|
+
raise models.APIError(
|
|
1221
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1222
|
+
)
|
|
1223
|
+
|
|
1224
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1225
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1226
|
+
raise models.APIError(
|
|
1227
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1228
|
+
http_res.status_code,
|
|
1229
|
+
http_res_text,
|
|
1230
|
+
http_res,
|
|
1231
|
+
)
|
|
1232
|
+
|
|
1233
|
+
async def get_deploy_config_async(
|
|
1234
|
+
self,
|
|
1235
|
+
*,
|
|
1236
|
+
server_id: str,
|
|
1237
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1238
|
+
server_url: Optional[str] = None,
|
|
1239
|
+
timeout_ms: Optional[int] = None,
|
|
1240
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1241
|
+
) -> models.DeployConfig:
|
|
1242
|
+
r"""Retrieve Deploy Config
|
|
1243
|
+
|
|
1244
|
+
:param server_id: The Server ID
|
|
1245
|
+
:param retries: Override the default retry configuration for this method
|
|
1246
|
+
:param server_url: Override the default server URL for this method
|
|
1247
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1248
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1249
|
+
"""
|
|
1250
|
+
base_url = None
|
|
1251
|
+
url_variables = None
|
|
1252
|
+
if timeout_ms is None:
|
|
1253
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1254
|
+
|
|
1255
|
+
if server_url is not None:
|
|
1256
|
+
base_url = server_url
|
|
1257
|
+
else:
|
|
1258
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1259
|
+
|
|
1260
|
+
request = models.GetServerDeployConfigRequest(
|
|
1261
|
+
server_id=server_id,
|
|
1262
|
+
)
|
|
1263
|
+
|
|
1264
|
+
req = self._build_request_async(
|
|
1265
|
+
method="GET",
|
|
1266
|
+
path="/servers/{server_id}/deploy_config",
|
|
1267
|
+
base_url=base_url,
|
|
1268
|
+
url_variables=url_variables,
|
|
1269
|
+
request=request,
|
|
1270
|
+
request_body_required=False,
|
|
1271
|
+
request_has_path_params=True,
|
|
1272
|
+
request_has_query_params=True,
|
|
1273
|
+
user_agent_header="user-agent",
|
|
1274
|
+
accept_header_value="application/vnd.api+json",
|
|
1275
|
+
http_headers=http_headers,
|
|
1276
|
+
security=self.sdk_configuration.security,
|
|
1277
|
+
timeout_ms=timeout_ms,
|
|
1278
|
+
)
|
|
1279
|
+
|
|
1280
|
+
if retries == UNSET:
|
|
1281
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1282
|
+
retries = self.sdk_configuration.retry_config
|
|
1283
|
+
|
|
1284
|
+
retry_config = None
|
|
1285
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1286
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1287
|
+
|
|
1288
|
+
http_res = await self.do_request_async(
|
|
1289
|
+
hook_ctx=HookContext(
|
|
1290
|
+
base_url=base_url or "",
|
|
1291
|
+
operation_id="get-server-deploy-config",
|
|
1292
|
+
oauth2_scopes=[],
|
|
1293
|
+
security_source=get_security_from_env(
|
|
1294
|
+
self.sdk_configuration.security, models.Security
|
|
1295
|
+
),
|
|
1296
|
+
),
|
|
1297
|
+
request=req,
|
|
1298
|
+
error_status_codes=["4XX", "5XX"],
|
|
1299
|
+
retry_config=retry_config,
|
|
1300
|
+
)
|
|
1301
|
+
|
|
1302
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1303
|
+
return utils.unmarshal_json(http_res.text, models.DeployConfig)
|
|
1304
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1305
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1306
|
+
raise models.APIError(
|
|
1307
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1308
|
+
)
|
|
1309
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1310
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1311
|
+
raise models.APIError(
|
|
1312
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1313
|
+
)
|
|
1314
|
+
|
|
1315
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1316
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1317
|
+
raise models.APIError(
|
|
1318
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1319
|
+
http_res.status_code,
|
|
1320
|
+
http_res_text,
|
|
1321
|
+
http_res,
|
|
1322
|
+
)
|
|
1323
|
+
|
|
1324
|
+
def update_deploy_config(
|
|
1325
|
+
self,
|
|
1326
|
+
*,
|
|
1327
|
+
server_id: str,
|
|
1328
|
+
type_: models.UpdateServerDeployConfigServersType,
|
|
1329
|
+
attributes: Optional[
|
|
1330
|
+
Union[
|
|
1331
|
+
models.UpdateServerDeployConfigServersAttributes,
|
|
1332
|
+
models.UpdateServerDeployConfigServersAttributesTypedDict,
|
|
1333
|
+
]
|
|
1334
|
+
] = None,
|
|
1335
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1336
|
+
server_url: Optional[str] = None,
|
|
1337
|
+
timeout_ms: Optional[int] = None,
|
|
1338
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1339
|
+
) -> models.DeployConfig:
|
|
1340
|
+
r"""Update Deploy Config
|
|
1341
|
+
|
|
1342
|
+
:param server_id: The Server ID
|
|
1343
|
+
:param type:
|
|
1344
|
+
:param attributes:
|
|
1345
|
+
:param retries: Override the default retry configuration for this method
|
|
1346
|
+
:param server_url: Override the default server URL for this method
|
|
1347
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1348
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1349
|
+
"""
|
|
1350
|
+
base_url = None
|
|
1351
|
+
url_variables = None
|
|
1352
|
+
if timeout_ms is None:
|
|
1353
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1354
|
+
|
|
1355
|
+
if server_url is not None:
|
|
1356
|
+
base_url = server_url
|
|
1357
|
+
else:
|
|
1358
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1359
|
+
|
|
1360
|
+
request = models.UpdateServerDeployConfigRequest(
|
|
1361
|
+
server_id=server_id,
|
|
1362
|
+
request_body=models.UpdateServerDeployConfigServersRequestBody(
|
|
1363
|
+
type=type_,
|
|
1364
|
+
attributes=utils.get_pydantic_model(
|
|
1365
|
+
attributes,
|
|
1366
|
+
Optional[models.UpdateServerDeployConfigServersAttributes],
|
|
1367
|
+
),
|
|
1368
|
+
),
|
|
1369
|
+
)
|
|
1370
|
+
|
|
1371
|
+
req = self._build_request(
|
|
1372
|
+
method="PATCH",
|
|
1373
|
+
path="/servers/{server_id}/deploy_config",
|
|
1374
|
+
base_url=base_url,
|
|
1375
|
+
url_variables=url_variables,
|
|
1376
|
+
request=request,
|
|
1377
|
+
request_body_required=True,
|
|
1378
|
+
request_has_path_params=True,
|
|
1379
|
+
request_has_query_params=True,
|
|
1380
|
+
user_agent_header="user-agent",
|
|
1381
|
+
accept_header_value="application/vnd.api+json",
|
|
1382
|
+
http_headers=http_headers,
|
|
1383
|
+
security=self.sdk_configuration.security,
|
|
1384
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1385
|
+
request.request_body,
|
|
1386
|
+
False,
|
|
1387
|
+
False,
|
|
1388
|
+
"json",
|
|
1389
|
+
models.UpdateServerDeployConfigServersRequestBody,
|
|
1390
|
+
),
|
|
1391
|
+
timeout_ms=timeout_ms,
|
|
1392
|
+
)
|
|
1393
|
+
|
|
1394
|
+
if retries == UNSET:
|
|
1395
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1396
|
+
retries = self.sdk_configuration.retry_config
|
|
1397
|
+
|
|
1398
|
+
retry_config = None
|
|
1399
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1400
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1401
|
+
|
|
1402
|
+
http_res = self.do_request(
|
|
1403
|
+
hook_ctx=HookContext(
|
|
1404
|
+
base_url=base_url or "",
|
|
1405
|
+
operation_id="update-server-deploy-config",
|
|
1406
|
+
oauth2_scopes=[],
|
|
1407
|
+
security_source=get_security_from_env(
|
|
1408
|
+
self.sdk_configuration.security, models.Security
|
|
1409
|
+
),
|
|
1410
|
+
),
|
|
1411
|
+
request=req,
|
|
1412
|
+
error_status_codes=["403", "406", "422", "4XX", "5XX"],
|
|
1413
|
+
retry_config=retry_config,
|
|
1414
|
+
)
|
|
1415
|
+
|
|
1416
|
+
response_data: Any = None
|
|
1417
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1418
|
+
return utils.unmarshal_json(http_res.text, models.DeployConfig)
|
|
1419
|
+
if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
|
|
1420
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1421
|
+
raise models.ErrorObject(data=response_data)
|
|
1422
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
1423
|
+
response_data = utils.unmarshal_json(
|
|
1424
|
+
http_res.text, models.DeployConfigErrorData
|
|
1425
|
+
)
|
|
1426
|
+
raise models.DeployConfigError(data=response_data)
|
|
1427
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1428
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1429
|
+
raise models.APIError(
|
|
1430
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1431
|
+
)
|
|
1432
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1433
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1434
|
+
raise models.APIError(
|
|
1435
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1436
|
+
)
|
|
1437
|
+
|
|
1438
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1439
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1440
|
+
raise models.APIError(
|
|
1441
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1442
|
+
http_res.status_code,
|
|
1443
|
+
http_res_text,
|
|
1444
|
+
http_res,
|
|
1445
|
+
)
|
|
1446
|
+
|
|
1447
|
+
async def update_deploy_config_async(
|
|
1448
|
+
self,
|
|
1449
|
+
*,
|
|
1450
|
+
server_id: str,
|
|
1451
|
+
type_: models.UpdateServerDeployConfigServersType,
|
|
1452
|
+
attributes: Optional[
|
|
1453
|
+
Union[
|
|
1454
|
+
models.UpdateServerDeployConfigServersAttributes,
|
|
1455
|
+
models.UpdateServerDeployConfigServersAttributesTypedDict,
|
|
1456
|
+
]
|
|
1457
|
+
] = None,
|
|
1458
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1459
|
+
server_url: Optional[str] = None,
|
|
1460
|
+
timeout_ms: Optional[int] = None,
|
|
1461
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1462
|
+
) -> models.DeployConfig:
|
|
1463
|
+
r"""Update Deploy Config
|
|
1464
|
+
|
|
1465
|
+
:param server_id: The Server ID
|
|
1466
|
+
:param type:
|
|
1467
|
+
:param attributes:
|
|
1468
|
+
:param retries: Override the default retry configuration for this method
|
|
1469
|
+
:param server_url: Override the default server URL for this method
|
|
1470
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1471
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1472
|
+
"""
|
|
1473
|
+
base_url = None
|
|
1474
|
+
url_variables = None
|
|
1475
|
+
if timeout_ms is None:
|
|
1476
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1477
|
+
|
|
1478
|
+
if server_url is not None:
|
|
1479
|
+
base_url = server_url
|
|
1480
|
+
else:
|
|
1481
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1482
|
+
|
|
1483
|
+
request = models.UpdateServerDeployConfigRequest(
|
|
1484
|
+
server_id=server_id,
|
|
1485
|
+
request_body=models.UpdateServerDeployConfigServersRequestBody(
|
|
1486
|
+
type=type_,
|
|
1487
|
+
attributes=utils.get_pydantic_model(
|
|
1488
|
+
attributes,
|
|
1489
|
+
Optional[models.UpdateServerDeployConfigServersAttributes],
|
|
1490
|
+
),
|
|
1491
|
+
),
|
|
1492
|
+
)
|
|
1493
|
+
|
|
1494
|
+
req = self._build_request_async(
|
|
1495
|
+
method="PATCH",
|
|
1496
|
+
path="/servers/{server_id}/deploy_config",
|
|
1497
|
+
base_url=base_url,
|
|
1498
|
+
url_variables=url_variables,
|
|
1499
|
+
request=request,
|
|
1500
|
+
request_body_required=True,
|
|
1501
|
+
request_has_path_params=True,
|
|
1502
|
+
request_has_query_params=True,
|
|
1503
|
+
user_agent_header="user-agent",
|
|
1504
|
+
accept_header_value="application/vnd.api+json",
|
|
1505
|
+
http_headers=http_headers,
|
|
1506
|
+
security=self.sdk_configuration.security,
|
|
1507
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1508
|
+
request.request_body,
|
|
1509
|
+
False,
|
|
1510
|
+
False,
|
|
1511
|
+
"json",
|
|
1512
|
+
models.UpdateServerDeployConfigServersRequestBody,
|
|
1513
|
+
),
|
|
1514
|
+
timeout_ms=timeout_ms,
|
|
1515
|
+
)
|
|
1516
|
+
|
|
1517
|
+
if retries == UNSET:
|
|
1518
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1519
|
+
retries = self.sdk_configuration.retry_config
|
|
1520
|
+
|
|
1521
|
+
retry_config = None
|
|
1522
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1523
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1524
|
+
|
|
1525
|
+
http_res = await self.do_request_async(
|
|
1526
|
+
hook_ctx=HookContext(
|
|
1527
|
+
base_url=base_url or "",
|
|
1528
|
+
operation_id="update-server-deploy-config",
|
|
1529
|
+
oauth2_scopes=[],
|
|
1530
|
+
security_source=get_security_from_env(
|
|
1531
|
+
self.sdk_configuration.security, models.Security
|
|
1532
|
+
),
|
|
1533
|
+
),
|
|
1534
|
+
request=req,
|
|
1535
|
+
error_status_codes=["403", "406", "422", "4XX", "5XX"],
|
|
1536
|
+
retry_config=retry_config,
|
|
1537
|
+
)
|
|
1538
|
+
|
|
1539
|
+
response_data: Any = None
|
|
1540
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1541
|
+
return utils.unmarshal_json(http_res.text, models.DeployConfig)
|
|
1542
|
+
if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
|
|
1543
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1544
|
+
raise models.ErrorObject(data=response_data)
|
|
1545
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
1546
|
+
response_data = utils.unmarshal_json(
|
|
1547
|
+
http_res.text, models.DeployConfigErrorData
|
|
1548
|
+
)
|
|
1549
|
+
raise models.DeployConfigError(data=response_data)
|
|
1550
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1551
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1552
|
+
raise models.APIError(
|
|
1553
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1554
|
+
)
|
|
1555
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1556
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1557
|
+
raise models.APIError(
|
|
1558
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1559
|
+
)
|
|
1560
|
+
|
|
1561
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1562
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1563
|
+
raise models.APIError(
|
|
1564
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1565
|
+
http_res.status_code,
|
|
1566
|
+
http_res_text,
|
|
1567
|
+
http_res,
|
|
1568
|
+
)
|
|
1569
|
+
|
|
1570
|
+
def lock(
|
|
1571
|
+
self,
|
|
1572
|
+
*,
|
|
1573
|
+
server_id: str,
|
|
1574
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1575
|
+
server_url: Optional[str] = None,
|
|
1576
|
+
timeout_ms: Optional[int] = None,
|
|
1577
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1578
|
+
) -> models.Server1:
|
|
1579
|
+
r"""Lock the server
|
|
1580
|
+
|
|
1581
|
+
Locks the server. A locked server cannot be deleted or modified and no actions can be performed on it.
|
|
1582
|
+
|
|
1583
|
+
:param server_id:
|
|
1584
|
+
:param retries: Override the default retry configuration for this method
|
|
1585
|
+
:param server_url: Override the default server URL for this method
|
|
1586
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1587
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1588
|
+
"""
|
|
1589
|
+
base_url = None
|
|
1590
|
+
url_variables = None
|
|
1591
|
+
if timeout_ms is None:
|
|
1592
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1593
|
+
|
|
1594
|
+
if server_url is not None:
|
|
1595
|
+
base_url = server_url
|
|
1596
|
+
else:
|
|
1597
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1598
|
+
|
|
1599
|
+
request = models.ServerLockRequest(
|
|
1600
|
+
server_id=server_id,
|
|
1601
|
+
)
|
|
1602
|
+
|
|
1603
|
+
req = self._build_request(
|
|
1604
|
+
method="POST",
|
|
1605
|
+
path="/servers/{server_id}/lock",
|
|
1606
|
+
base_url=base_url,
|
|
1607
|
+
url_variables=url_variables,
|
|
1608
|
+
request=request,
|
|
1609
|
+
request_body_required=False,
|
|
1610
|
+
request_has_path_params=True,
|
|
1611
|
+
request_has_query_params=True,
|
|
1612
|
+
user_agent_header="user-agent",
|
|
1613
|
+
accept_header_value="application/vnd.api+json",
|
|
1614
|
+
http_headers=http_headers,
|
|
1615
|
+
security=self.sdk_configuration.security,
|
|
1616
|
+
timeout_ms=timeout_ms,
|
|
1617
|
+
)
|
|
1618
|
+
|
|
1619
|
+
if retries == UNSET:
|
|
1620
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1621
|
+
retries = self.sdk_configuration.retry_config
|
|
1622
|
+
|
|
1623
|
+
retry_config = None
|
|
1624
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1625
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1626
|
+
|
|
1627
|
+
http_res = self.do_request(
|
|
1628
|
+
hook_ctx=HookContext(
|
|
1629
|
+
base_url=base_url or "",
|
|
1630
|
+
operation_id="server-lock",
|
|
1631
|
+
oauth2_scopes=[],
|
|
1632
|
+
security_source=get_security_from_env(
|
|
1633
|
+
self.sdk_configuration.security, models.Security
|
|
1634
|
+
),
|
|
1635
|
+
),
|
|
1636
|
+
request=req,
|
|
1637
|
+
error_status_codes=["403", "404", "4XX", "5XX"],
|
|
1638
|
+
retry_config=retry_config,
|
|
1639
|
+
)
|
|
1640
|
+
|
|
1641
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1642
|
+
return utils.unmarshal_json(http_res.text, models.Server1)
|
|
1643
|
+
if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
|
|
1644
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1645
|
+
raise models.APIError(
|
|
1646
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1647
|
+
)
|
|
1648
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1649
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1650
|
+
raise models.APIError(
|
|
1651
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1652
|
+
)
|
|
1653
|
+
|
|
1654
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1655
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1656
|
+
raise models.APIError(
|
|
1657
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1658
|
+
http_res.status_code,
|
|
1659
|
+
http_res_text,
|
|
1660
|
+
http_res,
|
|
1661
|
+
)
|
|
1662
|
+
|
|
1663
|
+
async def lock_async(
|
|
1664
|
+
self,
|
|
1665
|
+
*,
|
|
1666
|
+
server_id: str,
|
|
1667
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1668
|
+
server_url: Optional[str] = None,
|
|
1669
|
+
timeout_ms: Optional[int] = None,
|
|
1670
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1671
|
+
) -> models.Server1:
|
|
1672
|
+
r"""Lock the server
|
|
1673
|
+
|
|
1674
|
+
Locks the server. A locked server cannot be deleted or modified and no actions can be performed on it.
|
|
1675
|
+
|
|
1676
|
+
:param server_id:
|
|
1677
|
+
:param retries: Override the default retry configuration for this method
|
|
1678
|
+
:param server_url: Override the default server URL for this method
|
|
1679
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1680
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1681
|
+
"""
|
|
1682
|
+
base_url = None
|
|
1683
|
+
url_variables = None
|
|
1684
|
+
if timeout_ms is None:
|
|
1685
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1686
|
+
|
|
1687
|
+
if server_url is not None:
|
|
1688
|
+
base_url = server_url
|
|
1689
|
+
else:
|
|
1690
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1691
|
+
|
|
1692
|
+
request = models.ServerLockRequest(
|
|
1693
|
+
server_id=server_id,
|
|
1694
|
+
)
|
|
1695
|
+
|
|
1696
|
+
req = self._build_request_async(
|
|
1697
|
+
method="POST",
|
|
1698
|
+
path="/servers/{server_id}/lock",
|
|
1699
|
+
base_url=base_url,
|
|
1700
|
+
url_variables=url_variables,
|
|
1701
|
+
request=request,
|
|
1702
|
+
request_body_required=False,
|
|
1703
|
+
request_has_path_params=True,
|
|
1704
|
+
request_has_query_params=True,
|
|
1705
|
+
user_agent_header="user-agent",
|
|
1706
|
+
accept_header_value="application/vnd.api+json",
|
|
1707
|
+
http_headers=http_headers,
|
|
1708
|
+
security=self.sdk_configuration.security,
|
|
1709
|
+
timeout_ms=timeout_ms,
|
|
1710
|
+
)
|
|
1711
|
+
|
|
1712
|
+
if retries == UNSET:
|
|
1713
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1714
|
+
retries = self.sdk_configuration.retry_config
|
|
1715
|
+
|
|
1716
|
+
retry_config = None
|
|
1717
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1718
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1719
|
+
|
|
1720
|
+
http_res = await self.do_request_async(
|
|
1721
|
+
hook_ctx=HookContext(
|
|
1722
|
+
base_url=base_url or "",
|
|
1723
|
+
operation_id="server-lock",
|
|
1724
|
+
oauth2_scopes=[],
|
|
1725
|
+
security_source=get_security_from_env(
|
|
1726
|
+
self.sdk_configuration.security, models.Security
|
|
1727
|
+
),
|
|
1728
|
+
),
|
|
1729
|
+
request=req,
|
|
1730
|
+
error_status_codes=["403", "404", "4XX", "5XX"],
|
|
1731
|
+
retry_config=retry_config,
|
|
1732
|
+
)
|
|
1733
|
+
|
|
1734
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1735
|
+
return utils.unmarshal_json(http_res.text, models.Server1)
|
|
1736
|
+
if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
|
|
1737
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1738
|
+
raise models.APIError(
|
|
1739
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1740
|
+
)
|
|
1741
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1742
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1743
|
+
raise models.APIError(
|
|
1744
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1745
|
+
)
|
|
1746
|
+
|
|
1747
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1748
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1749
|
+
raise models.APIError(
|
|
1750
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1751
|
+
http_res.status_code,
|
|
1752
|
+
http_res_text,
|
|
1753
|
+
http_res,
|
|
1754
|
+
)
|
|
1755
|
+
|
|
1756
|
+
def unlock(
|
|
1757
|
+
self,
|
|
1758
|
+
*,
|
|
1759
|
+
server_id: str,
|
|
1760
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1761
|
+
server_url: Optional[str] = None,
|
|
1762
|
+
timeout_ms: Optional[int] = None,
|
|
1763
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1764
|
+
) -> models.Server1:
|
|
1765
|
+
r"""Unlock the server
|
|
1766
|
+
|
|
1767
|
+
Unlocks the server. A locked server cannot be deleted or modified and no actions can be performed on it.
|
|
1768
|
+
|
|
1769
|
+
:param server_id:
|
|
1770
|
+
:param retries: Override the default retry configuration for this method
|
|
1771
|
+
:param server_url: Override the default server URL for this method
|
|
1772
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1773
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1774
|
+
"""
|
|
1775
|
+
base_url = None
|
|
1776
|
+
url_variables = None
|
|
1777
|
+
if timeout_ms is None:
|
|
1778
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1779
|
+
|
|
1780
|
+
if server_url is not None:
|
|
1781
|
+
base_url = server_url
|
|
1782
|
+
else:
|
|
1783
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1784
|
+
|
|
1785
|
+
request = models.ServerUnlockRequest(
|
|
1786
|
+
server_id=server_id,
|
|
1787
|
+
)
|
|
1788
|
+
|
|
1789
|
+
req = self._build_request(
|
|
1790
|
+
method="POST",
|
|
1791
|
+
path="/servers/{server_id}/unlock",
|
|
1792
|
+
base_url=base_url,
|
|
1793
|
+
url_variables=url_variables,
|
|
1794
|
+
request=request,
|
|
1795
|
+
request_body_required=False,
|
|
1796
|
+
request_has_path_params=True,
|
|
1797
|
+
request_has_query_params=True,
|
|
1798
|
+
user_agent_header="user-agent",
|
|
1799
|
+
accept_header_value="application/vnd.api+json",
|
|
1800
|
+
http_headers=http_headers,
|
|
1801
|
+
security=self.sdk_configuration.security,
|
|
1802
|
+
timeout_ms=timeout_ms,
|
|
1803
|
+
)
|
|
1804
|
+
|
|
1805
|
+
if retries == UNSET:
|
|
1806
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1807
|
+
retries = self.sdk_configuration.retry_config
|
|
1808
|
+
|
|
1809
|
+
retry_config = None
|
|
1810
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1811
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1812
|
+
|
|
1813
|
+
http_res = self.do_request(
|
|
1814
|
+
hook_ctx=HookContext(
|
|
1815
|
+
base_url=base_url or "",
|
|
1816
|
+
operation_id="server-unlock",
|
|
1817
|
+
oauth2_scopes=[],
|
|
1818
|
+
security_source=get_security_from_env(
|
|
1819
|
+
self.sdk_configuration.security, models.Security
|
|
1820
|
+
),
|
|
1821
|
+
),
|
|
1822
|
+
request=req,
|
|
1823
|
+
error_status_codes=["403", "404", "4XX", "5XX"],
|
|
1824
|
+
retry_config=retry_config,
|
|
1825
|
+
)
|
|
1826
|
+
|
|
1827
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1828
|
+
return utils.unmarshal_json(http_res.text, models.Server1)
|
|
1829
|
+
if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
|
|
1830
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1831
|
+
raise models.APIError(
|
|
1832
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1833
|
+
)
|
|
1834
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1835
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1836
|
+
raise models.APIError(
|
|
1837
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1838
|
+
)
|
|
1839
|
+
|
|
1840
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1841
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1842
|
+
raise models.APIError(
|
|
1843
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1844
|
+
http_res.status_code,
|
|
1845
|
+
http_res_text,
|
|
1846
|
+
http_res,
|
|
1847
|
+
)
|
|
1848
|
+
|
|
1849
|
+
async def unlock_async(
|
|
1850
|
+
self,
|
|
1851
|
+
*,
|
|
1852
|
+
server_id: str,
|
|
1853
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1854
|
+
server_url: Optional[str] = None,
|
|
1855
|
+
timeout_ms: Optional[int] = None,
|
|
1856
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1857
|
+
) -> models.Server1:
|
|
1858
|
+
r"""Unlock the server
|
|
1859
|
+
|
|
1860
|
+
Unlocks the server. A locked server cannot be deleted or modified and no actions can be performed on it.
|
|
1861
|
+
|
|
1862
|
+
:param server_id:
|
|
1863
|
+
:param retries: Override the default retry configuration for this method
|
|
1864
|
+
:param server_url: Override the default server URL for this method
|
|
1865
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1866
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1867
|
+
"""
|
|
1868
|
+
base_url = None
|
|
1869
|
+
url_variables = None
|
|
1870
|
+
if timeout_ms is None:
|
|
1871
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1872
|
+
|
|
1873
|
+
if server_url is not None:
|
|
1874
|
+
base_url = server_url
|
|
1875
|
+
else:
|
|
1876
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1877
|
+
|
|
1878
|
+
request = models.ServerUnlockRequest(
|
|
1879
|
+
server_id=server_id,
|
|
1880
|
+
)
|
|
1881
|
+
|
|
1882
|
+
req = self._build_request_async(
|
|
1883
|
+
method="POST",
|
|
1884
|
+
path="/servers/{server_id}/unlock",
|
|
1885
|
+
base_url=base_url,
|
|
1886
|
+
url_variables=url_variables,
|
|
1887
|
+
request=request,
|
|
1888
|
+
request_body_required=False,
|
|
1889
|
+
request_has_path_params=True,
|
|
1890
|
+
request_has_query_params=True,
|
|
1891
|
+
user_agent_header="user-agent",
|
|
1892
|
+
accept_header_value="application/vnd.api+json",
|
|
1893
|
+
http_headers=http_headers,
|
|
1894
|
+
security=self.sdk_configuration.security,
|
|
1895
|
+
timeout_ms=timeout_ms,
|
|
1896
|
+
)
|
|
1897
|
+
|
|
1898
|
+
if retries == UNSET:
|
|
1899
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1900
|
+
retries = self.sdk_configuration.retry_config
|
|
1901
|
+
|
|
1902
|
+
retry_config = None
|
|
1903
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1904
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1905
|
+
|
|
1906
|
+
http_res = await self.do_request_async(
|
|
1907
|
+
hook_ctx=HookContext(
|
|
1908
|
+
base_url=base_url or "",
|
|
1909
|
+
operation_id="server-unlock",
|
|
1910
|
+
oauth2_scopes=[],
|
|
1911
|
+
security_source=get_security_from_env(
|
|
1912
|
+
self.sdk_configuration.security, models.Security
|
|
1913
|
+
),
|
|
1914
|
+
),
|
|
1915
|
+
request=req,
|
|
1916
|
+
error_status_codes=["403", "404", "4XX", "5XX"],
|
|
1917
|
+
retry_config=retry_config,
|
|
1918
|
+
)
|
|
1919
|
+
|
|
1920
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1921
|
+
return utils.unmarshal_json(http_res.text, models.Server1)
|
|
1922
|
+
if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
|
|
1923
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1924
|
+
raise models.APIError(
|
|
1925
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1926
|
+
)
|
|
1927
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1928
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1929
|
+
raise models.APIError(
|
|
1930
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1931
|
+
)
|
|
1932
|
+
|
|
1933
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1934
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1935
|
+
raise models.APIError(
|
|
1936
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1937
|
+
http_res.status_code,
|
|
1938
|
+
http_res_text,
|
|
1939
|
+
http_res,
|
|
1940
|
+
)
|
|
1941
|
+
|
|
1942
|
+
def create_out_of_band_connection(
|
|
1943
|
+
self,
|
|
1944
|
+
*,
|
|
1945
|
+
server_id: str,
|
|
1946
|
+
data: Union[
|
|
1947
|
+
models.CreateServerOutOfBandServersData,
|
|
1948
|
+
models.CreateServerOutOfBandServersDataTypedDict,
|
|
1949
|
+
],
|
|
1950
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1951
|
+
server_url: Optional[str] = None,
|
|
1952
|
+
timeout_ms: Optional[int] = None,
|
|
1953
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1954
|
+
) -> models.OutOfBandConnection:
|
|
1955
|
+
r"""Start Out of Band Connection
|
|
1956
|
+
|
|
1957
|
+
:param server_id:
|
|
1958
|
+
:param data:
|
|
1959
|
+
:param retries: Override the default retry configuration for this method
|
|
1960
|
+
:param server_url: Override the default server URL for this method
|
|
1961
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1962
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1963
|
+
"""
|
|
1964
|
+
base_url = None
|
|
1965
|
+
url_variables = None
|
|
1966
|
+
if timeout_ms is None:
|
|
1967
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1968
|
+
|
|
1969
|
+
if server_url is not None:
|
|
1970
|
+
base_url = server_url
|
|
1971
|
+
else:
|
|
1972
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1973
|
+
|
|
1974
|
+
request = models.CreateServerOutOfBandRequest(
|
|
1975
|
+
server_id=server_id,
|
|
1976
|
+
request_body=models.CreateServerOutOfBandServersRequestBody(
|
|
1977
|
+
data=utils.get_pydantic_model(
|
|
1978
|
+
data, models.CreateServerOutOfBandServersData
|
|
1979
|
+
),
|
|
1980
|
+
),
|
|
1981
|
+
)
|
|
1982
|
+
|
|
1983
|
+
req = self._build_request(
|
|
1984
|
+
method="POST",
|
|
1985
|
+
path="/servers/{server_id}/out_of_band_connection",
|
|
1986
|
+
base_url=base_url,
|
|
1987
|
+
url_variables=url_variables,
|
|
1988
|
+
request=request,
|
|
1989
|
+
request_body_required=True,
|
|
1990
|
+
request_has_path_params=True,
|
|
1991
|
+
request_has_query_params=True,
|
|
1992
|
+
user_agent_header="user-agent",
|
|
1993
|
+
accept_header_value="application/vnd.api+json",
|
|
1994
|
+
http_headers=http_headers,
|
|
1995
|
+
security=self.sdk_configuration.security,
|
|
1996
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1997
|
+
request.request_body,
|
|
1998
|
+
False,
|
|
1999
|
+
False,
|
|
2000
|
+
"json",
|
|
2001
|
+
models.CreateServerOutOfBandServersRequestBody,
|
|
2002
|
+
),
|
|
2003
|
+
timeout_ms=timeout_ms,
|
|
2004
|
+
)
|
|
2005
|
+
|
|
2006
|
+
if retries == UNSET:
|
|
2007
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2008
|
+
retries = self.sdk_configuration.retry_config
|
|
2009
|
+
|
|
2010
|
+
retry_config = None
|
|
2011
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2012
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2013
|
+
|
|
2014
|
+
http_res = self.do_request(
|
|
2015
|
+
hook_ctx=HookContext(
|
|
2016
|
+
base_url=base_url or "",
|
|
2017
|
+
operation_id="create-server-out-of-band",
|
|
2018
|
+
oauth2_scopes=[],
|
|
2019
|
+
security_source=get_security_from_env(
|
|
2020
|
+
self.sdk_configuration.security, models.Security
|
|
2021
|
+
),
|
|
2022
|
+
),
|
|
2023
|
+
request=req,
|
|
2024
|
+
error_status_codes=["403", "404", "406", "4XX", "5XX"],
|
|
2025
|
+
retry_config=retry_config,
|
|
2026
|
+
)
|
|
2027
|
+
|
|
2028
|
+
response_data: Any = None
|
|
2029
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2030
|
+
return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
|
|
2031
|
+
if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
|
|
2032
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2033
|
+
raise models.ErrorObject(data=response_data)
|
|
2034
|
+
if utils.match_response(http_res, ["406", "4XX"], "*"):
|
|
2035
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2036
|
+
raise models.APIError(
|
|
2037
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2038
|
+
)
|
|
2039
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2040
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2041
|
+
raise models.APIError(
|
|
2042
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2043
|
+
)
|
|
2044
|
+
|
|
2045
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2046
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2047
|
+
raise models.APIError(
|
|
2048
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2049
|
+
http_res.status_code,
|
|
2050
|
+
http_res_text,
|
|
2051
|
+
http_res,
|
|
2052
|
+
)
|
|
2053
|
+
|
|
2054
|
+
async def create_out_of_band_connection_async(
|
|
2055
|
+
self,
|
|
2056
|
+
*,
|
|
2057
|
+
server_id: str,
|
|
2058
|
+
data: Union[
|
|
2059
|
+
models.CreateServerOutOfBandServersData,
|
|
2060
|
+
models.CreateServerOutOfBandServersDataTypedDict,
|
|
2061
|
+
],
|
|
2062
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2063
|
+
server_url: Optional[str] = None,
|
|
2064
|
+
timeout_ms: Optional[int] = None,
|
|
2065
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2066
|
+
) -> models.OutOfBandConnection:
|
|
2067
|
+
r"""Start Out of Band Connection
|
|
2068
|
+
|
|
2069
|
+
:param server_id:
|
|
2070
|
+
:param data:
|
|
2071
|
+
:param retries: Override the default retry configuration for this method
|
|
2072
|
+
:param server_url: Override the default server URL for this method
|
|
2073
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2074
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2075
|
+
"""
|
|
2076
|
+
base_url = None
|
|
2077
|
+
url_variables = None
|
|
2078
|
+
if timeout_ms is None:
|
|
2079
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2080
|
+
|
|
2081
|
+
if server_url is not None:
|
|
2082
|
+
base_url = server_url
|
|
2083
|
+
else:
|
|
2084
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2085
|
+
|
|
2086
|
+
request = models.CreateServerOutOfBandRequest(
|
|
2087
|
+
server_id=server_id,
|
|
2088
|
+
request_body=models.CreateServerOutOfBandServersRequestBody(
|
|
2089
|
+
data=utils.get_pydantic_model(
|
|
2090
|
+
data, models.CreateServerOutOfBandServersData
|
|
2091
|
+
),
|
|
2092
|
+
),
|
|
2093
|
+
)
|
|
2094
|
+
|
|
2095
|
+
req = self._build_request_async(
|
|
2096
|
+
method="POST",
|
|
2097
|
+
path="/servers/{server_id}/out_of_band_connection",
|
|
2098
|
+
base_url=base_url,
|
|
2099
|
+
url_variables=url_variables,
|
|
2100
|
+
request=request,
|
|
2101
|
+
request_body_required=True,
|
|
2102
|
+
request_has_path_params=True,
|
|
2103
|
+
request_has_query_params=True,
|
|
2104
|
+
user_agent_header="user-agent",
|
|
2105
|
+
accept_header_value="application/vnd.api+json",
|
|
2106
|
+
http_headers=http_headers,
|
|
2107
|
+
security=self.sdk_configuration.security,
|
|
2108
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2109
|
+
request.request_body,
|
|
2110
|
+
False,
|
|
2111
|
+
False,
|
|
2112
|
+
"json",
|
|
2113
|
+
models.CreateServerOutOfBandServersRequestBody,
|
|
2114
|
+
),
|
|
2115
|
+
timeout_ms=timeout_ms,
|
|
2116
|
+
)
|
|
2117
|
+
|
|
2118
|
+
if retries == UNSET:
|
|
2119
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2120
|
+
retries = self.sdk_configuration.retry_config
|
|
2121
|
+
|
|
2122
|
+
retry_config = None
|
|
2123
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2124
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2125
|
+
|
|
2126
|
+
http_res = await self.do_request_async(
|
|
2127
|
+
hook_ctx=HookContext(
|
|
2128
|
+
base_url=base_url or "",
|
|
2129
|
+
operation_id="create-server-out-of-band",
|
|
2130
|
+
oauth2_scopes=[],
|
|
2131
|
+
security_source=get_security_from_env(
|
|
2132
|
+
self.sdk_configuration.security, models.Security
|
|
2133
|
+
),
|
|
2134
|
+
),
|
|
2135
|
+
request=req,
|
|
2136
|
+
error_status_codes=["403", "404", "406", "4XX", "5XX"],
|
|
2137
|
+
retry_config=retry_config,
|
|
2138
|
+
)
|
|
2139
|
+
|
|
2140
|
+
response_data: Any = None
|
|
2141
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2142
|
+
return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
|
|
2143
|
+
if utils.match_response(http_res, ["403", "404"], "application/vnd.api+json"):
|
|
2144
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2145
|
+
raise models.ErrorObject(data=response_data)
|
|
2146
|
+
if utils.match_response(http_res, ["406", "4XX"], "*"):
|
|
2147
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2148
|
+
raise models.APIError(
|
|
2149
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2150
|
+
)
|
|
2151
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2152
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2153
|
+
raise models.APIError(
|
|
2154
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2155
|
+
)
|
|
2156
|
+
|
|
2157
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2158
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2159
|
+
raise models.APIError(
|
|
2160
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2161
|
+
http_res.status_code,
|
|
2162
|
+
http_res_text,
|
|
2163
|
+
http_res,
|
|
2164
|
+
)
|
|
2165
|
+
|
|
2166
|
+
def list_out_of_band_connections(
|
|
2167
|
+
self,
|
|
2168
|
+
*,
|
|
2169
|
+
server_id: str,
|
|
2170
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2171
|
+
server_url: Optional[str] = None,
|
|
2172
|
+
timeout_ms: Optional[int] = None,
|
|
2173
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2174
|
+
) -> models.OutOfBandConnection:
|
|
2175
|
+
r"""List Out of Band Connections
|
|
2176
|
+
|
|
2177
|
+
:param server_id: The Server ID
|
|
2178
|
+
:param retries: Override the default retry configuration for this method
|
|
2179
|
+
:param server_url: Override the default server URL for this method
|
|
2180
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2181
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2182
|
+
"""
|
|
2183
|
+
base_url = None
|
|
2184
|
+
url_variables = None
|
|
2185
|
+
if timeout_ms is None:
|
|
2186
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2187
|
+
|
|
2188
|
+
if server_url is not None:
|
|
2189
|
+
base_url = server_url
|
|
2190
|
+
else:
|
|
2191
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2192
|
+
|
|
2193
|
+
request = models.GetServerOutOfBandRequest(
|
|
2194
|
+
server_id=server_id,
|
|
2195
|
+
)
|
|
2196
|
+
|
|
2197
|
+
req = self._build_request(
|
|
2198
|
+
method="GET",
|
|
2199
|
+
path="/servers/{server_id}/out_of_band_connection",
|
|
2200
|
+
base_url=base_url,
|
|
2201
|
+
url_variables=url_variables,
|
|
2202
|
+
request=request,
|
|
2203
|
+
request_body_required=False,
|
|
2204
|
+
request_has_path_params=True,
|
|
2205
|
+
request_has_query_params=True,
|
|
2206
|
+
user_agent_header="user-agent",
|
|
2207
|
+
accept_header_value="application/vnd.api+json",
|
|
2208
|
+
http_headers=http_headers,
|
|
2209
|
+
security=self.sdk_configuration.security,
|
|
2210
|
+
timeout_ms=timeout_ms,
|
|
2211
|
+
)
|
|
2212
|
+
|
|
2213
|
+
if retries == UNSET:
|
|
2214
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2215
|
+
retries = self.sdk_configuration.retry_config
|
|
2216
|
+
|
|
2217
|
+
retry_config = None
|
|
2218
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2219
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2220
|
+
|
|
2221
|
+
http_res = self.do_request(
|
|
2222
|
+
hook_ctx=HookContext(
|
|
2223
|
+
base_url=base_url or "",
|
|
2224
|
+
operation_id="get-server-out-of-band",
|
|
2225
|
+
oauth2_scopes=[],
|
|
2226
|
+
security_source=get_security_from_env(
|
|
2227
|
+
self.sdk_configuration.security, models.Security
|
|
2228
|
+
),
|
|
2229
|
+
),
|
|
2230
|
+
request=req,
|
|
2231
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
2232
|
+
retry_config=retry_config,
|
|
2233
|
+
)
|
|
2234
|
+
|
|
2235
|
+
response_data: Any = None
|
|
2236
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
2237
|
+
return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
|
|
2238
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
2239
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2240
|
+
raise models.ErrorObject(data=response_data)
|
|
2241
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2242
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2243
|
+
raise models.APIError(
|
|
2244
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2245
|
+
)
|
|
2246
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2247
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2248
|
+
raise models.APIError(
|
|
2249
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2250
|
+
)
|
|
2251
|
+
|
|
2252
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2253
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2254
|
+
raise models.APIError(
|
|
2255
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2256
|
+
http_res.status_code,
|
|
2257
|
+
http_res_text,
|
|
2258
|
+
http_res,
|
|
2259
|
+
)
|
|
2260
|
+
|
|
2261
|
+
async def list_out_of_band_connections_async(
|
|
2262
|
+
self,
|
|
2263
|
+
*,
|
|
2264
|
+
server_id: str,
|
|
2265
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2266
|
+
server_url: Optional[str] = None,
|
|
2267
|
+
timeout_ms: Optional[int] = None,
|
|
2268
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2269
|
+
) -> models.OutOfBandConnection:
|
|
2270
|
+
r"""List Out of Band Connections
|
|
2271
|
+
|
|
2272
|
+
:param server_id: The Server ID
|
|
2273
|
+
:param retries: Override the default retry configuration for this method
|
|
2274
|
+
:param server_url: Override the default server URL for this method
|
|
2275
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2276
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2277
|
+
"""
|
|
2278
|
+
base_url = None
|
|
2279
|
+
url_variables = None
|
|
2280
|
+
if timeout_ms is None:
|
|
2281
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2282
|
+
|
|
2283
|
+
if server_url is not None:
|
|
2284
|
+
base_url = server_url
|
|
2285
|
+
else:
|
|
2286
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2287
|
+
|
|
2288
|
+
request = models.GetServerOutOfBandRequest(
|
|
2289
|
+
server_id=server_id,
|
|
2290
|
+
)
|
|
2291
|
+
|
|
2292
|
+
req = self._build_request_async(
|
|
2293
|
+
method="GET",
|
|
2294
|
+
path="/servers/{server_id}/out_of_band_connection",
|
|
2295
|
+
base_url=base_url,
|
|
2296
|
+
url_variables=url_variables,
|
|
2297
|
+
request=request,
|
|
2298
|
+
request_body_required=False,
|
|
2299
|
+
request_has_path_params=True,
|
|
2300
|
+
request_has_query_params=True,
|
|
2301
|
+
user_agent_header="user-agent",
|
|
2302
|
+
accept_header_value="application/vnd.api+json",
|
|
2303
|
+
http_headers=http_headers,
|
|
2304
|
+
security=self.sdk_configuration.security,
|
|
2305
|
+
timeout_ms=timeout_ms,
|
|
2306
|
+
)
|
|
2307
|
+
|
|
2308
|
+
if retries == UNSET:
|
|
2309
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2310
|
+
retries = self.sdk_configuration.retry_config
|
|
2311
|
+
|
|
2312
|
+
retry_config = None
|
|
2313
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2314
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2315
|
+
|
|
2316
|
+
http_res = await self.do_request_async(
|
|
2317
|
+
hook_ctx=HookContext(
|
|
2318
|
+
base_url=base_url or "",
|
|
2319
|
+
operation_id="get-server-out-of-band",
|
|
2320
|
+
oauth2_scopes=[],
|
|
2321
|
+
security_source=get_security_from_env(
|
|
2322
|
+
self.sdk_configuration.security, models.Security
|
|
2323
|
+
),
|
|
2324
|
+
),
|
|
2325
|
+
request=req,
|
|
2326
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
2327
|
+
retry_config=retry_config,
|
|
2328
|
+
)
|
|
2329
|
+
|
|
2330
|
+
response_data: Any = None
|
|
2331
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
2332
|
+
return utils.unmarshal_json(http_res.text, models.OutOfBandConnection)
|
|
2333
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
2334
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2335
|
+
raise models.ErrorObject(data=response_data)
|
|
2336
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2337
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2338
|
+
raise models.APIError(
|
|
2339
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2340
|
+
)
|
|
2341
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2342
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2343
|
+
raise models.APIError(
|
|
2344
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2345
|
+
)
|
|
2346
|
+
|
|
2347
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2348
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2349
|
+
raise models.APIError(
|
|
2350
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2351
|
+
http_res.status_code,
|
|
2352
|
+
http_res_text,
|
|
2353
|
+
http_res,
|
|
2354
|
+
)
|
|
2355
|
+
|
|
2356
|
+
def actions(
|
|
2357
|
+
self,
|
|
2358
|
+
*,
|
|
2359
|
+
server_id: str,
|
|
2360
|
+
data: Union[
|
|
2361
|
+
models.CreateServerActionServersData,
|
|
2362
|
+
models.CreateServerActionServersDataTypedDict,
|
|
2363
|
+
],
|
|
2364
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2365
|
+
server_url: Optional[str] = None,
|
|
2366
|
+
timeout_ms: Optional[int] = None,
|
|
2367
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2368
|
+
) -> models.ServerAction:
|
|
2369
|
+
r"""Run Server Action
|
|
2370
|
+
|
|
2371
|
+
Performs an action on a given server:
|
|
2372
|
+
- `power_on`
|
|
2373
|
+
- `power_off`
|
|
2374
|
+
- `reboot`
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
:param server_id:
|
|
2378
|
+
:param data:
|
|
2379
|
+
:param retries: Override the default retry configuration for this method
|
|
2380
|
+
:param server_url: Override the default server URL for this method
|
|
2381
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2382
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2383
|
+
"""
|
|
2384
|
+
base_url = None
|
|
2385
|
+
url_variables = None
|
|
2386
|
+
if timeout_ms is None:
|
|
2387
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2388
|
+
|
|
2389
|
+
if server_url is not None:
|
|
2390
|
+
base_url = server_url
|
|
2391
|
+
else:
|
|
2392
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2393
|
+
|
|
2394
|
+
request = models.CreateServerActionRequest(
|
|
2395
|
+
server_id=server_id,
|
|
2396
|
+
request_body=models.CreateServerActionServersRequestBody(
|
|
2397
|
+
data=utils.get_pydantic_model(
|
|
2398
|
+
data, models.CreateServerActionServersData
|
|
2399
|
+
),
|
|
2400
|
+
),
|
|
2401
|
+
)
|
|
2402
|
+
|
|
2403
|
+
req = self._build_request(
|
|
2404
|
+
method="POST",
|
|
2405
|
+
path="/servers/{server_id}/actions",
|
|
2406
|
+
base_url=base_url,
|
|
2407
|
+
url_variables=url_variables,
|
|
2408
|
+
request=request,
|
|
2409
|
+
request_body_required=True,
|
|
2410
|
+
request_has_path_params=True,
|
|
2411
|
+
request_has_query_params=True,
|
|
2412
|
+
user_agent_header="user-agent",
|
|
2413
|
+
accept_header_value="application/vnd.api+json",
|
|
2414
|
+
http_headers=http_headers,
|
|
2415
|
+
security=self.sdk_configuration.security,
|
|
2416
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2417
|
+
request.request_body,
|
|
2418
|
+
False,
|
|
2419
|
+
False,
|
|
2420
|
+
"json",
|
|
2421
|
+
models.CreateServerActionServersRequestBody,
|
|
2422
|
+
),
|
|
2423
|
+
timeout_ms=timeout_ms,
|
|
2424
|
+
)
|
|
2425
|
+
|
|
2426
|
+
if retries == UNSET:
|
|
2427
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2428
|
+
retries = self.sdk_configuration.retry_config
|
|
2429
|
+
|
|
2430
|
+
retry_config = None
|
|
2431
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2432
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2433
|
+
|
|
2434
|
+
http_res = self.do_request(
|
|
2435
|
+
hook_ctx=HookContext(
|
|
2436
|
+
base_url=base_url or "",
|
|
2437
|
+
operation_id="create-server-action",
|
|
2438
|
+
oauth2_scopes=[],
|
|
2439
|
+
security_source=get_security_from_env(
|
|
2440
|
+
self.sdk_configuration.security, models.Security
|
|
2441
|
+
),
|
|
2442
|
+
),
|
|
2443
|
+
request=req,
|
|
2444
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
2445
|
+
retry_config=retry_config,
|
|
2446
|
+
)
|
|
2447
|
+
|
|
2448
|
+
response_data: Any = None
|
|
2449
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2450
|
+
return utils.unmarshal_json(http_res.text, models.ServerAction)
|
|
2451
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
2452
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2453
|
+
raise models.ErrorObject(data=response_data)
|
|
2454
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2455
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2456
|
+
raise models.APIError(
|
|
2457
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2458
|
+
)
|
|
2459
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2460
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2461
|
+
raise models.APIError(
|
|
2462
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2463
|
+
)
|
|
2464
|
+
|
|
2465
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2466
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2467
|
+
raise models.APIError(
|
|
2468
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2469
|
+
http_res.status_code,
|
|
2470
|
+
http_res_text,
|
|
2471
|
+
http_res,
|
|
2472
|
+
)
|
|
2473
|
+
|
|
2474
|
+
async def actions_async(
|
|
2475
|
+
self,
|
|
2476
|
+
*,
|
|
2477
|
+
server_id: str,
|
|
2478
|
+
data: Union[
|
|
2479
|
+
models.CreateServerActionServersData,
|
|
2480
|
+
models.CreateServerActionServersDataTypedDict,
|
|
2481
|
+
],
|
|
2482
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2483
|
+
server_url: Optional[str] = None,
|
|
2484
|
+
timeout_ms: Optional[int] = None,
|
|
2485
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2486
|
+
) -> models.ServerAction:
|
|
2487
|
+
r"""Run Server Action
|
|
2488
|
+
|
|
2489
|
+
Performs an action on a given server:
|
|
2490
|
+
- `power_on`
|
|
2491
|
+
- `power_off`
|
|
2492
|
+
- `reboot`
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
:param server_id:
|
|
2496
|
+
:param data:
|
|
2497
|
+
:param retries: Override the default retry configuration for this method
|
|
2498
|
+
:param server_url: Override the default server URL for this method
|
|
2499
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2500
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2501
|
+
"""
|
|
2502
|
+
base_url = None
|
|
2503
|
+
url_variables = None
|
|
2504
|
+
if timeout_ms is None:
|
|
2505
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2506
|
+
|
|
2507
|
+
if server_url is not None:
|
|
2508
|
+
base_url = server_url
|
|
2509
|
+
else:
|
|
2510
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2511
|
+
|
|
2512
|
+
request = models.CreateServerActionRequest(
|
|
2513
|
+
server_id=server_id,
|
|
2514
|
+
request_body=models.CreateServerActionServersRequestBody(
|
|
2515
|
+
data=utils.get_pydantic_model(
|
|
2516
|
+
data, models.CreateServerActionServersData
|
|
2517
|
+
),
|
|
2518
|
+
),
|
|
2519
|
+
)
|
|
2520
|
+
|
|
2521
|
+
req = self._build_request_async(
|
|
2522
|
+
method="POST",
|
|
2523
|
+
path="/servers/{server_id}/actions",
|
|
2524
|
+
base_url=base_url,
|
|
2525
|
+
url_variables=url_variables,
|
|
2526
|
+
request=request,
|
|
2527
|
+
request_body_required=True,
|
|
2528
|
+
request_has_path_params=True,
|
|
2529
|
+
request_has_query_params=True,
|
|
2530
|
+
user_agent_header="user-agent",
|
|
2531
|
+
accept_header_value="application/vnd.api+json",
|
|
2532
|
+
http_headers=http_headers,
|
|
2533
|
+
security=self.sdk_configuration.security,
|
|
2534
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2535
|
+
request.request_body,
|
|
2536
|
+
False,
|
|
2537
|
+
False,
|
|
2538
|
+
"json",
|
|
2539
|
+
models.CreateServerActionServersRequestBody,
|
|
2540
|
+
),
|
|
2541
|
+
timeout_ms=timeout_ms,
|
|
2542
|
+
)
|
|
2543
|
+
|
|
2544
|
+
if retries == UNSET:
|
|
2545
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2546
|
+
retries = self.sdk_configuration.retry_config
|
|
2547
|
+
|
|
2548
|
+
retry_config = None
|
|
2549
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2550
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2551
|
+
|
|
2552
|
+
http_res = await self.do_request_async(
|
|
2553
|
+
hook_ctx=HookContext(
|
|
2554
|
+
base_url=base_url or "",
|
|
2555
|
+
operation_id="create-server-action",
|
|
2556
|
+
oauth2_scopes=[],
|
|
2557
|
+
security_source=get_security_from_env(
|
|
2558
|
+
self.sdk_configuration.security, models.Security
|
|
2559
|
+
),
|
|
2560
|
+
),
|
|
2561
|
+
request=req,
|
|
2562
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
2563
|
+
retry_config=retry_config,
|
|
2564
|
+
)
|
|
2565
|
+
|
|
2566
|
+
response_data: Any = None
|
|
2567
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2568
|
+
return utils.unmarshal_json(http_res.text, models.ServerAction)
|
|
2569
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
2570
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2571
|
+
raise models.ErrorObject(data=response_data)
|
|
2572
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2573
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2574
|
+
raise models.APIError(
|
|
2575
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2576
|
+
)
|
|
2577
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2578
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2579
|
+
raise models.APIError(
|
|
2580
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2581
|
+
)
|
|
2582
|
+
|
|
2583
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2584
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2585
|
+
raise models.APIError(
|
|
2586
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2587
|
+
http_res.status_code,
|
|
2588
|
+
http_res_text,
|
|
2589
|
+
http_res,
|
|
2590
|
+
)
|
|
2591
|
+
|
|
2592
|
+
def create_ipmi_session(
|
|
2593
|
+
self,
|
|
2594
|
+
*,
|
|
2595
|
+
server_id: str,
|
|
2596
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2597
|
+
server_url: Optional[str] = None,
|
|
2598
|
+
timeout_ms: Optional[int] = None,
|
|
2599
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2600
|
+
) -> models.IpmiSession:
|
|
2601
|
+
r"""Generate IPMI credentials
|
|
2602
|
+
|
|
2603
|
+
Generates IPMI credentials for a given server. Remote access creates a VPN connection to the internal network of your server so you can connect to its IPMI.
|
|
2604
|
+
You will have to use a VPN client such as https://openvpn.net to connect. See `VPN Sessions` API to create a VPN connection.
|
|
2605
|
+
|
|
2606
|
+
Related guide: https://docs.latitude.sh/docs/ipmi
|
|
2607
|
+
|
|
2608
|
+
|
|
2609
|
+
:param server_id:
|
|
2610
|
+
:param retries: Override the default retry configuration for this method
|
|
2611
|
+
:param server_url: Override the default server URL for this method
|
|
2612
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2613
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2614
|
+
"""
|
|
2615
|
+
base_url = None
|
|
2616
|
+
url_variables = None
|
|
2617
|
+
if timeout_ms is None:
|
|
2618
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2619
|
+
|
|
2620
|
+
if server_url is not None:
|
|
2621
|
+
base_url = server_url
|
|
2622
|
+
else:
|
|
2623
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2624
|
+
|
|
2625
|
+
request = models.CreateIpmiSessionRequest(
|
|
2626
|
+
server_id=server_id,
|
|
2627
|
+
)
|
|
2628
|
+
|
|
2629
|
+
req = self._build_request(
|
|
2630
|
+
method="POST",
|
|
2631
|
+
path="/servers/{server_id}/remote_access",
|
|
2632
|
+
base_url=base_url,
|
|
2633
|
+
url_variables=url_variables,
|
|
2634
|
+
request=request,
|
|
2635
|
+
request_body_required=False,
|
|
2636
|
+
request_has_path_params=True,
|
|
2637
|
+
request_has_query_params=True,
|
|
2638
|
+
user_agent_header="user-agent",
|
|
2639
|
+
accept_header_value="application/vnd.api+json",
|
|
2640
|
+
http_headers=http_headers,
|
|
2641
|
+
security=self.sdk_configuration.security,
|
|
2642
|
+
timeout_ms=timeout_ms,
|
|
2643
|
+
)
|
|
2644
|
+
|
|
2645
|
+
if retries == UNSET:
|
|
2646
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2647
|
+
retries = self.sdk_configuration.retry_config
|
|
2648
|
+
|
|
2649
|
+
retry_config = None
|
|
2650
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2651
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2652
|
+
|
|
2653
|
+
http_res = self.do_request(
|
|
2654
|
+
hook_ctx=HookContext(
|
|
2655
|
+
base_url=base_url or "",
|
|
2656
|
+
operation_id="create-ipmi-session",
|
|
2657
|
+
oauth2_scopes=[],
|
|
2658
|
+
security_source=get_security_from_env(
|
|
2659
|
+
self.sdk_configuration.security, models.Security
|
|
2660
|
+
),
|
|
2661
|
+
),
|
|
2662
|
+
request=req,
|
|
2663
|
+
error_status_codes=["403", "404", "422", "4XX", "5XX"],
|
|
2664
|
+
retry_config=retry_config,
|
|
2665
|
+
)
|
|
2666
|
+
|
|
2667
|
+
response_data: Any = None
|
|
2668
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2669
|
+
return utils.unmarshal_json(http_res.text, models.IpmiSession)
|
|
2670
|
+
if utils.match_response(
|
|
2671
|
+
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
2672
|
+
):
|
|
2673
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2674
|
+
raise models.ErrorObject(data=response_data)
|
|
2675
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2676
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2677
|
+
raise models.APIError(
|
|
2678
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2679
|
+
)
|
|
2680
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2681
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2682
|
+
raise models.APIError(
|
|
2683
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2684
|
+
)
|
|
2685
|
+
|
|
2686
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2687
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2688
|
+
raise models.APIError(
|
|
2689
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2690
|
+
http_res.status_code,
|
|
2691
|
+
http_res_text,
|
|
2692
|
+
http_res,
|
|
2693
|
+
)
|
|
2694
|
+
|
|
2695
|
+
async def create_ipmi_session_async(
|
|
2696
|
+
self,
|
|
2697
|
+
*,
|
|
2698
|
+
server_id: str,
|
|
2699
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2700
|
+
server_url: Optional[str] = None,
|
|
2701
|
+
timeout_ms: Optional[int] = None,
|
|
2702
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2703
|
+
) -> models.IpmiSession:
|
|
2704
|
+
r"""Generate IPMI credentials
|
|
2705
|
+
|
|
2706
|
+
Generates IPMI credentials for a given server. Remote access creates a VPN connection to the internal network of your server so you can connect to its IPMI.
|
|
2707
|
+
You will have to use a VPN client such as https://openvpn.net to connect. See `VPN Sessions` API to create a VPN connection.
|
|
2708
|
+
|
|
2709
|
+
Related guide: https://docs.latitude.sh/docs/ipmi
|
|
2710
|
+
|
|
2711
|
+
|
|
2712
|
+
:param server_id:
|
|
2713
|
+
:param retries: Override the default retry configuration for this method
|
|
2714
|
+
:param server_url: Override the default server URL for this method
|
|
2715
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2716
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2717
|
+
"""
|
|
2718
|
+
base_url = None
|
|
2719
|
+
url_variables = None
|
|
2720
|
+
if timeout_ms is None:
|
|
2721
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2722
|
+
|
|
2723
|
+
if server_url is not None:
|
|
2724
|
+
base_url = server_url
|
|
2725
|
+
else:
|
|
2726
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2727
|
+
|
|
2728
|
+
request = models.CreateIpmiSessionRequest(
|
|
2729
|
+
server_id=server_id,
|
|
2730
|
+
)
|
|
2731
|
+
|
|
2732
|
+
req = self._build_request_async(
|
|
2733
|
+
method="POST",
|
|
2734
|
+
path="/servers/{server_id}/remote_access",
|
|
2735
|
+
base_url=base_url,
|
|
2736
|
+
url_variables=url_variables,
|
|
2737
|
+
request=request,
|
|
2738
|
+
request_body_required=False,
|
|
2739
|
+
request_has_path_params=True,
|
|
2740
|
+
request_has_query_params=True,
|
|
2741
|
+
user_agent_header="user-agent",
|
|
2742
|
+
accept_header_value="application/vnd.api+json",
|
|
2743
|
+
http_headers=http_headers,
|
|
2744
|
+
security=self.sdk_configuration.security,
|
|
2745
|
+
timeout_ms=timeout_ms,
|
|
2746
|
+
)
|
|
2747
|
+
|
|
2748
|
+
if retries == UNSET:
|
|
2749
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2750
|
+
retries = self.sdk_configuration.retry_config
|
|
2751
|
+
|
|
2752
|
+
retry_config = None
|
|
2753
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2754
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2755
|
+
|
|
2756
|
+
http_res = await self.do_request_async(
|
|
2757
|
+
hook_ctx=HookContext(
|
|
2758
|
+
base_url=base_url or "",
|
|
2759
|
+
operation_id="create-ipmi-session",
|
|
2760
|
+
oauth2_scopes=[],
|
|
2761
|
+
security_source=get_security_from_env(
|
|
2762
|
+
self.sdk_configuration.security, models.Security
|
|
2763
|
+
),
|
|
2764
|
+
),
|
|
2765
|
+
request=req,
|
|
2766
|
+
error_status_codes=["403", "404", "422", "4XX", "5XX"],
|
|
2767
|
+
retry_config=retry_config,
|
|
2768
|
+
)
|
|
2769
|
+
|
|
2770
|
+
response_data: Any = None
|
|
2771
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2772
|
+
return utils.unmarshal_json(http_res.text, models.IpmiSession)
|
|
2773
|
+
if utils.match_response(
|
|
2774
|
+
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
2775
|
+
):
|
|
2776
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2777
|
+
raise models.ErrorObject(data=response_data)
|
|
2778
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2779
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2780
|
+
raise models.APIError(
|
|
2781
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2782
|
+
)
|
|
2783
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2784
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2785
|
+
raise models.APIError(
|
|
2786
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2787
|
+
)
|
|
2788
|
+
|
|
2789
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2790
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2791
|
+
raise models.APIError(
|
|
2792
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2793
|
+
http_res.status_code,
|
|
2794
|
+
http_res_text,
|
|
2795
|
+
http_res,
|
|
2796
|
+
)
|
|
2797
|
+
|
|
2798
|
+
def start_rescue_mode(
|
|
2799
|
+
self,
|
|
2800
|
+
*,
|
|
2801
|
+
server_id: str,
|
|
2802
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2803
|
+
server_url: Optional[str] = None,
|
|
2804
|
+
timeout_ms: Optional[int] = None,
|
|
2805
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2806
|
+
) -> models.ServerRescue:
|
|
2807
|
+
r"""Puts a Server in rescue mode
|
|
2808
|
+
|
|
2809
|
+
Starts rescue mode on a given server.
|
|
2810
|
+
|
|
2811
|
+
:param server_id:
|
|
2812
|
+
:param retries: Override the default retry configuration for this method
|
|
2813
|
+
:param server_url: Override the default server URL for this method
|
|
2814
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2815
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2816
|
+
"""
|
|
2817
|
+
base_url = None
|
|
2818
|
+
url_variables = None
|
|
2819
|
+
if timeout_ms is None:
|
|
2820
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2821
|
+
|
|
2822
|
+
if server_url is not None:
|
|
2823
|
+
base_url = server_url
|
|
2824
|
+
else:
|
|
2825
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2826
|
+
|
|
2827
|
+
request = models.ServerStartRescueModeRequest(
|
|
2828
|
+
server_id=server_id,
|
|
2829
|
+
)
|
|
2830
|
+
|
|
2831
|
+
req = self._build_request(
|
|
2832
|
+
method="POST",
|
|
2833
|
+
path="/servers/{server_id}/rescue_mode",
|
|
2834
|
+
base_url=base_url,
|
|
2835
|
+
url_variables=url_variables,
|
|
2836
|
+
request=request,
|
|
2837
|
+
request_body_required=False,
|
|
2838
|
+
request_has_path_params=True,
|
|
2839
|
+
request_has_query_params=True,
|
|
2840
|
+
user_agent_header="user-agent",
|
|
2841
|
+
accept_header_value="application/vnd.api+json",
|
|
2842
|
+
http_headers=http_headers,
|
|
2843
|
+
security=self.sdk_configuration.security,
|
|
2844
|
+
timeout_ms=timeout_ms,
|
|
2845
|
+
)
|
|
2846
|
+
|
|
2847
|
+
if retries == UNSET:
|
|
2848
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2849
|
+
retries = self.sdk_configuration.retry_config
|
|
2850
|
+
|
|
2851
|
+
retry_config = None
|
|
2852
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2853
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2854
|
+
|
|
2855
|
+
http_res = self.do_request(
|
|
2856
|
+
hook_ctx=HookContext(
|
|
2857
|
+
base_url=base_url or "",
|
|
2858
|
+
operation_id="server-start-rescue-mode",
|
|
2859
|
+
oauth2_scopes=[],
|
|
2860
|
+
security_source=get_security_from_env(
|
|
2861
|
+
self.sdk_configuration.security, models.Security
|
|
2862
|
+
),
|
|
2863
|
+
),
|
|
2864
|
+
request=req,
|
|
2865
|
+
error_status_codes=["403", "406", "4XX", "5XX"],
|
|
2866
|
+
retry_config=retry_config,
|
|
2867
|
+
)
|
|
2868
|
+
|
|
2869
|
+
response_data: Any = None
|
|
2870
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2871
|
+
return utils.unmarshal_json(http_res.text, models.ServerRescue)
|
|
2872
|
+
if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
|
|
2873
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2874
|
+
raise models.ErrorObject(data=response_data)
|
|
2875
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2876
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2877
|
+
raise models.APIError(
|
|
2878
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2879
|
+
)
|
|
2880
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2881
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2882
|
+
raise models.APIError(
|
|
2883
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2884
|
+
)
|
|
2885
|
+
|
|
2886
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2887
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2888
|
+
raise models.APIError(
|
|
2889
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2890
|
+
http_res.status_code,
|
|
2891
|
+
http_res_text,
|
|
2892
|
+
http_res,
|
|
2893
|
+
)
|
|
2894
|
+
|
|
2895
|
+
async def start_rescue_mode_async(
|
|
2896
|
+
self,
|
|
2897
|
+
*,
|
|
2898
|
+
server_id: str,
|
|
2899
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2900
|
+
server_url: Optional[str] = None,
|
|
2901
|
+
timeout_ms: Optional[int] = None,
|
|
2902
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2903
|
+
) -> models.ServerRescue:
|
|
2904
|
+
r"""Puts a Server in rescue mode
|
|
2905
|
+
|
|
2906
|
+
Starts rescue mode on a given server.
|
|
2907
|
+
|
|
2908
|
+
:param server_id:
|
|
2909
|
+
:param retries: Override the default retry configuration for this method
|
|
2910
|
+
:param server_url: Override the default server URL for this method
|
|
2911
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2912
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2913
|
+
"""
|
|
2914
|
+
base_url = None
|
|
2915
|
+
url_variables = None
|
|
2916
|
+
if timeout_ms is None:
|
|
2917
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2918
|
+
|
|
2919
|
+
if server_url is not None:
|
|
2920
|
+
base_url = server_url
|
|
2921
|
+
else:
|
|
2922
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2923
|
+
|
|
2924
|
+
request = models.ServerStartRescueModeRequest(
|
|
2925
|
+
server_id=server_id,
|
|
2926
|
+
)
|
|
2927
|
+
|
|
2928
|
+
req = self._build_request_async(
|
|
2929
|
+
method="POST",
|
|
2930
|
+
path="/servers/{server_id}/rescue_mode",
|
|
2931
|
+
base_url=base_url,
|
|
2932
|
+
url_variables=url_variables,
|
|
2933
|
+
request=request,
|
|
2934
|
+
request_body_required=False,
|
|
2935
|
+
request_has_path_params=True,
|
|
2936
|
+
request_has_query_params=True,
|
|
2937
|
+
user_agent_header="user-agent",
|
|
2938
|
+
accept_header_value="application/vnd.api+json",
|
|
2939
|
+
http_headers=http_headers,
|
|
2940
|
+
security=self.sdk_configuration.security,
|
|
2941
|
+
timeout_ms=timeout_ms,
|
|
2942
|
+
)
|
|
2943
|
+
|
|
2944
|
+
if retries == UNSET:
|
|
2945
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2946
|
+
retries = self.sdk_configuration.retry_config
|
|
2947
|
+
|
|
2948
|
+
retry_config = None
|
|
2949
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2950
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2951
|
+
|
|
2952
|
+
http_res = await self.do_request_async(
|
|
2953
|
+
hook_ctx=HookContext(
|
|
2954
|
+
base_url=base_url or "",
|
|
2955
|
+
operation_id="server-start-rescue-mode",
|
|
2956
|
+
oauth2_scopes=[],
|
|
2957
|
+
security_source=get_security_from_env(
|
|
2958
|
+
self.sdk_configuration.security, models.Security
|
|
2959
|
+
),
|
|
2960
|
+
),
|
|
2961
|
+
request=req,
|
|
2962
|
+
error_status_codes=["403", "406", "4XX", "5XX"],
|
|
2963
|
+
retry_config=retry_config,
|
|
2964
|
+
)
|
|
2965
|
+
|
|
2966
|
+
response_data: Any = None
|
|
2967
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
2968
|
+
return utils.unmarshal_json(http_res.text, models.ServerRescue)
|
|
2969
|
+
if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
|
|
2970
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
2971
|
+
raise models.ErrorObject(data=response_data)
|
|
2972
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2973
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2974
|
+
raise models.APIError(
|
|
2975
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2976
|
+
)
|
|
2977
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2978
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2979
|
+
raise models.APIError(
|
|
2980
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2981
|
+
)
|
|
2982
|
+
|
|
2983
|
+
content_type = http_res.headers.get("Content-Type")
|
|
2984
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2985
|
+
raise models.APIError(
|
|
2986
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2987
|
+
http_res.status_code,
|
|
2988
|
+
http_res_text,
|
|
2989
|
+
http_res,
|
|
2990
|
+
)
|
|
2991
|
+
|
|
2992
|
+
def exit_rescue_mode(
|
|
2993
|
+
self,
|
|
2994
|
+
*,
|
|
2995
|
+
server_id: str,
|
|
2996
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2997
|
+
server_url: Optional[str] = None,
|
|
2998
|
+
timeout_ms: Optional[int] = None,
|
|
2999
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3000
|
+
) -> models.ServerRescue:
|
|
3001
|
+
r"""Exits rescue mode for a Server
|
|
3002
|
+
|
|
3003
|
+
Exits rescue mode on a given server.
|
|
3004
|
+
|
|
3005
|
+
:param server_id:
|
|
3006
|
+
:param retries: Override the default retry configuration for this method
|
|
3007
|
+
:param server_url: Override the default server URL for this method
|
|
3008
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3009
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3010
|
+
"""
|
|
3011
|
+
base_url = None
|
|
3012
|
+
url_variables = None
|
|
3013
|
+
if timeout_ms is None:
|
|
3014
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3015
|
+
|
|
3016
|
+
if server_url is not None:
|
|
3017
|
+
base_url = server_url
|
|
3018
|
+
else:
|
|
3019
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3020
|
+
|
|
3021
|
+
request = models.ServerExitRescueModeRequest(
|
|
3022
|
+
server_id=server_id,
|
|
3023
|
+
)
|
|
3024
|
+
|
|
3025
|
+
req = self._build_request(
|
|
3026
|
+
method="POST",
|
|
3027
|
+
path="/servers/{server_id}/exit_rescue_mode",
|
|
3028
|
+
base_url=base_url,
|
|
3029
|
+
url_variables=url_variables,
|
|
3030
|
+
request=request,
|
|
3031
|
+
request_body_required=False,
|
|
3032
|
+
request_has_path_params=True,
|
|
3033
|
+
request_has_query_params=True,
|
|
3034
|
+
user_agent_header="user-agent",
|
|
3035
|
+
accept_header_value="application/vnd.api+json",
|
|
3036
|
+
http_headers=http_headers,
|
|
3037
|
+
security=self.sdk_configuration.security,
|
|
3038
|
+
timeout_ms=timeout_ms,
|
|
3039
|
+
)
|
|
3040
|
+
|
|
3041
|
+
if retries == UNSET:
|
|
3042
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3043
|
+
retries = self.sdk_configuration.retry_config
|
|
3044
|
+
|
|
3045
|
+
retry_config = None
|
|
3046
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3047
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3048
|
+
|
|
3049
|
+
http_res = self.do_request(
|
|
3050
|
+
hook_ctx=HookContext(
|
|
3051
|
+
base_url=base_url or "",
|
|
3052
|
+
operation_id="server-exit-rescue-mode",
|
|
3053
|
+
oauth2_scopes=[],
|
|
3054
|
+
security_source=get_security_from_env(
|
|
3055
|
+
self.sdk_configuration.security, models.Security
|
|
3056
|
+
),
|
|
3057
|
+
),
|
|
3058
|
+
request=req,
|
|
3059
|
+
error_status_codes=["403", "406", "4XX", "5XX"],
|
|
3060
|
+
retry_config=retry_config,
|
|
3061
|
+
)
|
|
3062
|
+
|
|
3063
|
+
response_data: Any = None
|
|
3064
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
3065
|
+
return utils.unmarshal_json(http_res.text, models.ServerRescue)
|
|
3066
|
+
if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
|
|
3067
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3068
|
+
raise models.ErrorObject(data=response_data)
|
|
3069
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3070
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3071
|
+
raise models.APIError(
|
|
3072
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3073
|
+
)
|
|
3074
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3075
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3076
|
+
raise models.APIError(
|
|
3077
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3078
|
+
)
|
|
3079
|
+
|
|
3080
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3081
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3082
|
+
raise models.APIError(
|
|
3083
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3084
|
+
http_res.status_code,
|
|
3085
|
+
http_res_text,
|
|
3086
|
+
http_res,
|
|
3087
|
+
)
|
|
3088
|
+
|
|
3089
|
+
async def exit_rescue_mode_async(
|
|
3090
|
+
self,
|
|
3091
|
+
*,
|
|
3092
|
+
server_id: str,
|
|
3093
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3094
|
+
server_url: Optional[str] = None,
|
|
3095
|
+
timeout_ms: Optional[int] = None,
|
|
3096
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3097
|
+
) -> models.ServerRescue:
|
|
3098
|
+
r"""Exits rescue mode for a Server
|
|
3099
|
+
|
|
3100
|
+
Exits rescue mode on a given server.
|
|
3101
|
+
|
|
3102
|
+
:param server_id:
|
|
3103
|
+
:param retries: Override the default retry configuration for this method
|
|
3104
|
+
:param server_url: Override the default server URL for this method
|
|
3105
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3106
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3107
|
+
"""
|
|
3108
|
+
base_url = None
|
|
3109
|
+
url_variables = None
|
|
3110
|
+
if timeout_ms is None:
|
|
3111
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3112
|
+
|
|
3113
|
+
if server_url is not None:
|
|
3114
|
+
base_url = server_url
|
|
3115
|
+
else:
|
|
3116
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3117
|
+
|
|
3118
|
+
request = models.ServerExitRescueModeRequest(
|
|
3119
|
+
server_id=server_id,
|
|
3120
|
+
)
|
|
3121
|
+
|
|
3122
|
+
req = self._build_request_async(
|
|
3123
|
+
method="POST",
|
|
3124
|
+
path="/servers/{server_id}/exit_rescue_mode",
|
|
3125
|
+
base_url=base_url,
|
|
3126
|
+
url_variables=url_variables,
|
|
3127
|
+
request=request,
|
|
3128
|
+
request_body_required=False,
|
|
3129
|
+
request_has_path_params=True,
|
|
3130
|
+
request_has_query_params=True,
|
|
3131
|
+
user_agent_header="user-agent",
|
|
3132
|
+
accept_header_value="application/vnd.api+json",
|
|
3133
|
+
http_headers=http_headers,
|
|
3134
|
+
security=self.sdk_configuration.security,
|
|
3135
|
+
timeout_ms=timeout_ms,
|
|
3136
|
+
)
|
|
3137
|
+
|
|
3138
|
+
if retries == UNSET:
|
|
3139
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3140
|
+
retries = self.sdk_configuration.retry_config
|
|
3141
|
+
|
|
3142
|
+
retry_config = None
|
|
3143
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3144
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3145
|
+
|
|
3146
|
+
http_res = await self.do_request_async(
|
|
3147
|
+
hook_ctx=HookContext(
|
|
3148
|
+
base_url=base_url or "",
|
|
3149
|
+
operation_id="server-exit-rescue-mode",
|
|
3150
|
+
oauth2_scopes=[],
|
|
3151
|
+
security_source=get_security_from_env(
|
|
3152
|
+
self.sdk_configuration.security, models.Security
|
|
3153
|
+
),
|
|
3154
|
+
),
|
|
3155
|
+
request=req,
|
|
3156
|
+
error_status_codes=["403", "406", "4XX", "5XX"],
|
|
3157
|
+
retry_config=retry_config,
|
|
3158
|
+
)
|
|
3159
|
+
|
|
3160
|
+
response_data: Any = None
|
|
3161
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
3162
|
+
return utils.unmarshal_json(http_res.text, models.ServerRescue)
|
|
3163
|
+
if utils.match_response(http_res, ["403", "406"], "application/vnd.api+json"):
|
|
3164
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3165
|
+
raise models.ErrorObject(data=response_data)
|
|
3166
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3167
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3168
|
+
raise models.APIError(
|
|
3169
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3170
|
+
)
|
|
3171
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3172
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3173
|
+
raise models.APIError(
|
|
3174
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3175
|
+
)
|
|
3176
|
+
|
|
3177
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3178
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3179
|
+
raise models.APIError(
|
|
3180
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3181
|
+
http_res.status_code,
|
|
3182
|
+
http_res_text,
|
|
3183
|
+
http_res,
|
|
3184
|
+
)
|
|
3185
|
+
|
|
3186
|
+
def schedule_deletion(
|
|
3187
|
+
self,
|
|
3188
|
+
*,
|
|
3189
|
+
server_id: str,
|
|
3190
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3191
|
+
server_url: Optional[str] = None,
|
|
3192
|
+
timeout_ms: Optional[int] = None,
|
|
3193
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3194
|
+
) -> models.ServerScheduleDeletion:
|
|
3195
|
+
r"""Schedule the server deletion
|
|
3196
|
+
|
|
3197
|
+
Schedules the server to be removed at the end of the billing cycle.
|
|
3198
|
+
|
|
3199
|
+
:param server_id:
|
|
3200
|
+
:param retries: Override the default retry configuration for this method
|
|
3201
|
+
:param server_url: Override the default server URL for this method
|
|
3202
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3203
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3204
|
+
"""
|
|
3205
|
+
base_url = None
|
|
3206
|
+
url_variables = None
|
|
3207
|
+
if timeout_ms is None:
|
|
3208
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3209
|
+
|
|
3210
|
+
if server_url is not None:
|
|
3211
|
+
base_url = server_url
|
|
3212
|
+
else:
|
|
3213
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3214
|
+
|
|
3215
|
+
request = models.ServerScheduleDeletionRequest(
|
|
3216
|
+
server_id=server_id,
|
|
3217
|
+
)
|
|
3218
|
+
|
|
3219
|
+
req = self._build_request(
|
|
3220
|
+
method="POST",
|
|
3221
|
+
path="/servers/{server_id}/schedule_deletion",
|
|
3222
|
+
base_url=base_url,
|
|
3223
|
+
url_variables=url_variables,
|
|
3224
|
+
request=request,
|
|
3225
|
+
request_body_required=False,
|
|
3226
|
+
request_has_path_params=True,
|
|
3227
|
+
request_has_query_params=True,
|
|
3228
|
+
user_agent_header="user-agent",
|
|
3229
|
+
accept_header_value="application/vnd.api+json",
|
|
3230
|
+
http_headers=http_headers,
|
|
3231
|
+
security=self.sdk_configuration.security,
|
|
3232
|
+
timeout_ms=timeout_ms,
|
|
3233
|
+
)
|
|
3234
|
+
|
|
3235
|
+
if retries == UNSET:
|
|
3236
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3237
|
+
retries = self.sdk_configuration.retry_config
|
|
3238
|
+
|
|
3239
|
+
retry_config = None
|
|
3240
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3241
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3242
|
+
|
|
3243
|
+
http_res = self.do_request(
|
|
3244
|
+
hook_ctx=HookContext(
|
|
3245
|
+
base_url=base_url or "",
|
|
3246
|
+
operation_id="server-schedule-deletion",
|
|
3247
|
+
oauth2_scopes=[],
|
|
3248
|
+
security_source=get_security_from_env(
|
|
3249
|
+
self.sdk_configuration.security, models.Security
|
|
3250
|
+
),
|
|
3251
|
+
),
|
|
3252
|
+
request=req,
|
|
3253
|
+
error_status_codes=["403", "406", "423", "4XX", "5XX"],
|
|
3254
|
+
retry_config=retry_config,
|
|
3255
|
+
)
|
|
3256
|
+
|
|
3257
|
+
response_data: Any = None
|
|
3258
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
3259
|
+
return utils.unmarshal_json(http_res.text, models.ServerScheduleDeletion)
|
|
3260
|
+
if utils.match_response(
|
|
3261
|
+
http_res, ["403", "406", "423"], "application/vnd.api+json"
|
|
3262
|
+
):
|
|
3263
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3264
|
+
raise models.ErrorObject(data=response_data)
|
|
3265
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3266
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3267
|
+
raise models.APIError(
|
|
3268
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3269
|
+
)
|
|
3270
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3271
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3272
|
+
raise models.APIError(
|
|
3273
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3274
|
+
)
|
|
3275
|
+
|
|
3276
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3277
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3278
|
+
raise models.APIError(
|
|
3279
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3280
|
+
http_res.status_code,
|
|
3281
|
+
http_res_text,
|
|
3282
|
+
http_res,
|
|
3283
|
+
)
|
|
3284
|
+
|
|
3285
|
+
async def schedule_deletion_async(
|
|
3286
|
+
self,
|
|
3287
|
+
*,
|
|
3288
|
+
server_id: str,
|
|
3289
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3290
|
+
server_url: Optional[str] = None,
|
|
3291
|
+
timeout_ms: Optional[int] = None,
|
|
3292
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3293
|
+
) -> models.ServerScheduleDeletion:
|
|
3294
|
+
r"""Schedule the server deletion
|
|
3295
|
+
|
|
3296
|
+
Schedules the server to be removed at the end of the billing cycle.
|
|
3297
|
+
|
|
3298
|
+
:param server_id:
|
|
3299
|
+
:param retries: Override the default retry configuration for this method
|
|
3300
|
+
:param server_url: Override the default server URL for this method
|
|
3301
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3302
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3303
|
+
"""
|
|
3304
|
+
base_url = None
|
|
3305
|
+
url_variables = None
|
|
3306
|
+
if timeout_ms is None:
|
|
3307
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3308
|
+
|
|
3309
|
+
if server_url is not None:
|
|
3310
|
+
base_url = server_url
|
|
3311
|
+
else:
|
|
3312
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3313
|
+
|
|
3314
|
+
request = models.ServerScheduleDeletionRequest(
|
|
3315
|
+
server_id=server_id,
|
|
3316
|
+
)
|
|
3317
|
+
|
|
3318
|
+
req = self._build_request_async(
|
|
3319
|
+
method="POST",
|
|
3320
|
+
path="/servers/{server_id}/schedule_deletion",
|
|
3321
|
+
base_url=base_url,
|
|
3322
|
+
url_variables=url_variables,
|
|
3323
|
+
request=request,
|
|
3324
|
+
request_body_required=False,
|
|
3325
|
+
request_has_path_params=True,
|
|
3326
|
+
request_has_query_params=True,
|
|
3327
|
+
user_agent_header="user-agent",
|
|
3328
|
+
accept_header_value="application/vnd.api+json",
|
|
3329
|
+
http_headers=http_headers,
|
|
3330
|
+
security=self.sdk_configuration.security,
|
|
3331
|
+
timeout_ms=timeout_ms,
|
|
3332
|
+
)
|
|
3333
|
+
|
|
3334
|
+
if retries == UNSET:
|
|
3335
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3336
|
+
retries = self.sdk_configuration.retry_config
|
|
3337
|
+
|
|
3338
|
+
retry_config = None
|
|
3339
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3340
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3341
|
+
|
|
3342
|
+
http_res = await self.do_request_async(
|
|
3343
|
+
hook_ctx=HookContext(
|
|
3344
|
+
base_url=base_url or "",
|
|
3345
|
+
operation_id="server-schedule-deletion",
|
|
3346
|
+
oauth2_scopes=[],
|
|
3347
|
+
security_source=get_security_from_env(
|
|
3348
|
+
self.sdk_configuration.security, models.Security
|
|
3349
|
+
),
|
|
3350
|
+
),
|
|
3351
|
+
request=req,
|
|
3352
|
+
error_status_codes=["403", "406", "423", "4XX", "5XX"],
|
|
3353
|
+
retry_config=retry_config,
|
|
3354
|
+
)
|
|
3355
|
+
|
|
3356
|
+
response_data: Any = None
|
|
3357
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
3358
|
+
return utils.unmarshal_json(http_res.text, models.ServerScheduleDeletion)
|
|
3359
|
+
if utils.match_response(
|
|
3360
|
+
http_res, ["403", "406", "423"], "application/vnd.api+json"
|
|
3361
|
+
):
|
|
3362
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3363
|
+
raise models.ErrorObject(data=response_data)
|
|
3364
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3365
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3366
|
+
raise models.APIError(
|
|
3367
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3368
|
+
)
|
|
3369
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3370
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3371
|
+
raise models.APIError(
|
|
3372
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3373
|
+
)
|
|
3374
|
+
|
|
3375
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3376
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3377
|
+
raise models.APIError(
|
|
3378
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3379
|
+
http_res.status_code,
|
|
3380
|
+
http_res_text,
|
|
3381
|
+
http_res,
|
|
3382
|
+
)
|
|
3383
|
+
|
|
3384
|
+
def unschedule_deletion(
|
|
3385
|
+
self,
|
|
3386
|
+
*,
|
|
3387
|
+
server_id: str,
|
|
3388
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3389
|
+
server_url: Optional[str] = None,
|
|
3390
|
+
timeout_ms: Optional[int] = None,
|
|
3391
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3392
|
+
):
|
|
3393
|
+
r"""Unschedule the server deletion
|
|
3394
|
+
|
|
3395
|
+
Unschedules the server removal at the end of the billing cycle.
|
|
3396
|
+
|
|
3397
|
+
:param server_id:
|
|
3398
|
+
:param retries: Override the default retry configuration for this method
|
|
3399
|
+
:param server_url: Override the default server URL for this method
|
|
3400
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3401
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3402
|
+
"""
|
|
3403
|
+
base_url = None
|
|
3404
|
+
url_variables = None
|
|
3405
|
+
if timeout_ms is None:
|
|
3406
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3407
|
+
|
|
3408
|
+
if server_url is not None:
|
|
3409
|
+
base_url = server_url
|
|
3410
|
+
else:
|
|
3411
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3412
|
+
|
|
3413
|
+
request = models.ServerUnscheduleDeletionRequest(
|
|
3414
|
+
server_id=server_id,
|
|
3415
|
+
)
|
|
3416
|
+
|
|
3417
|
+
req = self._build_request(
|
|
3418
|
+
method="DELETE",
|
|
3419
|
+
path="/servers/{server_id}/schedule_deletion",
|
|
3420
|
+
base_url=base_url,
|
|
3421
|
+
url_variables=url_variables,
|
|
3422
|
+
request=request,
|
|
3423
|
+
request_body_required=False,
|
|
3424
|
+
request_has_path_params=True,
|
|
3425
|
+
request_has_query_params=True,
|
|
3426
|
+
user_agent_header="user-agent",
|
|
3427
|
+
accept_header_value="application/vnd.api+json",
|
|
3428
|
+
http_headers=http_headers,
|
|
3429
|
+
security=self.sdk_configuration.security,
|
|
3430
|
+
timeout_ms=timeout_ms,
|
|
3431
|
+
)
|
|
3432
|
+
|
|
3433
|
+
if retries == UNSET:
|
|
3434
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3435
|
+
retries = self.sdk_configuration.retry_config
|
|
3436
|
+
|
|
3437
|
+
retry_config = None
|
|
3438
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3439
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3440
|
+
|
|
3441
|
+
http_res = self.do_request(
|
|
3442
|
+
hook_ctx=HookContext(
|
|
3443
|
+
base_url=base_url or "",
|
|
3444
|
+
operation_id="server-unschedule-deletion",
|
|
3445
|
+
oauth2_scopes=[],
|
|
3446
|
+
security_source=get_security_from_env(
|
|
3447
|
+
self.sdk_configuration.security, models.Security
|
|
3448
|
+
),
|
|
3449
|
+
),
|
|
3450
|
+
request=req,
|
|
3451
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
3452
|
+
retry_config=retry_config,
|
|
3453
|
+
)
|
|
3454
|
+
|
|
3455
|
+
response_data: Any = None
|
|
3456
|
+
if utils.match_response(http_res, "204", "*"):
|
|
3457
|
+
return
|
|
3458
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
3459
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3460
|
+
raise models.ErrorObject(data=response_data)
|
|
3461
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3462
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3463
|
+
raise models.APIError(
|
|
3464
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3465
|
+
)
|
|
3466
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3467
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3468
|
+
raise models.APIError(
|
|
3469
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3470
|
+
)
|
|
3471
|
+
|
|
3472
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3473
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3474
|
+
raise models.APIError(
|
|
3475
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3476
|
+
http_res.status_code,
|
|
3477
|
+
http_res_text,
|
|
3478
|
+
http_res,
|
|
3479
|
+
)
|
|
3480
|
+
|
|
3481
|
+
async def unschedule_deletion_async(
|
|
3482
|
+
self,
|
|
3483
|
+
*,
|
|
3484
|
+
server_id: str,
|
|
3485
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3486
|
+
server_url: Optional[str] = None,
|
|
3487
|
+
timeout_ms: Optional[int] = None,
|
|
3488
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3489
|
+
):
|
|
3490
|
+
r"""Unschedule the server deletion
|
|
3491
|
+
|
|
3492
|
+
Unschedules the server removal at the end of the billing cycle.
|
|
3493
|
+
|
|
3494
|
+
:param server_id:
|
|
3495
|
+
:param retries: Override the default retry configuration for this method
|
|
3496
|
+
:param server_url: Override the default server URL for this method
|
|
3497
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3498
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3499
|
+
"""
|
|
3500
|
+
base_url = None
|
|
3501
|
+
url_variables = None
|
|
3502
|
+
if timeout_ms is None:
|
|
3503
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3504
|
+
|
|
3505
|
+
if server_url is not None:
|
|
3506
|
+
base_url = server_url
|
|
3507
|
+
else:
|
|
3508
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3509
|
+
|
|
3510
|
+
request = models.ServerUnscheduleDeletionRequest(
|
|
3511
|
+
server_id=server_id,
|
|
3512
|
+
)
|
|
3513
|
+
|
|
3514
|
+
req = self._build_request_async(
|
|
3515
|
+
method="DELETE",
|
|
3516
|
+
path="/servers/{server_id}/schedule_deletion",
|
|
3517
|
+
base_url=base_url,
|
|
3518
|
+
url_variables=url_variables,
|
|
3519
|
+
request=request,
|
|
3520
|
+
request_body_required=False,
|
|
3521
|
+
request_has_path_params=True,
|
|
3522
|
+
request_has_query_params=True,
|
|
3523
|
+
user_agent_header="user-agent",
|
|
3524
|
+
accept_header_value="application/vnd.api+json",
|
|
3525
|
+
http_headers=http_headers,
|
|
3526
|
+
security=self.sdk_configuration.security,
|
|
3527
|
+
timeout_ms=timeout_ms,
|
|
3528
|
+
)
|
|
3529
|
+
|
|
3530
|
+
if retries == UNSET:
|
|
3531
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3532
|
+
retries = self.sdk_configuration.retry_config
|
|
3533
|
+
|
|
3534
|
+
retry_config = None
|
|
3535
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3536
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3537
|
+
|
|
3538
|
+
http_res = await self.do_request_async(
|
|
3539
|
+
hook_ctx=HookContext(
|
|
3540
|
+
base_url=base_url or "",
|
|
3541
|
+
operation_id="server-unschedule-deletion",
|
|
3542
|
+
oauth2_scopes=[],
|
|
3543
|
+
security_source=get_security_from_env(
|
|
3544
|
+
self.sdk_configuration.security, models.Security
|
|
3545
|
+
),
|
|
3546
|
+
),
|
|
3547
|
+
request=req,
|
|
3548
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
3549
|
+
retry_config=retry_config,
|
|
3550
|
+
)
|
|
3551
|
+
|
|
3552
|
+
response_data: Any = None
|
|
3553
|
+
if utils.match_response(http_res, "204", "*"):
|
|
3554
|
+
return
|
|
3555
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
3556
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3557
|
+
raise models.ErrorObject(data=response_data)
|
|
3558
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3559
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3560
|
+
raise models.APIError(
|
|
3561
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3562
|
+
)
|
|
3563
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3564
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3565
|
+
raise models.APIError(
|
|
3566
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3567
|
+
)
|
|
3568
|
+
|
|
3569
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3570
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3571
|
+
raise models.APIError(
|
|
3572
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3573
|
+
http_res.status_code,
|
|
3574
|
+
http_res_text,
|
|
3575
|
+
http_res,
|
|
3576
|
+
)
|
|
3577
|
+
|
|
3578
|
+
def reinstall(
|
|
3579
|
+
self,
|
|
3580
|
+
*,
|
|
3581
|
+
server_id: str,
|
|
3582
|
+
data: Union[
|
|
3583
|
+
models.CreateServerReinstallServersData,
|
|
3584
|
+
models.CreateServerReinstallServersDataTypedDict,
|
|
3585
|
+
],
|
|
3586
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3587
|
+
server_url: Optional[str] = None,
|
|
3588
|
+
timeout_ms: Optional[int] = None,
|
|
3589
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3590
|
+
):
|
|
3591
|
+
r"""Run Server Reinstall
|
|
3592
|
+
|
|
3593
|
+
:param server_id:
|
|
3594
|
+
:param data:
|
|
3595
|
+
:param retries: Override the default retry configuration for this method
|
|
3596
|
+
:param server_url: Override the default server URL for this method
|
|
3597
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3598
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3599
|
+
"""
|
|
3600
|
+
base_url = None
|
|
3601
|
+
url_variables = None
|
|
3602
|
+
if timeout_ms is None:
|
|
3603
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3604
|
+
|
|
3605
|
+
if server_url is not None:
|
|
3606
|
+
base_url = server_url
|
|
3607
|
+
else:
|
|
3608
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3609
|
+
|
|
3610
|
+
request = models.CreateServerReinstallRequest(
|
|
3611
|
+
server_id=server_id,
|
|
3612
|
+
request_body=models.CreateServerReinstallServersRequestBody(
|
|
3613
|
+
data=utils.get_pydantic_model(
|
|
3614
|
+
data, models.CreateServerReinstallServersData
|
|
3615
|
+
),
|
|
3616
|
+
),
|
|
3617
|
+
)
|
|
3618
|
+
|
|
3619
|
+
req = self._build_request(
|
|
3620
|
+
method="POST",
|
|
3621
|
+
path="/servers/{server_id}/reinstall",
|
|
3622
|
+
base_url=base_url,
|
|
3623
|
+
url_variables=url_variables,
|
|
3624
|
+
request=request,
|
|
3625
|
+
request_body_required=True,
|
|
3626
|
+
request_has_path_params=True,
|
|
3627
|
+
request_has_query_params=True,
|
|
3628
|
+
user_agent_header="user-agent",
|
|
3629
|
+
accept_header_value="application/vnd.api+json",
|
|
3630
|
+
http_headers=http_headers,
|
|
3631
|
+
security=self.sdk_configuration.security,
|
|
3632
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
3633
|
+
request.request_body,
|
|
3634
|
+
False,
|
|
3635
|
+
False,
|
|
3636
|
+
"json",
|
|
3637
|
+
models.CreateServerReinstallServersRequestBody,
|
|
3638
|
+
),
|
|
3639
|
+
timeout_ms=timeout_ms,
|
|
3640
|
+
)
|
|
3641
|
+
|
|
3642
|
+
if retries == UNSET:
|
|
3643
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3644
|
+
retries = self.sdk_configuration.retry_config
|
|
3645
|
+
|
|
3646
|
+
retry_config = None
|
|
3647
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3648
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3649
|
+
|
|
3650
|
+
http_res = self.do_request(
|
|
3651
|
+
hook_ctx=HookContext(
|
|
3652
|
+
base_url=base_url or "",
|
|
3653
|
+
operation_id="create-server-reinstall",
|
|
3654
|
+
oauth2_scopes=[],
|
|
3655
|
+
security_source=get_security_from_env(
|
|
3656
|
+
self.sdk_configuration.security, models.Security
|
|
3657
|
+
),
|
|
3658
|
+
),
|
|
3659
|
+
request=req,
|
|
3660
|
+
error_status_codes=["403", "404", "422", "423", "4XX", "5XX"],
|
|
3661
|
+
retry_config=retry_config,
|
|
3662
|
+
)
|
|
3663
|
+
|
|
3664
|
+
response_data: Any = None
|
|
3665
|
+
if utils.match_response(http_res, "201", "*"):
|
|
3666
|
+
return
|
|
3667
|
+
if utils.match_response(
|
|
3668
|
+
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
3669
|
+
):
|
|
3670
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3671
|
+
raise models.ErrorObject(data=response_data)
|
|
3672
|
+
if utils.match_response(http_res, "423", "application/vnd.api+json"):
|
|
3673
|
+
response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
|
|
3674
|
+
raise models.ServerError(data=response_data)
|
|
3675
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3676
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3677
|
+
raise models.APIError(
|
|
3678
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3679
|
+
)
|
|
3680
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3681
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3682
|
+
raise models.APIError(
|
|
3683
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3684
|
+
)
|
|
3685
|
+
|
|
3686
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3687
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3688
|
+
raise models.APIError(
|
|
3689
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3690
|
+
http_res.status_code,
|
|
3691
|
+
http_res_text,
|
|
3692
|
+
http_res,
|
|
3693
|
+
)
|
|
3694
|
+
|
|
3695
|
+
async def reinstall_async(
|
|
3696
|
+
self,
|
|
3697
|
+
*,
|
|
3698
|
+
server_id: str,
|
|
3699
|
+
data: Union[
|
|
3700
|
+
models.CreateServerReinstallServersData,
|
|
3701
|
+
models.CreateServerReinstallServersDataTypedDict,
|
|
3702
|
+
],
|
|
3703
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3704
|
+
server_url: Optional[str] = None,
|
|
3705
|
+
timeout_ms: Optional[int] = None,
|
|
3706
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3707
|
+
):
|
|
3708
|
+
r"""Run Server Reinstall
|
|
3709
|
+
|
|
3710
|
+
:param server_id:
|
|
3711
|
+
:param data:
|
|
3712
|
+
:param retries: Override the default retry configuration for this method
|
|
3713
|
+
:param server_url: Override the default server URL for this method
|
|
3714
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3715
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3716
|
+
"""
|
|
3717
|
+
base_url = None
|
|
3718
|
+
url_variables = None
|
|
3719
|
+
if timeout_ms is None:
|
|
3720
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3721
|
+
|
|
3722
|
+
if server_url is not None:
|
|
3723
|
+
base_url = server_url
|
|
3724
|
+
else:
|
|
3725
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3726
|
+
|
|
3727
|
+
request = models.CreateServerReinstallRequest(
|
|
3728
|
+
server_id=server_id,
|
|
3729
|
+
request_body=models.CreateServerReinstallServersRequestBody(
|
|
3730
|
+
data=utils.get_pydantic_model(
|
|
3731
|
+
data, models.CreateServerReinstallServersData
|
|
3732
|
+
),
|
|
3733
|
+
),
|
|
3734
|
+
)
|
|
3735
|
+
|
|
3736
|
+
req = self._build_request_async(
|
|
3737
|
+
method="POST",
|
|
3738
|
+
path="/servers/{server_id}/reinstall",
|
|
3739
|
+
base_url=base_url,
|
|
3740
|
+
url_variables=url_variables,
|
|
3741
|
+
request=request,
|
|
3742
|
+
request_body_required=True,
|
|
3743
|
+
request_has_path_params=True,
|
|
3744
|
+
request_has_query_params=True,
|
|
3745
|
+
user_agent_header="user-agent",
|
|
3746
|
+
accept_header_value="application/vnd.api+json",
|
|
3747
|
+
http_headers=http_headers,
|
|
3748
|
+
security=self.sdk_configuration.security,
|
|
3749
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
3750
|
+
request.request_body,
|
|
3751
|
+
False,
|
|
3752
|
+
False,
|
|
3753
|
+
"json",
|
|
3754
|
+
models.CreateServerReinstallServersRequestBody,
|
|
3755
|
+
),
|
|
3756
|
+
timeout_ms=timeout_ms,
|
|
3757
|
+
)
|
|
3758
|
+
|
|
3759
|
+
if retries == UNSET:
|
|
3760
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3761
|
+
retries = self.sdk_configuration.retry_config
|
|
3762
|
+
|
|
3763
|
+
retry_config = None
|
|
3764
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3765
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3766
|
+
|
|
3767
|
+
http_res = await self.do_request_async(
|
|
3768
|
+
hook_ctx=HookContext(
|
|
3769
|
+
base_url=base_url or "",
|
|
3770
|
+
operation_id="create-server-reinstall",
|
|
3771
|
+
oauth2_scopes=[],
|
|
3772
|
+
security_source=get_security_from_env(
|
|
3773
|
+
self.sdk_configuration.security, models.Security
|
|
3774
|
+
),
|
|
3775
|
+
),
|
|
3776
|
+
request=req,
|
|
3777
|
+
error_status_codes=["403", "404", "422", "423", "4XX", "5XX"],
|
|
3778
|
+
retry_config=retry_config,
|
|
3779
|
+
)
|
|
3780
|
+
|
|
3781
|
+
response_data: Any = None
|
|
3782
|
+
if utils.match_response(http_res, "201", "*"):
|
|
3783
|
+
return
|
|
3784
|
+
if utils.match_response(
|
|
3785
|
+
http_res, ["403", "404", "422"], "application/vnd.api+json"
|
|
3786
|
+
):
|
|
3787
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
3788
|
+
raise models.ErrorObject(data=response_data)
|
|
3789
|
+
if utils.match_response(http_res, "423", "application/vnd.api+json"):
|
|
3790
|
+
response_data = utils.unmarshal_json(http_res.text, models.ServerErrorData)
|
|
3791
|
+
raise models.ServerError(data=response_data)
|
|
3792
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3793
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3794
|
+
raise models.APIError(
|
|
3795
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3796
|
+
)
|
|
3797
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3798
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3799
|
+
raise models.APIError(
|
|
3800
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
3801
|
+
)
|
|
3802
|
+
|
|
3803
|
+
content_type = http_res.headers.get("Content-Type")
|
|
3804
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3805
|
+
raise models.APIError(
|
|
3806
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
3807
|
+
http_res.status_code,
|
|
3808
|
+
http_res_text,
|
|
3809
|
+
http_res,
|
|
3810
|
+
)
|