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,818 @@
|
|
|
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 VpnSessions(BaseSDK):
|
|
12
|
+
def list(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
filter_location: Optional[models.FilterLocation] = None,
|
|
16
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
17
|
+
server_url: Optional[str] = None,
|
|
18
|
+
timeout_ms: Optional[int] = None,
|
|
19
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
20
|
+
) -> models.GetVpnSessionsResponseBody:
|
|
21
|
+
r"""List all Active VPN Sessions
|
|
22
|
+
|
|
23
|
+
:param filter_location:
|
|
24
|
+
:param retries: Override the default retry configuration for this method
|
|
25
|
+
:param server_url: Override the default server URL for this method
|
|
26
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
27
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
28
|
+
"""
|
|
29
|
+
base_url = None
|
|
30
|
+
url_variables = None
|
|
31
|
+
if timeout_ms is None:
|
|
32
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
33
|
+
|
|
34
|
+
if server_url is not None:
|
|
35
|
+
base_url = server_url
|
|
36
|
+
else:
|
|
37
|
+
base_url = self._get_url(base_url, url_variables)
|
|
38
|
+
|
|
39
|
+
request = models.GetVpnSessionsRequest(
|
|
40
|
+
filter_location=filter_location,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
req = self._build_request(
|
|
44
|
+
method="GET",
|
|
45
|
+
path="/vpn_sessions",
|
|
46
|
+
base_url=base_url,
|
|
47
|
+
url_variables=url_variables,
|
|
48
|
+
request=request,
|
|
49
|
+
request_body_required=False,
|
|
50
|
+
request_has_path_params=False,
|
|
51
|
+
request_has_query_params=True,
|
|
52
|
+
user_agent_header="user-agent",
|
|
53
|
+
accept_header_value="application/vnd.api+json",
|
|
54
|
+
http_headers=http_headers,
|
|
55
|
+
security=self.sdk_configuration.security,
|
|
56
|
+
timeout_ms=timeout_ms,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if retries == UNSET:
|
|
60
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
61
|
+
retries = self.sdk_configuration.retry_config
|
|
62
|
+
|
|
63
|
+
retry_config = None
|
|
64
|
+
if isinstance(retries, utils.RetryConfig):
|
|
65
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
66
|
+
|
|
67
|
+
http_res = self.do_request(
|
|
68
|
+
hook_ctx=HookContext(
|
|
69
|
+
base_url=base_url or "",
|
|
70
|
+
operation_id="get-vpn-sessions",
|
|
71
|
+
oauth2_scopes=[],
|
|
72
|
+
security_source=get_security_from_env(
|
|
73
|
+
self.sdk_configuration.security, models.Security
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
request=req,
|
|
77
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
78
|
+
retry_config=retry_config,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
response_data: Any = None
|
|
82
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
83
|
+
return utils.unmarshal_json(
|
|
84
|
+
http_res.text, models.GetVpnSessionsResponseBody
|
|
85
|
+
)
|
|
86
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
87
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
88
|
+
raise models.ErrorObject(data=response_data)
|
|
89
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
90
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
91
|
+
raise models.APIError(
|
|
92
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
93
|
+
)
|
|
94
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
95
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
96
|
+
raise models.APIError(
|
|
97
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
content_type = http_res.headers.get("Content-Type")
|
|
101
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
102
|
+
raise models.APIError(
|
|
103
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
104
|
+
http_res.status_code,
|
|
105
|
+
http_res_text,
|
|
106
|
+
http_res,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
async def list_async(
|
|
110
|
+
self,
|
|
111
|
+
*,
|
|
112
|
+
filter_location: Optional[models.FilterLocation] = None,
|
|
113
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
114
|
+
server_url: Optional[str] = None,
|
|
115
|
+
timeout_ms: Optional[int] = None,
|
|
116
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
117
|
+
) -> models.GetVpnSessionsResponseBody:
|
|
118
|
+
r"""List all Active VPN Sessions
|
|
119
|
+
|
|
120
|
+
:param filter_location:
|
|
121
|
+
:param retries: Override the default retry configuration for this method
|
|
122
|
+
:param server_url: Override the default server URL for this method
|
|
123
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
124
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
125
|
+
"""
|
|
126
|
+
base_url = None
|
|
127
|
+
url_variables = None
|
|
128
|
+
if timeout_ms is None:
|
|
129
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
130
|
+
|
|
131
|
+
if server_url is not None:
|
|
132
|
+
base_url = server_url
|
|
133
|
+
else:
|
|
134
|
+
base_url = self._get_url(base_url, url_variables)
|
|
135
|
+
|
|
136
|
+
request = models.GetVpnSessionsRequest(
|
|
137
|
+
filter_location=filter_location,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
req = self._build_request_async(
|
|
141
|
+
method="GET",
|
|
142
|
+
path="/vpn_sessions",
|
|
143
|
+
base_url=base_url,
|
|
144
|
+
url_variables=url_variables,
|
|
145
|
+
request=request,
|
|
146
|
+
request_body_required=False,
|
|
147
|
+
request_has_path_params=False,
|
|
148
|
+
request_has_query_params=True,
|
|
149
|
+
user_agent_header="user-agent",
|
|
150
|
+
accept_header_value="application/vnd.api+json",
|
|
151
|
+
http_headers=http_headers,
|
|
152
|
+
security=self.sdk_configuration.security,
|
|
153
|
+
timeout_ms=timeout_ms,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
if retries == UNSET:
|
|
157
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
158
|
+
retries = self.sdk_configuration.retry_config
|
|
159
|
+
|
|
160
|
+
retry_config = None
|
|
161
|
+
if isinstance(retries, utils.RetryConfig):
|
|
162
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
163
|
+
|
|
164
|
+
http_res = await self.do_request_async(
|
|
165
|
+
hook_ctx=HookContext(
|
|
166
|
+
base_url=base_url or "",
|
|
167
|
+
operation_id="get-vpn-sessions",
|
|
168
|
+
oauth2_scopes=[],
|
|
169
|
+
security_source=get_security_from_env(
|
|
170
|
+
self.sdk_configuration.security, models.Security
|
|
171
|
+
),
|
|
172
|
+
),
|
|
173
|
+
request=req,
|
|
174
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
175
|
+
retry_config=retry_config,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
response_data: Any = None
|
|
179
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
180
|
+
return utils.unmarshal_json(
|
|
181
|
+
http_res.text, models.GetVpnSessionsResponseBody
|
|
182
|
+
)
|
|
183
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
184
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
185
|
+
raise models.ErrorObject(data=response_data)
|
|
186
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
187
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
188
|
+
raise models.APIError(
|
|
189
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
190
|
+
)
|
|
191
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
192
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
193
|
+
raise models.APIError(
|
|
194
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
content_type = http_res.headers.get("Content-Type")
|
|
198
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
199
|
+
raise models.APIError(
|
|
200
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
201
|
+
http_res.status_code,
|
|
202
|
+
http_res_text,
|
|
203
|
+
http_res,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
def create(
|
|
207
|
+
self,
|
|
208
|
+
*,
|
|
209
|
+
request: Union[
|
|
210
|
+
models.PostVpnSessionVpnSessionsRequestBody,
|
|
211
|
+
models.PostVpnSessionVpnSessionsRequestBodyTypedDict,
|
|
212
|
+
] = models.PostVpnSessionVpnSessionsRequestBody(),
|
|
213
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
214
|
+
server_url: Optional[str] = None,
|
|
215
|
+
timeout_ms: Optional[int] = None,
|
|
216
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
217
|
+
) -> models.VpnSessionWithPassword:
|
|
218
|
+
r"""Create a VPN Session
|
|
219
|
+
|
|
220
|
+
Creates a new VPN Session.
|
|
221
|
+
`NOTE:` The VPN credentials are only listed ONCE upon creation. They can however be refreshed or deleted.
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
:param request: The request object to send.
|
|
225
|
+
:param retries: Override the default retry configuration for this method
|
|
226
|
+
:param server_url: Override the default server URL for this method
|
|
227
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
228
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
229
|
+
"""
|
|
230
|
+
base_url = None
|
|
231
|
+
url_variables = None
|
|
232
|
+
if timeout_ms is None:
|
|
233
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
234
|
+
|
|
235
|
+
if server_url is not None:
|
|
236
|
+
base_url = server_url
|
|
237
|
+
else:
|
|
238
|
+
base_url = self._get_url(base_url, url_variables)
|
|
239
|
+
|
|
240
|
+
if not isinstance(request, BaseModel):
|
|
241
|
+
request = utils.unmarshal(
|
|
242
|
+
request, models.PostVpnSessionVpnSessionsRequestBody
|
|
243
|
+
)
|
|
244
|
+
request = cast(models.PostVpnSessionVpnSessionsRequestBody, request)
|
|
245
|
+
|
|
246
|
+
req = self._build_request(
|
|
247
|
+
method="POST",
|
|
248
|
+
path="/vpn_sessions",
|
|
249
|
+
base_url=base_url,
|
|
250
|
+
url_variables=url_variables,
|
|
251
|
+
request=request,
|
|
252
|
+
request_body_required=True,
|
|
253
|
+
request_has_path_params=False,
|
|
254
|
+
request_has_query_params=True,
|
|
255
|
+
user_agent_header="user-agent",
|
|
256
|
+
accept_header_value="application/vnd.api+json",
|
|
257
|
+
http_headers=http_headers,
|
|
258
|
+
security=self.sdk_configuration.security,
|
|
259
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
260
|
+
request,
|
|
261
|
+
False,
|
|
262
|
+
True,
|
|
263
|
+
"json",
|
|
264
|
+
Optional[models.PostVpnSessionVpnSessionsRequestBody],
|
|
265
|
+
),
|
|
266
|
+
timeout_ms=timeout_ms,
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
if retries == UNSET:
|
|
270
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
271
|
+
retries = self.sdk_configuration.retry_config
|
|
272
|
+
|
|
273
|
+
retry_config = None
|
|
274
|
+
if isinstance(retries, utils.RetryConfig):
|
|
275
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
276
|
+
|
|
277
|
+
http_res = self.do_request(
|
|
278
|
+
hook_ctx=HookContext(
|
|
279
|
+
base_url=base_url or "",
|
|
280
|
+
operation_id="post-vpn-session",
|
|
281
|
+
oauth2_scopes=[],
|
|
282
|
+
security_source=get_security_from_env(
|
|
283
|
+
self.sdk_configuration.security, models.Security
|
|
284
|
+
),
|
|
285
|
+
),
|
|
286
|
+
request=req,
|
|
287
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
288
|
+
retry_config=retry_config,
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
response_data: Any = None
|
|
292
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
293
|
+
return utils.unmarshal_json(http_res.text, models.VpnSessionWithPassword)
|
|
294
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
295
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
296
|
+
raise models.ErrorObject(data=response_data)
|
|
297
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
298
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
299
|
+
raise models.APIError(
|
|
300
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
301
|
+
)
|
|
302
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
303
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
304
|
+
raise models.APIError(
|
|
305
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
content_type = http_res.headers.get("Content-Type")
|
|
309
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
310
|
+
raise models.APIError(
|
|
311
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
312
|
+
http_res.status_code,
|
|
313
|
+
http_res_text,
|
|
314
|
+
http_res,
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
async def create_async(
|
|
318
|
+
self,
|
|
319
|
+
*,
|
|
320
|
+
request: Union[
|
|
321
|
+
models.PostVpnSessionVpnSessionsRequestBody,
|
|
322
|
+
models.PostVpnSessionVpnSessionsRequestBodyTypedDict,
|
|
323
|
+
] = models.PostVpnSessionVpnSessionsRequestBody(),
|
|
324
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
325
|
+
server_url: Optional[str] = None,
|
|
326
|
+
timeout_ms: Optional[int] = None,
|
|
327
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
328
|
+
) -> models.VpnSessionWithPassword:
|
|
329
|
+
r"""Create a VPN Session
|
|
330
|
+
|
|
331
|
+
Creates a new VPN Session.
|
|
332
|
+
`NOTE:` The VPN credentials are only listed ONCE upon creation. They can however be refreshed or deleted.
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
:param request: The request object to send.
|
|
336
|
+
:param retries: Override the default retry configuration for this method
|
|
337
|
+
:param server_url: Override the default server URL for this method
|
|
338
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
339
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
340
|
+
"""
|
|
341
|
+
base_url = None
|
|
342
|
+
url_variables = None
|
|
343
|
+
if timeout_ms is None:
|
|
344
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
345
|
+
|
|
346
|
+
if server_url is not None:
|
|
347
|
+
base_url = server_url
|
|
348
|
+
else:
|
|
349
|
+
base_url = self._get_url(base_url, url_variables)
|
|
350
|
+
|
|
351
|
+
if not isinstance(request, BaseModel):
|
|
352
|
+
request = utils.unmarshal(
|
|
353
|
+
request, models.PostVpnSessionVpnSessionsRequestBody
|
|
354
|
+
)
|
|
355
|
+
request = cast(models.PostVpnSessionVpnSessionsRequestBody, request)
|
|
356
|
+
|
|
357
|
+
req = self._build_request_async(
|
|
358
|
+
method="POST",
|
|
359
|
+
path="/vpn_sessions",
|
|
360
|
+
base_url=base_url,
|
|
361
|
+
url_variables=url_variables,
|
|
362
|
+
request=request,
|
|
363
|
+
request_body_required=True,
|
|
364
|
+
request_has_path_params=False,
|
|
365
|
+
request_has_query_params=True,
|
|
366
|
+
user_agent_header="user-agent",
|
|
367
|
+
accept_header_value="application/vnd.api+json",
|
|
368
|
+
http_headers=http_headers,
|
|
369
|
+
security=self.sdk_configuration.security,
|
|
370
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
371
|
+
request,
|
|
372
|
+
False,
|
|
373
|
+
True,
|
|
374
|
+
"json",
|
|
375
|
+
Optional[models.PostVpnSessionVpnSessionsRequestBody],
|
|
376
|
+
),
|
|
377
|
+
timeout_ms=timeout_ms,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
if retries == UNSET:
|
|
381
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
382
|
+
retries = self.sdk_configuration.retry_config
|
|
383
|
+
|
|
384
|
+
retry_config = None
|
|
385
|
+
if isinstance(retries, utils.RetryConfig):
|
|
386
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
387
|
+
|
|
388
|
+
http_res = await self.do_request_async(
|
|
389
|
+
hook_ctx=HookContext(
|
|
390
|
+
base_url=base_url or "",
|
|
391
|
+
operation_id="post-vpn-session",
|
|
392
|
+
oauth2_scopes=[],
|
|
393
|
+
security_source=get_security_from_env(
|
|
394
|
+
self.sdk_configuration.security, models.Security
|
|
395
|
+
),
|
|
396
|
+
),
|
|
397
|
+
request=req,
|
|
398
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
399
|
+
retry_config=retry_config,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
response_data: Any = None
|
|
403
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
404
|
+
return utils.unmarshal_json(http_res.text, models.VpnSessionWithPassword)
|
|
405
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
406
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
407
|
+
raise models.ErrorObject(data=response_data)
|
|
408
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
409
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
410
|
+
raise models.APIError(
|
|
411
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
412
|
+
)
|
|
413
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
414
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
415
|
+
raise models.APIError(
|
|
416
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
content_type = http_res.headers.get("Content-Type")
|
|
420
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
421
|
+
raise models.APIError(
|
|
422
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
423
|
+
http_res.status_code,
|
|
424
|
+
http_res_text,
|
|
425
|
+
http_res,
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
def refresh_password(
|
|
429
|
+
self,
|
|
430
|
+
*,
|
|
431
|
+
vpn_session_id: str,
|
|
432
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
433
|
+
server_url: Optional[str] = None,
|
|
434
|
+
timeout_ms: Optional[int] = None,
|
|
435
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
436
|
+
) -> models.VpnSessionWithPassword:
|
|
437
|
+
r"""Refresh a VPN Session
|
|
438
|
+
|
|
439
|
+
Refreshing an existing VPN Session will create new credentials for that session
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
:param vpn_session_id:
|
|
443
|
+
:param retries: Override the default retry configuration for this method
|
|
444
|
+
:param server_url: Override the default server URL for this method
|
|
445
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
446
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
447
|
+
"""
|
|
448
|
+
base_url = None
|
|
449
|
+
url_variables = None
|
|
450
|
+
if timeout_ms is None:
|
|
451
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
452
|
+
|
|
453
|
+
if server_url is not None:
|
|
454
|
+
base_url = server_url
|
|
455
|
+
else:
|
|
456
|
+
base_url = self._get_url(base_url, url_variables)
|
|
457
|
+
|
|
458
|
+
request = models.PutVpnSessionRequest(
|
|
459
|
+
vpn_session_id=vpn_session_id,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
req = self._build_request(
|
|
463
|
+
method="PATCH",
|
|
464
|
+
path="/vpn_sessions/{vpn_session_id}/refresh_password",
|
|
465
|
+
base_url=base_url,
|
|
466
|
+
url_variables=url_variables,
|
|
467
|
+
request=request,
|
|
468
|
+
request_body_required=False,
|
|
469
|
+
request_has_path_params=True,
|
|
470
|
+
request_has_query_params=True,
|
|
471
|
+
user_agent_header="user-agent",
|
|
472
|
+
accept_header_value="application/vnd.api+json",
|
|
473
|
+
http_headers=http_headers,
|
|
474
|
+
security=self.sdk_configuration.security,
|
|
475
|
+
timeout_ms=timeout_ms,
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
if retries == UNSET:
|
|
479
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
480
|
+
retries = self.sdk_configuration.retry_config
|
|
481
|
+
|
|
482
|
+
retry_config = None
|
|
483
|
+
if isinstance(retries, utils.RetryConfig):
|
|
484
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
485
|
+
|
|
486
|
+
http_res = self.do_request(
|
|
487
|
+
hook_ctx=HookContext(
|
|
488
|
+
base_url=base_url or "",
|
|
489
|
+
operation_id="put-vpn-session",
|
|
490
|
+
oauth2_scopes=[],
|
|
491
|
+
security_source=get_security_from_env(
|
|
492
|
+
self.sdk_configuration.security, models.Security
|
|
493
|
+
),
|
|
494
|
+
),
|
|
495
|
+
request=req,
|
|
496
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
497
|
+
retry_config=retry_config,
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
response_data: Any = None
|
|
501
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
502
|
+
return utils.unmarshal_json(http_res.text, models.VpnSessionWithPassword)
|
|
503
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
504
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
505
|
+
raise models.ErrorObject(data=response_data)
|
|
506
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
507
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
508
|
+
raise models.APIError(
|
|
509
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
510
|
+
)
|
|
511
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
512
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
513
|
+
raise models.APIError(
|
|
514
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
content_type = http_res.headers.get("Content-Type")
|
|
518
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
519
|
+
raise models.APIError(
|
|
520
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
521
|
+
http_res.status_code,
|
|
522
|
+
http_res_text,
|
|
523
|
+
http_res,
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
async def refresh_password_async(
|
|
527
|
+
self,
|
|
528
|
+
*,
|
|
529
|
+
vpn_session_id: str,
|
|
530
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
531
|
+
server_url: Optional[str] = None,
|
|
532
|
+
timeout_ms: Optional[int] = None,
|
|
533
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
534
|
+
) -> models.VpnSessionWithPassword:
|
|
535
|
+
r"""Refresh a VPN Session
|
|
536
|
+
|
|
537
|
+
Refreshing an existing VPN Session will create new credentials for that session
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
:param vpn_session_id:
|
|
541
|
+
:param retries: Override the default retry configuration for this method
|
|
542
|
+
:param server_url: Override the default server URL for this method
|
|
543
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
544
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
545
|
+
"""
|
|
546
|
+
base_url = None
|
|
547
|
+
url_variables = None
|
|
548
|
+
if timeout_ms is None:
|
|
549
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
550
|
+
|
|
551
|
+
if server_url is not None:
|
|
552
|
+
base_url = server_url
|
|
553
|
+
else:
|
|
554
|
+
base_url = self._get_url(base_url, url_variables)
|
|
555
|
+
|
|
556
|
+
request = models.PutVpnSessionRequest(
|
|
557
|
+
vpn_session_id=vpn_session_id,
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
req = self._build_request_async(
|
|
561
|
+
method="PATCH",
|
|
562
|
+
path="/vpn_sessions/{vpn_session_id}/refresh_password",
|
|
563
|
+
base_url=base_url,
|
|
564
|
+
url_variables=url_variables,
|
|
565
|
+
request=request,
|
|
566
|
+
request_body_required=False,
|
|
567
|
+
request_has_path_params=True,
|
|
568
|
+
request_has_query_params=True,
|
|
569
|
+
user_agent_header="user-agent",
|
|
570
|
+
accept_header_value="application/vnd.api+json",
|
|
571
|
+
http_headers=http_headers,
|
|
572
|
+
security=self.sdk_configuration.security,
|
|
573
|
+
timeout_ms=timeout_ms,
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
if retries == UNSET:
|
|
577
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
578
|
+
retries = self.sdk_configuration.retry_config
|
|
579
|
+
|
|
580
|
+
retry_config = None
|
|
581
|
+
if isinstance(retries, utils.RetryConfig):
|
|
582
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
583
|
+
|
|
584
|
+
http_res = await self.do_request_async(
|
|
585
|
+
hook_ctx=HookContext(
|
|
586
|
+
base_url=base_url or "",
|
|
587
|
+
operation_id="put-vpn-session",
|
|
588
|
+
oauth2_scopes=[],
|
|
589
|
+
security_source=get_security_from_env(
|
|
590
|
+
self.sdk_configuration.security, models.Security
|
|
591
|
+
),
|
|
592
|
+
),
|
|
593
|
+
request=req,
|
|
594
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
595
|
+
retry_config=retry_config,
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
response_data: Any = None
|
|
599
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
600
|
+
return utils.unmarshal_json(http_res.text, models.VpnSessionWithPassword)
|
|
601
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
602
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
603
|
+
raise models.ErrorObject(data=response_data)
|
|
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 delete(
|
|
625
|
+
self,
|
|
626
|
+
*,
|
|
627
|
+
vpn_session_id: str,
|
|
628
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
629
|
+
server_url: Optional[str] = None,
|
|
630
|
+
timeout_ms: Optional[int] = None,
|
|
631
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
632
|
+
):
|
|
633
|
+
r"""Delete a VPN Session
|
|
634
|
+
|
|
635
|
+
Deletes an existing VPN Session.
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
:param vpn_session_id:
|
|
639
|
+
:param retries: Override the default retry configuration for this method
|
|
640
|
+
:param server_url: Override the default server URL for this method
|
|
641
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
642
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
643
|
+
"""
|
|
644
|
+
base_url = None
|
|
645
|
+
url_variables = None
|
|
646
|
+
if timeout_ms is None:
|
|
647
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
648
|
+
|
|
649
|
+
if server_url is not None:
|
|
650
|
+
base_url = server_url
|
|
651
|
+
else:
|
|
652
|
+
base_url = self._get_url(base_url, url_variables)
|
|
653
|
+
|
|
654
|
+
request = models.DeleteVpnSessionRequest(
|
|
655
|
+
vpn_session_id=vpn_session_id,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
req = self._build_request(
|
|
659
|
+
method="DELETE",
|
|
660
|
+
path="/vpn_sessions/{vpn_session_id}",
|
|
661
|
+
base_url=base_url,
|
|
662
|
+
url_variables=url_variables,
|
|
663
|
+
request=request,
|
|
664
|
+
request_body_required=False,
|
|
665
|
+
request_has_path_params=True,
|
|
666
|
+
request_has_query_params=True,
|
|
667
|
+
user_agent_header="user-agent",
|
|
668
|
+
accept_header_value="application/vnd.api+json",
|
|
669
|
+
http_headers=http_headers,
|
|
670
|
+
security=self.sdk_configuration.security,
|
|
671
|
+
timeout_ms=timeout_ms,
|
|
672
|
+
)
|
|
673
|
+
|
|
674
|
+
if retries == UNSET:
|
|
675
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
676
|
+
retries = self.sdk_configuration.retry_config
|
|
677
|
+
|
|
678
|
+
retry_config = None
|
|
679
|
+
if isinstance(retries, utils.RetryConfig):
|
|
680
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
681
|
+
|
|
682
|
+
http_res = self.do_request(
|
|
683
|
+
hook_ctx=HookContext(
|
|
684
|
+
base_url=base_url or "",
|
|
685
|
+
operation_id="delete-vpn-session",
|
|
686
|
+
oauth2_scopes=[],
|
|
687
|
+
security_source=get_security_from_env(
|
|
688
|
+
self.sdk_configuration.security, models.Security
|
|
689
|
+
),
|
|
690
|
+
),
|
|
691
|
+
request=req,
|
|
692
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
693
|
+
retry_config=retry_config,
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
response_data: Any = None
|
|
697
|
+
if utils.match_response(http_res, "204", "*"):
|
|
698
|
+
return
|
|
699
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
700
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
701
|
+
raise models.ErrorObject(data=response_data)
|
|
702
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
703
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
704
|
+
raise models.APIError(
|
|
705
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
706
|
+
)
|
|
707
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
708
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
709
|
+
raise models.APIError(
|
|
710
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
711
|
+
)
|
|
712
|
+
|
|
713
|
+
content_type = http_res.headers.get("Content-Type")
|
|
714
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
715
|
+
raise models.APIError(
|
|
716
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
717
|
+
http_res.status_code,
|
|
718
|
+
http_res_text,
|
|
719
|
+
http_res,
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
async def delete_async(
|
|
723
|
+
self,
|
|
724
|
+
*,
|
|
725
|
+
vpn_session_id: str,
|
|
726
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
727
|
+
server_url: Optional[str] = None,
|
|
728
|
+
timeout_ms: Optional[int] = None,
|
|
729
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
730
|
+
):
|
|
731
|
+
r"""Delete a VPN Session
|
|
732
|
+
|
|
733
|
+
Deletes an existing VPN Session.
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
:param vpn_session_id:
|
|
737
|
+
:param retries: Override the default retry configuration for this method
|
|
738
|
+
:param server_url: Override the default server URL for this method
|
|
739
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
740
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
741
|
+
"""
|
|
742
|
+
base_url = None
|
|
743
|
+
url_variables = None
|
|
744
|
+
if timeout_ms is None:
|
|
745
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
746
|
+
|
|
747
|
+
if server_url is not None:
|
|
748
|
+
base_url = server_url
|
|
749
|
+
else:
|
|
750
|
+
base_url = self._get_url(base_url, url_variables)
|
|
751
|
+
|
|
752
|
+
request = models.DeleteVpnSessionRequest(
|
|
753
|
+
vpn_session_id=vpn_session_id,
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
req = self._build_request_async(
|
|
757
|
+
method="DELETE",
|
|
758
|
+
path="/vpn_sessions/{vpn_session_id}",
|
|
759
|
+
base_url=base_url,
|
|
760
|
+
url_variables=url_variables,
|
|
761
|
+
request=request,
|
|
762
|
+
request_body_required=False,
|
|
763
|
+
request_has_path_params=True,
|
|
764
|
+
request_has_query_params=True,
|
|
765
|
+
user_agent_header="user-agent",
|
|
766
|
+
accept_header_value="application/vnd.api+json",
|
|
767
|
+
http_headers=http_headers,
|
|
768
|
+
security=self.sdk_configuration.security,
|
|
769
|
+
timeout_ms=timeout_ms,
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
if retries == UNSET:
|
|
773
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
774
|
+
retries = self.sdk_configuration.retry_config
|
|
775
|
+
|
|
776
|
+
retry_config = None
|
|
777
|
+
if isinstance(retries, utils.RetryConfig):
|
|
778
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
779
|
+
|
|
780
|
+
http_res = await self.do_request_async(
|
|
781
|
+
hook_ctx=HookContext(
|
|
782
|
+
base_url=base_url or "",
|
|
783
|
+
operation_id="delete-vpn-session",
|
|
784
|
+
oauth2_scopes=[],
|
|
785
|
+
security_source=get_security_from_env(
|
|
786
|
+
self.sdk_configuration.security, models.Security
|
|
787
|
+
),
|
|
788
|
+
),
|
|
789
|
+
request=req,
|
|
790
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
791
|
+
retry_config=retry_config,
|
|
792
|
+
)
|
|
793
|
+
|
|
794
|
+
response_data: Any = None
|
|
795
|
+
if utils.match_response(http_res, "204", "*"):
|
|
796
|
+
return
|
|
797
|
+
if utils.match_response(http_res, "404", "application/vnd.api+json"):
|
|
798
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
799
|
+
raise models.ErrorObject(data=response_data)
|
|
800
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
801
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
802
|
+
raise models.APIError(
|
|
803
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
804
|
+
)
|
|
805
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
806
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
807
|
+
raise models.APIError(
|
|
808
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
809
|
+
)
|
|
810
|
+
|
|
811
|
+
content_type = http_res.headers.get("Content-Type")
|
|
812
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
813
|
+
raise models.APIError(
|
|
814
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
815
|
+
http_res.status_code,
|
|
816
|
+
http_res_text,
|
|
817
|
+
http_res,
|
|
818
|
+
)
|