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