stackit-vpn 0.1.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.
- src/stackit/vpn/__init__.py +145 -0
- src/stackit/vpn/api/__init__.py +4 -0
- src/stackit/vpn/api/default_api.py +3947 -0
- src/stackit/vpn/api_client.py +652 -0
- src/stackit/vpn/api_response.py +23 -0
- src/stackit/vpn/configuration.py +164 -0
- src/stackit/vpn/exceptions.py +217 -0
- src/stackit/vpn/models/__init__.py +58 -0
- src/stackit/vpn/models/api_error.py +104 -0
- src/stackit/vpn/models/api_error_detail.py +99 -0
- src/stackit/vpn/models/api_error_response.py +86 -0
- src/stackit/vpn/models/bgp_gateway_config.py +94 -0
- src/stackit/vpn/models/bgp_status.py +112 -0
- src/stackit/vpn/models/bgp_status_peers.py +97 -0
- src/stackit/vpn/models/bgp_status_routes.py +93 -0
- src/stackit/vpn/models/bgp_tunnel_config.py +84 -0
- src/stackit/vpn/models/connection_list.py +98 -0
- src/stackit/vpn/models/connection_response.py +149 -0
- src/stackit/vpn/models/connection_status_response.py +113 -0
- src/stackit/vpn/models/create_gateway_connection_payload.py +139 -0
- src/stackit/vpn/models/create_vpn_gateway_payload.py +124 -0
- src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py +82 -0
- src/stackit/vpn/models/gateway.py +124 -0
- src/stackit/vpn/models/gateway_list.py +98 -0
- src/stackit/vpn/models/gateway_response.py +144 -0
- src/stackit/vpn/models/gateway_status.py +38 -0
- src/stackit/vpn/models/gateway_status_response.py +122 -0
- src/stackit/vpn/models/peering_config.py +103 -0
- src/stackit/vpn/models/phase.py +122 -0
- src/stackit/vpn/models/phase1_status.py +99 -0
- src/stackit/vpn/models/phase2_status.py +143 -0
- src/stackit/vpn/models/plan.py +101 -0
- src/stackit/vpn/models/plan_list.py +98 -0
- src/stackit/vpn/models/quota.py +82 -0
- src/stackit/vpn/models/quota_list.py +88 -0
- src/stackit/vpn/models/quota_list_response.py +88 -0
- src/stackit/vpn/models/region.py +36 -0
- src/stackit/vpn/models/routing_type.py +37 -0
- src/stackit/vpn/models/tunnel_configuration.py +124 -0
- src/stackit/vpn/models/tunnel_configuration_phase1.py +126 -0
- src/stackit/vpn/models/tunnel_configuration_phase2.py +165 -0
- src/stackit/vpn/models/tunnel_status.py +110 -0
- src/stackit/vpn/models/update_gateway_connection_payload.py +139 -0
- src/stackit/vpn/models/update_vpn_gateway_payload.py +124 -0
- src/stackit/vpn/models/vpn_tunnels.py +114 -0
- src/stackit/vpn/py.typed +0 -0
- src/stackit/vpn/rest.py +164 -0
- stackit_vpn-0.1.0.dist-info/METADATA +53 -0
- stackit_vpn-0.1.0.dist-info/RECORD +52 -0
- stackit_vpn-0.1.0.dist-info/WHEEL +4 -0
- stackit_vpn-0.1.0.dist-info/licenses/LICENSE.md +201 -0
- stackit_vpn-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT VPN API
|
|
5
|
+
|
|
6
|
+
Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
from typing import Dict, List, Optional, TypedDict
|
|
16
|
+
|
|
17
|
+
from typing_extensions import NotRequired
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
ServerVariablesT = Dict[str, str]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class HostSettingVariable(TypedDict):
|
|
26
|
+
description: str
|
|
27
|
+
default_value: str
|
|
28
|
+
enum_values: List[str]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class HostSetting(TypedDict):
|
|
32
|
+
url: str
|
|
33
|
+
description: str
|
|
34
|
+
variables: NotRequired[Dict[str, HostSettingVariable]]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class HostConfiguration:
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
region=None,
|
|
41
|
+
server_index=None,
|
|
42
|
+
server_variables=None,
|
|
43
|
+
server_operation_index=None,
|
|
44
|
+
server_operation_variables=None,
|
|
45
|
+
ignore_operation_servers=False,
|
|
46
|
+
) -> None:
|
|
47
|
+
print(
|
|
48
|
+
"WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n",
|
|
49
|
+
"as a function argument instead of being set in the client configuration.\n"
|
|
50
|
+
"Once all services have migrated, the methods to specify the region in the client configuration "
|
|
51
|
+
"will be removed.",
|
|
52
|
+
file=sys.stderr,
|
|
53
|
+
)
|
|
54
|
+
"""Constructor
|
|
55
|
+
"""
|
|
56
|
+
self._base_path = "https://vpn.api.eu01.stackit.cloud"
|
|
57
|
+
"""Default Base url
|
|
58
|
+
"""
|
|
59
|
+
self.server_index = 0 if server_index is None else server_index
|
|
60
|
+
self.server_operation_index = server_operation_index or {}
|
|
61
|
+
"""Default server index
|
|
62
|
+
"""
|
|
63
|
+
self.server_variables = server_variables or {}
|
|
64
|
+
if region:
|
|
65
|
+
self.server_variables["region"] = "{}.".format(region)
|
|
66
|
+
self.server_operation_variables = server_operation_variables or {}
|
|
67
|
+
"""Default server variables
|
|
68
|
+
"""
|
|
69
|
+
self.ignore_operation_servers = ignore_operation_servers
|
|
70
|
+
"""Ignore operation servers
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
def get_host_settings(self) -> List[HostSetting]:
|
|
74
|
+
"""Gets an array of host settings
|
|
75
|
+
|
|
76
|
+
:return: An array of host settings
|
|
77
|
+
"""
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
"url": "https://vpn.api.{region}stackit.cloud",
|
|
81
|
+
"description": "No description provided",
|
|
82
|
+
"variables": {
|
|
83
|
+
"region": {
|
|
84
|
+
"description": "No description provided",
|
|
85
|
+
"default_value": "eu01.",
|
|
86
|
+
"enum_values": ["eu01."],
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
def get_host_from_settings(
|
|
93
|
+
self,
|
|
94
|
+
index: Optional[int],
|
|
95
|
+
variables: Optional[ServerVariablesT] = None,
|
|
96
|
+
servers: Optional[List[HostSetting]] = None,
|
|
97
|
+
) -> str:
|
|
98
|
+
"""Gets host URL based on the index and variables
|
|
99
|
+
:param index: array index of the host settings
|
|
100
|
+
:param variables: hash of variable and the corresponding value
|
|
101
|
+
:param servers: an array of host settings or None
|
|
102
|
+
:error: if a region is given for a global url
|
|
103
|
+
:return: URL based on host settings
|
|
104
|
+
"""
|
|
105
|
+
if index is None:
|
|
106
|
+
return self._base_path
|
|
107
|
+
|
|
108
|
+
variables = {} if variables is None else variables
|
|
109
|
+
servers = self.get_host_settings() if servers is None else servers
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
server = servers[index]
|
|
113
|
+
except IndexError:
|
|
114
|
+
raise ValueError(
|
|
115
|
+
"Invalid index {0} when selecting the host settings. "
|
|
116
|
+
"Must be less than {1}".format(index, len(servers))
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
url = server["url"]
|
|
120
|
+
|
|
121
|
+
# check if environment variable was provided for region
|
|
122
|
+
# if nothing was set this is None
|
|
123
|
+
region_env = os.environ.get("STACKIT_REGION")
|
|
124
|
+
|
|
125
|
+
# go through variables and replace placeholders
|
|
126
|
+
for variable_name, variable in server.get("variables", {}).items():
|
|
127
|
+
# If a region is provided by the user for a global url
|
|
128
|
+
# return an error (except for providing via environment variable).
|
|
129
|
+
# The region is provided as a function argument instead of being set in the client configuration.
|
|
130
|
+
if (
|
|
131
|
+
variable_name == "region"
|
|
132
|
+
and (variable["default_value"] == "global" or variable["default_value"] == "")
|
|
133
|
+
and region_env is None
|
|
134
|
+
and variables.get(variable_name) is not None
|
|
135
|
+
):
|
|
136
|
+
raise ValueError(
|
|
137
|
+
"this API does not support setting a region in the client configuration, "
|
|
138
|
+
"please check if the region can be specified as a function parameter"
|
|
139
|
+
)
|
|
140
|
+
used_value = variables.get(variable_name, variable["default_value"])
|
|
141
|
+
|
|
142
|
+
if "enum_values" in variable and used_value not in variable["enum_values"]:
|
|
143
|
+
given_value = variables[variable_name].replace(".", "")
|
|
144
|
+
valid_values = [v.replace(".", "") for v in variable["enum_values"]]
|
|
145
|
+
raise ValueError(
|
|
146
|
+
"The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
|
|
147
|
+
variable_name, given_value, valid_values
|
|
148
|
+
)
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
url = url.replace("{" + variable_name + "}", used_value)
|
|
152
|
+
|
|
153
|
+
return url
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def host(self) -> str:
|
|
157
|
+
"""Return generated host."""
|
|
158
|
+
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
159
|
+
|
|
160
|
+
@host.setter
|
|
161
|
+
def host(self, value: str) -> None:
|
|
162
|
+
"""Fix base path."""
|
|
163
|
+
self._base_path = value
|
|
164
|
+
self.server_index = None
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT VPN API
|
|
5
|
+
|
|
6
|
+
Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class OpenApiException(Exception):
|
|
20
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
24
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
|
|
25
|
+
"""Raises an exception for TypeErrors
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
msg (str): the exception message
|
|
29
|
+
|
|
30
|
+
Keyword Args:
|
|
31
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
32
|
+
current_item
|
|
33
|
+
None if unset
|
|
34
|
+
valid_classes (tuple): the primitive classes that current item
|
|
35
|
+
should be an instance of
|
|
36
|
+
None if unset
|
|
37
|
+
key_type (bool): False if our value is a value in a dict
|
|
38
|
+
True if it is a key in a dict
|
|
39
|
+
False if our item is an item in a list
|
|
40
|
+
None if unset
|
|
41
|
+
"""
|
|
42
|
+
self.path_to_item = path_to_item
|
|
43
|
+
self.valid_classes = valid_classes
|
|
44
|
+
self.key_type = key_type
|
|
45
|
+
full_msg = msg
|
|
46
|
+
if path_to_item:
|
|
47
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
48
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
52
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Args:
|
|
55
|
+
msg (str): the exception message
|
|
56
|
+
|
|
57
|
+
Keyword Args:
|
|
58
|
+
path_to_item (list) the path to the exception in the
|
|
59
|
+
received_data dict. None if unset
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
self.path_to_item = path_to_item
|
|
63
|
+
full_msg = msg
|
|
64
|
+
if path_to_item:
|
|
65
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
66
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
70
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
71
|
+
"""
|
|
72
|
+
Raised when an attribute reference or assignment fails.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
msg (str): the exception message
|
|
76
|
+
|
|
77
|
+
Keyword Args:
|
|
78
|
+
path_to_item (None/list) the path to the exception in the
|
|
79
|
+
received_data dict
|
|
80
|
+
"""
|
|
81
|
+
self.path_to_item = path_to_item
|
|
82
|
+
full_msg = msg
|
|
83
|
+
if path_to_item:
|
|
84
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
85
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
89
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
90
|
+
"""
|
|
91
|
+
Args:
|
|
92
|
+
msg (str): the exception message
|
|
93
|
+
|
|
94
|
+
Keyword Args:
|
|
95
|
+
path_to_item (None/list) the path to the exception in the
|
|
96
|
+
received_data dict
|
|
97
|
+
"""
|
|
98
|
+
self.path_to_item = path_to_item
|
|
99
|
+
full_msg = msg
|
|
100
|
+
if path_to_item:
|
|
101
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
102
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ApiException(OpenApiException):
|
|
106
|
+
|
|
107
|
+
def __init__(
|
|
108
|
+
self,
|
|
109
|
+
status=None,
|
|
110
|
+
reason=None,
|
|
111
|
+
http_resp=None,
|
|
112
|
+
*,
|
|
113
|
+
body: Optional[str] = None,
|
|
114
|
+
data: Optional[Any] = None,
|
|
115
|
+
) -> None:
|
|
116
|
+
self.status = status
|
|
117
|
+
self.reason = reason
|
|
118
|
+
self.body = body
|
|
119
|
+
self.data = data
|
|
120
|
+
self.headers = None
|
|
121
|
+
|
|
122
|
+
if http_resp:
|
|
123
|
+
if self.status is None:
|
|
124
|
+
self.status = http_resp.status
|
|
125
|
+
if self.reason is None:
|
|
126
|
+
self.reason = http_resp.reason
|
|
127
|
+
if self.body is None:
|
|
128
|
+
try:
|
|
129
|
+
self.body = http_resp.data.decode("utf-8")
|
|
130
|
+
except Exception: # noqa: S110
|
|
131
|
+
pass
|
|
132
|
+
self.headers = http_resp.headers
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_response(
|
|
136
|
+
cls,
|
|
137
|
+
*,
|
|
138
|
+
http_resp,
|
|
139
|
+
body: Optional[str],
|
|
140
|
+
data: Optional[Any],
|
|
141
|
+
) -> Self:
|
|
142
|
+
if http_resp.status == 400:
|
|
143
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
144
|
+
|
|
145
|
+
if http_resp.status == 401:
|
|
146
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
147
|
+
|
|
148
|
+
if http_resp.status == 403:
|
|
149
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
150
|
+
|
|
151
|
+
if http_resp.status == 404:
|
|
152
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
153
|
+
|
|
154
|
+
# Added new conditions for 409 and 422
|
|
155
|
+
if http_resp.status == 409:
|
|
156
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
157
|
+
|
|
158
|
+
if http_resp.status == 422:
|
|
159
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
160
|
+
|
|
161
|
+
if 500 <= http_resp.status <= 599:
|
|
162
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
163
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
164
|
+
|
|
165
|
+
def __str__(self):
|
|
166
|
+
"""Custom error messages for exception"""
|
|
167
|
+
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
|
|
168
|
+
if self.headers:
|
|
169
|
+
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
|
170
|
+
|
|
171
|
+
if self.data or self.body:
|
|
172
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
173
|
+
|
|
174
|
+
return error_message
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class BadRequestException(ApiException):
|
|
178
|
+
pass
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class NotFoundException(ApiException):
|
|
182
|
+
pass
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class UnauthorizedException(ApiException):
|
|
186
|
+
pass
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class ForbiddenException(ApiException):
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class ServiceException(ApiException):
|
|
194
|
+
pass
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class ConflictException(ApiException):
|
|
198
|
+
"""Exception for HTTP 409 Conflict."""
|
|
199
|
+
|
|
200
|
+
pass
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class UnprocessableEntityException(ApiException):
|
|
204
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
205
|
+
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def render_path(path_to_item):
|
|
210
|
+
"""Returns a string representation of a path"""
|
|
211
|
+
result = ""
|
|
212
|
+
for pth in path_to_item:
|
|
213
|
+
if isinstance(pth, int):
|
|
214
|
+
result += "[{0}]".format(pth)
|
|
215
|
+
else:
|
|
216
|
+
result += "['{0}']".format(pth)
|
|
217
|
+
return result
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
"""
|
|
5
|
+
STACKIT VPN API
|
|
6
|
+
|
|
7
|
+
Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec
|
|
8
|
+
|
|
9
|
+
The version of the OpenAPI document: 1beta1
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
# import models into model package
|
|
16
|
+
from stackit.vpn.models.api_error import APIError
|
|
17
|
+
from stackit.vpn.models.api_error_detail import APIErrorDetail
|
|
18
|
+
from stackit.vpn.models.api_error_response import APIErrorResponse
|
|
19
|
+
from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig
|
|
20
|
+
from stackit.vpn.models.bgp_status import BGPStatus
|
|
21
|
+
from stackit.vpn.models.bgp_status_peers import BGPStatusPeers
|
|
22
|
+
from stackit.vpn.models.bgp_status_routes import BGPStatusRoutes
|
|
23
|
+
from stackit.vpn.models.bgp_tunnel_config import BGPTunnelConfig
|
|
24
|
+
from stackit.vpn.models.connection_list import ConnectionList
|
|
25
|
+
from stackit.vpn.models.connection_response import ConnectionResponse
|
|
26
|
+
from stackit.vpn.models.connection_status_response import ConnectionStatusResponse
|
|
27
|
+
from stackit.vpn.models.create_gateway_connection_payload import (
|
|
28
|
+
CreateGatewayConnectionPayload,
|
|
29
|
+
)
|
|
30
|
+
from stackit.vpn.models.create_vpn_gateway_payload import CreateVPNGatewayPayload
|
|
31
|
+
from stackit.vpn.models.create_vpn_gateway_payload_availability_zones import (
|
|
32
|
+
CreateVPNGatewayPayloadAvailabilityZones,
|
|
33
|
+
)
|
|
34
|
+
from stackit.vpn.models.gateway import Gateway
|
|
35
|
+
from stackit.vpn.models.gateway_list import GatewayList
|
|
36
|
+
from stackit.vpn.models.gateway_response import GatewayResponse
|
|
37
|
+
from stackit.vpn.models.gateway_status import GatewayStatus
|
|
38
|
+
from stackit.vpn.models.gateway_status_response import GatewayStatusResponse
|
|
39
|
+
from stackit.vpn.models.peering_config import PeeringConfig
|
|
40
|
+
from stackit.vpn.models.phase import Phase
|
|
41
|
+
from stackit.vpn.models.phase1_status import Phase1Status
|
|
42
|
+
from stackit.vpn.models.phase2_status import Phase2Status
|
|
43
|
+
from stackit.vpn.models.plan import Plan
|
|
44
|
+
from stackit.vpn.models.plan_list import PlanList
|
|
45
|
+
from stackit.vpn.models.quota import Quota
|
|
46
|
+
from stackit.vpn.models.quota_list import QuotaList
|
|
47
|
+
from stackit.vpn.models.quota_list_response import QuotaListResponse
|
|
48
|
+
from stackit.vpn.models.region import Region
|
|
49
|
+
from stackit.vpn.models.routing_type import RoutingType
|
|
50
|
+
from stackit.vpn.models.tunnel_configuration import TunnelConfiguration
|
|
51
|
+
from stackit.vpn.models.tunnel_configuration_phase1 import TunnelConfigurationPhase1
|
|
52
|
+
from stackit.vpn.models.tunnel_configuration_phase2 import TunnelConfigurationPhase2
|
|
53
|
+
from stackit.vpn.models.tunnel_status import TunnelStatus
|
|
54
|
+
from stackit.vpn.models.update_gateway_connection_payload import (
|
|
55
|
+
UpdateGatewayConnectionPayload,
|
|
56
|
+
)
|
|
57
|
+
from stackit.vpn.models.update_vpn_gateway_payload import UpdateVPNGatewayPayload
|
|
58
|
+
from stackit.vpn.models.vpn_tunnels import VPNTunnels
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT VPN API
|
|
5
|
+
|
|
6
|
+
Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
from stackit.vpn.models.api_error_detail import APIErrorDetail
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class APIError(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
APIError
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
|
|
31
|
+
code: StrictInt = Field(description="The HTTP status code.")
|
|
32
|
+
details: Optional[List[APIErrorDetail]] = Field(default=None, description="Can contain more details on the error.")
|
|
33
|
+
message: StrictStr = Field(description="A message describing the error.")
|
|
34
|
+
status: StrictStr = Field(description="The HTTP status code text.")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["code", "details", "message", "status"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of APIError from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in details (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.details:
|
|
77
|
+
for _item_details in self.details:
|
|
78
|
+
if _item_details:
|
|
79
|
+
_items.append(_item_details.to_dict())
|
|
80
|
+
_dict["details"] = _items
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of APIError from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate(
|
|
93
|
+
{
|
|
94
|
+
"code": obj.get("code"),
|
|
95
|
+
"details": (
|
|
96
|
+
[APIErrorDetail.from_dict(_item) for _item in obj["details"]]
|
|
97
|
+
if obj.get("details") is not None
|
|
98
|
+
else None
|
|
99
|
+
),
|
|
100
|
+
"message": obj.get("message"),
|
|
101
|
+
"status": obj.get("status"),
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
return _obj
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT VPN API
|
|
5
|
+
|
|
6
|
+
Provision and manage STACKIT VPN gateways. Use this API to establish secure, encrypted IPsec tunnels between your STACKIT Network Area (SNA) and external networks. The service supports the following routing architectures: - Policy-based IPsec - Static route-based IPsec - Dynamic BGP IPsec
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class APIErrorDetail(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
APIErrorDetail
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
|
|
29
|
+
domain: StrictStr = Field(description="The domain of the error source.")
|
|
30
|
+
metadata: Optional[Dict[str, Any]] = Field(
|
|
31
|
+
default=None,
|
|
32
|
+
description="Metadata contains more information. For bad requests this would be field information.",
|
|
33
|
+
)
|
|
34
|
+
reason: StrictStr = Field(description="The reason why the error occurs.")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["domain", "metadata", "reason"]
|
|
36
|
+
|
|
37
|
+
@field_validator("reason")
|
|
38
|
+
def reason_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value not in set(["INVALID_FIELD", "INVALID_PATH_PARAMETER"]):
|
|
41
|
+
raise ValueError("must be one of enum values ('INVALID_FIELD', 'INVALID_PATH_PARAMETER')")
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
populate_by_name=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of APIErrorDetail from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of APIErrorDetail from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate(
|
|
93
|
+
{
|
|
94
|
+
"domain": obj.get("domain") if obj.get("domain") is not None else "vpn.access.stackit.cloud",
|
|
95
|
+
"metadata": obj.get("metadata"),
|
|
96
|
+
"reason": obj.get("reason"),
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
return _obj
|