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,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
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing_extensions import Self
22
+
23
+
24
+ class Phase(BaseModel):
25
+ """
26
+ Phase
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
+ __properties: ClassVar[List[str]] = ["dhGroups", "encryptionAlgorithms", "integrityAlgorithms"]
37
+
38
+ @field_validator("dh_groups")
39
+ def dh_groups_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value is None:
42
+ return value
43
+
44
+ for i in value:
45
+ if i not in set(["modp1024", "modp2048", "ecp256", "ecp384", "modp2048s256"]):
46
+ raise ValueError(
47
+ "each list item must be one of ('modp1024', 'modp2048', 'ecp256', 'ecp384', 'modp2048s256')"
48
+ )
49
+ return value
50
+
51
+ @field_validator("encryption_algorithms")
52
+ def encryption_algorithms_validate_enum(cls, value):
53
+ """Validates the enum"""
54
+ for i in value:
55
+ if i not in set(["aes256", "aes128gcm16", "aes256gcm16"]):
56
+ raise ValueError("each list item must be one of ('aes256', 'aes128gcm16', 'aes256gcm16')")
57
+ return value
58
+
59
+ @field_validator("integrity_algorithms")
60
+ def integrity_algorithms_validate_enum(cls, value):
61
+ """Validates the enum"""
62
+ for i in value:
63
+ if i not in set(["sha1", "sha2_256", "sha2_384"]):
64
+ raise ValueError("each list item must be one of ('sha1', 'sha2_256', 'sha2_384')")
65
+ return value
66
+
67
+ model_config = ConfigDict(
68
+ populate_by_name=True,
69
+ validate_assignment=True,
70
+ protected_namespaces=(),
71
+ )
72
+
73
+ def to_str(self) -> str:
74
+ """Returns the string representation of the model using alias"""
75
+ return pprint.pformat(self.model_dump(by_alias=True))
76
+
77
+ def to_json(self) -> str:
78
+ """Returns the JSON representation of the model using alias"""
79
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
80
+ return json.dumps(self.to_dict())
81
+
82
+ @classmethod
83
+ def from_json(cls, json_str: str) -> Optional[Self]:
84
+ """Create an instance of Phase from a JSON string"""
85
+ return cls.from_dict(json.loads(json_str))
86
+
87
+ def to_dict(self) -> Dict[str, Any]:
88
+ """Return the dictionary representation of the model using alias.
89
+
90
+ This has the following differences from calling pydantic's
91
+ `self.model_dump(by_alias=True)`:
92
+
93
+ * `None` is only added to the output dict for nullable fields that
94
+ were set at model initialization. Other fields with value `None`
95
+ are ignored.
96
+ """
97
+ excluded_fields: Set[str] = set([])
98
+
99
+ _dict = self.model_dump(
100
+ by_alias=True,
101
+ exclude=excluded_fields,
102
+ exclude_none=True,
103
+ )
104
+ return _dict
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108
+ """Create an instance of Phase from a dict"""
109
+ if obj is None:
110
+ return None
111
+
112
+ if not isinstance(obj, dict):
113
+ return cls.model_validate(obj)
114
+
115
+ _obj = cls.model_validate(
116
+ {
117
+ "dhGroups": obj.get("dhGroups"),
118
+ "encryptionAlgorithms": obj.get("encryptionAlgorithms"),
119
+ "integrityAlgorithms": obj.get("integrityAlgorithms"),
120
+ }
121
+ )
122
+ 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
21
+ from typing_extensions import Self
22
+
23
+
24
+ class Phase1Status(BaseModel):
25
+ """
26
+ Phase1Status
27
+ """ # noqa: E501
28
+
29
+ dh_group: Optional[StrictStr] = Field(
30
+ default=None, description="The negotiated Diffie-Hellman Group", alias="dhGroup"
31
+ )
32
+ encryption_algorithm: Optional[StrictStr] = Field(
33
+ default=None, description="The negotiated encryption algorithm.", alias="encryptionAlgorithm"
34
+ )
35
+ integrity_algorithm: Optional[StrictStr] = Field(
36
+ default=None,
37
+ description="The negotiated integrity algorithm or pseudo-random-function.",
38
+ alias="integrityAlgorithm",
39
+ )
40
+ state: Optional[StrictStr] = None
41
+ __properties: ClassVar[List[str]] = ["dhGroup", "encryptionAlgorithm", "integrityAlgorithm", "state"]
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 Phase1Status 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
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of Phase1Status from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate(
92
+ {
93
+ "dhGroup": obj.get("dhGroup"),
94
+ "encryptionAlgorithm": obj.get("encryptionAlgorithm"),
95
+ "integrityAlgorithm": obj.get("integrityAlgorithm"),
96
+ "state": obj.get("state"),
97
+ }
98
+ )
99
+ return _obj
@@ -0,0 +1,143 @@
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 Phase2Status(BaseModel):
25
+ """
26
+ Phase2Status
27
+ """ # noqa: E501
28
+
29
+ bytes_in: Optional[StrictStr] = Field(
30
+ default=None,
31
+ description="The total data volume received through this Security Association, measured in bytes.",
32
+ alias="bytesIn",
33
+ )
34
+ bytes_out: Optional[StrictStr] = Field(
35
+ default=None,
36
+ description="The total data volume sent through this Security Association, measured in bytes.",
37
+ alias="bytesOut",
38
+ )
39
+ dh_group: Optional[StrictStr] = Field(
40
+ default=None, description="The negotiated Diffie-Hellman Group", alias="dhGroup"
41
+ )
42
+ encap: Optional[StrictStr] = Field(
43
+ default=None, description="Indicates whether NAT traversal encapsulation is active for the connection."
44
+ )
45
+ encryption_algorithm: Optional[StrictStr] = Field(
46
+ default=None, description="The negotiated encryption algorithm.", alias="encryptionAlgorithm"
47
+ )
48
+ integrity_algorithm: Optional[StrictStr] = Field(
49
+ default=None,
50
+ description="The negotiated integrity algorithm or pseudo-random-function.",
51
+ alias="integrityAlgorithm",
52
+ )
53
+ packets_in: Optional[StrictStr] = Field(
54
+ default=None,
55
+ description="The total number of packets received through this IPsec Security Association.",
56
+ alias="packetsIn",
57
+ )
58
+ packets_out: Optional[StrictStr] = Field(
59
+ default=None,
60
+ description="The total number of packets sent through this IPsec Security Association",
61
+ alias="packetsOut",
62
+ )
63
+ protocol: Optional[StrictStr] = Field(
64
+ default=None,
65
+ description="The security protocol used for the tunnel, typically `ESP` (Encapsulating Security Payload).",
66
+ )
67
+ state: Optional[StrictStr] = None
68
+ __properties: ClassVar[List[str]] = [
69
+ "bytesIn",
70
+ "bytesOut",
71
+ "dhGroup",
72
+ "encap",
73
+ "encryptionAlgorithm",
74
+ "integrityAlgorithm",
75
+ "packetsIn",
76
+ "packetsOut",
77
+ "protocol",
78
+ "state",
79
+ ]
80
+
81
+ model_config = ConfigDict(
82
+ populate_by_name=True,
83
+ validate_assignment=True,
84
+ protected_namespaces=(),
85
+ )
86
+
87
+ def to_str(self) -> str:
88
+ """Returns the string representation of the model using alias"""
89
+ return pprint.pformat(self.model_dump(by_alias=True))
90
+
91
+ def to_json(self) -> str:
92
+ """Returns the JSON representation of the model using alias"""
93
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
94
+ return json.dumps(self.to_dict())
95
+
96
+ @classmethod
97
+ def from_json(cls, json_str: str) -> Optional[Self]:
98
+ """Create an instance of Phase2Status from a JSON string"""
99
+ return cls.from_dict(json.loads(json_str))
100
+
101
+ def to_dict(self) -> Dict[str, Any]:
102
+ """Return the dictionary representation of the model using alias.
103
+
104
+ This has the following differences from calling pydantic's
105
+ `self.model_dump(by_alias=True)`:
106
+
107
+ * `None` is only added to the output dict for nullable fields that
108
+ were set at model initialization. Other fields with value `None`
109
+ are ignored.
110
+ """
111
+ excluded_fields: Set[str] = set([])
112
+
113
+ _dict = self.model_dump(
114
+ by_alias=True,
115
+ exclude=excluded_fields,
116
+ exclude_none=True,
117
+ )
118
+ return _dict
119
+
120
+ @classmethod
121
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
122
+ """Create an instance of Phase2Status from a dict"""
123
+ if obj is None:
124
+ return None
125
+
126
+ if not isinstance(obj, dict):
127
+ return cls.model_validate(obj)
128
+
129
+ _obj = cls.model_validate(
130
+ {
131
+ "bytesIn": obj.get("bytesIn"),
132
+ "bytesOut": obj.get("bytesOut"),
133
+ "dhGroup": obj.get("dhGroup"),
134
+ "encap": obj.get("encap"),
135
+ "encryptionAlgorithm": obj.get("encryptionAlgorithm"),
136
+ "integrityAlgorithm": obj.get("integrityAlgorithm"),
137
+ "packetsIn": obj.get("packetsIn"),
138
+ "packetsOut": obj.get("packetsOut"),
139
+ "protocol": obj.get("protocol"),
140
+ "state": obj.get("state"),
141
+ }
142
+ )
143
+ return _obj
@@ -0,0 +1,101 @@
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
+
24
+ class Plan(BaseModel):
25
+ """
26
+ Plan
27
+ """ # noqa: E501
28
+
29
+ max_bandwidth: Optional[StrictInt] = Field(
30
+ default=None,
31
+ description="The maximum throughput supported by the gateway in each direction, measured in MBit/s",
32
+ alias="maxBandwidth",
33
+ )
34
+ max_connections: Optional[StrictInt] = Field(
35
+ default=None,
36
+ description="The maximum number of connections supported by the VPN Gateway.",
37
+ alias="maxConnections",
38
+ )
39
+ name: Optional[StrictStr] = Field(default=None, description="The name of the service plan.")
40
+ plan_id: Optional[StrictStr] = Field(default=None, description="The service plan identifier.", alias="planId")
41
+ sku: Optional[StrictStr] = Field(default=None, description="The SKU identifier used for billing.")
42
+ __properties: ClassVar[List[str]] = ["maxBandwidth", "maxConnections", "name", "planId", "sku"]
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 Plan 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 Plan 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
+ "maxBandwidth": obj.get("maxBandwidth"),
95
+ "maxConnections": obj.get("maxConnections"),
96
+ "name": obj.get("name"),
97
+ "planId": obj.get("planId"),
98
+ "sku": obj.get("sku"),
99
+ }
100
+ )
101
+ 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, Field, StrictStr
21
+ from typing_extensions import Self
22
+
23
+ from stackit.vpn.models.plan import Plan
24
+
25
+
26
+ class PlanList(BaseModel):
27
+ """
28
+ PlanList
29
+ """ # noqa: E501
30
+
31
+ default_plan_id: Optional[StrictStr] = Field(
32
+ default=None, description="The service plan identifier.", alias="defaultPlanId"
33
+ )
34
+ plans: Optional[List[Plan]] = None
35
+ __properties: ClassVar[List[str]] = ["defaultPlanId", "plans"]
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 PlanList 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 plans (list)
75
+ _items = []
76
+ if self.plans:
77
+ for _item_plans in self.plans:
78
+ if _item_plans:
79
+ _items.append(_item_plans.to_dict())
80
+ _dict["plans"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of PlanList 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
+ "defaultPlanId": obj.get("defaultPlanId"),
95
+ "plans": [Plan.from_dict(_item) for _item in obj["plans"]] if obj.get("plans") is not None else None,
96
+ }
97
+ )
98
+ 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, StrictInt
21
+ from typing_extensions import Self
22
+
23
+
24
+ class Quota(BaseModel):
25
+ """
26
+ Quota
27
+ """ # noqa: E501
28
+
29
+ limit: StrictInt
30
+ usage: StrictInt
31
+ __properties: ClassVar[List[str]] = ["limit", "usage"]
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 Quota 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 Quota 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({"limit": obj.get("limit"), "usage": obj.get("usage")})
82
+ return _obj