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,1672 @@
|
|
|
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 PrivateNetworks(BaseSDK):
|
|
12
|
+
def list(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
filter_location: Optional[str] = None,
|
|
16
|
+
filter_project: Optional[str] = None,
|
|
17
|
+
filter_tags: Optional[str] = None,
|
|
18
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
19
|
+
server_url: Optional[str] = None,
|
|
20
|
+
timeout_ms: Optional[int] = None,
|
|
21
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
22
|
+
) -> models.VirtualNetworks:
|
|
23
|
+
r"""List all Virtual Networks
|
|
24
|
+
|
|
25
|
+
Lists virtual networks assigned to a project
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
:param filter_location: The location slug to filter by
|
|
29
|
+
:param filter_project: The project id or slug to filter by
|
|
30
|
+
:param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return ssh keys with `tag_1` AND `tag_2`
|
|
31
|
+
:param retries: Override the default retry configuration for this method
|
|
32
|
+
:param server_url: Override the default server URL for this method
|
|
33
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
34
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
35
|
+
"""
|
|
36
|
+
base_url = None
|
|
37
|
+
url_variables = None
|
|
38
|
+
if timeout_ms is None:
|
|
39
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
40
|
+
|
|
41
|
+
if server_url is not None:
|
|
42
|
+
base_url = server_url
|
|
43
|
+
else:
|
|
44
|
+
base_url = self._get_url(base_url, url_variables)
|
|
45
|
+
|
|
46
|
+
request = models.GetVirtualNetworksRequest(
|
|
47
|
+
filter_location=filter_location,
|
|
48
|
+
filter_project=filter_project,
|
|
49
|
+
filter_tags=filter_tags,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
req = self._build_request(
|
|
53
|
+
method="GET",
|
|
54
|
+
path="/virtual_networks",
|
|
55
|
+
base_url=base_url,
|
|
56
|
+
url_variables=url_variables,
|
|
57
|
+
request=request,
|
|
58
|
+
request_body_required=False,
|
|
59
|
+
request_has_path_params=False,
|
|
60
|
+
request_has_query_params=True,
|
|
61
|
+
user_agent_header="user-agent",
|
|
62
|
+
accept_header_value="application/vnd.api+json",
|
|
63
|
+
http_headers=http_headers,
|
|
64
|
+
security=self.sdk_configuration.security,
|
|
65
|
+
timeout_ms=timeout_ms,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
if retries == UNSET:
|
|
69
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
70
|
+
retries = self.sdk_configuration.retry_config
|
|
71
|
+
|
|
72
|
+
retry_config = None
|
|
73
|
+
if isinstance(retries, utils.RetryConfig):
|
|
74
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
75
|
+
|
|
76
|
+
http_res = self.do_request(
|
|
77
|
+
hook_ctx=HookContext(
|
|
78
|
+
base_url=base_url or "",
|
|
79
|
+
operation_id="get-virtual-networks",
|
|
80
|
+
oauth2_scopes=[],
|
|
81
|
+
security_source=get_security_from_env(
|
|
82
|
+
self.sdk_configuration.security, models.Security
|
|
83
|
+
),
|
|
84
|
+
),
|
|
85
|
+
request=req,
|
|
86
|
+
error_status_codes=["4XX", "5XX"],
|
|
87
|
+
retry_config=retry_config,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
91
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetworks)
|
|
92
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
93
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
94
|
+
raise models.APIError(
|
|
95
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
96
|
+
)
|
|
97
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
98
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
99
|
+
raise models.APIError(
|
|
100
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
content_type = http_res.headers.get("Content-Type")
|
|
104
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
105
|
+
raise models.APIError(
|
|
106
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
107
|
+
http_res.status_code,
|
|
108
|
+
http_res_text,
|
|
109
|
+
http_res,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
async def list_async(
|
|
113
|
+
self,
|
|
114
|
+
*,
|
|
115
|
+
filter_location: Optional[str] = None,
|
|
116
|
+
filter_project: Optional[str] = None,
|
|
117
|
+
filter_tags: Optional[str] = None,
|
|
118
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
119
|
+
server_url: Optional[str] = None,
|
|
120
|
+
timeout_ms: Optional[int] = None,
|
|
121
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
122
|
+
) -> models.VirtualNetworks:
|
|
123
|
+
r"""List all Virtual Networks
|
|
124
|
+
|
|
125
|
+
Lists virtual networks assigned to a project
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
:param filter_location: The location slug to filter by
|
|
129
|
+
:param filter_project: The project id or slug to filter by
|
|
130
|
+
:param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return ssh keys with `tag_1` AND `tag_2`
|
|
131
|
+
:param retries: Override the default retry configuration for this method
|
|
132
|
+
:param server_url: Override the default server URL for this method
|
|
133
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
134
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
135
|
+
"""
|
|
136
|
+
base_url = None
|
|
137
|
+
url_variables = None
|
|
138
|
+
if timeout_ms is None:
|
|
139
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
140
|
+
|
|
141
|
+
if server_url is not None:
|
|
142
|
+
base_url = server_url
|
|
143
|
+
else:
|
|
144
|
+
base_url = self._get_url(base_url, url_variables)
|
|
145
|
+
|
|
146
|
+
request = models.GetVirtualNetworksRequest(
|
|
147
|
+
filter_location=filter_location,
|
|
148
|
+
filter_project=filter_project,
|
|
149
|
+
filter_tags=filter_tags,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
req = self._build_request_async(
|
|
153
|
+
method="GET",
|
|
154
|
+
path="/virtual_networks",
|
|
155
|
+
base_url=base_url,
|
|
156
|
+
url_variables=url_variables,
|
|
157
|
+
request=request,
|
|
158
|
+
request_body_required=False,
|
|
159
|
+
request_has_path_params=False,
|
|
160
|
+
request_has_query_params=True,
|
|
161
|
+
user_agent_header="user-agent",
|
|
162
|
+
accept_header_value="application/vnd.api+json",
|
|
163
|
+
http_headers=http_headers,
|
|
164
|
+
security=self.sdk_configuration.security,
|
|
165
|
+
timeout_ms=timeout_ms,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
if retries == UNSET:
|
|
169
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
170
|
+
retries = self.sdk_configuration.retry_config
|
|
171
|
+
|
|
172
|
+
retry_config = None
|
|
173
|
+
if isinstance(retries, utils.RetryConfig):
|
|
174
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
175
|
+
|
|
176
|
+
http_res = await self.do_request_async(
|
|
177
|
+
hook_ctx=HookContext(
|
|
178
|
+
base_url=base_url or "",
|
|
179
|
+
operation_id="get-virtual-networks",
|
|
180
|
+
oauth2_scopes=[],
|
|
181
|
+
security_source=get_security_from_env(
|
|
182
|
+
self.sdk_configuration.security, models.Security
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
request=req,
|
|
186
|
+
error_status_codes=["4XX", "5XX"],
|
|
187
|
+
retry_config=retry_config,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
191
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetworks)
|
|
192
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
193
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
194
|
+
raise models.APIError(
|
|
195
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
196
|
+
)
|
|
197
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
198
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
199
|
+
raise models.APIError(
|
|
200
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
content_type = http_res.headers.get("Content-Type")
|
|
204
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
205
|
+
raise models.APIError(
|
|
206
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
207
|
+
http_res.status_code,
|
|
208
|
+
http_res_text,
|
|
209
|
+
http_res,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
def create(
|
|
213
|
+
self,
|
|
214
|
+
*,
|
|
215
|
+
data: Union[
|
|
216
|
+
models.CreateVirtualNetworkPrivateNetworksData,
|
|
217
|
+
models.CreateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
218
|
+
],
|
|
219
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
220
|
+
server_url: Optional[str] = None,
|
|
221
|
+
timeout_ms: Optional[int] = None,
|
|
222
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
223
|
+
) -> models.VirtualNetwork:
|
|
224
|
+
r"""Create a Virtual Network
|
|
225
|
+
|
|
226
|
+
Creates a new Virtual Network.
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
:param data:
|
|
230
|
+
:param retries: Override the default retry configuration for this method
|
|
231
|
+
:param server_url: Override the default server URL for this method
|
|
232
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
233
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
234
|
+
"""
|
|
235
|
+
base_url = None
|
|
236
|
+
url_variables = None
|
|
237
|
+
if timeout_ms is None:
|
|
238
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
239
|
+
|
|
240
|
+
if server_url is not None:
|
|
241
|
+
base_url = server_url
|
|
242
|
+
else:
|
|
243
|
+
base_url = self._get_url(base_url, url_variables)
|
|
244
|
+
|
|
245
|
+
request = models.CreateVirtualNetworkPrivateNetworksRequestBody(
|
|
246
|
+
data=utils.get_pydantic_model(
|
|
247
|
+
data, models.CreateVirtualNetworkPrivateNetworksData
|
|
248
|
+
),
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
req = self._build_request(
|
|
252
|
+
method="POST",
|
|
253
|
+
path="/virtual_networks",
|
|
254
|
+
base_url=base_url,
|
|
255
|
+
url_variables=url_variables,
|
|
256
|
+
request=request,
|
|
257
|
+
request_body_required=True,
|
|
258
|
+
request_has_path_params=False,
|
|
259
|
+
request_has_query_params=True,
|
|
260
|
+
user_agent_header="user-agent",
|
|
261
|
+
accept_header_value="application/vnd.api+json",
|
|
262
|
+
http_headers=http_headers,
|
|
263
|
+
security=self.sdk_configuration.security,
|
|
264
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
265
|
+
request,
|
|
266
|
+
False,
|
|
267
|
+
False,
|
|
268
|
+
"json",
|
|
269
|
+
models.CreateVirtualNetworkPrivateNetworksRequestBody,
|
|
270
|
+
),
|
|
271
|
+
timeout_ms=timeout_ms,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
if retries == UNSET:
|
|
275
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
276
|
+
retries = self.sdk_configuration.retry_config
|
|
277
|
+
|
|
278
|
+
retry_config = None
|
|
279
|
+
if isinstance(retries, utils.RetryConfig):
|
|
280
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
281
|
+
|
|
282
|
+
http_res = self.do_request(
|
|
283
|
+
hook_ctx=HookContext(
|
|
284
|
+
base_url=base_url or "",
|
|
285
|
+
operation_id="create-virtual-network",
|
|
286
|
+
oauth2_scopes=[],
|
|
287
|
+
security_source=get_security_from_env(
|
|
288
|
+
self.sdk_configuration.security, models.Security
|
|
289
|
+
),
|
|
290
|
+
),
|
|
291
|
+
request=req,
|
|
292
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
293
|
+
retry_config=retry_config,
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
response_data: Any = None
|
|
297
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
298
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
|
|
299
|
+
if utils.match_response(http_res, "422", "application/vnd.api+json"):
|
|
300
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
301
|
+
raise models.ErrorObject(data=response_data)
|
|
302
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
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
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
308
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
309
|
+
raise models.APIError(
|
|
310
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
content_type = http_res.headers.get("Content-Type")
|
|
314
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
315
|
+
raise models.APIError(
|
|
316
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
317
|
+
http_res.status_code,
|
|
318
|
+
http_res_text,
|
|
319
|
+
http_res,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
async def create_async(
|
|
323
|
+
self,
|
|
324
|
+
*,
|
|
325
|
+
data: Union[
|
|
326
|
+
models.CreateVirtualNetworkPrivateNetworksData,
|
|
327
|
+
models.CreateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
328
|
+
],
|
|
329
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
330
|
+
server_url: Optional[str] = None,
|
|
331
|
+
timeout_ms: Optional[int] = None,
|
|
332
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
333
|
+
) -> models.VirtualNetwork:
|
|
334
|
+
r"""Create a Virtual Network
|
|
335
|
+
|
|
336
|
+
Creates a new Virtual Network.
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
:param data:
|
|
340
|
+
:param retries: Override the default retry configuration for this method
|
|
341
|
+
:param server_url: Override the default server URL for this method
|
|
342
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
343
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
344
|
+
"""
|
|
345
|
+
base_url = None
|
|
346
|
+
url_variables = None
|
|
347
|
+
if timeout_ms is None:
|
|
348
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
349
|
+
|
|
350
|
+
if server_url is not None:
|
|
351
|
+
base_url = server_url
|
|
352
|
+
else:
|
|
353
|
+
base_url = self._get_url(base_url, url_variables)
|
|
354
|
+
|
|
355
|
+
request = models.CreateVirtualNetworkPrivateNetworksRequestBody(
|
|
356
|
+
data=utils.get_pydantic_model(
|
|
357
|
+
data, models.CreateVirtualNetworkPrivateNetworksData
|
|
358
|
+
),
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
req = self._build_request_async(
|
|
362
|
+
method="POST",
|
|
363
|
+
path="/virtual_networks",
|
|
364
|
+
base_url=base_url,
|
|
365
|
+
url_variables=url_variables,
|
|
366
|
+
request=request,
|
|
367
|
+
request_body_required=True,
|
|
368
|
+
request_has_path_params=False,
|
|
369
|
+
request_has_query_params=True,
|
|
370
|
+
user_agent_header="user-agent",
|
|
371
|
+
accept_header_value="application/vnd.api+json",
|
|
372
|
+
http_headers=http_headers,
|
|
373
|
+
security=self.sdk_configuration.security,
|
|
374
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
375
|
+
request,
|
|
376
|
+
False,
|
|
377
|
+
False,
|
|
378
|
+
"json",
|
|
379
|
+
models.CreateVirtualNetworkPrivateNetworksRequestBody,
|
|
380
|
+
),
|
|
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="create-virtual-network",
|
|
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=["422", "4XX", "5XX"],
|
|
403
|
+
retry_config=retry_config,
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
response_data: Any = None
|
|
407
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
408
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
|
|
409
|
+
if utils.match_response(http_res, "422", "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 update(
|
|
433
|
+
self,
|
|
434
|
+
*,
|
|
435
|
+
vlan_id: str,
|
|
436
|
+
data: Union[
|
|
437
|
+
models.UpdateVirtualNetworkPrivateNetworksData,
|
|
438
|
+
models.UpdateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
439
|
+
],
|
|
440
|
+
id: Optional[str] = "vlan_81EVOtR1N4J2Z",
|
|
441
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
442
|
+
server_url: Optional[str] = None,
|
|
443
|
+
timeout_ms: Optional[int] = None,
|
|
444
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
445
|
+
) -> models.VirtualNetwork:
|
|
446
|
+
r"""Update a Virtual Network
|
|
447
|
+
|
|
448
|
+
Update a Virtual Network.
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
:param vlan_id: The Virtual Network ID
|
|
452
|
+
:param data:
|
|
453
|
+
:param id:
|
|
454
|
+
:param retries: Override the default retry configuration for this method
|
|
455
|
+
:param server_url: Override the default server URL for this method
|
|
456
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
457
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
458
|
+
"""
|
|
459
|
+
base_url = None
|
|
460
|
+
url_variables = None
|
|
461
|
+
if timeout_ms is None:
|
|
462
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
463
|
+
|
|
464
|
+
if server_url is not None:
|
|
465
|
+
base_url = server_url
|
|
466
|
+
else:
|
|
467
|
+
base_url = self._get_url(base_url, url_variables)
|
|
468
|
+
|
|
469
|
+
request = models.UpdateVirtualNetworkRequest(
|
|
470
|
+
vlan_id=vlan_id,
|
|
471
|
+
request_body=models.UpdateVirtualNetworkPrivateNetworksRequestBody(
|
|
472
|
+
id=id,
|
|
473
|
+
data=utils.get_pydantic_model(
|
|
474
|
+
data, models.UpdateVirtualNetworkPrivateNetworksData
|
|
475
|
+
),
|
|
476
|
+
),
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
req = self._build_request(
|
|
480
|
+
method="PATCH",
|
|
481
|
+
path="/virtual_networks/{vlan_id}",
|
|
482
|
+
base_url=base_url,
|
|
483
|
+
url_variables=url_variables,
|
|
484
|
+
request=request,
|
|
485
|
+
request_body_required=True,
|
|
486
|
+
request_has_path_params=True,
|
|
487
|
+
request_has_query_params=True,
|
|
488
|
+
user_agent_header="user-agent",
|
|
489
|
+
accept_header_value="application/vnd.api+json",
|
|
490
|
+
http_headers=http_headers,
|
|
491
|
+
security=self.sdk_configuration.security,
|
|
492
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
493
|
+
request.request_body,
|
|
494
|
+
False,
|
|
495
|
+
False,
|
|
496
|
+
"json",
|
|
497
|
+
models.UpdateVirtualNetworkPrivateNetworksRequestBody,
|
|
498
|
+
),
|
|
499
|
+
timeout_ms=timeout_ms,
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
if retries == UNSET:
|
|
503
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
504
|
+
retries = self.sdk_configuration.retry_config
|
|
505
|
+
|
|
506
|
+
retry_config = None
|
|
507
|
+
if isinstance(retries, utils.RetryConfig):
|
|
508
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
509
|
+
|
|
510
|
+
http_res = self.do_request(
|
|
511
|
+
hook_ctx=HookContext(
|
|
512
|
+
base_url=base_url or "",
|
|
513
|
+
operation_id="update-virtual-network",
|
|
514
|
+
oauth2_scopes=[],
|
|
515
|
+
security_source=get_security_from_env(
|
|
516
|
+
self.sdk_configuration.security, models.Security
|
|
517
|
+
),
|
|
518
|
+
),
|
|
519
|
+
request=req,
|
|
520
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
521
|
+
retry_config=retry_config,
|
|
522
|
+
)
|
|
523
|
+
|
|
524
|
+
response_data: Any = None
|
|
525
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
526
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
|
|
527
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
528
|
+
response_data = utils.unmarshal_json(
|
|
529
|
+
http_res.text, models.VirtualNetworkErrorData
|
|
530
|
+
)
|
|
531
|
+
raise models.VirtualNetworkError(data=response_data)
|
|
532
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
533
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
534
|
+
raise models.APIError(
|
|
535
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
536
|
+
)
|
|
537
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
538
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
539
|
+
raise models.APIError(
|
|
540
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
content_type = http_res.headers.get("Content-Type")
|
|
544
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
545
|
+
raise models.APIError(
|
|
546
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
547
|
+
http_res.status_code,
|
|
548
|
+
http_res_text,
|
|
549
|
+
http_res,
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
async def update_async(
|
|
553
|
+
self,
|
|
554
|
+
*,
|
|
555
|
+
vlan_id: str,
|
|
556
|
+
data: Union[
|
|
557
|
+
models.UpdateVirtualNetworkPrivateNetworksData,
|
|
558
|
+
models.UpdateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
559
|
+
],
|
|
560
|
+
id: Optional[str] = "vlan_81EVOtR1N4J2Z",
|
|
561
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
562
|
+
server_url: Optional[str] = None,
|
|
563
|
+
timeout_ms: Optional[int] = None,
|
|
564
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
565
|
+
) -> models.VirtualNetwork:
|
|
566
|
+
r"""Update a Virtual Network
|
|
567
|
+
|
|
568
|
+
Update a Virtual Network.
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
:param vlan_id: The Virtual Network ID
|
|
572
|
+
:param data:
|
|
573
|
+
:param id:
|
|
574
|
+
:param retries: Override the default retry configuration for this method
|
|
575
|
+
:param server_url: Override the default server URL for this method
|
|
576
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
577
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
578
|
+
"""
|
|
579
|
+
base_url = None
|
|
580
|
+
url_variables = None
|
|
581
|
+
if timeout_ms is None:
|
|
582
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
583
|
+
|
|
584
|
+
if server_url is not None:
|
|
585
|
+
base_url = server_url
|
|
586
|
+
else:
|
|
587
|
+
base_url = self._get_url(base_url, url_variables)
|
|
588
|
+
|
|
589
|
+
request = models.UpdateVirtualNetworkRequest(
|
|
590
|
+
vlan_id=vlan_id,
|
|
591
|
+
request_body=models.UpdateVirtualNetworkPrivateNetworksRequestBody(
|
|
592
|
+
id=id,
|
|
593
|
+
data=utils.get_pydantic_model(
|
|
594
|
+
data, models.UpdateVirtualNetworkPrivateNetworksData
|
|
595
|
+
),
|
|
596
|
+
),
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
req = self._build_request_async(
|
|
600
|
+
method="PATCH",
|
|
601
|
+
path="/virtual_networks/{vlan_id}",
|
|
602
|
+
base_url=base_url,
|
|
603
|
+
url_variables=url_variables,
|
|
604
|
+
request=request,
|
|
605
|
+
request_body_required=True,
|
|
606
|
+
request_has_path_params=True,
|
|
607
|
+
request_has_query_params=True,
|
|
608
|
+
user_agent_header="user-agent",
|
|
609
|
+
accept_header_value="application/vnd.api+json",
|
|
610
|
+
http_headers=http_headers,
|
|
611
|
+
security=self.sdk_configuration.security,
|
|
612
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
613
|
+
request.request_body,
|
|
614
|
+
False,
|
|
615
|
+
False,
|
|
616
|
+
"json",
|
|
617
|
+
models.UpdateVirtualNetworkPrivateNetworksRequestBody,
|
|
618
|
+
),
|
|
619
|
+
timeout_ms=timeout_ms,
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
if retries == UNSET:
|
|
623
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
624
|
+
retries = self.sdk_configuration.retry_config
|
|
625
|
+
|
|
626
|
+
retry_config = None
|
|
627
|
+
if isinstance(retries, utils.RetryConfig):
|
|
628
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
629
|
+
|
|
630
|
+
http_res = await self.do_request_async(
|
|
631
|
+
hook_ctx=HookContext(
|
|
632
|
+
base_url=base_url or "",
|
|
633
|
+
operation_id="update-virtual-network",
|
|
634
|
+
oauth2_scopes=[],
|
|
635
|
+
security_source=get_security_from_env(
|
|
636
|
+
self.sdk_configuration.security, models.Security
|
|
637
|
+
),
|
|
638
|
+
),
|
|
639
|
+
request=req,
|
|
640
|
+
error_status_codes=["403", "4XX", "5XX"],
|
|
641
|
+
retry_config=retry_config,
|
|
642
|
+
)
|
|
643
|
+
|
|
644
|
+
response_data: Any = None
|
|
645
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
646
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetwork)
|
|
647
|
+
if utils.match_response(http_res, "403", "application/vnd.api+json"):
|
|
648
|
+
response_data = utils.unmarshal_json(
|
|
649
|
+
http_res.text, models.VirtualNetworkErrorData
|
|
650
|
+
)
|
|
651
|
+
raise models.VirtualNetworkError(data=response_data)
|
|
652
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
653
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
654
|
+
raise models.APIError(
|
|
655
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
656
|
+
)
|
|
657
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
658
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
659
|
+
raise models.APIError(
|
|
660
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
content_type = http_res.headers.get("Content-Type")
|
|
664
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
665
|
+
raise models.APIError(
|
|
666
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
667
|
+
http_res.status_code,
|
|
668
|
+
http_res_text,
|
|
669
|
+
http_res,
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
def delete_virtual_network(
|
|
673
|
+
self,
|
|
674
|
+
*,
|
|
675
|
+
vlan_id: int,
|
|
676
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
677
|
+
server_url: Optional[str] = None,
|
|
678
|
+
timeout_ms: Optional[int] = None,
|
|
679
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
680
|
+
):
|
|
681
|
+
r"""Delete a Virtual Network
|
|
682
|
+
|
|
683
|
+
Delete virtual network
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
:param vlan_id: The virtual network ID
|
|
687
|
+
:param retries: Override the default retry configuration for this method
|
|
688
|
+
:param server_url: Override the default server URL for this method
|
|
689
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
690
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
691
|
+
"""
|
|
692
|
+
base_url = None
|
|
693
|
+
url_variables = None
|
|
694
|
+
if timeout_ms is None:
|
|
695
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
696
|
+
|
|
697
|
+
if server_url is not None:
|
|
698
|
+
base_url = server_url
|
|
699
|
+
else:
|
|
700
|
+
base_url = self._get_url(base_url, url_variables)
|
|
701
|
+
|
|
702
|
+
request = models.DestroyVirtualNetworkRequest(
|
|
703
|
+
vlan_id=vlan_id,
|
|
704
|
+
)
|
|
705
|
+
|
|
706
|
+
req = self._build_request(
|
|
707
|
+
method="DELETE",
|
|
708
|
+
path="/virtual_networks/{vlan_id}",
|
|
709
|
+
base_url=base_url,
|
|
710
|
+
url_variables=url_variables,
|
|
711
|
+
request=request,
|
|
712
|
+
request_body_required=False,
|
|
713
|
+
request_has_path_params=True,
|
|
714
|
+
request_has_query_params=True,
|
|
715
|
+
user_agent_header="user-agent",
|
|
716
|
+
accept_header_value="application/vnd.api+json",
|
|
717
|
+
http_headers=http_headers,
|
|
718
|
+
security=self.sdk_configuration.security,
|
|
719
|
+
timeout_ms=timeout_ms,
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
if retries == UNSET:
|
|
723
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
724
|
+
retries = self.sdk_configuration.retry_config
|
|
725
|
+
|
|
726
|
+
retry_config = None
|
|
727
|
+
if isinstance(retries, utils.RetryConfig):
|
|
728
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
729
|
+
|
|
730
|
+
http_res = self.do_request(
|
|
731
|
+
hook_ctx=HookContext(
|
|
732
|
+
base_url=base_url or "",
|
|
733
|
+
operation_id="destroy-virtual-network",
|
|
734
|
+
oauth2_scopes=[],
|
|
735
|
+
security_source=get_security_from_env(
|
|
736
|
+
self.sdk_configuration.security, models.Security
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
request=req,
|
|
740
|
+
error_status_codes=["406", "4XX", "5XX"],
|
|
741
|
+
retry_config=retry_config,
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
response_data: Any = None
|
|
745
|
+
if utils.match_response(http_res, "204", "*"):
|
|
746
|
+
return
|
|
747
|
+
if utils.match_response(http_res, "406", "application/vnd.api+json"):
|
|
748
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
749
|
+
raise models.ErrorObject(data=response_data)
|
|
750
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
751
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
752
|
+
raise models.APIError(
|
|
753
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
754
|
+
)
|
|
755
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
756
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
757
|
+
raise models.APIError(
|
|
758
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
759
|
+
)
|
|
760
|
+
|
|
761
|
+
content_type = http_res.headers.get("Content-Type")
|
|
762
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
763
|
+
raise models.APIError(
|
|
764
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
765
|
+
http_res.status_code,
|
|
766
|
+
http_res_text,
|
|
767
|
+
http_res,
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
async def delete_virtual_network_async(
|
|
771
|
+
self,
|
|
772
|
+
*,
|
|
773
|
+
vlan_id: int,
|
|
774
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
775
|
+
server_url: Optional[str] = None,
|
|
776
|
+
timeout_ms: Optional[int] = None,
|
|
777
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
778
|
+
):
|
|
779
|
+
r"""Delete a Virtual Network
|
|
780
|
+
|
|
781
|
+
Delete virtual network
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
:param vlan_id: The virtual network ID
|
|
785
|
+
:param retries: Override the default retry configuration for this method
|
|
786
|
+
:param server_url: Override the default server URL for this method
|
|
787
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
788
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
789
|
+
"""
|
|
790
|
+
base_url = None
|
|
791
|
+
url_variables = None
|
|
792
|
+
if timeout_ms is None:
|
|
793
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
794
|
+
|
|
795
|
+
if server_url is not None:
|
|
796
|
+
base_url = server_url
|
|
797
|
+
else:
|
|
798
|
+
base_url = self._get_url(base_url, url_variables)
|
|
799
|
+
|
|
800
|
+
request = models.DestroyVirtualNetworkRequest(
|
|
801
|
+
vlan_id=vlan_id,
|
|
802
|
+
)
|
|
803
|
+
|
|
804
|
+
req = self._build_request_async(
|
|
805
|
+
method="DELETE",
|
|
806
|
+
path="/virtual_networks/{vlan_id}",
|
|
807
|
+
base_url=base_url,
|
|
808
|
+
url_variables=url_variables,
|
|
809
|
+
request=request,
|
|
810
|
+
request_body_required=False,
|
|
811
|
+
request_has_path_params=True,
|
|
812
|
+
request_has_query_params=True,
|
|
813
|
+
user_agent_header="user-agent",
|
|
814
|
+
accept_header_value="application/vnd.api+json",
|
|
815
|
+
http_headers=http_headers,
|
|
816
|
+
security=self.sdk_configuration.security,
|
|
817
|
+
timeout_ms=timeout_ms,
|
|
818
|
+
)
|
|
819
|
+
|
|
820
|
+
if retries == UNSET:
|
|
821
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
822
|
+
retries = self.sdk_configuration.retry_config
|
|
823
|
+
|
|
824
|
+
retry_config = None
|
|
825
|
+
if isinstance(retries, utils.RetryConfig):
|
|
826
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
827
|
+
|
|
828
|
+
http_res = await self.do_request_async(
|
|
829
|
+
hook_ctx=HookContext(
|
|
830
|
+
base_url=base_url or "",
|
|
831
|
+
operation_id="destroy-virtual-network",
|
|
832
|
+
oauth2_scopes=[],
|
|
833
|
+
security_source=get_security_from_env(
|
|
834
|
+
self.sdk_configuration.security, models.Security
|
|
835
|
+
),
|
|
836
|
+
),
|
|
837
|
+
request=req,
|
|
838
|
+
error_status_codes=["406", "4XX", "5XX"],
|
|
839
|
+
retry_config=retry_config,
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
response_data: Any = None
|
|
843
|
+
if utils.match_response(http_res, "204", "*"):
|
|
844
|
+
return
|
|
845
|
+
if utils.match_response(http_res, "406", "application/vnd.api+json"):
|
|
846
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
847
|
+
raise models.ErrorObject(data=response_data)
|
|
848
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
849
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
850
|
+
raise models.APIError(
|
|
851
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
852
|
+
)
|
|
853
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
854
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
855
|
+
raise models.APIError(
|
|
856
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
857
|
+
)
|
|
858
|
+
|
|
859
|
+
content_type = http_res.headers.get("Content-Type")
|
|
860
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
861
|
+
raise models.APIError(
|
|
862
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
863
|
+
http_res.status_code,
|
|
864
|
+
http_res_text,
|
|
865
|
+
http_res,
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
def get(
|
|
869
|
+
self,
|
|
870
|
+
*,
|
|
871
|
+
vlan_id: str,
|
|
872
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
873
|
+
server_url: Optional[str] = None,
|
|
874
|
+
timeout_ms: Optional[int] = None,
|
|
875
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
876
|
+
) -> models.GetVirtualNetworkResponseBody:
|
|
877
|
+
r"""Retrieve a Virtual Network
|
|
878
|
+
|
|
879
|
+
Retrieve a Virtual Network.
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
:param vlan_id: Virtual Network ID
|
|
883
|
+
:param retries: Override the default retry configuration for this method
|
|
884
|
+
:param server_url: Override the default server URL for this method
|
|
885
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
886
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
887
|
+
"""
|
|
888
|
+
base_url = None
|
|
889
|
+
url_variables = None
|
|
890
|
+
if timeout_ms is None:
|
|
891
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
892
|
+
|
|
893
|
+
if server_url is not None:
|
|
894
|
+
base_url = server_url
|
|
895
|
+
else:
|
|
896
|
+
base_url = self._get_url(base_url, url_variables)
|
|
897
|
+
|
|
898
|
+
request = models.GetVirtualNetworkRequest(
|
|
899
|
+
vlan_id=vlan_id,
|
|
900
|
+
)
|
|
901
|
+
|
|
902
|
+
req = self._build_request(
|
|
903
|
+
method="GET",
|
|
904
|
+
path="/virtual_networks/{vlan_id}",
|
|
905
|
+
base_url=base_url,
|
|
906
|
+
url_variables=url_variables,
|
|
907
|
+
request=request,
|
|
908
|
+
request_body_required=False,
|
|
909
|
+
request_has_path_params=True,
|
|
910
|
+
request_has_query_params=True,
|
|
911
|
+
user_agent_header="user-agent",
|
|
912
|
+
accept_header_value="application/vnd.api+json",
|
|
913
|
+
http_headers=http_headers,
|
|
914
|
+
security=self.sdk_configuration.security,
|
|
915
|
+
timeout_ms=timeout_ms,
|
|
916
|
+
)
|
|
917
|
+
|
|
918
|
+
if retries == UNSET:
|
|
919
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
920
|
+
retries = self.sdk_configuration.retry_config
|
|
921
|
+
|
|
922
|
+
retry_config = None
|
|
923
|
+
if isinstance(retries, utils.RetryConfig):
|
|
924
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
925
|
+
|
|
926
|
+
http_res = self.do_request(
|
|
927
|
+
hook_ctx=HookContext(
|
|
928
|
+
base_url=base_url or "",
|
|
929
|
+
operation_id="get-virtual-network",
|
|
930
|
+
oauth2_scopes=[],
|
|
931
|
+
security_source=get_security_from_env(
|
|
932
|
+
self.sdk_configuration.security, models.Security
|
|
933
|
+
),
|
|
934
|
+
),
|
|
935
|
+
request=req,
|
|
936
|
+
error_status_codes=["4XX", "5XX"],
|
|
937
|
+
retry_config=retry_config,
|
|
938
|
+
)
|
|
939
|
+
|
|
940
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
941
|
+
return utils.unmarshal_json(
|
|
942
|
+
http_res.text, models.GetVirtualNetworkResponseBody
|
|
943
|
+
)
|
|
944
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
945
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
946
|
+
raise models.APIError(
|
|
947
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
948
|
+
)
|
|
949
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
950
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
951
|
+
raise models.APIError(
|
|
952
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
953
|
+
)
|
|
954
|
+
|
|
955
|
+
content_type = http_res.headers.get("Content-Type")
|
|
956
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
957
|
+
raise models.APIError(
|
|
958
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
959
|
+
http_res.status_code,
|
|
960
|
+
http_res_text,
|
|
961
|
+
http_res,
|
|
962
|
+
)
|
|
963
|
+
|
|
964
|
+
async def get_async(
|
|
965
|
+
self,
|
|
966
|
+
*,
|
|
967
|
+
vlan_id: str,
|
|
968
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
969
|
+
server_url: Optional[str] = None,
|
|
970
|
+
timeout_ms: Optional[int] = None,
|
|
971
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
972
|
+
) -> models.GetVirtualNetworkResponseBody:
|
|
973
|
+
r"""Retrieve a Virtual Network
|
|
974
|
+
|
|
975
|
+
Retrieve a Virtual Network.
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
:param vlan_id: Virtual Network ID
|
|
979
|
+
:param retries: Override the default retry configuration for this method
|
|
980
|
+
:param server_url: Override the default server URL for this method
|
|
981
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
982
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
983
|
+
"""
|
|
984
|
+
base_url = None
|
|
985
|
+
url_variables = None
|
|
986
|
+
if timeout_ms is None:
|
|
987
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
988
|
+
|
|
989
|
+
if server_url is not None:
|
|
990
|
+
base_url = server_url
|
|
991
|
+
else:
|
|
992
|
+
base_url = self._get_url(base_url, url_variables)
|
|
993
|
+
|
|
994
|
+
request = models.GetVirtualNetworkRequest(
|
|
995
|
+
vlan_id=vlan_id,
|
|
996
|
+
)
|
|
997
|
+
|
|
998
|
+
req = self._build_request_async(
|
|
999
|
+
method="GET",
|
|
1000
|
+
path="/virtual_networks/{vlan_id}",
|
|
1001
|
+
base_url=base_url,
|
|
1002
|
+
url_variables=url_variables,
|
|
1003
|
+
request=request,
|
|
1004
|
+
request_body_required=False,
|
|
1005
|
+
request_has_path_params=True,
|
|
1006
|
+
request_has_query_params=True,
|
|
1007
|
+
user_agent_header="user-agent",
|
|
1008
|
+
accept_header_value="application/vnd.api+json",
|
|
1009
|
+
http_headers=http_headers,
|
|
1010
|
+
security=self.sdk_configuration.security,
|
|
1011
|
+
timeout_ms=timeout_ms,
|
|
1012
|
+
)
|
|
1013
|
+
|
|
1014
|
+
if retries == UNSET:
|
|
1015
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1016
|
+
retries = self.sdk_configuration.retry_config
|
|
1017
|
+
|
|
1018
|
+
retry_config = None
|
|
1019
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1020
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1021
|
+
|
|
1022
|
+
http_res = await self.do_request_async(
|
|
1023
|
+
hook_ctx=HookContext(
|
|
1024
|
+
base_url=base_url or "",
|
|
1025
|
+
operation_id="get-virtual-network",
|
|
1026
|
+
oauth2_scopes=[],
|
|
1027
|
+
security_source=get_security_from_env(
|
|
1028
|
+
self.sdk_configuration.security, models.Security
|
|
1029
|
+
),
|
|
1030
|
+
),
|
|
1031
|
+
request=req,
|
|
1032
|
+
error_status_codes=["4XX", "5XX"],
|
|
1033
|
+
retry_config=retry_config,
|
|
1034
|
+
)
|
|
1035
|
+
|
|
1036
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1037
|
+
return utils.unmarshal_json(
|
|
1038
|
+
http_res.text, models.GetVirtualNetworkResponseBody
|
|
1039
|
+
)
|
|
1040
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1041
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1042
|
+
raise models.APIError(
|
|
1043
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1044
|
+
)
|
|
1045
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1046
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1047
|
+
raise models.APIError(
|
|
1048
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1049
|
+
)
|
|
1050
|
+
|
|
1051
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1052
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1053
|
+
raise models.APIError(
|
|
1054
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1055
|
+
http_res.status_code,
|
|
1056
|
+
http_res_text,
|
|
1057
|
+
http_res,
|
|
1058
|
+
)
|
|
1059
|
+
|
|
1060
|
+
def list_assignments(
|
|
1061
|
+
self,
|
|
1062
|
+
*,
|
|
1063
|
+
filter_server: Optional[str] = None,
|
|
1064
|
+
filter_vid: Optional[str] = None,
|
|
1065
|
+
filter_virtual_network_id: Optional[str] = None,
|
|
1066
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1067
|
+
server_url: Optional[str] = None,
|
|
1068
|
+
timeout_ms: Optional[int] = None,
|
|
1069
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1070
|
+
) -> models.VirtualNetworkAssignments:
|
|
1071
|
+
r"""List all servers assigned to virtual networks
|
|
1072
|
+
|
|
1073
|
+
Returns a list of all servers assigned to virtual networks.
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
:param filter_server: The server ID to filter by
|
|
1077
|
+
:param filter_vid: The vlan ID to filter by
|
|
1078
|
+
:param filter_virtual_network_id: The virtual network ID to filter by
|
|
1079
|
+
:param retries: Override the default retry configuration for this method
|
|
1080
|
+
:param server_url: Override the default server URL for this method
|
|
1081
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1082
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1083
|
+
"""
|
|
1084
|
+
base_url = None
|
|
1085
|
+
url_variables = None
|
|
1086
|
+
if timeout_ms is None:
|
|
1087
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1088
|
+
|
|
1089
|
+
if server_url is not None:
|
|
1090
|
+
base_url = server_url
|
|
1091
|
+
else:
|
|
1092
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1093
|
+
|
|
1094
|
+
request = models.GetVirtualNetworksAssignmentsRequest(
|
|
1095
|
+
filter_server=filter_server,
|
|
1096
|
+
filter_vid=filter_vid,
|
|
1097
|
+
filter_virtual_network_id=filter_virtual_network_id,
|
|
1098
|
+
)
|
|
1099
|
+
|
|
1100
|
+
req = self._build_request(
|
|
1101
|
+
method="GET",
|
|
1102
|
+
path="/virtual_networks/assignments",
|
|
1103
|
+
base_url=base_url,
|
|
1104
|
+
url_variables=url_variables,
|
|
1105
|
+
request=request,
|
|
1106
|
+
request_body_required=False,
|
|
1107
|
+
request_has_path_params=False,
|
|
1108
|
+
request_has_query_params=True,
|
|
1109
|
+
user_agent_header="user-agent",
|
|
1110
|
+
accept_header_value="application/vnd.api+json",
|
|
1111
|
+
http_headers=http_headers,
|
|
1112
|
+
security=self.sdk_configuration.security,
|
|
1113
|
+
timeout_ms=timeout_ms,
|
|
1114
|
+
)
|
|
1115
|
+
|
|
1116
|
+
if retries == UNSET:
|
|
1117
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1118
|
+
retries = self.sdk_configuration.retry_config
|
|
1119
|
+
|
|
1120
|
+
retry_config = None
|
|
1121
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1122
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1123
|
+
|
|
1124
|
+
http_res = self.do_request(
|
|
1125
|
+
hook_ctx=HookContext(
|
|
1126
|
+
base_url=base_url or "",
|
|
1127
|
+
operation_id="get-virtual-networks-assignments",
|
|
1128
|
+
oauth2_scopes=[],
|
|
1129
|
+
security_source=get_security_from_env(
|
|
1130
|
+
self.sdk_configuration.security, models.Security
|
|
1131
|
+
),
|
|
1132
|
+
),
|
|
1133
|
+
request=req,
|
|
1134
|
+
error_status_codes=["4XX", "5XX"],
|
|
1135
|
+
retry_config=retry_config,
|
|
1136
|
+
)
|
|
1137
|
+
|
|
1138
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1139
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetworkAssignments)
|
|
1140
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1141
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1142
|
+
raise models.APIError(
|
|
1143
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1144
|
+
)
|
|
1145
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1146
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1147
|
+
raise models.APIError(
|
|
1148
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1149
|
+
)
|
|
1150
|
+
|
|
1151
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1152
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1153
|
+
raise models.APIError(
|
|
1154
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1155
|
+
http_res.status_code,
|
|
1156
|
+
http_res_text,
|
|
1157
|
+
http_res,
|
|
1158
|
+
)
|
|
1159
|
+
|
|
1160
|
+
async def list_assignments_async(
|
|
1161
|
+
self,
|
|
1162
|
+
*,
|
|
1163
|
+
filter_server: Optional[str] = None,
|
|
1164
|
+
filter_vid: Optional[str] = None,
|
|
1165
|
+
filter_virtual_network_id: Optional[str] = None,
|
|
1166
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1167
|
+
server_url: Optional[str] = None,
|
|
1168
|
+
timeout_ms: Optional[int] = None,
|
|
1169
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1170
|
+
) -> models.VirtualNetworkAssignments:
|
|
1171
|
+
r"""List all servers assigned to virtual networks
|
|
1172
|
+
|
|
1173
|
+
Returns a list of all servers assigned to virtual networks.
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
:param filter_server: The server ID to filter by
|
|
1177
|
+
:param filter_vid: The vlan ID to filter by
|
|
1178
|
+
:param filter_virtual_network_id: The virtual network ID to filter by
|
|
1179
|
+
:param retries: Override the default retry configuration for this method
|
|
1180
|
+
:param server_url: Override the default server URL for this method
|
|
1181
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1182
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1183
|
+
"""
|
|
1184
|
+
base_url = None
|
|
1185
|
+
url_variables = None
|
|
1186
|
+
if timeout_ms is None:
|
|
1187
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1188
|
+
|
|
1189
|
+
if server_url is not None:
|
|
1190
|
+
base_url = server_url
|
|
1191
|
+
else:
|
|
1192
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1193
|
+
|
|
1194
|
+
request = models.GetVirtualNetworksAssignmentsRequest(
|
|
1195
|
+
filter_server=filter_server,
|
|
1196
|
+
filter_vid=filter_vid,
|
|
1197
|
+
filter_virtual_network_id=filter_virtual_network_id,
|
|
1198
|
+
)
|
|
1199
|
+
|
|
1200
|
+
req = self._build_request_async(
|
|
1201
|
+
method="GET",
|
|
1202
|
+
path="/virtual_networks/assignments",
|
|
1203
|
+
base_url=base_url,
|
|
1204
|
+
url_variables=url_variables,
|
|
1205
|
+
request=request,
|
|
1206
|
+
request_body_required=False,
|
|
1207
|
+
request_has_path_params=False,
|
|
1208
|
+
request_has_query_params=True,
|
|
1209
|
+
user_agent_header="user-agent",
|
|
1210
|
+
accept_header_value="application/vnd.api+json",
|
|
1211
|
+
http_headers=http_headers,
|
|
1212
|
+
security=self.sdk_configuration.security,
|
|
1213
|
+
timeout_ms=timeout_ms,
|
|
1214
|
+
)
|
|
1215
|
+
|
|
1216
|
+
if retries == UNSET:
|
|
1217
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1218
|
+
retries = self.sdk_configuration.retry_config
|
|
1219
|
+
|
|
1220
|
+
retry_config = None
|
|
1221
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1222
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1223
|
+
|
|
1224
|
+
http_res = await self.do_request_async(
|
|
1225
|
+
hook_ctx=HookContext(
|
|
1226
|
+
base_url=base_url or "",
|
|
1227
|
+
operation_id="get-virtual-networks-assignments",
|
|
1228
|
+
oauth2_scopes=[],
|
|
1229
|
+
security_source=get_security_from_env(
|
|
1230
|
+
self.sdk_configuration.security, models.Security
|
|
1231
|
+
),
|
|
1232
|
+
),
|
|
1233
|
+
request=req,
|
|
1234
|
+
error_status_codes=["4XX", "5XX"],
|
|
1235
|
+
retry_config=retry_config,
|
|
1236
|
+
)
|
|
1237
|
+
|
|
1238
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1239
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetworkAssignments)
|
|
1240
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1241
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1242
|
+
raise models.APIError(
|
|
1243
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1244
|
+
)
|
|
1245
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1246
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1247
|
+
raise models.APIError(
|
|
1248
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1249
|
+
)
|
|
1250
|
+
|
|
1251
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1252
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1253
|
+
raise models.APIError(
|
|
1254
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1255
|
+
http_res.status_code,
|
|
1256
|
+
http_res_text,
|
|
1257
|
+
http_res,
|
|
1258
|
+
)
|
|
1259
|
+
|
|
1260
|
+
def assign(
|
|
1261
|
+
self,
|
|
1262
|
+
*,
|
|
1263
|
+
request: Union[
|
|
1264
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBody,
|
|
1265
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBodyTypedDict,
|
|
1266
|
+
] = models.AssignServerVirtualNetworkPrivateNetworksRequestBody(),
|
|
1267
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1268
|
+
server_url: Optional[str] = None,
|
|
1269
|
+
timeout_ms: Optional[int] = None,
|
|
1270
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1271
|
+
) -> models.VirtualNetworkAssignment:
|
|
1272
|
+
r"""Assign Virtual network
|
|
1273
|
+
|
|
1274
|
+
:param request: The request object to send.
|
|
1275
|
+
:param retries: Override the default retry configuration for this method
|
|
1276
|
+
:param server_url: Override the default server URL for this method
|
|
1277
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1278
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1279
|
+
"""
|
|
1280
|
+
base_url = None
|
|
1281
|
+
url_variables = None
|
|
1282
|
+
if timeout_ms is None:
|
|
1283
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1284
|
+
|
|
1285
|
+
if server_url is not None:
|
|
1286
|
+
base_url = server_url
|
|
1287
|
+
else:
|
|
1288
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1289
|
+
|
|
1290
|
+
if not isinstance(request, BaseModel):
|
|
1291
|
+
request = utils.unmarshal(
|
|
1292
|
+
request, models.AssignServerVirtualNetworkPrivateNetworksRequestBody
|
|
1293
|
+
)
|
|
1294
|
+
request = cast(
|
|
1295
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBody, request
|
|
1296
|
+
)
|
|
1297
|
+
|
|
1298
|
+
req = self._build_request(
|
|
1299
|
+
method="POST",
|
|
1300
|
+
path="/virtual_networks/assignments",
|
|
1301
|
+
base_url=base_url,
|
|
1302
|
+
url_variables=url_variables,
|
|
1303
|
+
request=request,
|
|
1304
|
+
request_body_required=True,
|
|
1305
|
+
request_has_path_params=False,
|
|
1306
|
+
request_has_query_params=True,
|
|
1307
|
+
user_agent_header="user-agent",
|
|
1308
|
+
accept_header_value="application/vnd.api+json",
|
|
1309
|
+
http_headers=http_headers,
|
|
1310
|
+
security=self.sdk_configuration.security,
|
|
1311
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1312
|
+
request,
|
|
1313
|
+
False,
|
|
1314
|
+
True,
|
|
1315
|
+
"json",
|
|
1316
|
+
Optional[models.AssignServerVirtualNetworkPrivateNetworksRequestBody],
|
|
1317
|
+
),
|
|
1318
|
+
timeout_ms=timeout_ms,
|
|
1319
|
+
)
|
|
1320
|
+
|
|
1321
|
+
if retries == UNSET:
|
|
1322
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1323
|
+
retries = self.sdk_configuration.retry_config
|
|
1324
|
+
|
|
1325
|
+
retry_config = None
|
|
1326
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1327
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1328
|
+
|
|
1329
|
+
http_res = self.do_request(
|
|
1330
|
+
hook_ctx=HookContext(
|
|
1331
|
+
base_url=base_url or "",
|
|
1332
|
+
operation_id="assign-server-virtual-network",
|
|
1333
|
+
oauth2_scopes=[],
|
|
1334
|
+
security_source=get_security_from_env(
|
|
1335
|
+
self.sdk_configuration.security, models.Security
|
|
1336
|
+
),
|
|
1337
|
+
),
|
|
1338
|
+
request=req,
|
|
1339
|
+
error_status_codes=["403", "422", "4XX", "5XX"],
|
|
1340
|
+
retry_config=retry_config,
|
|
1341
|
+
)
|
|
1342
|
+
|
|
1343
|
+
response_data: Any = None
|
|
1344
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
1345
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetworkAssignment)
|
|
1346
|
+
if utils.match_response(http_res, ["403", "422"], "application/vnd.api+json"):
|
|
1347
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1348
|
+
raise models.ErrorObject(data=response_data)
|
|
1349
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1350
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1351
|
+
raise models.APIError(
|
|
1352
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1353
|
+
)
|
|
1354
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1355
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1356
|
+
raise models.APIError(
|
|
1357
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1358
|
+
)
|
|
1359
|
+
|
|
1360
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1361
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1362
|
+
raise models.APIError(
|
|
1363
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1364
|
+
http_res.status_code,
|
|
1365
|
+
http_res_text,
|
|
1366
|
+
http_res,
|
|
1367
|
+
)
|
|
1368
|
+
|
|
1369
|
+
async def assign_async(
|
|
1370
|
+
self,
|
|
1371
|
+
*,
|
|
1372
|
+
request: Union[
|
|
1373
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBody,
|
|
1374
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBodyTypedDict,
|
|
1375
|
+
] = models.AssignServerVirtualNetworkPrivateNetworksRequestBody(),
|
|
1376
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1377
|
+
server_url: Optional[str] = None,
|
|
1378
|
+
timeout_ms: Optional[int] = None,
|
|
1379
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1380
|
+
) -> models.VirtualNetworkAssignment:
|
|
1381
|
+
r"""Assign Virtual network
|
|
1382
|
+
|
|
1383
|
+
:param request: The request object to send.
|
|
1384
|
+
:param retries: Override the default retry configuration for this method
|
|
1385
|
+
:param server_url: Override the default server URL for this method
|
|
1386
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1387
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1388
|
+
"""
|
|
1389
|
+
base_url = None
|
|
1390
|
+
url_variables = None
|
|
1391
|
+
if timeout_ms is None:
|
|
1392
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1393
|
+
|
|
1394
|
+
if server_url is not None:
|
|
1395
|
+
base_url = server_url
|
|
1396
|
+
else:
|
|
1397
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1398
|
+
|
|
1399
|
+
if not isinstance(request, BaseModel):
|
|
1400
|
+
request = utils.unmarshal(
|
|
1401
|
+
request, models.AssignServerVirtualNetworkPrivateNetworksRequestBody
|
|
1402
|
+
)
|
|
1403
|
+
request = cast(
|
|
1404
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBody, request
|
|
1405
|
+
)
|
|
1406
|
+
|
|
1407
|
+
req = self._build_request_async(
|
|
1408
|
+
method="POST",
|
|
1409
|
+
path="/virtual_networks/assignments",
|
|
1410
|
+
base_url=base_url,
|
|
1411
|
+
url_variables=url_variables,
|
|
1412
|
+
request=request,
|
|
1413
|
+
request_body_required=True,
|
|
1414
|
+
request_has_path_params=False,
|
|
1415
|
+
request_has_query_params=True,
|
|
1416
|
+
user_agent_header="user-agent",
|
|
1417
|
+
accept_header_value="application/vnd.api+json",
|
|
1418
|
+
http_headers=http_headers,
|
|
1419
|
+
security=self.sdk_configuration.security,
|
|
1420
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1421
|
+
request,
|
|
1422
|
+
False,
|
|
1423
|
+
True,
|
|
1424
|
+
"json",
|
|
1425
|
+
Optional[models.AssignServerVirtualNetworkPrivateNetworksRequestBody],
|
|
1426
|
+
),
|
|
1427
|
+
timeout_ms=timeout_ms,
|
|
1428
|
+
)
|
|
1429
|
+
|
|
1430
|
+
if retries == UNSET:
|
|
1431
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1432
|
+
retries = self.sdk_configuration.retry_config
|
|
1433
|
+
|
|
1434
|
+
retry_config = None
|
|
1435
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1436
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1437
|
+
|
|
1438
|
+
http_res = await self.do_request_async(
|
|
1439
|
+
hook_ctx=HookContext(
|
|
1440
|
+
base_url=base_url or "",
|
|
1441
|
+
operation_id="assign-server-virtual-network",
|
|
1442
|
+
oauth2_scopes=[],
|
|
1443
|
+
security_source=get_security_from_env(
|
|
1444
|
+
self.sdk_configuration.security, models.Security
|
|
1445
|
+
),
|
|
1446
|
+
),
|
|
1447
|
+
request=req,
|
|
1448
|
+
error_status_codes=["403", "422", "4XX", "5XX"],
|
|
1449
|
+
retry_config=retry_config,
|
|
1450
|
+
)
|
|
1451
|
+
|
|
1452
|
+
response_data: Any = None
|
|
1453
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
1454
|
+
return utils.unmarshal_json(http_res.text, models.VirtualNetworkAssignment)
|
|
1455
|
+
if utils.match_response(http_res, ["403", "422"], "application/vnd.api+json"):
|
|
1456
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1457
|
+
raise models.ErrorObject(data=response_data)
|
|
1458
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1459
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1460
|
+
raise models.APIError(
|
|
1461
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1462
|
+
)
|
|
1463
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1464
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1465
|
+
raise models.APIError(
|
|
1466
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1467
|
+
)
|
|
1468
|
+
|
|
1469
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1470
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1471
|
+
raise models.APIError(
|
|
1472
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1473
|
+
http_res.status_code,
|
|
1474
|
+
http_res_text,
|
|
1475
|
+
http_res,
|
|
1476
|
+
)
|
|
1477
|
+
|
|
1478
|
+
def remove_assignment(
|
|
1479
|
+
self,
|
|
1480
|
+
*,
|
|
1481
|
+
assignment_id: str,
|
|
1482
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1483
|
+
server_url: Optional[str] = None,
|
|
1484
|
+
timeout_ms: Optional[int] = None,
|
|
1485
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1486
|
+
):
|
|
1487
|
+
r"""Delete Virtual Network Assignment
|
|
1488
|
+
|
|
1489
|
+
Allow you to remove a Virtual Network assignment.
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
:param assignment_id:
|
|
1493
|
+
:param retries: Override the default retry configuration for this method
|
|
1494
|
+
:param server_url: Override the default server URL for this method
|
|
1495
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1496
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1497
|
+
"""
|
|
1498
|
+
base_url = None
|
|
1499
|
+
url_variables = None
|
|
1500
|
+
if timeout_ms is None:
|
|
1501
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1502
|
+
|
|
1503
|
+
if server_url is not None:
|
|
1504
|
+
base_url = server_url
|
|
1505
|
+
else:
|
|
1506
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1507
|
+
|
|
1508
|
+
request = models.DeleteVirtualNetworksAssignmentsRequest(
|
|
1509
|
+
assignment_id=assignment_id,
|
|
1510
|
+
)
|
|
1511
|
+
|
|
1512
|
+
req = self._build_request(
|
|
1513
|
+
method="DELETE",
|
|
1514
|
+
path="/virtual_networks/assignments/{assignment_id}",
|
|
1515
|
+
base_url=base_url,
|
|
1516
|
+
url_variables=url_variables,
|
|
1517
|
+
request=request,
|
|
1518
|
+
request_body_required=False,
|
|
1519
|
+
request_has_path_params=True,
|
|
1520
|
+
request_has_query_params=True,
|
|
1521
|
+
user_agent_header="user-agent",
|
|
1522
|
+
accept_header_value="application/vnd.api+json",
|
|
1523
|
+
http_headers=http_headers,
|
|
1524
|
+
security=self.sdk_configuration.security,
|
|
1525
|
+
timeout_ms=timeout_ms,
|
|
1526
|
+
)
|
|
1527
|
+
|
|
1528
|
+
if retries == UNSET:
|
|
1529
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1530
|
+
retries = self.sdk_configuration.retry_config
|
|
1531
|
+
|
|
1532
|
+
retry_config = None
|
|
1533
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1534
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1535
|
+
|
|
1536
|
+
http_res = self.do_request(
|
|
1537
|
+
hook_ctx=HookContext(
|
|
1538
|
+
base_url=base_url or "",
|
|
1539
|
+
operation_id="delete-virtual-networks-assignments",
|
|
1540
|
+
oauth2_scopes=[],
|
|
1541
|
+
security_source=get_security_from_env(
|
|
1542
|
+
self.sdk_configuration.security, models.Security
|
|
1543
|
+
),
|
|
1544
|
+
),
|
|
1545
|
+
request=req,
|
|
1546
|
+
error_status_codes=["403", "423", "4XX", "5XX"],
|
|
1547
|
+
retry_config=retry_config,
|
|
1548
|
+
)
|
|
1549
|
+
|
|
1550
|
+
response_data: Any = None
|
|
1551
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1552
|
+
return
|
|
1553
|
+
if utils.match_response(http_res, ["403", "423"], "application/vnd.api+json"):
|
|
1554
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1555
|
+
raise models.ErrorObject(data=response_data)
|
|
1556
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1557
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1558
|
+
raise models.APIError(
|
|
1559
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1560
|
+
)
|
|
1561
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1562
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1563
|
+
raise models.APIError(
|
|
1564
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1565
|
+
)
|
|
1566
|
+
|
|
1567
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1568
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1569
|
+
raise models.APIError(
|
|
1570
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1571
|
+
http_res.status_code,
|
|
1572
|
+
http_res_text,
|
|
1573
|
+
http_res,
|
|
1574
|
+
)
|
|
1575
|
+
|
|
1576
|
+
async def remove_assignment_async(
|
|
1577
|
+
self,
|
|
1578
|
+
*,
|
|
1579
|
+
assignment_id: str,
|
|
1580
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1581
|
+
server_url: Optional[str] = None,
|
|
1582
|
+
timeout_ms: Optional[int] = None,
|
|
1583
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1584
|
+
):
|
|
1585
|
+
r"""Delete Virtual Network Assignment
|
|
1586
|
+
|
|
1587
|
+
Allow you to remove a Virtual Network assignment.
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
:param assignment_id:
|
|
1591
|
+
:param retries: Override the default retry configuration for this method
|
|
1592
|
+
:param server_url: Override the default server URL for this method
|
|
1593
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1594
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1595
|
+
"""
|
|
1596
|
+
base_url = None
|
|
1597
|
+
url_variables = None
|
|
1598
|
+
if timeout_ms is None:
|
|
1599
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1600
|
+
|
|
1601
|
+
if server_url is not None:
|
|
1602
|
+
base_url = server_url
|
|
1603
|
+
else:
|
|
1604
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1605
|
+
|
|
1606
|
+
request = models.DeleteVirtualNetworksAssignmentsRequest(
|
|
1607
|
+
assignment_id=assignment_id,
|
|
1608
|
+
)
|
|
1609
|
+
|
|
1610
|
+
req = self._build_request_async(
|
|
1611
|
+
method="DELETE",
|
|
1612
|
+
path="/virtual_networks/assignments/{assignment_id}",
|
|
1613
|
+
base_url=base_url,
|
|
1614
|
+
url_variables=url_variables,
|
|
1615
|
+
request=request,
|
|
1616
|
+
request_body_required=False,
|
|
1617
|
+
request_has_path_params=True,
|
|
1618
|
+
request_has_query_params=True,
|
|
1619
|
+
user_agent_header="user-agent",
|
|
1620
|
+
accept_header_value="application/vnd.api+json",
|
|
1621
|
+
http_headers=http_headers,
|
|
1622
|
+
security=self.sdk_configuration.security,
|
|
1623
|
+
timeout_ms=timeout_ms,
|
|
1624
|
+
)
|
|
1625
|
+
|
|
1626
|
+
if retries == UNSET:
|
|
1627
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1628
|
+
retries = self.sdk_configuration.retry_config
|
|
1629
|
+
|
|
1630
|
+
retry_config = None
|
|
1631
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1632
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1633
|
+
|
|
1634
|
+
http_res = await self.do_request_async(
|
|
1635
|
+
hook_ctx=HookContext(
|
|
1636
|
+
base_url=base_url or "",
|
|
1637
|
+
operation_id="delete-virtual-networks-assignments",
|
|
1638
|
+
oauth2_scopes=[],
|
|
1639
|
+
security_source=get_security_from_env(
|
|
1640
|
+
self.sdk_configuration.security, models.Security
|
|
1641
|
+
),
|
|
1642
|
+
),
|
|
1643
|
+
request=req,
|
|
1644
|
+
error_status_codes=["403", "423", "4XX", "5XX"],
|
|
1645
|
+
retry_config=retry_config,
|
|
1646
|
+
)
|
|
1647
|
+
|
|
1648
|
+
response_data: Any = None
|
|
1649
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1650
|
+
return
|
|
1651
|
+
if utils.match_response(http_res, ["403", "423"], "application/vnd.api+json"):
|
|
1652
|
+
response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
|
|
1653
|
+
raise models.ErrorObject(data=response_data)
|
|
1654
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1655
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1656
|
+
raise models.APIError(
|
|
1657
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1658
|
+
)
|
|
1659
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1660
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1661
|
+
raise models.APIError(
|
|
1662
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1663
|
+
)
|
|
1664
|
+
|
|
1665
|
+
content_type = http_res.headers.get("Content-Type")
|
|
1666
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1667
|
+
raise models.APIError(
|
|
1668
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1669
|
+
http_res.status_code,
|
|
1670
|
+
http_res_text,
|
|
1671
|
+
http_res,
|
|
1672
|
+
)
|