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,88 @@
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
21
+ from typing_extensions import Self
22
+
23
+ from stackit.vpn.models.quota import Quota
24
+
25
+
26
+ class QuotaList(BaseModel):
27
+ """
28
+ QuotaList
29
+ """ # noqa: E501
30
+
31
+ gateways: Quota = Field(description="Current limit and usage for VPN gateways.")
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 QuotaList 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 gateways
72
+ if self.gateways:
73
+ _dict["gateways"] = self.gateways.to_dict()
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of QuotaList from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate(
86
+ {"gateways": Quota.from_dict(obj["gateways"]) if obj.get("gateways") is not None else None}
87
+ )
88
+ return _obj
@@ -0,0 +1,88 @@
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.quota_list import QuotaList
24
+
25
+
26
+ class QuotaListResponse(BaseModel):
27
+ """
28
+ QuotaListResponse
29
+ """ # noqa: E501
30
+
31
+ quotas: QuotaList
32
+ __properties: ClassVar[List[str]] = ["quotas"]
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 QuotaListResponse 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 quotas
72
+ if self.quotas:
73
+ _dict["quotas"] = self.quotas.to_dict()
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of QuotaListResponse from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate(
86
+ {"quotas": QuotaList.from_dict(obj["quotas"]) if obj.get("quotas") is not None else None}
87
+ )
88
+ return _obj
@@ -0,0 +1,36 @@
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 Region(str, Enum):
23
+ """
24
+ The region in which the resource is located.
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ EU01 = "eu01"
31
+ EU02 = "eu02"
32
+
33
+ @classmethod
34
+ def from_json(cls, json_str: str) -> Self:
35
+ """Create an instance of Region from a JSON string"""
36
+ return cls(json.loads(json_str))
@@ -0,0 +1,37 @@
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 RoutingType(str, Enum):
23
+ """
24
+ RoutingType
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ POLICY_BASED = "POLICY_BASED"
31
+ ROUTE_BASED = "ROUTE_BASED"
32
+ BGP_ROUTE_BASED = "BGP_ROUTE_BASED"
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of RoutingType from a JSON string"""
37
+ return cls(json.loads(json_str))
@@ -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, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.vpn.models.bgp_tunnel_config import BGPTunnelConfig
25
+ from stackit.vpn.models.peering_config import PeeringConfig
26
+ from stackit.vpn.models.tunnel_configuration_phase1 import TunnelConfigurationPhase1
27
+ from stackit.vpn.models.tunnel_configuration_phase2 import TunnelConfigurationPhase2
28
+
29
+
30
+ class TunnelConfiguration(BaseModel):
31
+ """
32
+ TunnelConfiguration
33
+ """ # noqa: E501
34
+
35
+ bgp: Optional[BGPTunnelConfig] = None
36
+ peering: Optional[PeeringConfig] = None
37
+ phase1: TunnelConfigurationPhase1
38
+ phase2: TunnelConfigurationPhase2
39
+ pre_shared_key: Optional[Annotated[str, Field(min_length=20, strict=True)]] = Field(
40
+ default=None,
41
+ description="A Pre-Shared Key for authentication. Required in create-requests, optional in update-requests and omitted in every response.",
42
+ alias="preSharedKey",
43
+ )
44
+ remote_address: Annotated[str, Field(strict=True)] = Field(alias="remoteAddress")
45
+ __properties: ClassVar[List[str]] = ["bgp", "peering", "phase1", "phase2", "preSharedKey", "remoteAddress"]
46
+
47
+ @field_validator("remote_address")
48
+ def remote_address_validate_regular_expression(cls, value):
49
+ """Validates the regular expression"""
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 TunnelConfiguration 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
+ # override the default output from pydantic by calling `to_dict()` of bgp
92
+ if self.bgp:
93
+ _dict["bgp"] = self.bgp.to_dict()
94
+ # override the default output from pydantic by calling `to_dict()` of peering
95
+ if self.peering:
96
+ _dict["peering"] = self.peering.to_dict()
97
+ # override the default output from pydantic by calling `to_dict()` of phase1
98
+ if self.phase1:
99
+ _dict["phase1"] = self.phase1.to_dict()
100
+ # override the default output from pydantic by calling `to_dict()` of phase2
101
+ if self.phase2:
102
+ _dict["phase2"] = self.phase2.to_dict()
103
+ return _dict
104
+
105
+ @classmethod
106
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
107
+ """Create an instance of TunnelConfiguration from a dict"""
108
+ if obj is None:
109
+ return None
110
+
111
+ if not isinstance(obj, dict):
112
+ return cls.model_validate(obj)
113
+
114
+ _obj = cls.model_validate(
115
+ {
116
+ "bgp": BGPTunnelConfig.from_dict(obj["bgp"]) if obj.get("bgp") is not None else None,
117
+ "peering": PeeringConfig.from_dict(obj["peering"]) if obj.get("peering") is not None else None,
118
+ "phase1": TunnelConfigurationPhase1.from_dict(obj["phase1"]) if obj.get("phase1") is not None else None,
119
+ "phase2": TunnelConfigurationPhase2.from_dict(obj["phase2"]) if obj.get("phase2") is not None else None,
120
+ "preSharedKey": obj.get("preSharedKey"),
121
+ "remoteAddress": obj.get("remoteAddress"),
122
+ }
123
+ )
124
+ return _obj
@@ -0,0 +1,126 @@
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 Annotated, Self
22
+
23
+
24
+ class TunnelConfigurationPhase1(BaseModel):
25
+ """
26
+ TunnelConfigurationPhase1
27
+ """ # noqa: E501
28
+
29
+ dh_groups: Optional[List[StrictStr]] = Field(
30
+ default=None,
31
+ description="The Diffie-Hellman Group. Required, except if AEAD algorithms are selected.",
32
+ alias="dhGroups",
33
+ )
34
+ encryption_algorithms: List[StrictStr] = Field(alias="encryptionAlgorithms")
35
+ integrity_algorithms: List[StrictStr] = Field(alias="integrityAlgorithms")
36
+ rekey_time: Optional[Annotated[int, Field(le=28800, strict=True, ge=900)]] = Field(
37
+ default=14400, description="Time to schedule a IKE re-keying (in seconds).", alias="rekeyTime"
38
+ )
39
+ __properties: ClassVar[List[str]] = ["dhGroups", "encryptionAlgorithms", "integrityAlgorithms", "rekeyTime"]
40
+
41
+ @field_validator("dh_groups")
42
+ def dh_groups_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value is None:
45
+ return value
46
+
47
+ for i in value:
48
+ if i not in set(["modp1024", "modp2048", "ecp256", "ecp384", "modp2048s256"]):
49
+ raise ValueError(
50
+ "each list item must be one of ('modp1024', 'modp2048', 'ecp256', 'ecp384', 'modp2048s256')"
51
+ )
52
+ return value
53
+
54
+ @field_validator("encryption_algorithms")
55
+ def encryption_algorithms_validate_enum(cls, value):
56
+ """Validates the enum"""
57
+ for i in value:
58
+ if i not in set(["aes256", "aes128gcm16", "aes256gcm16"]):
59
+ raise ValueError("each list item must be one of ('aes256', 'aes128gcm16', 'aes256gcm16')")
60
+ return value
61
+
62
+ @field_validator("integrity_algorithms")
63
+ def integrity_algorithms_validate_enum(cls, value):
64
+ """Validates the enum"""
65
+ for i in value:
66
+ if i not in set(["sha1", "sha2_256", "sha2_384"]):
67
+ raise ValueError("each list item must be one of ('sha1', 'sha2_256', 'sha2_384')")
68
+ return value
69
+
70
+ model_config = ConfigDict(
71
+ populate_by_name=True,
72
+ validate_assignment=True,
73
+ protected_namespaces=(),
74
+ )
75
+
76
+ def to_str(self) -> str:
77
+ """Returns the string representation of the model using alias"""
78
+ return pprint.pformat(self.model_dump(by_alias=True))
79
+
80
+ def to_json(self) -> str:
81
+ """Returns the JSON representation of the model using alias"""
82
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
83
+ return json.dumps(self.to_dict())
84
+
85
+ @classmethod
86
+ def from_json(cls, json_str: str) -> Optional[Self]:
87
+ """Create an instance of TunnelConfigurationPhase1 from a JSON string"""
88
+ return cls.from_dict(json.loads(json_str))
89
+
90
+ def to_dict(self) -> Dict[str, Any]:
91
+ """Return the dictionary representation of the model using alias.
92
+
93
+ This has the following differences from calling pydantic's
94
+ `self.model_dump(by_alias=True)`:
95
+
96
+ * `None` is only added to the output dict for nullable fields that
97
+ were set at model initialization. Other fields with value `None`
98
+ are ignored.
99
+ """
100
+ excluded_fields: Set[str] = set([])
101
+
102
+ _dict = self.model_dump(
103
+ by_alias=True,
104
+ exclude=excluded_fields,
105
+ exclude_none=True,
106
+ )
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of TunnelConfigurationPhase1 from a dict"""
112
+ if obj is None:
113
+ return None
114
+
115
+ if not isinstance(obj, dict):
116
+ return cls.model_validate(obj)
117
+
118
+ _obj = cls.model_validate(
119
+ {
120
+ "dhGroups": obj.get("dhGroups"),
121
+ "encryptionAlgorithms": obj.get("encryptionAlgorithms"),
122
+ "integrityAlgorithms": obj.get("integrityAlgorithms"),
123
+ "rekeyTime": obj.get("rekeyTime") if obj.get("rekeyTime") is not None else 14400,
124
+ }
125
+ )
126
+ return _obj
@@ -0,0 +1,165 @@
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 Annotated, Self
22
+
23
+
24
+ class TunnelConfigurationPhase2(BaseModel):
25
+ """
26
+ TunnelConfigurationPhase2
27
+ """ # noqa: E501
28
+
29
+ dh_groups: Optional[List[StrictStr]] = Field(
30
+ default=None,
31
+ description="The Diffie-Hellman Group. Required, except if AEAD algorithms are selected.",
32
+ alias="dhGroups",
33
+ )
34
+ encryption_algorithms: List[StrictStr] = Field(alias="encryptionAlgorithms")
35
+ integrity_algorithms: List[StrictStr] = Field(alias="integrityAlgorithms")
36
+ dpd_action: Optional[StrictStr] = Field(
37
+ default="restart",
38
+ description='Action to perform for this CHILD_SA on DPD timeout. "clear": Closes the CHILD_SA and does not take further action. "restart": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. ',
39
+ alias="dpdAction",
40
+ )
41
+ rekey_time: Optional[Annotated[int, Field(le=3600, strict=True, ge=900)]] = Field(
42
+ default=3600, description="Time to schedule a Child SA re-keying (in seconds).", alias="rekeyTime"
43
+ )
44
+ start_action: Optional[StrictStr] = Field(
45
+ default="start",
46
+ description='Action to perform after loading the connection configuration. "none": The connection will be loaded but needs to be manually initiated. "start": initiates the connection actively. ',
47
+ alias="startAction",
48
+ )
49
+ __properties: ClassVar[List[str]] = [
50
+ "dhGroups",
51
+ "encryptionAlgorithms",
52
+ "integrityAlgorithms",
53
+ "dpdAction",
54
+ "rekeyTime",
55
+ "startAction",
56
+ ]
57
+
58
+ @field_validator("dh_groups")
59
+ def dh_groups_validate_enum(cls, value):
60
+ """Validates the enum"""
61
+ if value is None:
62
+ return value
63
+
64
+ for i in value:
65
+ if i not in set(["modp1024", "modp2048", "ecp256", "ecp384", "modp2048s256"]):
66
+ raise ValueError(
67
+ "each list item must be one of ('modp1024', 'modp2048', 'ecp256', 'ecp384', 'modp2048s256')"
68
+ )
69
+ return value
70
+
71
+ @field_validator("encryption_algorithms")
72
+ def encryption_algorithms_validate_enum(cls, value):
73
+ """Validates the enum"""
74
+ for i in value:
75
+ if i not in set(["aes256", "aes128gcm16", "aes256gcm16"]):
76
+ raise ValueError("each list item must be one of ('aes256', 'aes128gcm16', 'aes256gcm16')")
77
+ return value
78
+
79
+ @field_validator("integrity_algorithms")
80
+ def integrity_algorithms_validate_enum(cls, value):
81
+ """Validates the enum"""
82
+ for i in value:
83
+ if i not in set(["sha1", "sha2_256", "sha2_384"]):
84
+ raise ValueError("each list item must be one of ('sha1', 'sha2_256', 'sha2_384')")
85
+ return value
86
+
87
+ @field_validator("dpd_action")
88
+ def dpd_action_validate_enum(cls, value):
89
+ """Validates the enum"""
90
+ if value is None:
91
+ return value
92
+
93
+ if value not in set(["clear", "restart"]):
94
+ raise ValueError("must be one of enum values ('clear', 'restart')")
95
+ return value
96
+
97
+ @field_validator("start_action")
98
+ def start_action_validate_enum(cls, value):
99
+ """Validates the enum"""
100
+ if value is None:
101
+ return value
102
+
103
+ if value not in set(["none", "start"]):
104
+ raise ValueError("must be one of enum values ('none', 'start')")
105
+ return value
106
+
107
+ model_config = ConfigDict(
108
+ populate_by_name=True,
109
+ validate_assignment=True,
110
+ protected_namespaces=(),
111
+ )
112
+
113
+ def to_str(self) -> str:
114
+ """Returns the string representation of the model using alias"""
115
+ return pprint.pformat(self.model_dump(by_alias=True))
116
+
117
+ def to_json(self) -> str:
118
+ """Returns the JSON representation of the model using alias"""
119
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
120
+ return json.dumps(self.to_dict())
121
+
122
+ @classmethod
123
+ def from_json(cls, json_str: str) -> Optional[Self]:
124
+ """Create an instance of TunnelConfigurationPhase2 from a JSON string"""
125
+ return cls.from_dict(json.loads(json_str))
126
+
127
+ def to_dict(self) -> Dict[str, Any]:
128
+ """Return the dictionary representation of the model using alias.
129
+
130
+ This has the following differences from calling pydantic's
131
+ `self.model_dump(by_alias=True)`:
132
+
133
+ * `None` is only added to the output dict for nullable fields that
134
+ were set at model initialization. Other fields with value `None`
135
+ are ignored.
136
+ """
137
+ excluded_fields: Set[str] = set([])
138
+
139
+ _dict = self.model_dump(
140
+ by_alias=True,
141
+ exclude=excluded_fields,
142
+ exclude_none=True,
143
+ )
144
+ return _dict
145
+
146
+ @classmethod
147
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
148
+ """Create an instance of TunnelConfigurationPhase2 from a dict"""
149
+ if obj is None:
150
+ return None
151
+
152
+ if not isinstance(obj, dict):
153
+ return cls.model_validate(obj)
154
+
155
+ _obj = cls.model_validate(
156
+ {
157
+ "dhGroups": obj.get("dhGroups"),
158
+ "encryptionAlgorithms": obj.get("encryptionAlgorithms"),
159
+ "integrityAlgorithms": obj.get("integrityAlgorithms"),
160
+ "dpdAction": obj.get("dpdAction") if obj.get("dpdAction") is not None else "restart",
161
+ "rekeyTime": obj.get("rekeyTime") if obj.get("rekeyTime") is not None else 3600,
162
+ "startAction": obj.get("startAction") if obj.get("startAction") is not None else "start",
163
+ }
164
+ )
165
+ return _obj