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,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 Gateway(BaseModel):
32
+ """
33
+ Gateway
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 Gateway 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 Gateway 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,98 @@
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
21
+ from typing_extensions import Self
22
+
23
+ from stackit.vpn.models.gateway_response import GatewayResponse
24
+
25
+
26
+ class GatewayList(BaseModel):
27
+ """
28
+ GatewayList
29
+ """ # noqa: E501
30
+
31
+ gateways: List[GatewayResponse]
32
+ __properties: ClassVar[List[str]] = ["gateways"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of GatewayList from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ # override the default output from pydantic by calling `to_dict()` of each item in gateways (list)
72
+ _items = []
73
+ if self.gateways:
74
+ for _item_gateways in self.gateways:
75
+ if _item_gateways:
76
+ _items.append(_item_gateways.to_dict())
77
+ _dict["gateways"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of GatewayList from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate(
90
+ {
91
+ "gateways": (
92
+ [GatewayResponse.from_dict(_item) for _item in obj["gateways"]]
93
+ if obj.get("gateways") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,144 @@
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, StrictStr, field_validator
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.vpn.models.bgp_gateway_config import BGPGatewayConfig
26
+ from stackit.vpn.models.create_vpn_gateway_payload_availability_zones import (
27
+ CreateVPNGatewayPayloadAvailabilityZones,
28
+ )
29
+ from stackit.vpn.models.gateway_status import GatewayStatus
30
+ from stackit.vpn.models.routing_type import RoutingType
31
+
32
+
33
+ class GatewayResponse(BaseModel):
34
+ """
35
+ GatewayResponse
36
+ """ # noqa: E501
37
+
38
+ availability_zones: CreateVPNGatewayPayloadAvailabilityZones = Field(alias="availabilityZones")
39
+ bgp: Optional[BGPGatewayConfig] = None
40
+ display_name: Annotated[str, Field(strict=True)] = Field(
41
+ description="A user-friendly name for the VPN gateway.", alias="displayName"
42
+ )
43
+ labels: Optional[Dict[str, Annotated[str, Field(strict=True, max_length=63)]]] = Field(
44
+ default=None,
45
+ 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. ",
46
+ )
47
+ plan_id: StrictStr = Field(description="The service plan identifier.", alias="planId")
48
+ routing_type: RoutingType = Field(alias="routingType")
49
+ id: Optional[UUID] = Field(default=None, description="The server-generated UUID of the VPN gateway.")
50
+ state: Optional[GatewayStatus] = None
51
+ __properties: ClassVar[List[str]] = [
52
+ "availabilityZones",
53
+ "bgp",
54
+ "displayName",
55
+ "labels",
56
+ "planId",
57
+ "routingType",
58
+ "id",
59
+ "state",
60
+ ]
61
+
62
+ @field_validator("display_name")
63
+ def display_name_validate_regular_expression(cls, value):
64
+ """Validates the regular expression"""
65
+ if not re.match(r"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$", value):
66
+ raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/")
67
+ return value
68
+
69
+ model_config = ConfigDict(
70
+ populate_by_name=True,
71
+ validate_assignment=True,
72
+ protected_namespaces=(),
73
+ )
74
+
75
+ def to_str(self) -> str:
76
+ """Returns the string representation of the model using alias"""
77
+ return pprint.pformat(self.model_dump(by_alias=True))
78
+
79
+ def to_json(self) -> str:
80
+ """Returns the JSON representation of the model using alias"""
81
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
82
+ return json.dumps(self.to_dict())
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Optional[Self]:
86
+ """Create an instance of GatewayResponse from a JSON string"""
87
+ return cls.from_dict(json.loads(json_str))
88
+
89
+ def to_dict(self) -> Dict[str, Any]:
90
+ """Return the dictionary representation of the model using alias.
91
+
92
+ This has the following differences from calling pydantic's
93
+ `self.model_dump(by_alias=True)`:
94
+
95
+ * `None` is only added to the output dict for nullable fields that
96
+ were set at model initialization. Other fields with value `None`
97
+ are ignored.
98
+ * OpenAPI `readOnly` fields are excluded.
99
+ """
100
+ excluded_fields: Set[str] = set(
101
+ [
102
+ "id",
103
+ ]
104
+ )
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 availability_zones
112
+ if self.availability_zones:
113
+ _dict["availabilityZones"] = self.availability_zones.to_dict()
114
+ # override the default output from pydantic by calling `to_dict()` of bgp
115
+ if self.bgp:
116
+ _dict["bgp"] = self.bgp.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 GatewayResponse 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
+ "availabilityZones": (
131
+ CreateVPNGatewayPayloadAvailabilityZones.from_dict(obj["availabilityZones"])
132
+ if obj.get("availabilityZones") is not None
133
+ else None
134
+ ),
135
+ "bgp": BGPGatewayConfig.from_dict(obj["bgp"]) if obj.get("bgp") is not None else None,
136
+ "displayName": obj.get("displayName"),
137
+ "labels": obj.get("labels"),
138
+ "planId": obj.get("planId"),
139
+ "routingType": obj.get("routingType"),
140
+ "id": obj.get("id"),
141
+ "state": obj.get("state"),
142
+ }
143
+ )
144
+ return _obj
@@ -0,0 +1,38 @@
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
+ from enum import Enum
18
+
19
+ from typing_extensions import Self
20
+
21
+
22
+ class GatewayStatus(str, Enum):
23
+ """
24
+ The current lifecycle state of the gateway infrastructure. - `PENDING`: Provisioning or update is in progress. - `READY`: The gateway is fully operational. - `ERROR`: A failure occurred. - `DELETING`: The resource is being removed.
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ PENDING = "PENDING"
31
+ READY = "READY"
32
+ ERROR = "ERROR"
33
+ DELETING = "DELETING"
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of GatewayStatus from a JSON string"""
38
+ return cls(json.loads(json_str))
@@ -0,0 +1,122 @@
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 BaseModel, ConfigDict, Field, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.vpn.models.connection_status_response import ConnectionStatusResponse
25
+ from stackit.vpn.models.gateway_status import GatewayStatus
26
+ from stackit.vpn.models.vpn_tunnels import VPNTunnels
27
+
28
+
29
+ class GatewayStatusResponse(BaseModel):
30
+ """
31
+ GatewayStatusResponse
32
+ """ # noqa: E501
33
+
34
+ connections: Optional[List[ConnectionStatusResponse]] = None
35
+ display_name: Optional[StrictStr] = Field(
36
+ default=None, description="Name of the Gateway instance.", alias="displayName"
37
+ )
38
+ gateway_status: Optional[GatewayStatus] = Field(default=None, alias="gatewayStatus")
39
+ id: Optional[UUID] = Field(default=None, description="UUID of the Gateway instance.")
40
+ tunnels: Optional[List[VPNTunnels]] = None
41
+ __properties: ClassVar[List[str]] = ["connections", "displayName", "gatewayStatus", "id", "tunnels"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of GatewayStatusResponse from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of each item in connections (list)
81
+ _items = []
82
+ if self.connections:
83
+ for _item_connections in self.connections:
84
+ if _item_connections:
85
+ _items.append(_item_connections.to_dict())
86
+ _dict["connections"] = _items
87
+ # override the default output from pydantic by calling `to_dict()` of each item in tunnels (list)
88
+ _items = []
89
+ if self.tunnels:
90
+ for _item_tunnels in self.tunnels:
91
+ if _item_tunnels:
92
+ _items.append(_item_tunnels.to_dict())
93
+ _dict["tunnels"] = _items
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of GatewayStatusResponse from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate(
106
+ {
107
+ "connections": (
108
+ [ConnectionStatusResponse.from_dict(_item) for _item in obj["connections"]]
109
+ if obj.get("connections") is not None
110
+ else None
111
+ ),
112
+ "displayName": obj.get("displayName"),
113
+ "gatewayStatus": obj.get("gatewayStatus"),
114
+ "id": obj.get("id"),
115
+ "tunnels": (
116
+ [VPNTunnels.from_dict(_item) for _item in obj["tunnels"]]
117
+ if obj.get("tunnels") is not None
118
+ else None
119
+ ),
120
+ }
121
+ )
122
+ return _obj
@@ -0,0 +1,103 @@
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, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class PeeringConfig(BaseModel):
26
+ """
27
+ The peering object defines the point-to-point IP configuration for the Tunnel Interface. These addresses serve as next-hop identifiers and are used for BGP peering sessions and can be used in Static Route-Based connectivity.
28
+ """ # noqa: E501
29
+
30
+ local_address: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="localAddress")
31
+ remote_address: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, alias="remoteAddress")
32
+ __properties: ClassVar[List[str]] = ["localAddress", "remoteAddress"]
33
+
34
+ @field_validator("local_address")
35
+ def local_address_validate_regular_expression(cls, value):
36
+ """Validates the regular expression"""
37
+ if value is None:
38
+ return value
39
+
40
+ if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value):
41
+ raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/")
42
+ return value
43
+
44
+ @field_validator("remote_address")
45
+ def remote_address_validate_regular_expression(cls, value):
46
+ """Validates the regular expression"""
47
+ if value is None:
48
+ return value
49
+
50
+ if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", value):
51
+ raise ValueError(r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/")
52
+ return value
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of PeeringConfig from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of PeeringConfig from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate({"localAddress": obj.get("localAddress"), "remoteAddress": obj.get("remoteAddress")})
103
+ return _obj