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.
Files changed (52) hide show
  1. src/stackit/vpn/__init__.py +145 -0
  2. src/stackit/vpn/api/__init__.py +4 -0
  3. src/stackit/vpn/api/default_api.py +3947 -0
  4. src/stackit/vpn/api_client.py +652 -0
  5. src/stackit/vpn/api_response.py +23 -0
  6. src/stackit/vpn/configuration.py +164 -0
  7. src/stackit/vpn/exceptions.py +217 -0
  8. src/stackit/vpn/models/__init__.py +58 -0
  9. src/stackit/vpn/models/api_error.py +104 -0
  10. src/stackit/vpn/models/api_error_detail.py +99 -0
  11. src/stackit/vpn/models/api_error_response.py +86 -0
  12. src/stackit/vpn/models/bgp_gateway_config.py +94 -0
  13. src/stackit/vpn/models/bgp_status.py +112 -0
  14. src/stackit/vpn/models/bgp_status_peers.py +97 -0
  15. src/stackit/vpn/models/bgp_status_routes.py +93 -0
  16. src/stackit/vpn/models/bgp_tunnel_config.py +84 -0
  17. src/stackit/vpn/models/connection_list.py +98 -0
  18. src/stackit/vpn/models/connection_response.py +149 -0
  19. src/stackit/vpn/models/connection_status_response.py +113 -0
  20. src/stackit/vpn/models/create_gateway_connection_payload.py +139 -0
  21. src/stackit/vpn/models/create_vpn_gateway_payload.py +124 -0
  22. src/stackit/vpn/models/create_vpn_gateway_payload_availability_zones.py +82 -0
  23. src/stackit/vpn/models/gateway.py +124 -0
  24. src/stackit/vpn/models/gateway_list.py +98 -0
  25. src/stackit/vpn/models/gateway_response.py +144 -0
  26. src/stackit/vpn/models/gateway_status.py +38 -0
  27. src/stackit/vpn/models/gateway_status_response.py +122 -0
  28. src/stackit/vpn/models/peering_config.py +103 -0
  29. src/stackit/vpn/models/phase.py +122 -0
  30. src/stackit/vpn/models/phase1_status.py +99 -0
  31. src/stackit/vpn/models/phase2_status.py +143 -0
  32. src/stackit/vpn/models/plan.py +101 -0
  33. src/stackit/vpn/models/plan_list.py +98 -0
  34. src/stackit/vpn/models/quota.py +82 -0
  35. src/stackit/vpn/models/quota_list.py +88 -0
  36. src/stackit/vpn/models/quota_list_response.py +88 -0
  37. src/stackit/vpn/models/region.py +36 -0
  38. src/stackit/vpn/models/routing_type.py +37 -0
  39. src/stackit/vpn/models/tunnel_configuration.py +124 -0
  40. src/stackit/vpn/models/tunnel_configuration_phase1.py +126 -0
  41. src/stackit/vpn/models/tunnel_configuration_phase2.py +165 -0
  42. src/stackit/vpn/models/tunnel_status.py +110 -0
  43. src/stackit/vpn/models/update_gateway_connection_payload.py +139 -0
  44. src/stackit/vpn/models/update_vpn_gateway_payload.py +124 -0
  45. src/stackit/vpn/models/vpn_tunnels.py +114 -0
  46. src/stackit/vpn/py.typed +0 -0
  47. src/stackit/vpn/rest.py +164 -0
  48. stackit_vpn-0.1.0.dist-info/METADATA +53 -0
  49. stackit_vpn-0.1.0.dist-info/RECORD +52 -0
  50. stackit_vpn-0.1.0.dist-info/WHEEL +4 -0
  51. stackit_vpn-0.1.0.dist-info/licenses/LICENSE.md +201 -0
  52. stackit_vpn-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
@@ -0,0 +1,149 @@
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
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+ from uuid import UUID
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.vpn.models.tunnel_configuration import TunnelConfiguration
26
+
27
+
28
+ class ConnectionResponse(BaseModel):
29
+ """
30
+ ConnectionResponse
31
+ """ # noqa: E501
32
+
33
+ display_name: Annotated[str, Field(strict=True)] = Field(
34
+ description="A user-friendly name for the connection.", alias="displayName"
35
+ )
36
+ enabled: Optional[StrictBool] = Field(
37
+ default=None, description="This flag decides whether this connection should be enabled or disabled"
38
+ )
39
+ id: Optional[UUID] = Field(default=None, description="UUID of the Gateway instance.")
40
+ labels: Optional[Dict[str, Annotated[str, Field(strict=True, max_length=63)]]] = Field(
41
+ default=None,
42
+ description="Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. ",
43
+ )
44
+ local_subnets: Optional[
45
+ Annotated[List[Annotated[str, Field(strict=True)]], Field(min_length=1, max_length=100)]
46
+ ] = Field(
47
+ default=None,
48
+ description="Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based.",
49
+ alias="localSubnets",
50
+ )
51
+ remote_subnets: Optional[
52
+ Annotated[List[Annotated[str, Field(strict=True)]], Field(min_length=1, max_length=100)]
53
+ ] = Field(
54
+ default=None,
55
+ description="Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based.",
56
+ alias="remoteSubnets",
57
+ )
58
+ static_routes: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
59
+ default=None, description="Optional. Use this for route-based VPN.", alias="staticRoutes"
60
+ )
61
+ tunnel1: TunnelConfiguration
62
+ tunnel2: TunnelConfiguration
63
+ __properties: ClassVar[List[str]] = [
64
+ "displayName",
65
+ "enabled",
66
+ "id",
67
+ "labels",
68
+ "localSubnets",
69
+ "remoteSubnets",
70
+ "staticRoutes",
71
+ "tunnel1",
72
+ "tunnel2",
73
+ ]
74
+
75
+ @field_validator("display_name")
76
+ def display_name_validate_regular_expression(cls, value):
77
+ """Validates the regular expression"""
78
+ if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
79
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
80
+ return value
81
+
82
+ model_config = ConfigDict(
83
+ populate_by_name=True,
84
+ validate_assignment=True,
85
+ protected_namespaces=(),
86
+ )
87
+
88
+ def to_str(self) -> str:
89
+ """Returns the string representation of the model using alias"""
90
+ return pprint.pformat(self.model_dump(by_alias=True))
91
+
92
+ def to_json(self) -> str:
93
+ """Returns the JSON representation of the model using alias"""
94
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
95
+ return json.dumps(self.to_dict())
96
+
97
+ @classmethod
98
+ def from_json(cls, json_str: str) -> Optional[Self]:
99
+ """Create an instance of ConnectionResponse from a JSON string"""
100
+ return cls.from_dict(json.loads(json_str))
101
+
102
+ def to_dict(self) -> Dict[str, Any]:
103
+ """Return the dictionary representation of the model using alias.
104
+
105
+ This has the following differences from calling pydantic's
106
+ `self.model_dump(by_alias=True)`:
107
+
108
+ * `None` is only added to the output dict for nullable fields that
109
+ were set at model initialization. Other fields with value `None`
110
+ are ignored.
111
+ """
112
+ excluded_fields: Set[str] = set([])
113
+
114
+ _dict = self.model_dump(
115
+ by_alias=True,
116
+ exclude=excluded_fields,
117
+ exclude_none=True,
118
+ )
119
+ # override the default output from pydantic by calling `to_dict()` of tunnel1
120
+ if self.tunnel1:
121
+ _dict["tunnel1"] = self.tunnel1.to_dict()
122
+ # override the default output from pydantic by calling `to_dict()` of tunnel2
123
+ if self.tunnel2:
124
+ _dict["tunnel2"] = self.tunnel2.to_dict()
125
+ return _dict
126
+
127
+ @classmethod
128
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
129
+ """Create an instance of ConnectionResponse from a dict"""
130
+ if obj is None:
131
+ return None
132
+
133
+ if not isinstance(obj, dict):
134
+ return cls.model_validate(obj)
135
+
136
+ _obj = cls.model_validate(
137
+ {
138
+ "displayName": obj.get("displayName"),
139
+ "enabled": obj.get("enabled"),
140
+ "id": obj.get("id"),
141
+ "labels": obj.get("labels"),
142
+ "localSubnets": obj.get("localSubnets"),
143
+ "remoteSubnets": obj.get("remoteSubnets"),
144
+ "staticRoutes": obj.get("staticRoutes"),
145
+ "tunnel1": TunnelConfiguration.from_dict(obj["tunnel1"]) if obj.get("tunnel1") is not None else None,
146
+ "tunnel2": TunnelConfiguration.from_dict(obj["tunnel2"]) if obj.get("tunnel2") is not None else None,
147
+ }
148
+ )
149
+ return _obj
@@ -0,0 +1,113 @@
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
+ from uuid import UUID
20
+
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictStr,
27
+ )
28
+ from typing_extensions import Self
29
+
30
+ from stackit.vpn.models.tunnel_status import TunnelStatus
31
+
32
+
33
+ class ConnectionStatusResponse(BaseModel):
34
+ """
35
+ ConnectionStatusResponse
36
+ """ # noqa: E501
37
+
38
+ display_name: Optional[StrictStr] = Field(
39
+ default=None, description="The name of the connection.", alias="displayName"
40
+ )
41
+ enabled: Optional[StrictBool] = None
42
+ id: Optional[UUID] = Field(default=None, description="UUID of the connection.")
43
+ tunnels: Optional[List[TunnelStatus]] = None
44
+ __properties: ClassVar[List[str]] = ["displayName", "enabled", "id", "tunnels"]
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of ConnectionStatusResponse from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # override the default output from pydantic by calling `to_dict()` of each item in tunnels (list)
84
+ _items = []
85
+ if self.tunnels:
86
+ for _item_tunnels in self.tunnels:
87
+ if _item_tunnels:
88
+ _items.append(_item_tunnels.to_dict())
89
+ _dict["tunnels"] = _items
90
+ return _dict
91
+
92
+ @classmethod
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94
+ """Create an instance of ConnectionStatusResponse from a dict"""
95
+ if obj is None:
96
+ return None
97
+
98
+ if not isinstance(obj, dict):
99
+ return cls.model_validate(obj)
100
+
101
+ _obj = cls.model_validate(
102
+ {
103
+ "displayName": obj.get("displayName"),
104
+ "enabled": obj.get("enabled"),
105
+ "id": obj.get("id"),
106
+ "tunnels": (
107
+ [TunnelStatus.from_dict(_item) for _item in obj["tunnels"]]
108
+ if obj.get("tunnels") is not None
109
+ else None
110
+ ),
111
+ }
112
+ )
113
+ return _obj
@@ -0,0 +1,139 @@
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
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.vpn.models.tunnel_configuration import TunnelConfiguration
25
+
26
+
27
+ class CreateGatewayConnectionPayload(BaseModel):
28
+ """
29
+ CreateGatewayConnectionPayload
30
+ """ # noqa: E501
31
+
32
+ display_name: Annotated[str, Field(strict=True)] = Field(
33
+ description="A user-friendly name for the connection.", alias="displayName"
34
+ )
35
+ enabled: Optional[StrictBool] = Field(
36
+ default=None, description="This flag decides whether this connection should be enabled or disabled"
37
+ )
38
+ local_subnets: Optional[
39
+ Annotated[List[Annotated[str, Field(strict=True)]], Field(min_length=1, max_length=100)]
40
+ ] = Field(
41
+ default=None,
42
+ description="Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based.",
43
+ alias="localSubnets",
44
+ )
45
+ remote_subnets: Optional[
46
+ Annotated[List[Annotated[str, Field(strict=True)]], Field(min_length=1, max_length=100)]
47
+ ] = Field(
48
+ default=None,
49
+ description="Optional. Defaults to 0.0.0.0/0 for Route-based VPN configurations. Mandatory for Policy-based.",
50
+ alias="remoteSubnets",
51
+ )
52
+ static_routes: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
53
+ default=None, description="Optional. Use this for route-based VPN.", alias="staticRoutes"
54
+ )
55
+ tunnel1: TunnelConfiguration
56
+ tunnel2: TunnelConfiguration
57
+ __properties: ClassVar[List[str]] = [
58
+ "displayName",
59
+ "enabled",
60
+ "localSubnets",
61
+ "remoteSubnets",
62
+ "staticRoutes",
63
+ "tunnel1",
64
+ "tunnel2",
65
+ ]
66
+
67
+ @field_validator("display_name")
68
+ def display_name_validate_regular_expression(cls, value):
69
+ """Validates the regular expression"""
70
+ if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
71
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
72
+ return value
73
+
74
+ model_config = ConfigDict(
75
+ populate_by_name=True,
76
+ validate_assignment=True,
77
+ protected_namespaces=(),
78
+ )
79
+
80
+ def to_str(self) -> str:
81
+ """Returns the string representation of the model using alias"""
82
+ return pprint.pformat(self.model_dump(by_alias=True))
83
+
84
+ def to_json(self) -> str:
85
+ """Returns the JSON representation of the model using alias"""
86
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
+ return json.dumps(self.to_dict())
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Optional[Self]:
91
+ """Create an instance of CreateGatewayConnectionPayload from a JSON string"""
92
+ return cls.from_dict(json.loads(json_str))
93
+
94
+ def to_dict(self) -> Dict[str, Any]:
95
+ """Return the dictionary representation of the model using alias.
96
+
97
+ This has the following differences from calling pydantic's
98
+ `self.model_dump(by_alias=True)`:
99
+
100
+ * `None` is only added to the output dict for nullable fields that
101
+ were set at model initialization. Other fields with value `None`
102
+ are ignored.
103
+ """
104
+ excluded_fields: Set[str] = set([])
105
+
106
+ _dict = self.model_dump(
107
+ by_alias=True,
108
+ exclude=excluded_fields,
109
+ exclude_none=True,
110
+ )
111
+ # override the default output from pydantic by calling `to_dict()` of tunnel1
112
+ if self.tunnel1:
113
+ _dict["tunnel1"] = self.tunnel1.to_dict()
114
+ # override the default output from pydantic by calling `to_dict()` of tunnel2
115
+ if self.tunnel2:
116
+ _dict["tunnel2"] = self.tunnel2.to_dict()
117
+ return _dict
118
+
119
+ @classmethod
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
121
+ """Create an instance of CreateGatewayConnectionPayload from a dict"""
122
+ if obj is None:
123
+ return None
124
+
125
+ if not isinstance(obj, dict):
126
+ return cls.model_validate(obj)
127
+
128
+ _obj = cls.model_validate(
129
+ {
130
+ "displayName": obj.get("displayName"),
131
+ "enabled": obj.get("enabled"),
132
+ "localSubnets": obj.get("localSubnets"),
133
+ "remoteSubnets": obj.get("remoteSubnets"),
134
+ "staticRoutes": obj.get("staticRoutes"),
135
+ "tunnel1": TunnelConfiguration.from_dict(obj["tunnel1"]) if obj.get("tunnel1") is not None else None,
136
+ "tunnel2": TunnelConfiguration.from_dict(obj["tunnel2"]) if obj.get("tunnel2") is not None else None,
137
+ }
138
+ )
139
+ return _obj
@@ -0,0 +1,124 @@
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
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig
25
+ from stackit.vpn.models.create_vpn_gateway_payload_availability_zones import (
26
+ CreateVPNGatewayPayloadAvailabilityZones,
27
+ )
28
+ from stackit.vpn.models.routing_type import RoutingType
29
+
30
+
31
+ class CreateVPNGatewayPayload(BaseModel):
32
+ """
33
+ CreateVPNGatewayPayload
34
+ """ # noqa: E501
35
+
36
+ availability_zones: CreateVPNGatewayPayloadAvailabilityZones = Field(alias="availabilityZones")
37
+ bgp: Optional[BGPGatewayConfig] = None
38
+ display_name: Annotated[str, Field(strict=True)] = Field(
39
+ description="A user-friendly name for the VPN gateway.", alias="displayName"
40
+ )
41
+ labels: Optional[Dict[str, Annotated[str, Field(strict=True, max_length=63)]]] = Field(
42
+ default=None,
43
+ description="Map of custom labels. Key and values must be a string with max 63 chars, start/end with alphanumeric. The key of a label follows the same rules as the `LabelValue` except that it cannot be empty. ",
44
+ )
45
+ plan_id: StrictStr = Field(description="The service plan identifier.", alias="planId")
46
+ routing_type: RoutingType = Field(alias="routingType")
47
+ __properties: ClassVar[List[str]] = ["availabilityZones", "bgp", "displayName", "labels", "planId", "routingType"]
48
+
49
+ @field_validator("display_name")
50
+ def display_name_validate_regular_expression(cls, value):
51
+ """Validates the regular expression"""
52
+ if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
53
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
54
+ return value
55
+
56
+ model_config = ConfigDict(
57
+ populate_by_name=True,
58
+ validate_assignment=True,
59
+ protected_namespaces=(),
60
+ )
61
+
62
+ def to_str(self) -> str:
63
+ """Returns the string representation of the model using alias"""
64
+ return pprint.pformat(self.model_dump(by_alias=True))
65
+
66
+ def to_json(self) -> str:
67
+ """Returns the JSON representation of the model using alias"""
68
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
+ return json.dumps(self.to_dict())
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of CreateVPNGatewayPayload from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # override the default output from pydantic by calling `to_dict()` of availability_zones
94
+ if self.availability_zones:
95
+ _dict["availabilityZones"] = self.availability_zones.to_dict()
96
+ # override the default output from pydantic by calling `to_dict()` of bgp
97
+ if self.bgp:
98
+ _dict["bgp"] = self.bgp.to_dict()
99
+ return _dict
100
+
101
+ @classmethod
102
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
103
+ """Create an instance of CreateVPNGatewayPayload from a dict"""
104
+ if obj is None:
105
+ return None
106
+
107
+ if not isinstance(obj, dict):
108
+ return cls.model_validate(obj)
109
+
110
+ _obj = cls.model_validate(
111
+ {
112
+ "availabilityZones": (
113
+ CreateVPNGatewayPayloadAvailabilityZones.from_dict(obj["availabilityZones"])
114
+ if obj.get("availabilityZones") is not None
115
+ else None
116
+ ),
117
+ "bgp": BGPGatewayConfig.from_dict(obj["bgp"]) if obj.get("bgp") is not None else None,
118
+ "displayName": obj.get("displayName"),
119
+ "labels": obj.get("labels"),
120
+ "planId": obj.get("planId"),
121
+ "routingType": obj.get("routingType"),
122
+ }
123
+ )
124
+ return _obj
@@ -0,0 +1,82 @@
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
21
+ from typing_extensions import Self
22
+
23
+
24
+ class CreateVPNGatewayPayloadAvailabilityZones(BaseModel):
25
+ """
26
+ CreateVPNGatewayPayloadAvailabilityZones
27
+ """ # noqa: E501
28
+
29
+ tunnel1: StrictStr = Field(description="Object that represents an availability zone.")
30
+ tunnel2: StrictStr = Field(description="Object that represents an availability zone.")
31
+ __properties: ClassVar[List[str]] = ["tunnel1", "tunnel2"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of CreateVPNGatewayPayloadAvailabilityZones from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([])
64
+
65
+ _dict = self.model_dump(
66
+ by_alias=True,
67
+ exclude=excluded_fields,
68
+ exclude_none=True,
69
+ )
70
+ return _dict
71
+
72
+ @classmethod
73
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
+ """Create an instance of CreateVPNGatewayPayloadAvailabilityZones from a dict"""
75
+ if obj is None:
76
+ return None
77
+
78
+ if not isinstance(obj, dict):
79
+ return cls.model_validate(obj)
80
+
81
+ _obj = cls.model_validate({"tunnel1": obj.get("tunnel1"), "tunnel2": obj.get("tunnel2")})
82
+ return _obj