stackit-loadbalancer 0.0.1a1__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 (46) hide show
  1. stackit/loadbalancer/__init__.py +94 -0
  2. stackit/loadbalancer/api/__init__.py +4 -0
  3. stackit/loadbalancer/api/default_api.py +4224 -0
  4. stackit/loadbalancer/api_client.py +626 -0
  5. stackit/loadbalancer/api_response.py +23 -0
  6. stackit/loadbalancer/configuration.py +111 -0
  7. stackit/loadbalancer/exceptions.py +198 -0
  8. stackit/loadbalancer/models/__init__.py +75 -0
  9. stackit/loadbalancer/models/active_health_check.py +142 -0
  10. stackit/loadbalancer/models/create_credentials_payload.py +104 -0
  11. stackit/loadbalancer/models/create_credentials_response.py +92 -0
  12. stackit/loadbalancer/models/create_load_balancer_payload.py +231 -0
  13. stackit/loadbalancer/models/credentials_response.py +106 -0
  14. stackit/loadbalancer/models/get_credentials_response.py +92 -0
  15. stackit/loadbalancer/models/get_quota_response.py +106 -0
  16. stackit/loadbalancer/models/get_service_status_response.py +103 -0
  17. stackit/loadbalancer/models/google_protobuf_any.py +97 -0
  18. stackit/loadbalancer/models/list_credentials_response.py +98 -0
  19. stackit/loadbalancer/models/list_load_balancers_response.py +115 -0
  20. stackit/loadbalancer/models/list_plans_response.py +98 -0
  21. stackit/loadbalancer/models/listener.py +162 -0
  22. stackit/loadbalancer/models/load_balancer.py +231 -0
  23. stackit/loadbalancer/models/load_balancer_error.py +113 -0
  24. stackit/loadbalancer/models/load_balancer_options.py +116 -0
  25. stackit/loadbalancer/models/loadbalancer_option_access_control.py +85 -0
  26. stackit/loadbalancer/models/loadbalancer_option_logs.py +90 -0
  27. stackit/loadbalancer/models/loadbalancer_option_metrics.py +90 -0
  28. stackit/loadbalancer/models/loadbalancer_option_observability.py +100 -0
  29. stackit/loadbalancer/models/network.py +112 -0
  30. stackit/loadbalancer/models/options_tcp.py +96 -0
  31. stackit/loadbalancer/models/options_udp.py +96 -0
  32. stackit/loadbalancer/models/plan_details.py +97 -0
  33. stackit/loadbalancer/models/server_name_indicator.py +81 -0
  34. stackit/loadbalancer/models/session_persistence.py +85 -0
  35. stackit/loadbalancer/models/status.py +111 -0
  36. stackit/loadbalancer/models/target.py +97 -0
  37. stackit/loadbalancer/models/target_pool.py +137 -0
  38. stackit/loadbalancer/models/update_credentials_payload.py +104 -0
  39. stackit/loadbalancer/models/update_credentials_response.py +92 -0
  40. stackit/loadbalancer/models/update_load_balancer_payload.py +231 -0
  41. stackit/loadbalancer/models/update_target_pool_payload.py +137 -0
  42. stackit/loadbalancer/py.typed +0 -0
  43. stackit/loadbalancer/rest.py +148 -0
  44. stackit_loadbalancer-0.0.1a1.dist-info/METADATA +46 -0
  45. stackit_loadbalancer-0.0.1a1.dist-info/RECORD +46 -0
  46. stackit_loadbalancer-0.0.1a1.dist-info/WHEEL +4 -0
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
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.loadbalancer.models.credentials_response import CredentialsResponse
24
+
25
+
26
+ class CreateCredentialsResponse(BaseModel):
27
+ """
28
+ CreateCredentialsResponse
29
+ """
30
+
31
+ credential: Optional[CredentialsResponse] = None
32
+ __properties: ClassVar[List[str]] = ["credential"]
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 CreateCredentialsResponse 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 credential
72
+ if self.credential:
73
+ _dict["credential"] = self.credential.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 CreateCredentialsResponse 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
+ {
87
+ "credential": (
88
+ CredentialsResponse.from_dict(obj["credential"]) if obj.get("credential") is not None else None
89
+ )
90
+ }
91
+ )
92
+ return _obj
@@ -0,0 +1,231 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re
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.loadbalancer.models.listener import Listener
25
+ from stackit.loadbalancer.models.load_balancer_error import LoadBalancerError
26
+ from stackit.loadbalancer.models.load_balancer_options import LoadBalancerOptions
27
+ from stackit.loadbalancer.models.network import Network
28
+ from stackit.loadbalancer.models.target_pool import TargetPool
29
+
30
+
31
+ class CreateLoadBalancerPayload(BaseModel):
32
+ """
33
+ CreateLoadBalancerPayload
34
+ """
35
+
36
+ errors: Optional[List[LoadBalancerError]] = Field(
37
+ default=None, description="Reports all errors a load balancer has."
38
+ )
39
+ external_address: Optional[StrictStr] = Field(
40
+ default=None,
41
+ description="External load balancer IP address where this load balancer is exposed. Not changeable after creation.",
42
+ alias="externalAddress",
43
+ )
44
+ listeners: Optional[List[Listener]] = Field(
45
+ default=None,
46
+ description="There is a maximum listener count of 20. Port and protocol limitations: - UDP listeners cannot have the same port. - TCP-derived listeners cannot have the same port. A TCP-derived listener is any listener that listens on a TCP port. As of now those are: TCP, TCP_PROXY, and PROTOCOL_TLS_PASSTHROUGH. The only exception is, if all listeners for the same port are PROTOCOL_TLS_PASSTHROUGH. - PROTOCOL_TLS_PASSTHROUGH listeners cannot have the same port and at least one common domain name. - PROTOCOL_TLS_PASSTHROUGH listeners can have the same domain name and different ports though (e.g. ports 443 and 8443 for domain example.com). - PROTOCOL_TLS_PASSTHROUGH listeners without a domain name serve as a default listener and you can have only one default listener. ",
47
+ )
48
+ name: Optional[Annotated[str, Field(strict=True)]] = Field(
49
+ default=None, description="Load balancer name. Not changeable after creation."
50
+ )
51
+ networks: Optional[List[Network]] = Field(
52
+ default=None,
53
+ description="List of networks that listeners and targets reside in. Currently limited to one. Not changeable after creation.",
54
+ )
55
+ options: Optional[LoadBalancerOptions] = None
56
+ plan_id: Optional[StrictStr] = Field(
57
+ default=None,
58
+ description="Service Plan configures the size of the Load Balancer. Currently supported plans are p10, p50, p250 and p750. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum.",
59
+ alias="planId",
60
+ )
61
+ private_address: Optional[StrictStr] = Field(
62
+ default=None,
63
+ description="Transient private load balancer IP address that can change any time.",
64
+ alias="privateAddress",
65
+ )
66
+ status: Optional[StrictStr] = None
67
+ target_pools: Optional[List[TargetPool]] = Field(
68
+ default=None,
69
+ description="List of all target pools which will be used in the load balancer. Limited to 20.",
70
+ alias="targetPools",
71
+ )
72
+ version: Optional[StrictStr] = Field(
73
+ default=None,
74
+ description="Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case.",
75
+ )
76
+ __properties: ClassVar[List[str]] = [
77
+ "errors",
78
+ "externalAddress",
79
+ "listeners",
80
+ "name",
81
+ "networks",
82
+ "options",
83
+ "planId",
84
+ "privateAddress",
85
+ "status",
86
+ "targetPools",
87
+ "version",
88
+ ]
89
+
90
+ @field_validator("name")
91
+ def name_validate_regular_expression(cls, value):
92
+ """Validates the regular expression"""
93
+ if value is None:
94
+ return value
95
+
96
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
97
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
98
+ return value
99
+
100
+ @field_validator("status")
101
+ def status_validate_enum(cls, value):
102
+ """Validates the enum"""
103
+ if value is None:
104
+ return value
105
+
106
+ if value not in set(
107
+ ["STATUS_UNSPECIFIED", "STATUS_PENDING", "STATUS_READY", "STATUS_ERROR", "STATUS_TERMINATING"]
108
+ ):
109
+ raise ValueError(
110
+ "must be one of enum values ('STATUS_UNSPECIFIED', 'STATUS_PENDING', 'STATUS_READY', 'STATUS_ERROR', 'STATUS_TERMINATING')"
111
+ )
112
+ return value
113
+
114
+ model_config = ConfigDict(
115
+ populate_by_name=True,
116
+ validate_assignment=True,
117
+ protected_namespaces=(),
118
+ )
119
+
120
+ def to_str(self) -> str:
121
+ """Returns the string representation of the model using alias"""
122
+ return pprint.pformat(self.model_dump(by_alias=True))
123
+
124
+ def to_json(self) -> str:
125
+ """Returns the JSON representation of the model using alias"""
126
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
127
+ return json.dumps(self.to_dict())
128
+
129
+ @classmethod
130
+ def from_json(cls, json_str: str) -> Optional[Self]:
131
+ """Create an instance of CreateLoadBalancerPayload from a JSON string"""
132
+ return cls.from_dict(json.loads(json_str))
133
+
134
+ def to_dict(self) -> Dict[str, Any]:
135
+ """Return the dictionary representation of the model using alias.
136
+
137
+ This has the following differences from calling pydantic's
138
+ `self.model_dump(by_alias=True)`:
139
+
140
+ * `None` is only added to the output dict for nullable fields that
141
+ were set at model initialization. Other fields with value `None`
142
+ are ignored.
143
+ * OpenAPI `readOnly` fields are excluded.
144
+ * OpenAPI `readOnly` fields are excluded.
145
+ * OpenAPI `readOnly` fields are excluded.
146
+ """
147
+ excluded_fields: Set[str] = set(
148
+ [
149
+ "errors",
150
+ "private_address",
151
+ "status",
152
+ ]
153
+ )
154
+
155
+ _dict = self.model_dump(
156
+ by_alias=True,
157
+ exclude=excluded_fields,
158
+ exclude_none=True,
159
+ )
160
+ # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
161
+ _items = []
162
+ if self.errors:
163
+ for _item in self.errors:
164
+ if _item:
165
+ _items.append(_item.to_dict())
166
+ _dict["errors"] = _items
167
+ # override the default output from pydantic by calling `to_dict()` of each item in listeners (list)
168
+ _items = []
169
+ if self.listeners:
170
+ for _item in self.listeners:
171
+ if _item:
172
+ _items.append(_item.to_dict())
173
+ _dict["listeners"] = _items
174
+ # override the default output from pydantic by calling `to_dict()` of each item in networks (list)
175
+ _items = []
176
+ if self.networks:
177
+ for _item in self.networks:
178
+ if _item:
179
+ _items.append(_item.to_dict())
180
+ _dict["networks"] = _items
181
+ # override the default output from pydantic by calling `to_dict()` of options
182
+ if self.options:
183
+ _dict["options"] = self.options.to_dict()
184
+ # override the default output from pydantic by calling `to_dict()` of each item in target_pools (list)
185
+ _items = []
186
+ if self.target_pools:
187
+ for _item in self.target_pools:
188
+ if _item:
189
+ _items.append(_item.to_dict())
190
+ _dict["targetPools"] = _items
191
+ return _dict
192
+
193
+ @classmethod
194
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
195
+ """Create an instance of CreateLoadBalancerPayload from a dict"""
196
+ if obj is None:
197
+ return None
198
+
199
+ if not isinstance(obj, dict):
200
+ return cls.model_validate(obj)
201
+
202
+ _obj = cls.model_validate(
203
+ {
204
+ "errors": (
205
+ [LoadBalancerError.from_dict(_item) for _item in obj["errors"]]
206
+ if obj.get("errors") is not None
207
+ else None
208
+ ),
209
+ "externalAddress": obj.get("externalAddress"),
210
+ "listeners": (
211
+ [Listener.from_dict(_item) for _item in obj["listeners"]]
212
+ if obj.get("listeners") is not None
213
+ else None
214
+ ),
215
+ "name": obj.get("name"),
216
+ "networks": (
217
+ [Network.from_dict(_item) for _item in obj["networks"]] if obj.get("networks") is not None else None
218
+ ),
219
+ "options": LoadBalancerOptions.from_dict(obj["options"]) if obj.get("options") is not None else None,
220
+ "planId": obj.get("planId"),
221
+ "privateAddress": obj.get("privateAddress"),
222
+ "status": obj.get("status"),
223
+ "targetPools": (
224
+ [TargetPool.from_dict(_item) for _item in obj["targetPools"]]
225
+ if obj.get("targetPools") is not None
226
+ else None
227
+ ),
228
+ "version": obj.get("version"),
229
+ }
230
+ )
231
+ return _obj
@@ -0,0 +1,106 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re
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
+
25
+ class CredentialsResponse(BaseModel):
26
+ """
27
+ CredentialsResponse
28
+ """
29
+
30
+ credentials_ref: Optional[StrictStr] = Field(
31
+ default=None,
32
+ description="The credentials reference can be used for observability of the Load Balancer.",
33
+ alias="credentialsRef",
34
+ )
35
+ display_name: Optional[Annotated[str, Field(strict=True)]] = Field(
36
+ default=None, description="Credential name", alias="displayName"
37
+ )
38
+ username: Optional[StrictStr] = Field(default=None, description="The username used for the ARGUS instance")
39
+ __properties: ClassVar[List[str]] = ["credentialsRef", "displayName", "username"]
40
+
41
+ @field_validator("display_name")
42
+ def display_name_validate_regular_expression(cls, value):
43
+ """Validates the regular expression"""
44
+ if value is None:
45
+ return value
46
+
47
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
48
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
49
+ return value
50
+
51
+ model_config = ConfigDict(
52
+ populate_by_name=True,
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+ def to_str(self) -> str:
58
+ """Returns the string representation of the model using alias"""
59
+ return pprint.pformat(self.model_dump(by_alias=True))
60
+
61
+ def to_json(self) -> str:
62
+ """Returns the JSON representation of the model using alias"""
63
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
+ return json.dumps(self.to_dict())
65
+
66
+ @classmethod
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
68
+ """Create an instance of CredentialsResponse from a JSON string"""
69
+ return cls.from_dict(json.loads(json_str))
70
+
71
+ def to_dict(self) -> Dict[str, Any]:
72
+ """Return the dictionary representation of the model using alias.
73
+
74
+ This has the following differences from calling pydantic's
75
+ `self.model_dump(by_alias=True)`:
76
+
77
+ * `None` is only added to the output dict for nullable fields that
78
+ were set at model initialization. Other fields with value `None`
79
+ are ignored.
80
+ """
81
+ excluded_fields: Set[str] = set([])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of CredentialsResponse from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate(
100
+ {
101
+ "credentialsRef": obj.get("credentialsRef"),
102
+ "displayName": obj.get("displayName"),
103
+ "username": obj.get("username"),
104
+ }
105
+ )
106
+ return _obj
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
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.loadbalancer.models.credentials_response import CredentialsResponse
24
+
25
+
26
+ class GetCredentialsResponse(BaseModel):
27
+ """
28
+ GetCredentialsResponse
29
+ """
30
+
31
+ credential: Optional[CredentialsResponse] = None
32
+ __properties: ClassVar[List[str]] = ["credential"]
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 GetCredentialsResponse 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 credential
72
+ if self.credential:
73
+ _dict["credential"] = self.credential.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 GetCredentialsResponse 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
+ {
87
+ "credential": (
88
+ CredentialsResponse.from_dict(obj["credential"]) if obj.get("credential") is not None else None
89
+ )
90
+ }
91
+ )
92
+ return _obj
@@ -0,0 +1,106 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re
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 GetQuotaResponse(BaseModel):
26
+ """
27
+ GetQuotaResponse
28
+ """
29
+
30
+ max_load_balancers: Optional[Annotated[int, Field(le=1000000, strict=True, ge=-1)]] = Field(
31
+ default=None,
32
+ description="The maximum number of load balancing servers in this project. Unlimited if set to -1.",
33
+ alias="maxLoadBalancers",
34
+ )
35
+ project_id: Optional[Annotated[str, Field(strict=True)]] = Field(
36
+ default=None, description="Project identifier", alias="projectId"
37
+ )
38
+ __properties: ClassVar[List[str]] = ["maxLoadBalancers", "projectId"]
39
+
40
+ @field_validator("project_id")
41
+ def project_id_validate_regular_expression(cls, value):
42
+ """Validates the regular expression"""
43
+ if value is None:
44
+ return value
45
+
46
+ if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", value):
47
+ raise ValueError(
48
+ r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/"
49
+ )
50
+ return value
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+ def to_str(self) -> str:
59
+ """Returns the string representation of the model using alias"""
60
+ return pprint.pformat(self.model_dump(by_alias=True))
61
+
62
+ def to_json(self) -> str:
63
+ """Returns the JSON representation of the model using alias"""
64
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
+ return json.dumps(self.to_dict())
66
+
67
+ @classmethod
68
+ def from_json(cls, json_str: str) -> Optional[Self]:
69
+ """Create an instance of GetQuotaResponse from a JSON string"""
70
+ return cls.from_dict(json.loads(json_str))
71
+
72
+ def to_dict(self) -> Dict[str, Any]:
73
+ """Return the dictionary representation of the model using alias.
74
+
75
+ This has the following differences from calling pydantic's
76
+ `self.model_dump(by_alias=True)`:
77
+
78
+ * `None` is only added to the output dict for nullable fields that
79
+ were set at model initialization. Other fields with value `None`
80
+ are ignored.
81
+ * OpenAPI `readOnly` fields are excluded.
82
+ """
83
+ excluded_fields: Set[str] = set(
84
+ [
85
+ "project_id",
86
+ ]
87
+ )
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of GetQuotaResponse 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({"maxLoadBalancers": obj.get("maxLoadBalancers"), "projectId": obj.get("projectId")})
106
+ return _obj