latitudesh-python-sdk 0.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of latitudesh-python-sdk might be problematic. Click here for more details.
- latitudesh_python_sdk/__init__.py +18 -0
- latitudesh_python_sdk/_hooks/__init__.py +5 -0
- latitudesh_python_sdk/_hooks/registration.py +13 -0
- latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
- latitudesh_python_sdk/_hooks/types.py +106 -0
- latitudesh_python_sdk/_version.py +15 -0
- latitudesh_python_sdk/apikeys.py +802 -0
- latitudesh_python_sdk/basesdk.py +366 -0
- latitudesh_python_sdk/billing.py +210 -0
- latitudesh_python_sdk/events_sdk.py +240 -0
- latitudesh_python_sdk/firewalls_sdk.py +1640 -0
- latitudesh_python_sdk/httpclient.py +136 -0
- latitudesh_python_sdk/ipaddresses_sdk.py +448 -0
- latitudesh_python_sdk/models/__init__.py +1927 -0
- latitudesh_python_sdk/models/api_key.py +81 -0
- latitudesh_python_sdk/models/apierror.py +22 -0
- latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
- latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
- latitudesh_python_sdk/models/bandwidth_plan.py +72 -0
- latitudesh_python_sdk/models/bandwidth_plans.py +15 -0
- latitudesh_python_sdk/models/billing_usage.py +158 -0
- latitudesh_python_sdk/models/create_api_key.py +40 -0
- latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
- latitudesh_python_sdk/models/create_firewallop.py +69 -0
- latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
- latitudesh_python_sdk/models/create_projectop.py +79 -0
- latitudesh_python_sdk/models/create_server_actionop.py +69 -0
- latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
- latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
- latitudesh_python_sdk/models/create_serverop.py +173 -0
- latitudesh_python_sdk/models/create_tagop.py +50 -0
- latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
- latitudesh_python_sdk/models/custom_tag.py +54 -0
- latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
- latitudesh_python_sdk/models/delete_firewallop.py +18 -0
- latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
- latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
- latitudesh_python_sdk/models/delete_projectop.py +18 -0
- latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
- latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
- latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/deploy_config.py +74 -0
- latitudesh_python_sdk/models/destroy_serverop.py +31 -0
- latitudesh_python_sdk/models/destroy_tagop.py +16 -0
- latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
- latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
- latitudesh_python_sdk/models/error_object.py +49 -0
- latitudesh_python_sdk/models/events.py +90 -0
- latitudesh_python_sdk/models/filesystem_data.py +53 -0
- latitudesh_python_sdk/models/firewall.py +71 -0
- latitudesh_python_sdk/models/firewall_server.py +50 -0
- latitudesh_python_sdk/models/firewalls.py +26 -0
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +33 -0
- latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
- latitudesh_python_sdk/models/get_eventsop.py +98 -0
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +18 -0
- latitudesh_python_sdk/models/get_firewallop.py +18 -0
- latitudesh_python_sdk/models/get_ipop.py +33 -0
- latitudesh_python_sdk/models/get_ipsop.py +91 -0
- latitudesh_python_sdk/models/get_planop.py +16 -0
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +19 -0
- latitudesh_python_sdk/models/get_plansop.py +125 -0
- latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
- latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
- latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
- latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
- latitudesh_python_sdk/models/get_projectsop.py +76 -0
- latitudesh_python_sdk/models/get_regionop.py +18 -0
- latitudesh_python_sdk/models/get_role_idop.py +16 -0
- latitudesh_python_sdk/models/get_rolesop.py +19 -0
- latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
- latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
- latitudesh_python_sdk/models/get_serverop.py +33 -0
- latitudesh_python_sdk/models/get_serversop.py +156 -0
- latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +45 -0
- latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
- latitudesh_python_sdk/models/get_user_profileop.py +19 -0
- latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +40 -0
- latitudesh_python_sdk/models/get_virtual_networksop.py +40 -0
- latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
- latitudesh_python_sdk/models/index_virtual_machineop.py +22 -0
- latitudesh_python_sdk/models/ip_address.py +122 -0
- latitudesh_python_sdk/models/ip_addresses.py +15 -0
- latitudesh_python_sdk/models/ipmi_session.py +53 -0
- latitudesh_python_sdk/models/list_firewallsop.py +20 -0
- latitudesh_python_sdk/models/membership.py +63 -0
- latitudesh_python_sdk/models/operating_systems.py +57 -0
- latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
- latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
- latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
- latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
- latitudesh_python_sdk/models/plan.py +15 -0
- latitudesh_python_sdk/models/plan_data.py +206 -0
- latitudesh_python_sdk/models/post_api_keyop.py +19 -0
- latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
- latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
- latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
- latitudesh_python_sdk/models/post_team_membersop.py +54 -0
- latitudesh_python_sdk/models/post_teamop.py +67 -0
- latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
- latitudesh_python_sdk/models/project.py +130 -0
- latitudesh_python_sdk/models/project_include.py +72 -0
- latitudesh_python_sdk/models/projects.py +15 -0
- latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
- latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
- latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/region.py +50 -0
- latitudesh_python_sdk/models/region_resource_data.py +37 -0
- latitudesh_python_sdk/models/regions.py +50 -0
- latitudesh_python_sdk/models/role.py +15 -0
- latitudesh_python_sdk/models/role_data.py +35 -0
- latitudesh_python_sdk/models/security.py +25 -0
- latitudesh_python_sdk/models/server.py +54 -0
- latitudesh_python_sdk/models/server_action.py +52 -0
- latitudesh_python_sdk/models/server_data.py +219 -0
- latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_lockop.py +16 -0
- latitudesh_python_sdk/models/server_rescue.py +22 -0
- latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
- latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_unlockop.py +16 -0
- latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/servers.py +26 -0
- latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/ssh_key.py +15 -0
- latitudesh_python_sdk/models/ssh_key_data.py +55 -0
- latitudesh_python_sdk/models/storage_plan.py +36 -0
- latitudesh_python_sdk/models/storage_plans.py +15 -0
- latitudesh_python_sdk/models/team.py +74 -0
- latitudesh_python_sdk/models/team_include.py +43 -0
- latitudesh_python_sdk/models/team_members.py +51 -0
- latitudesh_python_sdk/models/teams.py +26 -0
- latitudesh_python_sdk/models/traffic.py +133 -0
- latitudesh_python_sdk/models/traffic_quota.py +106 -0
- latitudesh_python_sdk/models/update_api_key.py +48 -0
- latitudesh_python_sdk/models/update_api_keyop.py +41 -0
- latitudesh_python_sdk/models/update_firewallop.py +89 -0
- latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
- latitudesh_python_sdk/models/update_projectop.py +95 -0
- latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
- latitudesh_python_sdk/models/update_serverop.py +69 -0
- latitudesh_python_sdk/models/update_tagop.py +74 -0
- latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
- latitudesh_python_sdk/models/user.py +59 -0
- latitudesh_python_sdk/models/user_data.py +15 -0
- latitudesh_python_sdk/models/user_data_properties.py +46 -0
- latitudesh_python_sdk/models/user_include.py +52 -0
- latitudesh_python_sdk/models/user_team.py +61 -0
- latitudesh_python_sdk/models/user_teams.py +26 -0
- latitudesh_python_sdk/models/user_update.py +37 -0
- latitudesh_python_sdk/models/virtual_machine.py +25 -0
- latitudesh_python_sdk/models/virtual_machine_payload.py +41 -0
- latitudesh_python_sdk/models/virtual_machine_plans.py +180 -0
- latitudesh_python_sdk/models/virtual_network.py +103 -0
- latitudesh_python_sdk/models/virtual_network1.py +84 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +37 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
- latitudesh_python_sdk/models/virtual_networks.py +26 -0
- latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
- latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
- latitudesh_python_sdk/operatingsystems_sdk.py +188 -0
- latitudesh_python_sdk/plans.py +1178 -0
- latitudesh_python_sdk/privatenetworks.py +1672 -0
- latitudesh_python_sdk/projects_sdk.py +864 -0
- latitudesh_python_sdk/py.typed +1 -0
- latitudesh_python_sdk/regions_sdk.py +376 -0
- latitudesh_python_sdk/roles.py +374 -0
- latitudesh_python_sdk/sdk.py +214 -0
- latitudesh_python_sdk/sdkconfiguration.py +57 -0
- latitudesh_python_sdk/servers_sdk.py +3810 -0
- latitudesh_python_sdk/sshkeys.py +1050 -0
- latitudesh_python_sdk/storage.py +820 -0
- latitudesh_python_sdk/tags.py +786 -0
- latitudesh_python_sdk/teams_sdk.py +596 -0
- latitudesh_python_sdk/teamsmembers.py +578 -0
- latitudesh_python_sdk/traffic_sdk.py +400 -0
- latitudesh_python_sdk/types/__init__.py +21 -0
- latitudesh_python_sdk/types/basemodel.py +39 -0
- latitudesh_python_sdk/userdata_sdk.py +1052 -0
- latitudesh_python_sdk/userprofile.py +596 -0
- latitudesh_python_sdk/utils/__init__.py +101 -0
- latitudesh_python_sdk/utils/annotations.py +55 -0
- latitudesh_python_sdk/utils/enums.py +34 -0
- latitudesh_python_sdk/utils/eventstreaming.py +238 -0
- latitudesh_python_sdk/utils/forms.py +202 -0
- latitudesh_python_sdk/utils/headers.py +136 -0
- latitudesh_python_sdk/utils/logger.py +27 -0
- latitudesh_python_sdk/utils/metadata.py +118 -0
- latitudesh_python_sdk/utils/queryparams.py +205 -0
- latitudesh_python_sdk/utils/requestbodies.py +66 -0
- latitudesh_python_sdk/utils/retries.py +217 -0
- latitudesh_python_sdk/utils/security.py +192 -0
- latitudesh_python_sdk/utils/serializers.py +219 -0
- latitudesh_python_sdk/utils/url.py +155 -0
- latitudesh_python_sdk/utils/values.py +137 -0
- latitudesh_python_sdk/virtualmachines.py +772 -0
- latitudesh_python_sdk/vpnsessions.py +818 -0
- latitudesh_python_sdk-0.0.6.dist-info/LICENSE +21 -0
- latitudesh_python_sdk-0.0.6.dist-info/METADATA +730 -0
- latitudesh_python_sdk-0.0.6.dist-info/RECORD +206 -0
- latitudesh_python_sdk-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1178 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from latitudesh_python_sdk import models, utils
|
|
5
|
+
from latitudesh_python_sdk._hooks import HookContext
|
|
6
|
+
from latitudesh_python_sdk.types import BaseModel, OptionalNullable, UNSET
|
|
7
|
+
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
+
from typing import Any, Mapping, Optional, Union, cast
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Plans(BaseSDK):
|
|
12
|
+
def list(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
filter_name: Optional[str] = None,
|
|
16
|
+
filter_slug: Optional[str] = None,
|
|
17
|
+
filter_location: Optional[str] = None,
|
|
18
|
+
filter_stock_level: Optional[models.FilterStockLevel] = None,
|
|
19
|
+
filter_in_stock: Optional[bool] = None,
|
|
20
|
+
filter_gpu: Optional[bool] = None,
|
|
21
|
+
filter_ram: Optional[int] = None,
|
|
22
|
+
filter_disk: Optional[int] = None,
|
|
23
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
24
|
+
server_url: Optional[str] = None,
|
|
25
|
+
timeout_ms: Optional[int] = None,
|
|
26
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
27
|
+
) -> models.GetPlansResponseBody:
|
|
28
|
+
r"""List all Plans
|
|
29
|
+
|
|
30
|
+
Lists all plans. Availability by region is included in `attributes.regions.locations.available[*]` node for a given plan.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
:param filter_name: The plan name to filter by
|
|
34
|
+
:param filter_slug: The plan slug to filter by
|
|
35
|
+
:param filter_location: The location of the site to filter by
|
|
36
|
+
:param filter_stock_level: The stock level at the site to filter by
|
|
37
|
+
:param filter_in_stock: The stock available at the site to filter by
|
|
38
|
+
:param filter_gpu: Filter by the existence of an associated GPU
|
|
39
|
+
:param filter_ram: The ram size in Gigabytes to filter by, should be used with the following options: [eql] to filter for values equal to the provided value. [gte] to filter for values greater or equal to the provided value. [lte] to filter by values lower or equal to the provided value.
|
|
40
|
+
:param filter_disk: The disk size in Gigabytes to filter by, should be used with the following options: [eql] to filter for values equal to the provided value. [gte] to filter for values greater or equal to the provided value. [lte] to filter by values lower or equal to the provided value.
|
|
41
|
+
:param retries: Override the default retry configuration for this method
|
|
42
|
+
:param server_url: Override the default server URL for this method
|
|
43
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
44
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
45
|
+
"""
|
|
46
|
+
base_url = None
|
|
47
|
+
url_variables = None
|
|
48
|
+
if timeout_ms is None:
|
|
49
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
+
|
|
51
|
+
if server_url is not None:
|
|
52
|
+
base_url = server_url
|
|
53
|
+
else:
|
|
54
|
+
base_url = self._get_url(base_url, url_variables)
|
|
55
|
+
|
|
56
|
+
request = models.GetPlansRequest(
|
|
57
|
+
filter_name=filter_name,
|
|
58
|
+
filter_slug=filter_slug,
|
|
59
|
+
filter_location=filter_location,
|
|
60
|
+
filter_stock_level=filter_stock_level,
|
|
61
|
+
filter_in_stock=filter_in_stock,
|
|
62
|
+
filter_gpu=filter_gpu,
|
|
63
|
+
filter_ram=filter_ram,
|
|
64
|
+
filter_disk=filter_disk,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
req = self._build_request(
|
|
68
|
+
method="GET",
|
|
69
|
+
path="/plans",
|
|
70
|
+
base_url=base_url,
|
|
71
|
+
url_variables=url_variables,
|
|
72
|
+
request=request,
|
|
73
|
+
request_body_required=False,
|
|
74
|
+
request_has_path_params=False,
|
|
75
|
+
request_has_query_params=True,
|
|
76
|
+
user_agent_header="user-agent",
|
|
77
|
+
accept_header_value="application/vnd.api+json",
|
|
78
|
+
http_headers=http_headers,
|
|
79
|
+
security=self.sdk_configuration.security,
|
|
80
|
+
timeout_ms=timeout_ms,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if retries == UNSET:
|
|
84
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
85
|
+
retries = self.sdk_configuration.retry_config
|
|
86
|
+
|
|
87
|
+
retry_config = None
|
|
88
|
+
if isinstance(retries, utils.RetryConfig):
|
|
89
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
90
|
+
|
|
91
|
+
http_res = self.do_request(
|
|
92
|
+
hook_ctx=HookContext(
|
|
93
|
+
base_url=base_url or "",
|
|
94
|
+
operation_id="get-plans",
|
|
95
|
+
oauth2_scopes=[],
|
|
96
|
+
security_source=get_security_from_env(
|
|
97
|
+
self.sdk_configuration.security, models.Security
|
|
98
|
+
),
|
|
99
|
+
),
|
|
100
|
+
request=req,
|
|
101
|
+
error_status_codes=["4XX", "5XX"],
|
|
102
|
+
retry_config=retry_config,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
106
|
+
return utils.unmarshal_json(http_res.text, models.GetPlansResponseBody)
|
|
107
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
108
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
109
|
+
raise models.APIError(
|
|
110
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
111
|
+
)
|
|
112
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
113
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
114
|
+
raise models.APIError(
|
|
115
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
content_type = http_res.headers.get("Content-Type")
|
|
119
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
120
|
+
raise models.APIError(
|
|
121
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
122
|
+
http_res.status_code,
|
|
123
|
+
http_res_text,
|
|
124
|
+
http_res,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
async def list_async(
|
|
128
|
+
self,
|
|
129
|
+
*,
|
|
130
|
+
filter_name: Optional[str] = None,
|
|
131
|
+
filter_slug: Optional[str] = None,
|
|
132
|
+
filter_location: Optional[str] = None,
|
|
133
|
+
filter_stock_level: Optional[models.FilterStockLevel] = None,
|
|
134
|
+
filter_in_stock: Optional[bool] = None,
|
|
135
|
+
filter_gpu: Optional[bool] = None,
|
|
136
|
+
filter_ram: Optional[int] = None,
|
|
137
|
+
filter_disk: Optional[int] = None,
|
|
138
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
139
|
+
server_url: Optional[str] = None,
|
|
140
|
+
timeout_ms: Optional[int] = None,
|
|
141
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
142
|
+
) -> models.GetPlansResponseBody:
|
|
143
|
+
r"""List all Plans
|
|
144
|
+
|
|
145
|
+
Lists all plans. Availability by region is included in `attributes.regions.locations.available[*]` node for a given plan.
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
:param filter_name: The plan name to filter by
|
|
149
|
+
:param filter_slug: The plan slug to filter by
|
|
150
|
+
:param filter_location: The location of the site to filter by
|
|
151
|
+
:param filter_stock_level: The stock level at the site to filter by
|
|
152
|
+
:param filter_in_stock: The stock available at the site to filter by
|
|
153
|
+
:param filter_gpu: Filter by the existence of an associated GPU
|
|
154
|
+
:param filter_ram: The ram size in Gigabytes to filter by, should be used with the following options: [eql] to filter for values equal to the provided value. [gte] to filter for values greater or equal to the provided value. [lte] to filter by values lower or equal to the provided value.
|
|
155
|
+
:param filter_disk: The disk size in Gigabytes to filter by, should be used with the following options: [eql] to filter for values equal to the provided value. [gte] to filter for values greater or equal to the provided value. [lte] to filter by values lower or equal to the provided value.
|
|
156
|
+
:param retries: Override the default retry configuration for this method
|
|
157
|
+
:param server_url: Override the default server URL for this method
|
|
158
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
159
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
160
|
+
"""
|
|
161
|
+
base_url = None
|
|
162
|
+
url_variables = None
|
|
163
|
+
if timeout_ms is None:
|
|
164
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
165
|
+
|
|
166
|
+
if server_url is not None:
|
|
167
|
+
base_url = server_url
|
|
168
|
+
else:
|
|
169
|
+
base_url = self._get_url(base_url, url_variables)
|
|
170
|
+
|
|
171
|
+
request = models.GetPlansRequest(
|
|
172
|
+
filter_name=filter_name,
|
|
173
|
+
filter_slug=filter_slug,
|
|
174
|
+
filter_location=filter_location,
|
|
175
|
+
filter_stock_level=filter_stock_level,
|
|
176
|
+
filter_in_stock=filter_in_stock,
|
|
177
|
+
filter_gpu=filter_gpu,
|
|
178
|
+
filter_ram=filter_ram,
|
|
179
|
+
filter_disk=filter_disk,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
req = self._build_request_async(
|
|
183
|
+
method="GET",
|
|
184
|
+
path="/plans",
|
|
185
|
+
base_url=base_url,
|
|
186
|
+
url_variables=url_variables,
|
|
187
|
+
request=request,
|
|
188
|
+
request_body_required=False,
|
|
189
|
+
request_has_path_params=False,
|
|
190
|
+
request_has_query_params=True,
|
|
191
|
+
user_agent_header="user-agent",
|
|
192
|
+
accept_header_value="application/vnd.api+json",
|
|
193
|
+
http_headers=http_headers,
|
|
194
|
+
security=self.sdk_configuration.security,
|
|
195
|
+
timeout_ms=timeout_ms,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
if retries == UNSET:
|
|
199
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
200
|
+
retries = self.sdk_configuration.retry_config
|
|
201
|
+
|
|
202
|
+
retry_config = None
|
|
203
|
+
if isinstance(retries, utils.RetryConfig):
|
|
204
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
205
|
+
|
|
206
|
+
http_res = await self.do_request_async(
|
|
207
|
+
hook_ctx=HookContext(
|
|
208
|
+
base_url=base_url or "",
|
|
209
|
+
operation_id="get-plans",
|
|
210
|
+
oauth2_scopes=[],
|
|
211
|
+
security_source=get_security_from_env(
|
|
212
|
+
self.sdk_configuration.security, models.Security
|
|
213
|
+
),
|
|
214
|
+
),
|
|
215
|
+
request=req,
|
|
216
|
+
error_status_codes=["4XX", "5XX"],
|
|
217
|
+
retry_config=retry_config,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
221
|
+
return utils.unmarshal_json(http_res.text, models.GetPlansResponseBody)
|
|
222
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
223
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
224
|
+
raise models.APIError(
|
|
225
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
226
|
+
)
|
|
227
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
228
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
229
|
+
raise models.APIError(
|
|
230
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
content_type = http_res.headers.get("Content-Type")
|
|
234
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
235
|
+
raise models.APIError(
|
|
236
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
237
|
+
http_res.status_code,
|
|
238
|
+
http_res_text,
|
|
239
|
+
http_res,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
def get(
|
|
243
|
+
self,
|
|
244
|
+
*,
|
|
245
|
+
plan_id: str,
|
|
246
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
247
|
+
server_url: Optional[str] = None,
|
|
248
|
+
timeout_ms: Optional[int] = None,
|
|
249
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
250
|
+
) -> models.Plan:
|
|
251
|
+
r"""Retrieve a Plan
|
|
252
|
+
|
|
253
|
+
:param plan_id:
|
|
254
|
+
:param retries: Override the default retry configuration for this method
|
|
255
|
+
:param server_url: Override the default server URL for this method
|
|
256
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
257
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
258
|
+
"""
|
|
259
|
+
base_url = None
|
|
260
|
+
url_variables = None
|
|
261
|
+
if timeout_ms is None:
|
|
262
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
263
|
+
|
|
264
|
+
if server_url is not None:
|
|
265
|
+
base_url = server_url
|
|
266
|
+
else:
|
|
267
|
+
base_url = self._get_url(base_url, url_variables)
|
|
268
|
+
|
|
269
|
+
request = models.GetPlanRequest(
|
|
270
|
+
plan_id=plan_id,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
req = self._build_request(
|
|
274
|
+
method="GET",
|
|
275
|
+
path="/plans/{plan_id}",
|
|
276
|
+
base_url=base_url,
|
|
277
|
+
url_variables=url_variables,
|
|
278
|
+
request=request,
|
|
279
|
+
request_body_required=False,
|
|
280
|
+
request_has_path_params=True,
|
|
281
|
+
request_has_query_params=True,
|
|
282
|
+
user_agent_header="user-agent",
|
|
283
|
+
accept_header_value="application/vnd.api+json",
|
|
284
|
+
http_headers=http_headers,
|
|
285
|
+
security=self.sdk_configuration.security,
|
|
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 = self.do_request(
|
|
298
|
+
hook_ctx=HookContext(
|
|
299
|
+
base_url=base_url or "",
|
|
300
|
+
operation_id="get-plan",
|
|
301
|
+
oauth2_scopes=[],
|
|
302
|
+
security_source=get_security_from_env(
|
|
303
|
+
self.sdk_configuration.security, models.Security
|
|
304
|
+
),
|
|
305
|
+
),
|
|
306
|
+
request=req,
|
|
307
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
308
|
+
retry_config=retry_config,
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
response_data: Any = None
|
|
312
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
313
|
+
return utils.unmarshal_json(http_res.text, models.Plan)
|
|
314
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
315
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
316
|
+
raise models.ErrorObject(data=response_data)
|
|
317
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
318
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
319
|
+
raise models.APIError(
|
|
320
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
321
|
+
)
|
|
322
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
323
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
324
|
+
raise models.APIError(
|
|
325
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
content_type = http_res.headers.get("Content-Type")
|
|
329
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
330
|
+
raise models.APIError(
|
|
331
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
332
|
+
http_res.status_code,
|
|
333
|
+
http_res_text,
|
|
334
|
+
http_res,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
async def get_async(
|
|
338
|
+
self,
|
|
339
|
+
*,
|
|
340
|
+
plan_id: str,
|
|
341
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
342
|
+
server_url: Optional[str] = None,
|
|
343
|
+
timeout_ms: Optional[int] = None,
|
|
344
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
345
|
+
) -> models.Plan:
|
|
346
|
+
r"""Retrieve a Plan
|
|
347
|
+
|
|
348
|
+
:param plan_id:
|
|
349
|
+
:param retries: Override the default retry configuration for this method
|
|
350
|
+
:param server_url: Override the default server URL for this method
|
|
351
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
352
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
353
|
+
"""
|
|
354
|
+
base_url = None
|
|
355
|
+
url_variables = None
|
|
356
|
+
if timeout_ms is None:
|
|
357
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
358
|
+
|
|
359
|
+
if server_url is not None:
|
|
360
|
+
base_url = server_url
|
|
361
|
+
else:
|
|
362
|
+
base_url = self._get_url(base_url, url_variables)
|
|
363
|
+
|
|
364
|
+
request = models.GetPlanRequest(
|
|
365
|
+
plan_id=plan_id,
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
req = self._build_request_async(
|
|
369
|
+
method="GET",
|
|
370
|
+
path="/plans/{plan_id}",
|
|
371
|
+
base_url=base_url,
|
|
372
|
+
url_variables=url_variables,
|
|
373
|
+
request=request,
|
|
374
|
+
request_body_required=False,
|
|
375
|
+
request_has_path_params=True,
|
|
376
|
+
request_has_query_params=True,
|
|
377
|
+
user_agent_header="user-agent",
|
|
378
|
+
accept_header_value="application/vnd.api+json",
|
|
379
|
+
http_headers=http_headers,
|
|
380
|
+
security=self.sdk_configuration.security,
|
|
381
|
+
timeout_ms=timeout_ms,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
if retries == UNSET:
|
|
385
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
386
|
+
retries = self.sdk_configuration.retry_config
|
|
387
|
+
|
|
388
|
+
retry_config = None
|
|
389
|
+
if isinstance(retries, utils.RetryConfig):
|
|
390
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
391
|
+
|
|
392
|
+
http_res = await self.do_request_async(
|
|
393
|
+
hook_ctx=HookContext(
|
|
394
|
+
base_url=base_url or "",
|
|
395
|
+
operation_id="get-plan",
|
|
396
|
+
oauth2_scopes=[],
|
|
397
|
+
security_source=get_security_from_env(
|
|
398
|
+
self.sdk_configuration.security, models.Security
|
|
399
|
+
),
|
|
400
|
+
),
|
|
401
|
+
request=req,
|
|
402
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
403
|
+
retry_config=retry_config,
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
response_data: Any = None
|
|
407
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
408
|
+
return utils.unmarshal_json(http_res.text, models.Plan)
|
|
409
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
410
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
411
|
+
raise models.ErrorObject(data=response_data)
|
|
412
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
413
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
414
|
+
raise models.APIError(
|
|
415
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
416
|
+
)
|
|
417
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
418
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
419
|
+
raise models.APIError(
|
|
420
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
content_type = http_res.headers.get("Content-Type")
|
|
424
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
425
|
+
raise models.APIError(
|
|
426
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
427
|
+
http_res.status_code,
|
|
428
|
+
http_res_text,
|
|
429
|
+
http_res,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
def list_bandwidth(
|
|
433
|
+
self,
|
|
434
|
+
*,
|
|
435
|
+
api_version: Optional[str] = "2023-06-01",
|
|
436
|
+
filter_id: Optional[str] = None,
|
|
437
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
438
|
+
server_url: Optional[str] = None,
|
|
439
|
+
timeout_ms: Optional[int] = None,
|
|
440
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
441
|
+
) -> models.BandwidthPlans:
|
|
442
|
+
r"""List all bandwidth plans
|
|
443
|
+
|
|
444
|
+
Lists all bandwidth plans.
|
|
445
|
+
|
|
446
|
+
:param api_version:
|
|
447
|
+
:param filter_id: The plan ID to filter by
|
|
448
|
+
:param retries: Override the default retry configuration for this method
|
|
449
|
+
:param server_url: Override the default server URL for this method
|
|
450
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
451
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
452
|
+
"""
|
|
453
|
+
base_url = None
|
|
454
|
+
url_variables = None
|
|
455
|
+
if timeout_ms is None:
|
|
456
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
457
|
+
|
|
458
|
+
if server_url is not None:
|
|
459
|
+
base_url = server_url
|
|
460
|
+
else:
|
|
461
|
+
base_url = self._get_url(base_url, url_variables)
|
|
462
|
+
|
|
463
|
+
request = models.GetBandwidthPlansRequest(
|
|
464
|
+
api_version=api_version,
|
|
465
|
+
filter_id=filter_id,
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
req = self._build_request(
|
|
469
|
+
method="GET",
|
|
470
|
+
path="/plans/bandwidth",
|
|
471
|
+
base_url=base_url,
|
|
472
|
+
url_variables=url_variables,
|
|
473
|
+
request=request,
|
|
474
|
+
request_body_required=False,
|
|
475
|
+
request_has_path_params=False,
|
|
476
|
+
request_has_query_params=True,
|
|
477
|
+
user_agent_header="user-agent",
|
|
478
|
+
accept_header_value="application/vnd.api+json",
|
|
479
|
+
http_headers=http_headers,
|
|
480
|
+
security=self.sdk_configuration.security,
|
|
481
|
+
timeout_ms=timeout_ms,
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
if retries == UNSET:
|
|
485
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
486
|
+
retries = self.sdk_configuration.retry_config
|
|
487
|
+
|
|
488
|
+
retry_config = None
|
|
489
|
+
if isinstance(retries, utils.RetryConfig):
|
|
490
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
491
|
+
|
|
492
|
+
http_res = self.do_request(
|
|
493
|
+
hook_ctx=HookContext(
|
|
494
|
+
base_url=base_url or "",
|
|
495
|
+
operation_id="get-bandwidth-plans",
|
|
496
|
+
oauth2_scopes=[],
|
|
497
|
+
security_source=get_security_from_env(
|
|
498
|
+
self.sdk_configuration.security, models.Security
|
|
499
|
+
),
|
|
500
|
+
),
|
|
501
|
+
request=req,
|
|
502
|
+
error_status_codes=["4XX", "5XX"],
|
|
503
|
+
retry_config=retry_config,
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
507
|
+
return utils.unmarshal_json(http_res.text, models.BandwidthPlans)
|
|
508
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
509
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
510
|
+
raise models.APIError(
|
|
511
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
512
|
+
)
|
|
513
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
514
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
515
|
+
raise models.APIError(
|
|
516
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
content_type = http_res.headers.get("Content-Type")
|
|
520
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
521
|
+
raise models.APIError(
|
|
522
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
523
|
+
http_res.status_code,
|
|
524
|
+
http_res_text,
|
|
525
|
+
http_res,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
async def list_bandwidth_async(
|
|
529
|
+
self,
|
|
530
|
+
*,
|
|
531
|
+
api_version: Optional[str] = "2023-06-01",
|
|
532
|
+
filter_id: Optional[str] = None,
|
|
533
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
534
|
+
server_url: Optional[str] = None,
|
|
535
|
+
timeout_ms: Optional[int] = None,
|
|
536
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
537
|
+
) -> models.BandwidthPlans:
|
|
538
|
+
r"""List all bandwidth plans
|
|
539
|
+
|
|
540
|
+
Lists all bandwidth plans.
|
|
541
|
+
|
|
542
|
+
:param api_version:
|
|
543
|
+
:param filter_id: The plan ID to filter by
|
|
544
|
+
:param retries: Override the default retry configuration for this method
|
|
545
|
+
:param server_url: Override the default server URL for this method
|
|
546
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
547
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
548
|
+
"""
|
|
549
|
+
base_url = None
|
|
550
|
+
url_variables = None
|
|
551
|
+
if timeout_ms is None:
|
|
552
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
553
|
+
|
|
554
|
+
if server_url is not None:
|
|
555
|
+
base_url = server_url
|
|
556
|
+
else:
|
|
557
|
+
base_url = self._get_url(base_url, url_variables)
|
|
558
|
+
|
|
559
|
+
request = models.GetBandwidthPlansRequest(
|
|
560
|
+
api_version=api_version,
|
|
561
|
+
filter_id=filter_id,
|
|
562
|
+
)
|
|
563
|
+
|
|
564
|
+
req = self._build_request_async(
|
|
565
|
+
method="GET",
|
|
566
|
+
path="/plans/bandwidth",
|
|
567
|
+
base_url=base_url,
|
|
568
|
+
url_variables=url_variables,
|
|
569
|
+
request=request,
|
|
570
|
+
request_body_required=False,
|
|
571
|
+
request_has_path_params=False,
|
|
572
|
+
request_has_query_params=True,
|
|
573
|
+
user_agent_header="user-agent",
|
|
574
|
+
accept_header_value="application/vnd.api+json",
|
|
575
|
+
http_headers=http_headers,
|
|
576
|
+
security=self.sdk_configuration.security,
|
|
577
|
+
timeout_ms=timeout_ms,
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
if retries == UNSET:
|
|
581
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
582
|
+
retries = self.sdk_configuration.retry_config
|
|
583
|
+
|
|
584
|
+
retry_config = None
|
|
585
|
+
if isinstance(retries, utils.RetryConfig):
|
|
586
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
587
|
+
|
|
588
|
+
http_res = await self.do_request_async(
|
|
589
|
+
hook_ctx=HookContext(
|
|
590
|
+
base_url=base_url or "",
|
|
591
|
+
operation_id="get-bandwidth-plans",
|
|
592
|
+
oauth2_scopes=[],
|
|
593
|
+
security_source=get_security_from_env(
|
|
594
|
+
self.sdk_configuration.security, models.Security
|
|
595
|
+
),
|
|
596
|
+
),
|
|
597
|
+
request=req,
|
|
598
|
+
error_status_codes=["4XX", "5XX"],
|
|
599
|
+
retry_config=retry_config,
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
603
|
+
return utils.unmarshal_json(http_res.text, models.BandwidthPlans)
|
|
604
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
605
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
606
|
+
raise models.APIError(
|
|
607
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
608
|
+
)
|
|
609
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
610
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
611
|
+
raise models.APIError(
|
|
612
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
content_type = http_res.headers.get("Content-Type")
|
|
616
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
617
|
+
raise models.APIError(
|
|
618
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
619
|
+
http_res.status_code,
|
|
620
|
+
http_res_text,
|
|
621
|
+
http_res,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
def update_bandwidth(
|
|
625
|
+
self,
|
|
626
|
+
*,
|
|
627
|
+
request: Union[
|
|
628
|
+
models.UpdatePlansBandwidthPlansRequestBody,
|
|
629
|
+
models.UpdatePlansBandwidthPlansRequestBodyTypedDict,
|
|
630
|
+
] = models.UpdatePlansBandwidthPlansRequestBody(),
|
|
631
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
632
|
+
server_url: Optional[str] = None,
|
|
633
|
+
timeout_ms: Optional[int] = None,
|
|
634
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
635
|
+
) -> models.BandwidthPackages:
|
|
636
|
+
r"""Buy or remove bandwidth packages
|
|
637
|
+
|
|
638
|
+
Allow to increase or decrease bandwidth packages. Only admins and owners can request.
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
:param request: The request object to send.
|
|
642
|
+
:param retries: Override the default retry configuration for this method
|
|
643
|
+
:param server_url: Override the default server URL for this method
|
|
644
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
645
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
646
|
+
"""
|
|
647
|
+
base_url = None
|
|
648
|
+
url_variables = None
|
|
649
|
+
if timeout_ms is None:
|
|
650
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
651
|
+
|
|
652
|
+
if server_url is not None:
|
|
653
|
+
base_url = server_url
|
|
654
|
+
else:
|
|
655
|
+
base_url = self._get_url(base_url, url_variables)
|
|
656
|
+
|
|
657
|
+
if not isinstance(request, BaseModel):
|
|
658
|
+
request = utils.unmarshal(
|
|
659
|
+
request, models.UpdatePlansBandwidthPlansRequestBody
|
|
660
|
+
)
|
|
661
|
+
request = cast(models.UpdatePlansBandwidthPlansRequestBody, request)
|
|
662
|
+
|
|
663
|
+
req = self._build_request(
|
|
664
|
+
method="POST",
|
|
665
|
+
path="/plans/bandwidth",
|
|
666
|
+
base_url=base_url,
|
|
667
|
+
url_variables=url_variables,
|
|
668
|
+
request=request,
|
|
669
|
+
request_body_required=True,
|
|
670
|
+
request_has_path_params=False,
|
|
671
|
+
request_has_query_params=True,
|
|
672
|
+
user_agent_header="user-agent",
|
|
673
|
+
accept_header_value="application/vnd.api+json",
|
|
674
|
+
http_headers=http_headers,
|
|
675
|
+
security=self.sdk_configuration.security,
|
|
676
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
677
|
+
request,
|
|
678
|
+
False,
|
|
679
|
+
True,
|
|
680
|
+
"json",
|
|
681
|
+
Optional[models.UpdatePlansBandwidthPlansRequestBody],
|
|
682
|
+
),
|
|
683
|
+
timeout_ms=timeout_ms,
|
|
684
|
+
)
|
|
685
|
+
|
|
686
|
+
if retries == UNSET:
|
|
687
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
688
|
+
retries = self.sdk_configuration.retry_config
|
|
689
|
+
|
|
690
|
+
retry_config = None
|
|
691
|
+
if isinstance(retries, utils.RetryConfig):
|
|
692
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
693
|
+
|
|
694
|
+
http_res = self.do_request(
|
|
695
|
+
hook_ctx=HookContext(
|
|
696
|
+
base_url=base_url or "",
|
|
697
|
+
operation_id="update-plans-bandwidth",
|
|
698
|
+
oauth2_scopes=[],
|
|
699
|
+
security_source=get_security_from_env(
|
|
700
|
+
self.sdk_configuration.security, models.Security
|
|
701
|
+
),
|
|
702
|
+
),
|
|
703
|
+
request=req,
|
|
704
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
705
|
+
retry_config=retry_config,
|
|
706
|
+
)
|
|
707
|
+
|
|
708
|
+
response_data: Any = None
|
|
709
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
710
|
+
return utils.unmarshal_json(http_res.text, models.BandwidthPackages)
|
|
711
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
712
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
713
|
+
raise models.ErrorObject(data=response_data)
|
|
714
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
715
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
716
|
+
raise models.APIError(
|
|
717
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
718
|
+
)
|
|
719
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
720
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
721
|
+
raise models.APIError(
|
|
722
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
content_type = http_res.headers.get("Content-Type")
|
|
726
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
727
|
+
raise models.APIError(
|
|
728
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
729
|
+
http_res.status_code,
|
|
730
|
+
http_res_text,
|
|
731
|
+
http_res,
|
|
732
|
+
)
|
|
733
|
+
|
|
734
|
+
async def update_bandwidth_async(
|
|
735
|
+
self,
|
|
736
|
+
*,
|
|
737
|
+
request: Union[
|
|
738
|
+
models.UpdatePlansBandwidthPlansRequestBody,
|
|
739
|
+
models.UpdatePlansBandwidthPlansRequestBodyTypedDict,
|
|
740
|
+
] = models.UpdatePlansBandwidthPlansRequestBody(),
|
|
741
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
742
|
+
server_url: Optional[str] = None,
|
|
743
|
+
timeout_ms: Optional[int] = None,
|
|
744
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
745
|
+
) -> models.BandwidthPackages:
|
|
746
|
+
r"""Buy or remove bandwidth packages
|
|
747
|
+
|
|
748
|
+
Allow to increase or decrease bandwidth packages. Only admins and owners can request.
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
:param request: The request object to send.
|
|
752
|
+
:param retries: Override the default retry configuration for this method
|
|
753
|
+
:param server_url: Override the default server URL for this method
|
|
754
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
755
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
756
|
+
"""
|
|
757
|
+
base_url = None
|
|
758
|
+
url_variables = None
|
|
759
|
+
if timeout_ms is None:
|
|
760
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
761
|
+
|
|
762
|
+
if server_url is not None:
|
|
763
|
+
base_url = server_url
|
|
764
|
+
else:
|
|
765
|
+
base_url = self._get_url(base_url, url_variables)
|
|
766
|
+
|
|
767
|
+
if not isinstance(request, BaseModel):
|
|
768
|
+
request = utils.unmarshal(
|
|
769
|
+
request, models.UpdatePlansBandwidthPlansRequestBody
|
|
770
|
+
)
|
|
771
|
+
request = cast(models.UpdatePlansBandwidthPlansRequestBody, request)
|
|
772
|
+
|
|
773
|
+
req = self._build_request_async(
|
|
774
|
+
method="POST",
|
|
775
|
+
path="/plans/bandwidth",
|
|
776
|
+
base_url=base_url,
|
|
777
|
+
url_variables=url_variables,
|
|
778
|
+
request=request,
|
|
779
|
+
request_body_required=True,
|
|
780
|
+
request_has_path_params=False,
|
|
781
|
+
request_has_query_params=True,
|
|
782
|
+
user_agent_header="user-agent",
|
|
783
|
+
accept_header_value="application/vnd.api+json",
|
|
784
|
+
http_headers=http_headers,
|
|
785
|
+
security=self.sdk_configuration.security,
|
|
786
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
787
|
+
request,
|
|
788
|
+
False,
|
|
789
|
+
True,
|
|
790
|
+
"json",
|
|
791
|
+
Optional[models.UpdatePlansBandwidthPlansRequestBody],
|
|
792
|
+
),
|
|
793
|
+
timeout_ms=timeout_ms,
|
|
794
|
+
)
|
|
795
|
+
|
|
796
|
+
if retries == UNSET:
|
|
797
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
798
|
+
retries = self.sdk_configuration.retry_config
|
|
799
|
+
|
|
800
|
+
retry_config = None
|
|
801
|
+
if isinstance(retries, utils.RetryConfig):
|
|
802
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
803
|
+
|
|
804
|
+
http_res = await self.do_request_async(
|
|
805
|
+
hook_ctx=HookContext(
|
|
806
|
+
base_url=base_url or "",
|
|
807
|
+
operation_id="update-plans-bandwidth",
|
|
808
|
+
oauth2_scopes=[],
|
|
809
|
+
security_source=get_security_from_env(
|
|
810
|
+
self.sdk_configuration.security, models.Security
|
|
811
|
+
),
|
|
812
|
+
),
|
|
813
|
+
request=req,
|
|
814
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
815
|
+
retry_config=retry_config,
|
|
816
|
+
)
|
|
817
|
+
|
|
818
|
+
response_data: Any = None
|
|
819
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
820
|
+
return utils.unmarshal_json(http_res.text, models.BandwidthPackages)
|
|
821
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
822
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
823
|
+
raise models.ErrorObject(data=response_data)
|
|
824
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
825
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
826
|
+
raise models.APIError(
|
|
827
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
828
|
+
)
|
|
829
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
830
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
831
|
+
raise models.APIError(
|
|
832
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
content_type = http_res.headers.get("Content-Type")
|
|
836
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
837
|
+
raise models.APIError(
|
|
838
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
839
|
+
http_res.status_code,
|
|
840
|
+
http_res_text,
|
|
841
|
+
http_res,
|
|
842
|
+
)
|
|
843
|
+
|
|
844
|
+
def list_storage(
|
|
845
|
+
self,
|
|
846
|
+
*,
|
|
847
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
848
|
+
server_url: Optional[str] = None,
|
|
849
|
+
timeout_ms: Optional[int] = None,
|
|
850
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
851
|
+
) -> models.StoragePlans:
|
|
852
|
+
r"""List all Storage Plans
|
|
853
|
+
|
|
854
|
+
:param retries: Override the default retry configuration for this method
|
|
855
|
+
:param server_url: Override the default server URL for this method
|
|
856
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
857
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
858
|
+
"""
|
|
859
|
+
base_url = None
|
|
860
|
+
url_variables = None
|
|
861
|
+
if timeout_ms is None:
|
|
862
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
863
|
+
|
|
864
|
+
if server_url is not None:
|
|
865
|
+
base_url = server_url
|
|
866
|
+
else:
|
|
867
|
+
base_url = self._get_url(base_url, url_variables)
|
|
868
|
+
req = self._build_request(
|
|
869
|
+
method="GET",
|
|
870
|
+
path="/plans/storage",
|
|
871
|
+
base_url=base_url,
|
|
872
|
+
url_variables=url_variables,
|
|
873
|
+
request=None,
|
|
874
|
+
request_body_required=False,
|
|
875
|
+
request_has_path_params=False,
|
|
876
|
+
request_has_query_params=True,
|
|
877
|
+
user_agent_header="user-agent",
|
|
878
|
+
accept_header_value="application/vnd.api+json",
|
|
879
|
+
http_headers=http_headers,
|
|
880
|
+
security=self.sdk_configuration.security,
|
|
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 = self.do_request(
|
|
893
|
+
hook_ctx=HookContext(
|
|
894
|
+
base_url=base_url or "",
|
|
895
|
+
operation_id="get-storage-plans",
|
|
896
|
+
oauth2_scopes=[],
|
|
897
|
+
security_source=get_security_from_env(
|
|
898
|
+
self.sdk_configuration.security, models.Security
|
|
899
|
+
),
|
|
900
|
+
),
|
|
901
|
+
request=req,
|
|
902
|
+
error_status_codes=["4XX", "5XX"],
|
|
903
|
+
retry_config=retry_config,
|
|
904
|
+
)
|
|
905
|
+
|
|
906
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
907
|
+
return utils.unmarshal_json(http_res.text, models.StoragePlans)
|
|
908
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
909
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
910
|
+
raise models.APIError(
|
|
911
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
912
|
+
)
|
|
913
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
914
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
915
|
+
raise models.APIError(
|
|
916
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
917
|
+
)
|
|
918
|
+
|
|
919
|
+
content_type = http_res.headers.get("Content-Type")
|
|
920
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
921
|
+
raise models.APIError(
|
|
922
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
923
|
+
http_res.status_code,
|
|
924
|
+
http_res_text,
|
|
925
|
+
http_res,
|
|
926
|
+
)
|
|
927
|
+
|
|
928
|
+
async def list_storage_async(
|
|
929
|
+
self,
|
|
930
|
+
*,
|
|
931
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
932
|
+
server_url: Optional[str] = None,
|
|
933
|
+
timeout_ms: Optional[int] = None,
|
|
934
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
935
|
+
) -> models.StoragePlans:
|
|
936
|
+
r"""List all Storage Plans
|
|
937
|
+
|
|
938
|
+
:param retries: Override the default retry configuration for this method
|
|
939
|
+
:param server_url: Override the default server URL for this method
|
|
940
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
941
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
942
|
+
"""
|
|
943
|
+
base_url = None
|
|
944
|
+
url_variables = None
|
|
945
|
+
if timeout_ms is None:
|
|
946
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
947
|
+
|
|
948
|
+
if server_url is not None:
|
|
949
|
+
base_url = server_url
|
|
950
|
+
else:
|
|
951
|
+
base_url = self._get_url(base_url, url_variables)
|
|
952
|
+
req = self._build_request_async(
|
|
953
|
+
method="GET",
|
|
954
|
+
path="/plans/storage",
|
|
955
|
+
base_url=base_url,
|
|
956
|
+
url_variables=url_variables,
|
|
957
|
+
request=None,
|
|
958
|
+
request_body_required=False,
|
|
959
|
+
request_has_path_params=False,
|
|
960
|
+
request_has_query_params=True,
|
|
961
|
+
user_agent_header="user-agent",
|
|
962
|
+
accept_header_value="application/vnd.api+json",
|
|
963
|
+
http_headers=http_headers,
|
|
964
|
+
security=self.sdk_configuration.security,
|
|
965
|
+
timeout_ms=timeout_ms,
|
|
966
|
+
)
|
|
967
|
+
|
|
968
|
+
if retries == UNSET:
|
|
969
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
970
|
+
retries = self.sdk_configuration.retry_config
|
|
971
|
+
|
|
972
|
+
retry_config = None
|
|
973
|
+
if isinstance(retries, utils.RetryConfig):
|
|
974
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
975
|
+
|
|
976
|
+
http_res = await self.do_request_async(
|
|
977
|
+
hook_ctx=HookContext(
|
|
978
|
+
base_url=base_url or "",
|
|
979
|
+
operation_id="get-storage-plans",
|
|
980
|
+
oauth2_scopes=[],
|
|
981
|
+
security_source=get_security_from_env(
|
|
982
|
+
self.sdk_configuration.security, models.Security
|
|
983
|
+
),
|
|
984
|
+
),
|
|
985
|
+
request=req,
|
|
986
|
+
error_status_codes=["4XX", "5XX"],
|
|
987
|
+
retry_config=retry_config,
|
|
988
|
+
)
|
|
989
|
+
|
|
990
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
991
|
+
return utils.unmarshal_json(http_res.text, models.StoragePlans)
|
|
992
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
993
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
994
|
+
raise models.APIError(
|
|
995
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
996
|
+
)
|
|
997
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
998
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
999
|
+
raise models.APIError(
|
|
1000
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1001
|
+
)
|
|
1002
|
+
|
|
1003
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1004
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1005
|
+
raise models.APIError(
|
|
1006
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1007
|
+
http_res.status_code,
|
|
1008
|
+
http_res_text,
|
|
1009
|
+
http_res,
|
|
1010
|
+
)
|
|
1011
|
+
|
|
1012
|
+
def list_vm_plans(
|
|
1013
|
+
self,
|
|
1014
|
+
*,
|
|
1015
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1016
|
+
server_url: Optional[str] = None,
|
|
1017
|
+
timeout_ms: Optional[int] = None,
|
|
1018
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1019
|
+
) -> models.VirtualMachinePlans:
|
|
1020
|
+
r"""List all Virtual Machines Plans
|
|
1021
|
+
|
|
1022
|
+
:param retries: Override the default retry configuration for this method
|
|
1023
|
+
:param server_url: Override the default server URL for this method
|
|
1024
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1025
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1026
|
+
"""
|
|
1027
|
+
base_url = None
|
|
1028
|
+
url_variables = None
|
|
1029
|
+
if timeout_ms is None:
|
|
1030
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1031
|
+
|
|
1032
|
+
if server_url is not None:
|
|
1033
|
+
base_url = server_url
|
|
1034
|
+
else:
|
|
1035
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1036
|
+
req = self._build_request(
|
|
1037
|
+
method="GET",
|
|
1038
|
+
path="/plans/virtual_machines",
|
|
1039
|
+
base_url=base_url,
|
|
1040
|
+
url_variables=url_variables,
|
|
1041
|
+
request=None,
|
|
1042
|
+
request_body_required=False,
|
|
1043
|
+
request_has_path_params=False,
|
|
1044
|
+
request_has_query_params=True,
|
|
1045
|
+
user_agent_header="user-agent",
|
|
1046
|
+
accept_header_value="application/vnd.api+json",
|
|
1047
|
+
http_headers=http_headers,
|
|
1048
|
+
security=self.sdk_configuration.security,
|
|
1049
|
+
timeout_ms=timeout_ms,
|
|
1050
|
+
)
|
|
1051
|
+
|
|
1052
|
+
if retries == UNSET:
|
|
1053
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1054
|
+
retries = self.sdk_configuration.retry_config
|
|
1055
|
+
|
|
1056
|
+
retry_config = None
|
|
1057
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1058
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1059
|
+
|
|
1060
|
+
http_res = self.do_request(
|
|
1061
|
+
hook_ctx=HookContext(
|
|
1062
|
+
base_url=base_url or "",
|
|
1063
|
+
operation_id="get-vm-plans",
|
|
1064
|
+
oauth2_scopes=[],
|
|
1065
|
+
security_source=get_security_from_env(
|
|
1066
|
+
self.sdk_configuration.security, models.Security
|
|
1067
|
+
),
|
|
1068
|
+
),
|
|
1069
|
+
request=req,
|
|
1070
|
+
error_status_codes=["4XX", "5XX"],
|
|
1071
|
+
retry_config=retry_config,
|
|
1072
|
+
)
|
|
1073
|
+
|
|
1074
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1075
|
+
return utils.unmarshal_json(http_res.text, models.VirtualMachinePlans)
|
|
1076
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1077
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1078
|
+
raise models.APIError(
|
|
1079
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1080
|
+
)
|
|
1081
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1082
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1083
|
+
raise models.APIError(
|
|
1084
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1085
|
+
)
|
|
1086
|
+
|
|
1087
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1088
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1089
|
+
raise models.APIError(
|
|
1090
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1091
|
+
http_res.status_code,
|
|
1092
|
+
http_res_text,
|
|
1093
|
+
http_res,
|
|
1094
|
+
)
|
|
1095
|
+
|
|
1096
|
+
async def list_vm_plans_async(
|
|
1097
|
+
self,
|
|
1098
|
+
*,
|
|
1099
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1100
|
+
server_url: Optional[str] = None,
|
|
1101
|
+
timeout_ms: Optional[int] = None,
|
|
1102
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1103
|
+
) -> models.VirtualMachinePlans:
|
|
1104
|
+
r"""List all Virtual Machines Plans
|
|
1105
|
+
|
|
1106
|
+
:param retries: Override the default retry configuration for this method
|
|
1107
|
+
:param server_url: Override the default server URL for this method
|
|
1108
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1109
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1110
|
+
"""
|
|
1111
|
+
base_url = None
|
|
1112
|
+
url_variables = None
|
|
1113
|
+
if timeout_ms is None:
|
|
1114
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1115
|
+
|
|
1116
|
+
if server_url is not None:
|
|
1117
|
+
base_url = server_url
|
|
1118
|
+
else:
|
|
1119
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1120
|
+
req = self._build_request_async(
|
|
1121
|
+
method="GET",
|
|
1122
|
+
path="/plans/virtual_machines",
|
|
1123
|
+
base_url=base_url,
|
|
1124
|
+
url_variables=url_variables,
|
|
1125
|
+
request=None,
|
|
1126
|
+
request_body_required=False,
|
|
1127
|
+
request_has_path_params=False,
|
|
1128
|
+
request_has_query_params=True,
|
|
1129
|
+
user_agent_header="user-agent",
|
|
1130
|
+
accept_header_value="application/vnd.api+json",
|
|
1131
|
+
http_headers=http_headers,
|
|
1132
|
+
security=self.sdk_configuration.security,
|
|
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 = await self.do_request_async(
|
|
1145
|
+
hook_ctx=HookContext(
|
|
1146
|
+
base_url=base_url or "",
|
|
1147
|
+
operation_id="get-vm-plans",
|
|
1148
|
+
oauth2_scopes=[],
|
|
1149
|
+
security_source=get_security_from_env(
|
|
1150
|
+
self.sdk_configuration.security, models.Security
|
|
1151
|
+
),
|
|
1152
|
+
),
|
|
1153
|
+
request=req,
|
|
1154
|
+
error_status_codes=["4XX", "5XX"],
|
|
1155
|
+
retry_config=retry_config,
|
|
1156
|
+
)
|
|
1157
|
+
|
|
1158
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1159
|
+
return utils.unmarshal_json(http_res.text, models.VirtualMachinePlans)
|
|
1160
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1161
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1162
|
+
raise models.APIError(
|
|
1163
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1164
|
+
)
|
|
1165
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1166
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1167
|
+
raise models.APIError(
|
|
1168
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1169
|
+
)
|
|
1170
|
+
|
|
1171
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1172
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1173
|
+
raise models.APIError(
|
|
1174
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1175
|
+
http_res.status_code,
|
|
1176
|
+
http_res_text,
|
|
1177
|
+
http_res,
|
|
1178
|
+
)
|