latitudesh-python-sdk 2.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- latitudesh_python_sdk/__init__.py +18 -0
- latitudesh_python_sdk/_hooks/__init__.py +5 -0
- latitudesh_python_sdk/_hooks/registration.py +13 -0
- latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
- latitudesh_python_sdk/_hooks/types.py +113 -0
- latitudesh_python_sdk/_version.py +17 -0
- latitudesh_python_sdk/apikeys.py +703 -0
- latitudesh_python_sdk/basesdk.py +374 -0
- latitudesh_python_sdk/billing.py +197 -0
- latitudesh_python_sdk/events_sdk.py +298 -0
- latitudesh_python_sdk/firewalls_sdk.py +1786 -0
- latitudesh_python_sdk/httpclient.py +125 -0
- latitudesh_python_sdk/ipaddresses_sdk.py +470 -0
- latitudesh_python_sdk/models/__init__.py +3581 -0
- latitudesh_python_sdk/models/api_key.py +81 -0
- latitudesh_python_sdk/models/apierror.py +40 -0
- latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
- latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
- latitudesh_python_sdk/models/bandwidth_plan_data.py +72 -0
- latitudesh_python_sdk/models/bandwidth_plans.py +26 -0
- latitudesh_python_sdk/models/billing_usage.py +249 -0
- latitudesh_python_sdk/models/container_plan_data.py +163 -0
- latitudesh_python_sdk/models/create_api_key.py +40 -0
- latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
- latitudesh_python_sdk/models/create_firewallop.py +73 -0
- latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
- latitudesh_python_sdk/models/create_projectop.py +79 -0
- latitudesh_python_sdk/models/create_server_actionop.py +69 -0
- latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
- latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
- latitudesh_python_sdk/models/create_serverop.py +173 -0
- latitudesh_python_sdk/models/create_tagop.py +50 -0
- latitudesh_python_sdk/models/create_virtual_machine_actionop.py +63 -0
- latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
- latitudesh_python_sdk/models/custom_tag.py +26 -0
- latitudesh_python_sdk/models/custom_tag_data.py +54 -0
- latitudesh_python_sdk/models/custom_tags.py +26 -0
- latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
- latitudesh_python_sdk/models/delete_firewallop.py +18 -0
- latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
- latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
- latitudesh_python_sdk/models/delete_projectop.py +18 -0
- latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
- latitudesh_python_sdk/models/delete_storage_volumesop.py +16 -0
- latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
- latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
- latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/deploy_config.py +62 -0
- latitudesh_python_sdk/models/destroy_serverop.py +31 -0
- latitudesh_python_sdk/models/destroy_tagop.py +16 -0
- latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
- latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
- latitudesh_python_sdk/models/event_data.py +98 -0
- latitudesh_python_sdk/models/events.py +26 -0
- latitudesh_python_sdk/models/filesystem_data.py +57 -0
- latitudesh_python_sdk/models/firewall.py +26 -0
- latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
- latitudesh_python_sdk/models/firewall_assignments.py +29 -0
- latitudesh_python_sdk/models/firewall_data.py +75 -0
- latitudesh_python_sdk/models/firewall_server.py +36 -0
- latitudesh_python_sdk/models/firewalls.py +26 -0
- latitudesh_python_sdk/models/get_all_firewall_assignmentsop.py +51 -0
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +62 -0
- latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
- latitudesh_python_sdk/models/get_containers_planop.py +18 -0
- latitudesh_python_sdk/models/get_eventsop.py +126 -0
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +53 -0
- latitudesh_python_sdk/models/get_firewallop.py +18 -0
- latitudesh_python_sdk/models/get_ipop.py +33 -0
- latitudesh_python_sdk/models/get_ipsop.py +120 -0
- latitudesh_python_sdk/models/get_planop.py +16 -0
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +54 -0
- latitudesh_python_sdk/models/get_plansop.py +125 -0
- latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
- latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
- latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
- latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
- latitudesh_python_sdk/models/get_projectsop.py +105 -0
- latitudesh_python_sdk/models/get_regionop.py +18 -0
- latitudesh_python_sdk/models/get_regionsop.py +42 -0
- latitudesh_python_sdk/models/get_role_idop.py +16 -0
- latitudesh_python_sdk/models/get_rolesop.py +54 -0
- latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
- latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
- latitudesh_python_sdk/models/get_serverop.py +33 -0
- latitudesh_python_sdk/models/get_serversop.py +185 -0
- latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
- latitudesh_python_sdk/models/get_ssh_keysop.py +31 -0
- latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
- latitudesh_python_sdk/models/get_storage_volumeop.py +32 -0
- latitudesh_python_sdk/models/get_storage_volumesop.py +35 -0
- latitudesh_python_sdk/models/get_team_membersop.py +42 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +49 -0
- latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
- latitudesh_python_sdk/models/get_user_dataop.py +31 -0
- latitudesh_python_sdk/models/get_user_profileop.py +19 -0
- latitudesh_python_sdk/models/get_users_dataop.py +44 -0
- latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +72 -0
- latitudesh_python_sdk/models/get_virtual_networksop.py +69 -0
- latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
- latitudesh_python_sdk/models/index_virtual_machineop.py +31 -0
- latitudesh_python_sdk/models/ip_address.py +122 -0
- latitudesh_python_sdk/models/ip_addresses.py +15 -0
- latitudesh_python_sdk/models/ipmi_session.py +53 -0
- latitudesh_python_sdk/models/latitudesherror.py +30 -0
- latitudesh_python_sdk/models/list_firewallsop.py +49 -0
- latitudesh_python_sdk/models/membership.py +63 -0
- latitudesh_python_sdk/models/no_response_error.py +17 -0
- latitudesh_python_sdk/models/operating_system_data.py +65 -0
- latitudesh_python_sdk/models/operating_systems.py +26 -0
- latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
- latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
- latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
- latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
- latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
- latitudesh_python_sdk/models/plan.py +15 -0
- latitudesh_python_sdk/models/plan_data.py +210 -0
- latitudesh_python_sdk/models/post_api_keyop.py +19 -0
- latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
- latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
- latitudesh_python_sdk/models/post_ssh_keyop.py +63 -0
- latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
- latitudesh_python_sdk/models/post_storage_volumes_mountop.py +62 -0
- latitudesh_python_sdk/models/post_storage_volumesop.py +63 -0
- latitudesh_python_sdk/models/post_team_membersop.py +54 -0
- latitudesh_python_sdk/models/post_teamop.py +67 -0
- latitudesh_python_sdk/models/post_user_dataop.py +50 -0
- latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
- latitudesh_python_sdk/models/project.py +131 -0
- latitudesh_python_sdk/models/project_include.py +75 -0
- latitudesh_python_sdk/models/projects.py +15 -0
- latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
- latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
- latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
- latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/region.py +50 -0
- latitudesh_python_sdk/models/region_resource_data.py +37 -0
- latitudesh_python_sdk/models/regions.py +50 -0
- latitudesh_python_sdk/models/responsevalidationerror.py +27 -0
- latitudesh_python_sdk/models/role.py +26 -0
- latitudesh_python_sdk/models/role_data.py +35 -0
- latitudesh_python_sdk/models/security.py +25 -0
- latitudesh_python_sdk/models/server.py +26 -0
- latitudesh_python_sdk/models/server_action.py +52 -0
- latitudesh_python_sdk/models/server_data.py +280 -0
- latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_lockop.py +16 -0
- latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
- latitudesh_python_sdk/models/server_rescue.py +22 -0
- latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
- latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_unlockop.py +16 -0
- latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/servers.py +26 -0
- latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/ssh_key_data.py +55 -0
- latitudesh_python_sdk/models/ssh_keys.py +26 -0
- latitudesh_python_sdk/models/storage_plan_data.py +47 -0
- latitudesh_python_sdk/models/storage_plans.py +26 -0
- latitudesh_python_sdk/models/team.py +74 -0
- latitudesh_python_sdk/models/team_include.py +43 -0
- latitudesh_python_sdk/models/team_members.py +51 -0
- latitudesh_python_sdk/models/teams.py +26 -0
- latitudesh_python_sdk/models/traffic.py +133 -0
- latitudesh_python_sdk/models/traffic_quota.py +106 -0
- latitudesh_python_sdk/models/update_api_key.py +48 -0
- latitudesh_python_sdk/models/update_api_keyop.py +41 -0
- latitudesh_python_sdk/models/update_firewallop.py +89 -0
- latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
- latitudesh_python_sdk/models/update_projectop.py +95 -0
- latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
- latitudesh_python_sdk/models/update_serverop.py +85 -0
- latitudesh_python_sdk/models/update_tagop.py +74 -0
- latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
- latitudesh_python_sdk/models/user.py +59 -0
- latitudesh_python_sdk/models/user_data.py +26 -0
- latitudesh_python_sdk/models/user_data_properties.py +46 -0
- latitudesh_python_sdk/models/user_include.py +52 -0
- latitudesh_python_sdk/models/user_team.py +61 -0
- latitudesh_python_sdk/models/user_teams.py +26 -0
- latitudesh_python_sdk/models/user_update.py +37 -0
- latitudesh_python_sdk/models/virtual_machine.py +29 -0
- latitudesh_python_sdk/models/virtual_machine_attributes.py +115 -0
- latitudesh_python_sdk/models/virtual_machine_payload.py +47 -0
- latitudesh_python_sdk/models/virtual_machine_plans.py +181 -0
- latitudesh_python_sdk/models/virtual_network.py +26 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +29 -0
- latitudesh_python_sdk/models/virtual_network_assignment_data.py +65 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
- latitudesh_python_sdk/models/virtual_network_data.py +114 -0
- latitudesh_python_sdk/models/virtual_networks.py +26 -0
- latitudesh_python_sdk/models/volume_data.py +111 -0
- latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
- latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
- latitudesh_python_sdk/operatingsystems_sdk.py +238 -0
- latitudesh_python_sdk/plans.py +1304 -0
- latitudesh_python_sdk/privatenetworks.py +1612 -0
- latitudesh_python_sdk/projects_sdk.py +830 -0
- latitudesh_python_sdk/py.typed +1 -0
- latitudesh_python_sdk/regions_sdk.py +398 -0
- latitudesh_python_sdk/roles.py +398 -0
- latitudesh_python_sdk/sdk.py +264 -0
- latitudesh_python_sdk/sdkconfiguration.py +50 -0
- latitudesh_python_sdk/servers_sdk.py +3414 -0
- latitudesh_python_sdk/sshkeys_sdk.py +1882 -0
- latitudesh_python_sdk/storage.py +1651 -0
- latitudesh_python_sdk/tags.py +715 -0
- latitudesh_python_sdk/teams_sdk.py +527 -0
- latitudesh_python_sdk/teamsmembers.py +576 -0
- latitudesh_python_sdk/traffic_sdk.py +357 -0
- latitudesh_python_sdk/types/__init__.py +21 -0
- latitudesh_python_sdk/types/basemodel.py +39 -0
- latitudesh_python_sdk/userdata_sdk.py +1888 -0
- latitudesh_python_sdk/userprofile.py +531 -0
- latitudesh_python_sdk/utils/__init__.py +200 -0
- latitudesh_python_sdk/utils/annotations.py +79 -0
- latitudesh_python_sdk/utils/datetimes.py +23 -0
- latitudesh_python_sdk/utils/enums.py +74 -0
- latitudesh_python_sdk/utils/eventstreaming.py +248 -0
- latitudesh_python_sdk/utils/forms.py +234 -0
- latitudesh_python_sdk/utils/headers.py +136 -0
- latitudesh_python_sdk/utils/logger.py +27 -0
- latitudesh_python_sdk/utils/metadata.py +118 -0
- latitudesh_python_sdk/utils/queryparams.py +217 -0
- latitudesh_python_sdk/utils/requestbodies.py +66 -0
- latitudesh_python_sdk/utils/retries.py +281 -0
- latitudesh_python_sdk/utils/security.py +192 -0
- latitudesh_python_sdk/utils/serializers.py +249 -0
- latitudesh_python_sdk/utils/unmarshal_json_response.py +38 -0
- latitudesh_python_sdk/utils/url.py +155 -0
- latitudesh_python_sdk/utils/values.py +137 -0
- latitudesh_python_sdk/virtualmachines.py +941 -0
- latitudesh_python_sdk/vpnsessions.py +715 -0
- latitudesh_python_sdk-2.3.0.dist-info/METADATA +787 -0
- latitudesh_python_sdk-2.3.0.dist-info/RECORD +242 -0
- latitudesh_python_sdk-2.3.0.dist-info/WHEEL +4 -0
- latitudesh_python_sdk-2.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,1612 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from jsonpath import JSONPath
|
|
5
|
+
from latitudesh_python_sdk import models, utils
|
|
6
|
+
from latitudesh_python_sdk._hooks import HookContext
|
|
7
|
+
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
8
|
+
from latitudesh_python_sdk.utils import get_security_from_env
|
|
9
|
+
from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
|
+
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PrivateNetworks(BaseSDK):
|
|
14
|
+
def list(
|
|
15
|
+
self,
|
|
16
|
+
*,
|
|
17
|
+
filter_location: Optional[str] = None,
|
|
18
|
+
filter_project: Optional[str] = None,
|
|
19
|
+
filter_tags: Optional[str] = None,
|
|
20
|
+
page_size: Optional[int] = 20,
|
|
21
|
+
page_number: Optional[int] = 1,
|
|
22
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
23
|
+
server_url: Optional[str] = None,
|
|
24
|
+
timeout_ms: Optional[int] = None,
|
|
25
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
26
|
+
) -> Optional[models.GetVirtualNetworksResponse]:
|
|
27
|
+
r"""List all Virtual Networks
|
|
28
|
+
|
|
29
|
+
Lists virtual networks assigned to a project
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
:param filter_location: The location slug to filter by
|
|
33
|
+
:param filter_project: The project id or slug to filter by
|
|
34
|
+
: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`
|
|
35
|
+
:param page_size: Number of items to return per page
|
|
36
|
+
:param page_number: Page number to return (starts at 1)
|
|
37
|
+
:param retries: Override the default retry configuration for this method
|
|
38
|
+
:param server_url: Override the default server URL for this method
|
|
39
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
40
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
41
|
+
"""
|
|
42
|
+
base_url = None
|
|
43
|
+
url_variables = None
|
|
44
|
+
if timeout_ms is None:
|
|
45
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
46
|
+
|
|
47
|
+
if server_url is not None:
|
|
48
|
+
base_url = server_url
|
|
49
|
+
else:
|
|
50
|
+
base_url = self._get_url(base_url, url_variables)
|
|
51
|
+
|
|
52
|
+
request = models.GetVirtualNetworksRequest(
|
|
53
|
+
filter_location=filter_location,
|
|
54
|
+
filter_project=filter_project,
|
|
55
|
+
filter_tags=filter_tags,
|
|
56
|
+
page_size=page_size,
|
|
57
|
+
page_number=page_number,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
req = self._build_request(
|
|
61
|
+
method="GET",
|
|
62
|
+
path="/virtual_networks",
|
|
63
|
+
base_url=base_url,
|
|
64
|
+
url_variables=url_variables,
|
|
65
|
+
request=request,
|
|
66
|
+
request_body_required=False,
|
|
67
|
+
request_has_path_params=False,
|
|
68
|
+
request_has_query_params=True,
|
|
69
|
+
user_agent_header="user-agent",
|
|
70
|
+
accept_header_value="application/vnd.api+json",
|
|
71
|
+
http_headers=http_headers,
|
|
72
|
+
security=self.sdk_configuration.security,
|
|
73
|
+
allow_empty_value=None,
|
|
74
|
+
timeout_ms=timeout_ms,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
if retries == UNSET:
|
|
78
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
79
|
+
retries = self.sdk_configuration.retry_config
|
|
80
|
+
|
|
81
|
+
retry_config = None
|
|
82
|
+
if isinstance(retries, utils.RetryConfig):
|
|
83
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
84
|
+
|
|
85
|
+
http_res = self.do_request(
|
|
86
|
+
hook_ctx=HookContext(
|
|
87
|
+
config=self.sdk_configuration,
|
|
88
|
+
base_url=base_url or "",
|
|
89
|
+
operation_id="get-virtual-networks",
|
|
90
|
+
oauth2_scopes=None,
|
|
91
|
+
security_source=get_security_from_env(
|
|
92
|
+
self.sdk_configuration.security, models.Security
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
request=req,
|
|
96
|
+
error_status_codes=["4XX", "5XX"],
|
|
97
|
+
retry_config=retry_config,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def next_func() -> Optional[models.GetVirtualNetworksResponse]:
|
|
101
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
102
|
+
page = request.page_number if not request.page_number is None else 1
|
|
103
|
+
next_page = page + 1
|
|
104
|
+
|
|
105
|
+
if not http_res.text:
|
|
106
|
+
return None
|
|
107
|
+
results = JSONPath("$.data").parse(body)
|
|
108
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
109
|
+
return None
|
|
110
|
+
limit = request.page_size if not request.page_size is None else 20
|
|
111
|
+
if len(results[0]) < limit:
|
|
112
|
+
return None
|
|
113
|
+
|
|
114
|
+
return self.list(
|
|
115
|
+
filter_location=filter_location,
|
|
116
|
+
filter_project=filter_project,
|
|
117
|
+
filter_tags=filter_tags,
|
|
118
|
+
page_size=page_size,
|
|
119
|
+
page_number=next_page,
|
|
120
|
+
retries=retries,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
124
|
+
return models.GetVirtualNetworksResponse(
|
|
125
|
+
result=unmarshal_json_response(models.VirtualNetworks, http_res),
|
|
126
|
+
next=next_func,
|
|
127
|
+
)
|
|
128
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
129
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
130
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
131
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
132
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
133
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
134
|
+
|
|
135
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
136
|
+
|
|
137
|
+
async def list_async(
|
|
138
|
+
self,
|
|
139
|
+
*,
|
|
140
|
+
filter_location: Optional[str] = None,
|
|
141
|
+
filter_project: Optional[str] = None,
|
|
142
|
+
filter_tags: Optional[str] = None,
|
|
143
|
+
page_size: Optional[int] = 20,
|
|
144
|
+
page_number: Optional[int] = 1,
|
|
145
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
146
|
+
server_url: Optional[str] = None,
|
|
147
|
+
timeout_ms: Optional[int] = None,
|
|
148
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
149
|
+
) -> Optional[models.GetVirtualNetworksResponse]:
|
|
150
|
+
r"""List all Virtual Networks
|
|
151
|
+
|
|
152
|
+
Lists virtual networks assigned to a project
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
:param filter_location: The location slug to filter by
|
|
156
|
+
:param filter_project: The project id or slug to filter by
|
|
157
|
+
: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`
|
|
158
|
+
:param page_size: Number of items to return per page
|
|
159
|
+
:param page_number: Page number to return (starts at 1)
|
|
160
|
+
:param retries: Override the default retry configuration for this method
|
|
161
|
+
:param server_url: Override the default server URL for this method
|
|
162
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
163
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
164
|
+
"""
|
|
165
|
+
base_url = None
|
|
166
|
+
url_variables = None
|
|
167
|
+
if timeout_ms is None:
|
|
168
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
169
|
+
|
|
170
|
+
if server_url is not None:
|
|
171
|
+
base_url = server_url
|
|
172
|
+
else:
|
|
173
|
+
base_url = self._get_url(base_url, url_variables)
|
|
174
|
+
|
|
175
|
+
request = models.GetVirtualNetworksRequest(
|
|
176
|
+
filter_location=filter_location,
|
|
177
|
+
filter_project=filter_project,
|
|
178
|
+
filter_tags=filter_tags,
|
|
179
|
+
page_size=page_size,
|
|
180
|
+
page_number=page_number,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
req = self._build_request_async(
|
|
184
|
+
method="GET",
|
|
185
|
+
path="/virtual_networks",
|
|
186
|
+
base_url=base_url,
|
|
187
|
+
url_variables=url_variables,
|
|
188
|
+
request=request,
|
|
189
|
+
request_body_required=False,
|
|
190
|
+
request_has_path_params=False,
|
|
191
|
+
request_has_query_params=True,
|
|
192
|
+
user_agent_header="user-agent",
|
|
193
|
+
accept_header_value="application/vnd.api+json",
|
|
194
|
+
http_headers=http_headers,
|
|
195
|
+
security=self.sdk_configuration.security,
|
|
196
|
+
allow_empty_value=None,
|
|
197
|
+
timeout_ms=timeout_ms,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
if retries == UNSET:
|
|
201
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
202
|
+
retries = self.sdk_configuration.retry_config
|
|
203
|
+
|
|
204
|
+
retry_config = None
|
|
205
|
+
if isinstance(retries, utils.RetryConfig):
|
|
206
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
207
|
+
|
|
208
|
+
http_res = await self.do_request_async(
|
|
209
|
+
hook_ctx=HookContext(
|
|
210
|
+
config=self.sdk_configuration,
|
|
211
|
+
base_url=base_url or "",
|
|
212
|
+
operation_id="get-virtual-networks",
|
|
213
|
+
oauth2_scopes=None,
|
|
214
|
+
security_source=get_security_from_env(
|
|
215
|
+
self.sdk_configuration.security, models.Security
|
|
216
|
+
),
|
|
217
|
+
),
|
|
218
|
+
request=req,
|
|
219
|
+
error_status_codes=["4XX", "5XX"],
|
|
220
|
+
retry_config=retry_config,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
def next_func() -> Optional[models.GetVirtualNetworksResponse]:
|
|
224
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
225
|
+
page = request.page_number if not request.page_number is None else 1
|
|
226
|
+
next_page = page + 1
|
|
227
|
+
|
|
228
|
+
if not http_res.text:
|
|
229
|
+
return None
|
|
230
|
+
results = JSONPath("$.data").parse(body)
|
|
231
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
232
|
+
return None
|
|
233
|
+
limit = request.page_size if not request.page_size is None else 20
|
|
234
|
+
if len(results[0]) < limit:
|
|
235
|
+
return None
|
|
236
|
+
|
|
237
|
+
return self.list(
|
|
238
|
+
filter_location=filter_location,
|
|
239
|
+
filter_project=filter_project,
|
|
240
|
+
filter_tags=filter_tags,
|
|
241
|
+
page_size=page_size,
|
|
242
|
+
page_number=next_page,
|
|
243
|
+
retries=retries,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
247
|
+
return models.GetVirtualNetworksResponse(
|
|
248
|
+
result=unmarshal_json_response(models.VirtualNetworks, http_res),
|
|
249
|
+
next=next_func,
|
|
250
|
+
)
|
|
251
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
252
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
253
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
254
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
255
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
256
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
257
|
+
|
|
258
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
259
|
+
|
|
260
|
+
def create(
|
|
261
|
+
self,
|
|
262
|
+
*,
|
|
263
|
+
data: Union[
|
|
264
|
+
models.CreateVirtualNetworkPrivateNetworksData,
|
|
265
|
+
models.CreateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
266
|
+
],
|
|
267
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
268
|
+
server_url: Optional[str] = None,
|
|
269
|
+
timeout_ms: Optional[int] = None,
|
|
270
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
271
|
+
) -> models.VirtualNetwork:
|
|
272
|
+
r"""Create a Virtual Network
|
|
273
|
+
|
|
274
|
+
Creates a new Virtual Network.
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
:param data:
|
|
278
|
+
:param retries: Override the default retry configuration for this method
|
|
279
|
+
:param server_url: Override the default server URL for this method
|
|
280
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
281
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
282
|
+
"""
|
|
283
|
+
base_url = None
|
|
284
|
+
url_variables = None
|
|
285
|
+
if timeout_ms is None:
|
|
286
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
287
|
+
|
|
288
|
+
if server_url is not None:
|
|
289
|
+
base_url = server_url
|
|
290
|
+
else:
|
|
291
|
+
base_url = self._get_url(base_url, url_variables)
|
|
292
|
+
|
|
293
|
+
request = models.CreateVirtualNetworkPrivateNetworksRequestBody(
|
|
294
|
+
data=utils.get_pydantic_model(
|
|
295
|
+
data, models.CreateVirtualNetworkPrivateNetworksData
|
|
296
|
+
),
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
req = self._build_request(
|
|
300
|
+
method="POST",
|
|
301
|
+
path="/virtual_networks",
|
|
302
|
+
base_url=base_url,
|
|
303
|
+
url_variables=url_variables,
|
|
304
|
+
request=request,
|
|
305
|
+
request_body_required=True,
|
|
306
|
+
request_has_path_params=False,
|
|
307
|
+
request_has_query_params=True,
|
|
308
|
+
user_agent_header="user-agent",
|
|
309
|
+
accept_header_value="application/vnd.api+json",
|
|
310
|
+
http_headers=http_headers,
|
|
311
|
+
security=self.sdk_configuration.security,
|
|
312
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
313
|
+
request,
|
|
314
|
+
False,
|
|
315
|
+
False,
|
|
316
|
+
"json",
|
|
317
|
+
models.CreateVirtualNetworkPrivateNetworksRequestBody,
|
|
318
|
+
),
|
|
319
|
+
allow_empty_value=None,
|
|
320
|
+
timeout_ms=timeout_ms,
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
if retries == UNSET:
|
|
324
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
325
|
+
retries = self.sdk_configuration.retry_config
|
|
326
|
+
|
|
327
|
+
retry_config = None
|
|
328
|
+
if isinstance(retries, utils.RetryConfig):
|
|
329
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
330
|
+
|
|
331
|
+
http_res = self.do_request(
|
|
332
|
+
hook_ctx=HookContext(
|
|
333
|
+
config=self.sdk_configuration,
|
|
334
|
+
base_url=base_url or "",
|
|
335
|
+
operation_id="create-virtual-network",
|
|
336
|
+
oauth2_scopes=None,
|
|
337
|
+
security_source=get_security_from_env(
|
|
338
|
+
self.sdk_configuration.security, models.Security
|
|
339
|
+
),
|
|
340
|
+
),
|
|
341
|
+
request=req,
|
|
342
|
+
error_status_codes=["4XX", "5XX"],
|
|
343
|
+
retry_config=retry_config,
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
347
|
+
return unmarshal_json_response(models.VirtualNetwork, http_res)
|
|
348
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
349
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
350
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
351
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
352
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
353
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
354
|
+
|
|
355
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
356
|
+
|
|
357
|
+
async def create_async(
|
|
358
|
+
self,
|
|
359
|
+
*,
|
|
360
|
+
data: Union[
|
|
361
|
+
models.CreateVirtualNetworkPrivateNetworksData,
|
|
362
|
+
models.CreateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
363
|
+
],
|
|
364
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
365
|
+
server_url: Optional[str] = None,
|
|
366
|
+
timeout_ms: Optional[int] = None,
|
|
367
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
368
|
+
) -> models.VirtualNetwork:
|
|
369
|
+
r"""Create a Virtual Network
|
|
370
|
+
|
|
371
|
+
Creates a new Virtual Network.
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
:param data:
|
|
375
|
+
:param retries: Override the default retry configuration for this method
|
|
376
|
+
:param server_url: Override the default server URL for this method
|
|
377
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
378
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
379
|
+
"""
|
|
380
|
+
base_url = None
|
|
381
|
+
url_variables = None
|
|
382
|
+
if timeout_ms is None:
|
|
383
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
384
|
+
|
|
385
|
+
if server_url is not None:
|
|
386
|
+
base_url = server_url
|
|
387
|
+
else:
|
|
388
|
+
base_url = self._get_url(base_url, url_variables)
|
|
389
|
+
|
|
390
|
+
request = models.CreateVirtualNetworkPrivateNetworksRequestBody(
|
|
391
|
+
data=utils.get_pydantic_model(
|
|
392
|
+
data, models.CreateVirtualNetworkPrivateNetworksData
|
|
393
|
+
),
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
req = self._build_request_async(
|
|
397
|
+
method="POST",
|
|
398
|
+
path="/virtual_networks",
|
|
399
|
+
base_url=base_url,
|
|
400
|
+
url_variables=url_variables,
|
|
401
|
+
request=request,
|
|
402
|
+
request_body_required=True,
|
|
403
|
+
request_has_path_params=False,
|
|
404
|
+
request_has_query_params=True,
|
|
405
|
+
user_agent_header="user-agent",
|
|
406
|
+
accept_header_value="application/vnd.api+json",
|
|
407
|
+
http_headers=http_headers,
|
|
408
|
+
security=self.sdk_configuration.security,
|
|
409
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
410
|
+
request,
|
|
411
|
+
False,
|
|
412
|
+
False,
|
|
413
|
+
"json",
|
|
414
|
+
models.CreateVirtualNetworkPrivateNetworksRequestBody,
|
|
415
|
+
),
|
|
416
|
+
allow_empty_value=None,
|
|
417
|
+
timeout_ms=timeout_ms,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
if retries == UNSET:
|
|
421
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
422
|
+
retries = self.sdk_configuration.retry_config
|
|
423
|
+
|
|
424
|
+
retry_config = None
|
|
425
|
+
if isinstance(retries, utils.RetryConfig):
|
|
426
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
427
|
+
|
|
428
|
+
http_res = await self.do_request_async(
|
|
429
|
+
hook_ctx=HookContext(
|
|
430
|
+
config=self.sdk_configuration,
|
|
431
|
+
base_url=base_url or "",
|
|
432
|
+
operation_id="create-virtual-network",
|
|
433
|
+
oauth2_scopes=None,
|
|
434
|
+
security_source=get_security_from_env(
|
|
435
|
+
self.sdk_configuration.security, models.Security
|
|
436
|
+
),
|
|
437
|
+
),
|
|
438
|
+
request=req,
|
|
439
|
+
error_status_codes=["4XX", "5XX"],
|
|
440
|
+
retry_config=retry_config,
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
444
|
+
return unmarshal_json_response(models.VirtualNetwork, http_res)
|
|
445
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
446
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
447
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
448
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
449
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
450
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
451
|
+
|
|
452
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
453
|
+
|
|
454
|
+
def update(
|
|
455
|
+
self,
|
|
456
|
+
*,
|
|
457
|
+
vlan_id: str,
|
|
458
|
+
data: Union[
|
|
459
|
+
models.UpdateVirtualNetworkPrivateNetworksData,
|
|
460
|
+
models.UpdateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
461
|
+
],
|
|
462
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
463
|
+
server_url: Optional[str] = None,
|
|
464
|
+
timeout_ms: Optional[int] = None,
|
|
465
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
466
|
+
) -> models.VirtualNetwork:
|
|
467
|
+
r"""Update a Virtual Network
|
|
468
|
+
|
|
469
|
+
Update a Virtual Network.
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
:param vlan_id: The Virtual Network ID
|
|
473
|
+
:param data:
|
|
474
|
+
:param retries: Override the default retry configuration for this method
|
|
475
|
+
:param server_url: Override the default server URL for this method
|
|
476
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
477
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
478
|
+
"""
|
|
479
|
+
base_url = None
|
|
480
|
+
url_variables = None
|
|
481
|
+
if timeout_ms is None:
|
|
482
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
483
|
+
|
|
484
|
+
if server_url is not None:
|
|
485
|
+
base_url = server_url
|
|
486
|
+
else:
|
|
487
|
+
base_url = self._get_url(base_url, url_variables)
|
|
488
|
+
|
|
489
|
+
request = models.UpdateVirtualNetworkRequest(
|
|
490
|
+
vlan_id=vlan_id,
|
|
491
|
+
request_body=models.UpdateVirtualNetworkPrivateNetworksRequestBody(
|
|
492
|
+
data=utils.get_pydantic_model(
|
|
493
|
+
data, models.UpdateVirtualNetworkPrivateNetworksData
|
|
494
|
+
),
|
|
495
|
+
),
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
req = self._build_request(
|
|
499
|
+
method="PATCH",
|
|
500
|
+
path="/virtual_networks/{vlan_id}",
|
|
501
|
+
base_url=base_url,
|
|
502
|
+
url_variables=url_variables,
|
|
503
|
+
request=request,
|
|
504
|
+
request_body_required=True,
|
|
505
|
+
request_has_path_params=True,
|
|
506
|
+
request_has_query_params=True,
|
|
507
|
+
user_agent_header="user-agent",
|
|
508
|
+
accept_header_value="application/vnd.api+json",
|
|
509
|
+
http_headers=http_headers,
|
|
510
|
+
security=self.sdk_configuration.security,
|
|
511
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
512
|
+
request.request_body,
|
|
513
|
+
False,
|
|
514
|
+
False,
|
|
515
|
+
"json",
|
|
516
|
+
models.UpdateVirtualNetworkPrivateNetworksRequestBody,
|
|
517
|
+
),
|
|
518
|
+
allow_empty_value=None,
|
|
519
|
+
timeout_ms=timeout_ms,
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
if retries == UNSET:
|
|
523
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
524
|
+
retries = self.sdk_configuration.retry_config
|
|
525
|
+
|
|
526
|
+
retry_config = None
|
|
527
|
+
if isinstance(retries, utils.RetryConfig):
|
|
528
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
529
|
+
|
|
530
|
+
http_res = self.do_request(
|
|
531
|
+
hook_ctx=HookContext(
|
|
532
|
+
config=self.sdk_configuration,
|
|
533
|
+
base_url=base_url or "",
|
|
534
|
+
operation_id="update-virtual-network",
|
|
535
|
+
oauth2_scopes=None,
|
|
536
|
+
security_source=get_security_from_env(
|
|
537
|
+
self.sdk_configuration.security, models.Security
|
|
538
|
+
),
|
|
539
|
+
),
|
|
540
|
+
request=req,
|
|
541
|
+
error_status_codes=["4XX", "5XX"],
|
|
542
|
+
retry_config=retry_config,
|
|
543
|
+
)
|
|
544
|
+
|
|
545
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
546
|
+
return unmarshal_json_response(models.VirtualNetwork, http_res)
|
|
547
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
548
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
549
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
550
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
551
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
552
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
553
|
+
|
|
554
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
555
|
+
|
|
556
|
+
async def update_async(
|
|
557
|
+
self,
|
|
558
|
+
*,
|
|
559
|
+
vlan_id: str,
|
|
560
|
+
data: Union[
|
|
561
|
+
models.UpdateVirtualNetworkPrivateNetworksData,
|
|
562
|
+
models.UpdateVirtualNetworkPrivateNetworksDataTypedDict,
|
|
563
|
+
],
|
|
564
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
565
|
+
server_url: Optional[str] = None,
|
|
566
|
+
timeout_ms: Optional[int] = None,
|
|
567
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
568
|
+
) -> models.VirtualNetwork:
|
|
569
|
+
r"""Update a Virtual Network
|
|
570
|
+
|
|
571
|
+
Update a Virtual Network.
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
:param vlan_id: The Virtual Network ID
|
|
575
|
+
:param data:
|
|
576
|
+
:param retries: Override the default retry configuration for this method
|
|
577
|
+
:param server_url: Override the default server URL for this method
|
|
578
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
579
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
580
|
+
"""
|
|
581
|
+
base_url = None
|
|
582
|
+
url_variables = None
|
|
583
|
+
if timeout_ms is None:
|
|
584
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
585
|
+
|
|
586
|
+
if server_url is not None:
|
|
587
|
+
base_url = server_url
|
|
588
|
+
else:
|
|
589
|
+
base_url = self._get_url(base_url, url_variables)
|
|
590
|
+
|
|
591
|
+
request = models.UpdateVirtualNetworkRequest(
|
|
592
|
+
vlan_id=vlan_id,
|
|
593
|
+
request_body=models.UpdateVirtualNetworkPrivateNetworksRequestBody(
|
|
594
|
+
data=utils.get_pydantic_model(
|
|
595
|
+
data, models.UpdateVirtualNetworkPrivateNetworksData
|
|
596
|
+
),
|
|
597
|
+
),
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
req = self._build_request_async(
|
|
601
|
+
method="PATCH",
|
|
602
|
+
path="/virtual_networks/{vlan_id}",
|
|
603
|
+
base_url=base_url,
|
|
604
|
+
url_variables=url_variables,
|
|
605
|
+
request=request,
|
|
606
|
+
request_body_required=True,
|
|
607
|
+
request_has_path_params=True,
|
|
608
|
+
request_has_query_params=True,
|
|
609
|
+
user_agent_header="user-agent",
|
|
610
|
+
accept_header_value="application/vnd.api+json",
|
|
611
|
+
http_headers=http_headers,
|
|
612
|
+
security=self.sdk_configuration.security,
|
|
613
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
614
|
+
request.request_body,
|
|
615
|
+
False,
|
|
616
|
+
False,
|
|
617
|
+
"json",
|
|
618
|
+
models.UpdateVirtualNetworkPrivateNetworksRequestBody,
|
|
619
|
+
),
|
|
620
|
+
allow_empty_value=None,
|
|
621
|
+
timeout_ms=timeout_ms,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
if retries == UNSET:
|
|
625
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
626
|
+
retries = self.sdk_configuration.retry_config
|
|
627
|
+
|
|
628
|
+
retry_config = None
|
|
629
|
+
if isinstance(retries, utils.RetryConfig):
|
|
630
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
631
|
+
|
|
632
|
+
http_res = await self.do_request_async(
|
|
633
|
+
hook_ctx=HookContext(
|
|
634
|
+
config=self.sdk_configuration,
|
|
635
|
+
base_url=base_url or "",
|
|
636
|
+
operation_id="update-virtual-network",
|
|
637
|
+
oauth2_scopes=None,
|
|
638
|
+
security_source=get_security_from_env(
|
|
639
|
+
self.sdk_configuration.security, models.Security
|
|
640
|
+
),
|
|
641
|
+
),
|
|
642
|
+
request=req,
|
|
643
|
+
error_status_codes=["4XX", "5XX"],
|
|
644
|
+
retry_config=retry_config,
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
648
|
+
return unmarshal_json_response(models.VirtualNetwork, http_res)
|
|
649
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
650
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
651
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
652
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
653
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
654
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
655
|
+
|
|
656
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
657
|
+
|
|
658
|
+
def delete_virtual_network(
|
|
659
|
+
self,
|
|
660
|
+
*,
|
|
661
|
+
vlan_id: str,
|
|
662
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
663
|
+
server_url: Optional[str] = None,
|
|
664
|
+
timeout_ms: Optional[int] = None,
|
|
665
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
666
|
+
):
|
|
667
|
+
r"""Delete a Virtual Network
|
|
668
|
+
|
|
669
|
+
Delete virtual network
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
:param vlan_id: The virtual network ID
|
|
673
|
+
:param retries: Override the default retry configuration for this method
|
|
674
|
+
:param server_url: Override the default server URL for this method
|
|
675
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
676
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
677
|
+
"""
|
|
678
|
+
base_url = None
|
|
679
|
+
url_variables = None
|
|
680
|
+
if timeout_ms is None:
|
|
681
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
682
|
+
|
|
683
|
+
if server_url is not None:
|
|
684
|
+
base_url = server_url
|
|
685
|
+
else:
|
|
686
|
+
base_url = self._get_url(base_url, url_variables)
|
|
687
|
+
|
|
688
|
+
request = models.DestroyVirtualNetworkRequest(
|
|
689
|
+
vlan_id=vlan_id,
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
req = self._build_request(
|
|
693
|
+
method="DELETE",
|
|
694
|
+
path="/virtual_networks/{vlan_id}",
|
|
695
|
+
base_url=base_url,
|
|
696
|
+
url_variables=url_variables,
|
|
697
|
+
request=request,
|
|
698
|
+
request_body_required=False,
|
|
699
|
+
request_has_path_params=True,
|
|
700
|
+
request_has_query_params=True,
|
|
701
|
+
user_agent_header="user-agent",
|
|
702
|
+
accept_header_value="*/*",
|
|
703
|
+
http_headers=http_headers,
|
|
704
|
+
security=self.sdk_configuration.security,
|
|
705
|
+
allow_empty_value=None,
|
|
706
|
+
timeout_ms=timeout_ms,
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
if retries == UNSET:
|
|
710
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
711
|
+
retries = self.sdk_configuration.retry_config
|
|
712
|
+
|
|
713
|
+
retry_config = None
|
|
714
|
+
if isinstance(retries, utils.RetryConfig):
|
|
715
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
716
|
+
|
|
717
|
+
http_res = self.do_request(
|
|
718
|
+
hook_ctx=HookContext(
|
|
719
|
+
config=self.sdk_configuration,
|
|
720
|
+
base_url=base_url or "",
|
|
721
|
+
operation_id="destroy-virtual-network",
|
|
722
|
+
oauth2_scopes=None,
|
|
723
|
+
security_source=get_security_from_env(
|
|
724
|
+
self.sdk_configuration.security, models.Security
|
|
725
|
+
),
|
|
726
|
+
),
|
|
727
|
+
request=req,
|
|
728
|
+
error_status_codes=["4XX", "5XX"],
|
|
729
|
+
retry_config=retry_config,
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
if utils.match_response(http_res, "204", "*"):
|
|
733
|
+
return
|
|
734
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
735
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
736
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
737
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
738
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
739
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
740
|
+
|
|
741
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
742
|
+
|
|
743
|
+
async def delete_virtual_network_async(
|
|
744
|
+
self,
|
|
745
|
+
*,
|
|
746
|
+
vlan_id: str,
|
|
747
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
748
|
+
server_url: Optional[str] = None,
|
|
749
|
+
timeout_ms: Optional[int] = None,
|
|
750
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
751
|
+
):
|
|
752
|
+
r"""Delete a Virtual Network
|
|
753
|
+
|
|
754
|
+
Delete virtual network
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
:param vlan_id: The virtual network ID
|
|
758
|
+
:param retries: Override the default retry configuration for this method
|
|
759
|
+
:param server_url: Override the default server URL for this method
|
|
760
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
761
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
762
|
+
"""
|
|
763
|
+
base_url = None
|
|
764
|
+
url_variables = None
|
|
765
|
+
if timeout_ms is None:
|
|
766
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
767
|
+
|
|
768
|
+
if server_url is not None:
|
|
769
|
+
base_url = server_url
|
|
770
|
+
else:
|
|
771
|
+
base_url = self._get_url(base_url, url_variables)
|
|
772
|
+
|
|
773
|
+
request = models.DestroyVirtualNetworkRequest(
|
|
774
|
+
vlan_id=vlan_id,
|
|
775
|
+
)
|
|
776
|
+
|
|
777
|
+
req = self._build_request_async(
|
|
778
|
+
method="DELETE",
|
|
779
|
+
path="/virtual_networks/{vlan_id}",
|
|
780
|
+
base_url=base_url,
|
|
781
|
+
url_variables=url_variables,
|
|
782
|
+
request=request,
|
|
783
|
+
request_body_required=False,
|
|
784
|
+
request_has_path_params=True,
|
|
785
|
+
request_has_query_params=True,
|
|
786
|
+
user_agent_header="user-agent",
|
|
787
|
+
accept_header_value="*/*",
|
|
788
|
+
http_headers=http_headers,
|
|
789
|
+
security=self.sdk_configuration.security,
|
|
790
|
+
allow_empty_value=None,
|
|
791
|
+
timeout_ms=timeout_ms,
|
|
792
|
+
)
|
|
793
|
+
|
|
794
|
+
if retries == UNSET:
|
|
795
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
796
|
+
retries = self.sdk_configuration.retry_config
|
|
797
|
+
|
|
798
|
+
retry_config = None
|
|
799
|
+
if isinstance(retries, utils.RetryConfig):
|
|
800
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
801
|
+
|
|
802
|
+
http_res = await self.do_request_async(
|
|
803
|
+
hook_ctx=HookContext(
|
|
804
|
+
config=self.sdk_configuration,
|
|
805
|
+
base_url=base_url or "",
|
|
806
|
+
operation_id="destroy-virtual-network",
|
|
807
|
+
oauth2_scopes=None,
|
|
808
|
+
security_source=get_security_from_env(
|
|
809
|
+
self.sdk_configuration.security, models.Security
|
|
810
|
+
),
|
|
811
|
+
),
|
|
812
|
+
request=req,
|
|
813
|
+
error_status_codes=["4XX", "5XX"],
|
|
814
|
+
retry_config=retry_config,
|
|
815
|
+
)
|
|
816
|
+
|
|
817
|
+
if utils.match_response(http_res, "204", "*"):
|
|
818
|
+
return
|
|
819
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
820
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
821
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
822
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
823
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
824
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
825
|
+
|
|
826
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
827
|
+
|
|
828
|
+
def get(
|
|
829
|
+
self,
|
|
830
|
+
*,
|
|
831
|
+
vlan_id: str,
|
|
832
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
833
|
+
server_url: Optional[str] = None,
|
|
834
|
+
timeout_ms: Optional[int] = None,
|
|
835
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
836
|
+
) -> models.GetVirtualNetworkResponseBody:
|
|
837
|
+
r"""Retrieve a Virtual Network
|
|
838
|
+
|
|
839
|
+
Retrieve a Virtual Network.
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
:param vlan_id: Virtual Network ID
|
|
843
|
+
:param retries: Override the default retry configuration for this method
|
|
844
|
+
:param server_url: Override the default server URL for this method
|
|
845
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
846
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
847
|
+
"""
|
|
848
|
+
base_url = None
|
|
849
|
+
url_variables = None
|
|
850
|
+
if timeout_ms is None:
|
|
851
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
852
|
+
|
|
853
|
+
if server_url is not None:
|
|
854
|
+
base_url = server_url
|
|
855
|
+
else:
|
|
856
|
+
base_url = self._get_url(base_url, url_variables)
|
|
857
|
+
|
|
858
|
+
request = models.GetVirtualNetworkRequest(
|
|
859
|
+
vlan_id=vlan_id,
|
|
860
|
+
)
|
|
861
|
+
|
|
862
|
+
req = self._build_request(
|
|
863
|
+
method="GET",
|
|
864
|
+
path="/virtual_networks/{vlan_id}",
|
|
865
|
+
base_url=base_url,
|
|
866
|
+
url_variables=url_variables,
|
|
867
|
+
request=request,
|
|
868
|
+
request_body_required=False,
|
|
869
|
+
request_has_path_params=True,
|
|
870
|
+
request_has_query_params=True,
|
|
871
|
+
user_agent_header="user-agent",
|
|
872
|
+
accept_header_value="application/vnd.api+json",
|
|
873
|
+
http_headers=http_headers,
|
|
874
|
+
security=self.sdk_configuration.security,
|
|
875
|
+
allow_empty_value=None,
|
|
876
|
+
timeout_ms=timeout_ms,
|
|
877
|
+
)
|
|
878
|
+
|
|
879
|
+
if retries == UNSET:
|
|
880
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
881
|
+
retries = self.sdk_configuration.retry_config
|
|
882
|
+
|
|
883
|
+
retry_config = None
|
|
884
|
+
if isinstance(retries, utils.RetryConfig):
|
|
885
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
886
|
+
|
|
887
|
+
http_res = self.do_request(
|
|
888
|
+
hook_ctx=HookContext(
|
|
889
|
+
config=self.sdk_configuration,
|
|
890
|
+
base_url=base_url or "",
|
|
891
|
+
operation_id="get-virtual-network",
|
|
892
|
+
oauth2_scopes=None,
|
|
893
|
+
security_source=get_security_from_env(
|
|
894
|
+
self.sdk_configuration.security, models.Security
|
|
895
|
+
),
|
|
896
|
+
),
|
|
897
|
+
request=req,
|
|
898
|
+
error_status_codes=["4XX", "5XX"],
|
|
899
|
+
retry_config=retry_config,
|
|
900
|
+
)
|
|
901
|
+
|
|
902
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
903
|
+
return unmarshal_json_response(
|
|
904
|
+
models.GetVirtualNetworkResponseBody, http_res
|
|
905
|
+
)
|
|
906
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
907
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
908
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
909
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
910
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
911
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
912
|
+
|
|
913
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
914
|
+
|
|
915
|
+
async def get_async(
|
|
916
|
+
self,
|
|
917
|
+
*,
|
|
918
|
+
vlan_id: str,
|
|
919
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
920
|
+
server_url: Optional[str] = None,
|
|
921
|
+
timeout_ms: Optional[int] = None,
|
|
922
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
923
|
+
) -> models.GetVirtualNetworkResponseBody:
|
|
924
|
+
r"""Retrieve a Virtual Network
|
|
925
|
+
|
|
926
|
+
Retrieve a Virtual Network.
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
:param vlan_id: Virtual Network ID
|
|
930
|
+
:param retries: Override the default retry configuration for this method
|
|
931
|
+
:param server_url: Override the default server URL for this method
|
|
932
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
933
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
934
|
+
"""
|
|
935
|
+
base_url = None
|
|
936
|
+
url_variables = None
|
|
937
|
+
if timeout_ms is None:
|
|
938
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
939
|
+
|
|
940
|
+
if server_url is not None:
|
|
941
|
+
base_url = server_url
|
|
942
|
+
else:
|
|
943
|
+
base_url = self._get_url(base_url, url_variables)
|
|
944
|
+
|
|
945
|
+
request = models.GetVirtualNetworkRequest(
|
|
946
|
+
vlan_id=vlan_id,
|
|
947
|
+
)
|
|
948
|
+
|
|
949
|
+
req = self._build_request_async(
|
|
950
|
+
method="GET",
|
|
951
|
+
path="/virtual_networks/{vlan_id}",
|
|
952
|
+
base_url=base_url,
|
|
953
|
+
url_variables=url_variables,
|
|
954
|
+
request=request,
|
|
955
|
+
request_body_required=False,
|
|
956
|
+
request_has_path_params=True,
|
|
957
|
+
request_has_query_params=True,
|
|
958
|
+
user_agent_header="user-agent",
|
|
959
|
+
accept_header_value="application/vnd.api+json",
|
|
960
|
+
http_headers=http_headers,
|
|
961
|
+
security=self.sdk_configuration.security,
|
|
962
|
+
allow_empty_value=None,
|
|
963
|
+
timeout_ms=timeout_ms,
|
|
964
|
+
)
|
|
965
|
+
|
|
966
|
+
if retries == UNSET:
|
|
967
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
968
|
+
retries = self.sdk_configuration.retry_config
|
|
969
|
+
|
|
970
|
+
retry_config = None
|
|
971
|
+
if isinstance(retries, utils.RetryConfig):
|
|
972
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
973
|
+
|
|
974
|
+
http_res = await self.do_request_async(
|
|
975
|
+
hook_ctx=HookContext(
|
|
976
|
+
config=self.sdk_configuration,
|
|
977
|
+
base_url=base_url or "",
|
|
978
|
+
operation_id="get-virtual-network",
|
|
979
|
+
oauth2_scopes=None,
|
|
980
|
+
security_source=get_security_from_env(
|
|
981
|
+
self.sdk_configuration.security, models.Security
|
|
982
|
+
),
|
|
983
|
+
),
|
|
984
|
+
request=req,
|
|
985
|
+
error_status_codes=["4XX", "5XX"],
|
|
986
|
+
retry_config=retry_config,
|
|
987
|
+
)
|
|
988
|
+
|
|
989
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
990
|
+
return unmarshal_json_response(
|
|
991
|
+
models.GetVirtualNetworkResponseBody, http_res
|
|
992
|
+
)
|
|
993
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
994
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
995
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
996
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
997
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
998
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
999
|
+
|
|
1000
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1001
|
+
|
|
1002
|
+
def list_assignments(
|
|
1003
|
+
self,
|
|
1004
|
+
*,
|
|
1005
|
+
filter_server: Optional[str] = None,
|
|
1006
|
+
filter_vid: Optional[str] = None,
|
|
1007
|
+
filter_virtual_network_id: Optional[str] = None,
|
|
1008
|
+
page_size: Optional[int] = 20,
|
|
1009
|
+
page_number: Optional[int] = 1,
|
|
1010
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1011
|
+
server_url: Optional[str] = None,
|
|
1012
|
+
timeout_ms: Optional[int] = None,
|
|
1013
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1014
|
+
) -> Optional[models.GetVirtualNetworksAssignmentsResponse]:
|
|
1015
|
+
r"""List all servers assigned to virtual networks
|
|
1016
|
+
|
|
1017
|
+
Returns a list of all servers assigned to virtual networks.
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
:param filter_server: The server ID to filter by
|
|
1021
|
+
:param filter_vid: The vlan ID to filter by
|
|
1022
|
+
:param filter_virtual_network_id: The virtual network ID to filter by
|
|
1023
|
+
:param page_size: Number of items to return per page
|
|
1024
|
+
:param page_number: Page number to return (starts at 1)
|
|
1025
|
+
:param retries: Override the default retry configuration for this method
|
|
1026
|
+
:param server_url: Override the default server URL for this method
|
|
1027
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1028
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1029
|
+
"""
|
|
1030
|
+
base_url = None
|
|
1031
|
+
url_variables = None
|
|
1032
|
+
if timeout_ms is None:
|
|
1033
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1034
|
+
|
|
1035
|
+
if server_url is not None:
|
|
1036
|
+
base_url = server_url
|
|
1037
|
+
else:
|
|
1038
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1039
|
+
|
|
1040
|
+
request = models.GetVirtualNetworksAssignmentsRequest(
|
|
1041
|
+
filter_server=filter_server,
|
|
1042
|
+
filter_vid=filter_vid,
|
|
1043
|
+
filter_virtual_network_id=filter_virtual_network_id,
|
|
1044
|
+
page_size=page_size,
|
|
1045
|
+
page_number=page_number,
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
req = self._build_request(
|
|
1049
|
+
method="GET",
|
|
1050
|
+
path="/virtual_networks/assignments",
|
|
1051
|
+
base_url=base_url,
|
|
1052
|
+
url_variables=url_variables,
|
|
1053
|
+
request=request,
|
|
1054
|
+
request_body_required=False,
|
|
1055
|
+
request_has_path_params=False,
|
|
1056
|
+
request_has_query_params=True,
|
|
1057
|
+
user_agent_header="user-agent",
|
|
1058
|
+
accept_header_value="application/vnd.api+json",
|
|
1059
|
+
http_headers=http_headers,
|
|
1060
|
+
security=self.sdk_configuration.security,
|
|
1061
|
+
allow_empty_value=None,
|
|
1062
|
+
timeout_ms=timeout_ms,
|
|
1063
|
+
)
|
|
1064
|
+
|
|
1065
|
+
if retries == UNSET:
|
|
1066
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1067
|
+
retries = self.sdk_configuration.retry_config
|
|
1068
|
+
|
|
1069
|
+
retry_config = None
|
|
1070
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1071
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1072
|
+
|
|
1073
|
+
http_res = self.do_request(
|
|
1074
|
+
hook_ctx=HookContext(
|
|
1075
|
+
config=self.sdk_configuration,
|
|
1076
|
+
base_url=base_url or "",
|
|
1077
|
+
operation_id="get-virtual-networks-assignments",
|
|
1078
|
+
oauth2_scopes=None,
|
|
1079
|
+
security_source=get_security_from_env(
|
|
1080
|
+
self.sdk_configuration.security, models.Security
|
|
1081
|
+
),
|
|
1082
|
+
),
|
|
1083
|
+
request=req,
|
|
1084
|
+
error_status_codes=["4XX", "5XX"],
|
|
1085
|
+
retry_config=retry_config,
|
|
1086
|
+
)
|
|
1087
|
+
|
|
1088
|
+
def next_func() -> Optional[models.GetVirtualNetworksAssignmentsResponse]:
|
|
1089
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
1090
|
+
page = request.page_number if not request.page_number is None else 1
|
|
1091
|
+
next_page = page + 1
|
|
1092
|
+
|
|
1093
|
+
if not http_res.text:
|
|
1094
|
+
return None
|
|
1095
|
+
results = JSONPath("$.data").parse(body)
|
|
1096
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
1097
|
+
return None
|
|
1098
|
+
limit = request.page_size if not request.page_size is None else 20
|
|
1099
|
+
if len(results[0]) < limit:
|
|
1100
|
+
return None
|
|
1101
|
+
|
|
1102
|
+
return self.list_assignments(
|
|
1103
|
+
filter_server=filter_server,
|
|
1104
|
+
filter_vid=filter_vid,
|
|
1105
|
+
filter_virtual_network_id=filter_virtual_network_id,
|
|
1106
|
+
page_size=page_size,
|
|
1107
|
+
page_number=next_page,
|
|
1108
|
+
retries=retries,
|
|
1109
|
+
)
|
|
1110
|
+
|
|
1111
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1112
|
+
return models.GetVirtualNetworksAssignmentsResponse(
|
|
1113
|
+
result=unmarshal_json_response(
|
|
1114
|
+
models.VirtualNetworkAssignments, http_res
|
|
1115
|
+
),
|
|
1116
|
+
next=next_func,
|
|
1117
|
+
)
|
|
1118
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1119
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1120
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1121
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1122
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1123
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1124
|
+
|
|
1125
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1126
|
+
|
|
1127
|
+
async def list_assignments_async(
|
|
1128
|
+
self,
|
|
1129
|
+
*,
|
|
1130
|
+
filter_server: Optional[str] = None,
|
|
1131
|
+
filter_vid: Optional[str] = None,
|
|
1132
|
+
filter_virtual_network_id: Optional[str] = None,
|
|
1133
|
+
page_size: Optional[int] = 20,
|
|
1134
|
+
page_number: Optional[int] = 1,
|
|
1135
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1136
|
+
server_url: Optional[str] = None,
|
|
1137
|
+
timeout_ms: Optional[int] = None,
|
|
1138
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1139
|
+
) -> Optional[models.GetVirtualNetworksAssignmentsResponse]:
|
|
1140
|
+
r"""List all servers assigned to virtual networks
|
|
1141
|
+
|
|
1142
|
+
Returns a list of all servers assigned to virtual networks.
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
:param filter_server: The server ID to filter by
|
|
1146
|
+
:param filter_vid: The vlan ID to filter by
|
|
1147
|
+
:param filter_virtual_network_id: The virtual network ID to filter by
|
|
1148
|
+
:param page_size: Number of items to return per page
|
|
1149
|
+
:param page_number: Page number to return (starts at 1)
|
|
1150
|
+
:param retries: Override the default retry configuration for this method
|
|
1151
|
+
:param server_url: Override the default server URL for this method
|
|
1152
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1153
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1154
|
+
"""
|
|
1155
|
+
base_url = None
|
|
1156
|
+
url_variables = None
|
|
1157
|
+
if timeout_ms is None:
|
|
1158
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1159
|
+
|
|
1160
|
+
if server_url is not None:
|
|
1161
|
+
base_url = server_url
|
|
1162
|
+
else:
|
|
1163
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1164
|
+
|
|
1165
|
+
request = models.GetVirtualNetworksAssignmentsRequest(
|
|
1166
|
+
filter_server=filter_server,
|
|
1167
|
+
filter_vid=filter_vid,
|
|
1168
|
+
filter_virtual_network_id=filter_virtual_network_id,
|
|
1169
|
+
page_size=page_size,
|
|
1170
|
+
page_number=page_number,
|
|
1171
|
+
)
|
|
1172
|
+
|
|
1173
|
+
req = self._build_request_async(
|
|
1174
|
+
method="GET",
|
|
1175
|
+
path="/virtual_networks/assignments",
|
|
1176
|
+
base_url=base_url,
|
|
1177
|
+
url_variables=url_variables,
|
|
1178
|
+
request=request,
|
|
1179
|
+
request_body_required=False,
|
|
1180
|
+
request_has_path_params=False,
|
|
1181
|
+
request_has_query_params=True,
|
|
1182
|
+
user_agent_header="user-agent",
|
|
1183
|
+
accept_header_value="application/vnd.api+json",
|
|
1184
|
+
http_headers=http_headers,
|
|
1185
|
+
security=self.sdk_configuration.security,
|
|
1186
|
+
allow_empty_value=None,
|
|
1187
|
+
timeout_ms=timeout_ms,
|
|
1188
|
+
)
|
|
1189
|
+
|
|
1190
|
+
if retries == UNSET:
|
|
1191
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1192
|
+
retries = self.sdk_configuration.retry_config
|
|
1193
|
+
|
|
1194
|
+
retry_config = None
|
|
1195
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1196
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1197
|
+
|
|
1198
|
+
http_res = await self.do_request_async(
|
|
1199
|
+
hook_ctx=HookContext(
|
|
1200
|
+
config=self.sdk_configuration,
|
|
1201
|
+
base_url=base_url or "",
|
|
1202
|
+
operation_id="get-virtual-networks-assignments",
|
|
1203
|
+
oauth2_scopes=None,
|
|
1204
|
+
security_source=get_security_from_env(
|
|
1205
|
+
self.sdk_configuration.security, models.Security
|
|
1206
|
+
),
|
|
1207
|
+
),
|
|
1208
|
+
request=req,
|
|
1209
|
+
error_status_codes=["4XX", "5XX"],
|
|
1210
|
+
retry_config=retry_config,
|
|
1211
|
+
)
|
|
1212
|
+
|
|
1213
|
+
def next_func() -> Optional[models.GetVirtualNetworksAssignmentsResponse]:
|
|
1214
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
1215
|
+
page = request.page_number if not request.page_number is None else 1
|
|
1216
|
+
next_page = page + 1
|
|
1217
|
+
|
|
1218
|
+
if not http_res.text:
|
|
1219
|
+
return None
|
|
1220
|
+
results = JSONPath("$.data").parse(body)
|
|
1221
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
1222
|
+
return None
|
|
1223
|
+
limit = request.page_size if not request.page_size is None else 20
|
|
1224
|
+
if len(results[0]) < limit:
|
|
1225
|
+
return None
|
|
1226
|
+
|
|
1227
|
+
return self.list_assignments(
|
|
1228
|
+
filter_server=filter_server,
|
|
1229
|
+
filter_vid=filter_vid,
|
|
1230
|
+
filter_virtual_network_id=filter_virtual_network_id,
|
|
1231
|
+
page_size=page_size,
|
|
1232
|
+
page_number=next_page,
|
|
1233
|
+
retries=retries,
|
|
1234
|
+
)
|
|
1235
|
+
|
|
1236
|
+
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
1237
|
+
return models.GetVirtualNetworksAssignmentsResponse(
|
|
1238
|
+
result=unmarshal_json_response(
|
|
1239
|
+
models.VirtualNetworkAssignments, http_res
|
|
1240
|
+
),
|
|
1241
|
+
next=next_func,
|
|
1242
|
+
)
|
|
1243
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1244
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1245
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1246
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1247
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1248
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1249
|
+
|
|
1250
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1251
|
+
|
|
1252
|
+
def assign(
|
|
1253
|
+
self,
|
|
1254
|
+
*,
|
|
1255
|
+
data: Optional[
|
|
1256
|
+
Union[
|
|
1257
|
+
models.AssignServerVirtualNetworkPrivateNetworksData,
|
|
1258
|
+
models.AssignServerVirtualNetworkPrivateNetworksDataTypedDict,
|
|
1259
|
+
]
|
|
1260
|
+
] = None,
|
|
1261
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1262
|
+
server_url: Optional[str] = None,
|
|
1263
|
+
timeout_ms: Optional[int] = None,
|
|
1264
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1265
|
+
) -> models.VirtualNetworkAssignment:
|
|
1266
|
+
r"""Assign Virtual network
|
|
1267
|
+
|
|
1268
|
+
:param data:
|
|
1269
|
+
:param retries: Override the default retry configuration for this method
|
|
1270
|
+
:param server_url: Override the default server URL for this method
|
|
1271
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1272
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1273
|
+
"""
|
|
1274
|
+
base_url = None
|
|
1275
|
+
url_variables = None
|
|
1276
|
+
if timeout_ms is None:
|
|
1277
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1278
|
+
|
|
1279
|
+
if server_url is not None:
|
|
1280
|
+
base_url = server_url
|
|
1281
|
+
else:
|
|
1282
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1283
|
+
|
|
1284
|
+
request = models.AssignServerVirtualNetworkPrivateNetworksRequestBody(
|
|
1285
|
+
data=utils.get_pydantic_model(
|
|
1286
|
+
data, Optional[models.AssignServerVirtualNetworkPrivateNetworksData]
|
|
1287
|
+
),
|
|
1288
|
+
)
|
|
1289
|
+
|
|
1290
|
+
req = self._build_request(
|
|
1291
|
+
method="POST",
|
|
1292
|
+
path="/virtual_networks/assignments",
|
|
1293
|
+
base_url=base_url,
|
|
1294
|
+
url_variables=url_variables,
|
|
1295
|
+
request=request,
|
|
1296
|
+
request_body_required=True,
|
|
1297
|
+
request_has_path_params=False,
|
|
1298
|
+
request_has_query_params=True,
|
|
1299
|
+
user_agent_header="user-agent",
|
|
1300
|
+
accept_header_value="application/vnd.api+json",
|
|
1301
|
+
http_headers=http_headers,
|
|
1302
|
+
security=self.sdk_configuration.security,
|
|
1303
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1304
|
+
request,
|
|
1305
|
+
False,
|
|
1306
|
+
False,
|
|
1307
|
+
"json",
|
|
1308
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBody,
|
|
1309
|
+
),
|
|
1310
|
+
allow_empty_value=None,
|
|
1311
|
+
timeout_ms=timeout_ms,
|
|
1312
|
+
)
|
|
1313
|
+
|
|
1314
|
+
if retries == UNSET:
|
|
1315
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1316
|
+
retries = self.sdk_configuration.retry_config
|
|
1317
|
+
|
|
1318
|
+
retry_config = None
|
|
1319
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1320
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1321
|
+
|
|
1322
|
+
http_res = self.do_request(
|
|
1323
|
+
hook_ctx=HookContext(
|
|
1324
|
+
config=self.sdk_configuration,
|
|
1325
|
+
base_url=base_url or "",
|
|
1326
|
+
operation_id="assign-server-virtual-network",
|
|
1327
|
+
oauth2_scopes=None,
|
|
1328
|
+
security_source=get_security_from_env(
|
|
1329
|
+
self.sdk_configuration.security, models.Security
|
|
1330
|
+
),
|
|
1331
|
+
),
|
|
1332
|
+
request=req,
|
|
1333
|
+
error_status_codes=["4XX", "5XX"],
|
|
1334
|
+
retry_config=retry_config,
|
|
1335
|
+
)
|
|
1336
|
+
|
|
1337
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
1338
|
+
return unmarshal_json_response(models.VirtualNetworkAssignment, http_res)
|
|
1339
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1340
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1341
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1342
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1343
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1344
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1345
|
+
|
|
1346
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1347
|
+
|
|
1348
|
+
async def assign_async(
|
|
1349
|
+
self,
|
|
1350
|
+
*,
|
|
1351
|
+
data: Optional[
|
|
1352
|
+
Union[
|
|
1353
|
+
models.AssignServerVirtualNetworkPrivateNetworksData,
|
|
1354
|
+
models.AssignServerVirtualNetworkPrivateNetworksDataTypedDict,
|
|
1355
|
+
]
|
|
1356
|
+
] = None,
|
|
1357
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1358
|
+
server_url: Optional[str] = None,
|
|
1359
|
+
timeout_ms: Optional[int] = None,
|
|
1360
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1361
|
+
) -> models.VirtualNetworkAssignment:
|
|
1362
|
+
r"""Assign Virtual network
|
|
1363
|
+
|
|
1364
|
+
:param data:
|
|
1365
|
+
:param retries: Override the default retry configuration for this method
|
|
1366
|
+
:param server_url: Override the default server URL for this method
|
|
1367
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1368
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1369
|
+
"""
|
|
1370
|
+
base_url = None
|
|
1371
|
+
url_variables = None
|
|
1372
|
+
if timeout_ms is None:
|
|
1373
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1374
|
+
|
|
1375
|
+
if server_url is not None:
|
|
1376
|
+
base_url = server_url
|
|
1377
|
+
else:
|
|
1378
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1379
|
+
|
|
1380
|
+
request = models.AssignServerVirtualNetworkPrivateNetworksRequestBody(
|
|
1381
|
+
data=utils.get_pydantic_model(
|
|
1382
|
+
data, Optional[models.AssignServerVirtualNetworkPrivateNetworksData]
|
|
1383
|
+
),
|
|
1384
|
+
)
|
|
1385
|
+
|
|
1386
|
+
req = self._build_request_async(
|
|
1387
|
+
method="POST",
|
|
1388
|
+
path="/virtual_networks/assignments",
|
|
1389
|
+
base_url=base_url,
|
|
1390
|
+
url_variables=url_variables,
|
|
1391
|
+
request=request,
|
|
1392
|
+
request_body_required=True,
|
|
1393
|
+
request_has_path_params=False,
|
|
1394
|
+
request_has_query_params=True,
|
|
1395
|
+
user_agent_header="user-agent",
|
|
1396
|
+
accept_header_value="application/vnd.api+json",
|
|
1397
|
+
http_headers=http_headers,
|
|
1398
|
+
security=self.sdk_configuration.security,
|
|
1399
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1400
|
+
request,
|
|
1401
|
+
False,
|
|
1402
|
+
False,
|
|
1403
|
+
"json",
|
|
1404
|
+
models.AssignServerVirtualNetworkPrivateNetworksRequestBody,
|
|
1405
|
+
),
|
|
1406
|
+
allow_empty_value=None,
|
|
1407
|
+
timeout_ms=timeout_ms,
|
|
1408
|
+
)
|
|
1409
|
+
|
|
1410
|
+
if retries == UNSET:
|
|
1411
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1412
|
+
retries = self.sdk_configuration.retry_config
|
|
1413
|
+
|
|
1414
|
+
retry_config = None
|
|
1415
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1416
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1417
|
+
|
|
1418
|
+
http_res = await self.do_request_async(
|
|
1419
|
+
hook_ctx=HookContext(
|
|
1420
|
+
config=self.sdk_configuration,
|
|
1421
|
+
base_url=base_url or "",
|
|
1422
|
+
operation_id="assign-server-virtual-network",
|
|
1423
|
+
oauth2_scopes=None,
|
|
1424
|
+
security_source=get_security_from_env(
|
|
1425
|
+
self.sdk_configuration.security, models.Security
|
|
1426
|
+
),
|
|
1427
|
+
),
|
|
1428
|
+
request=req,
|
|
1429
|
+
error_status_codes=["4XX", "5XX"],
|
|
1430
|
+
retry_config=retry_config,
|
|
1431
|
+
)
|
|
1432
|
+
|
|
1433
|
+
if utils.match_response(http_res, "201", "application/vnd.api+json"):
|
|
1434
|
+
return unmarshal_json_response(models.VirtualNetworkAssignment, http_res)
|
|
1435
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1436
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1437
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1438
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1439
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1440
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1441
|
+
|
|
1442
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1443
|
+
|
|
1444
|
+
def remove_assignment(
|
|
1445
|
+
self,
|
|
1446
|
+
*,
|
|
1447
|
+
assignment_id: str,
|
|
1448
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1449
|
+
server_url: Optional[str] = None,
|
|
1450
|
+
timeout_ms: Optional[int] = None,
|
|
1451
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1452
|
+
):
|
|
1453
|
+
r"""Delete Virtual Network Assignment
|
|
1454
|
+
|
|
1455
|
+
Allow you to remove a Virtual Network assignment.
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
:param assignment_id:
|
|
1459
|
+
:param retries: Override the default retry configuration for this method
|
|
1460
|
+
:param server_url: Override the default server URL for this method
|
|
1461
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1462
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1463
|
+
"""
|
|
1464
|
+
base_url = None
|
|
1465
|
+
url_variables = None
|
|
1466
|
+
if timeout_ms is None:
|
|
1467
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1468
|
+
|
|
1469
|
+
if server_url is not None:
|
|
1470
|
+
base_url = server_url
|
|
1471
|
+
else:
|
|
1472
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1473
|
+
|
|
1474
|
+
request = models.DeleteVirtualNetworksAssignmentsRequest(
|
|
1475
|
+
assignment_id=assignment_id,
|
|
1476
|
+
)
|
|
1477
|
+
|
|
1478
|
+
req = self._build_request(
|
|
1479
|
+
method="DELETE",
|
|
1480
|
+
path="/virtual_networks/assignments/{assignment_id}",
|
|
1481
|
+
base_url=base_url,
|
|
1482
|
+
url_variables=url_variables,
|
|
1483
|
+
request=request,
|
|
1484
|
+
request_body_required=False,
|
|
1485
|
+
request_has_path_params=True,
|
|
1486
|
+
request_has_query_params=True,
|
|
1487
|
+
user_agent_header="user-agent",
|
|
1488
|
+
accept_header_value="*/*",
|
|
1489
|
+
http_headers=http_headers,
|
|
1490
|
+
security=self.sdk_configuration.security,
|
|
1491
|
+
allow_empty_value=None,
|
|
1492
|
+
timeout_ms=timeout_ms,
|
|
1493
|
+
)
|
|
1494
|
+
|
|
1495
|
+
if retries == UNSET:
|
|
1496
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1497
|
+
retries = self.sdk_configuration.retry_config
|
|
1498
|
+
|
|
1499
|
+
retry_config = None
|
|
1500
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1501
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1502
|
+
|
|
1503
|
+
http_res = self.do_request(
|
|
1504
|
+
hook_ctx=HookContext(
|
|
1505
|
+
config=self.sdk_configuration,
|
|
1506
|
+
base_url=base_url or "",
|
|
1507
|
+
operation_id="delete-virtual-networks-assignments",
|
|
1508
|
+
oauth2_scopes=None,
|
|
1509
|
+
security_source=get_security_from_env(
|
|
1510
|
+
self.sdk_configuration.security, models.Security
|
|
1511
|
+
),
|
|
1512
|
+
),
|
|
1513
|
+
request=req,
|
|
1514
|
+
error_status_codes=["4XX", "5XX"],
|
|
1515
|
+
retry_config=retry_config,
|
|
1516
|
+
)
|
|
1517
|
+
|
|
1518
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1519
|
+
return
|
|
1520
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1521
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1522
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1523
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1524
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1525
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1526
|
+
|
|
1527
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1528
|
+
|
|
1529
|
+
async def remove_assignment_async(
|
|
1530
|
+
self,
|
|
1531
|
+
*,
|
|
1532
|
+
assignment_id: str,
|
|
1533
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1534
|
+
server_url: Optional[str] = None,
|
|
1535
|
+
timeout_ms: Optional[int] = None,
|
|
1536
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1537
|
+
):
|
|
1538
|
+
r"""Delete Virtual Network Assignment
|
|
1539
|
+
|
|
1540
|
+
Allow you to remove a Virtual Network assignment.
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
:param assignment_id:
|
|
1544
|
+
:param retries: Override the default retry configuration for this method
|
|
1545
|
+
:param server_url: Override the default server URL for this method
|
|
1546
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1547
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1548
|
+
"""
|
|
1549
|
+
base_url = None
|
|
1550
|
+
url_variables = None
|
|
1551
|
+
if timeout_ms is None:
|
|
1552
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1553
|
+
|
|
1554
|
+
if server_url is not None:
|
|
1555
|
+
base_url = server_url
|
|
1556
|
+
else:
|
|
1557
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1558
|
+
|
|
1559
|
+
request = models.DeleteVirtualNetworksAssignmentsRequest(
|
|
1560
|
+
assignment_id=assignment_id,
|
|
1561
|
+
)
|
|
1562
|
+
|
|
1563
|
+
req = self._build_request_async(
|
|
1564
|
+
method="DELETE",
|
|
1565
|
+
path="/virtual_networks/assignments/{assignment_id}",
|
|
1566
|
+
base_url=base_url,
|
|
1567
|
+
url_variables=url_variables,
|
|
1568
|
+
request=request,
|
|
1569
|
+
request_body_required=False,
|
|
1570
|
+
request_has_path_params=True,
|
|
1571
|
+
request_has_query_params=True,
|
|
1572
|
+
user_agent_header="user-agent",
|
|
1573
|
+
accept_header_value="*/*",
|
|
1574
|
+
http_headers=http_headers,
|
|
1575
|
+
security=self.sdk_configuration.security,
|
|
1576
|
+
allow_empty_value=None,
|
|
1577
|
+
timeout_ms=timeout_ms,
|
|
1578
|
+
)
|
|
1579
|
+
|
|
1580
|
+
if retries == UNSET:
|
|
1581
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1582
|
+
retries = self.sdk_configuration.retry_config
|
|
1583
|
+
|
|
1584
|
+
retry_config = None
|
|
1585
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1586
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1587
|
+
|
|
1588
|
+
http_res = await self.do_request_async(
|
|
1589
|
+
hook_ctx=HookContext(
|
|
1590
|
+
config=self.sdk_configuration,
|
|
1591
|
+
base_url=base_url or "",
|
|
1592
|
+
operation_id="delete-virtual-networks-assignments",
|
|
1593
|
+
oauth2_scopes=None,
|
|
1594
|
+
security_source=get_security_from_env(
|
|
1595
|
+
self.sdk_configuration.security, models.Security
|
|
1596
|
+
),
|
|
1597
|
+
),
|
|
1598
|
+
request=req,
|
|
1599
|
+
error_status_codes=["4XX", "5XX"],
|
|
1600
|
+
retry_config=retry_config,
|
|
1601
|
+
)
|
|
1602
|
+
|
|
1603
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1604
|
+
return
|
|
1605
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1606
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1607
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1608
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1609
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1610
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1611
|
+
|
|
1612
|
+
raise models.APIError("Unexpected response received", http_res)
|