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.
- stackit/loadbalancer/__init__.py +94 -0
- stackit/loadbalancer/api/__init__.py +4 -0
- stackit/loadbalancer/api/default_api.py +4224 -0
- stackit/loadbalancer/api_client.py +626 -0
- stackit/loadbalancer/api_response.py +23 -0
- stackit/loadbalancer/configuration.py +111 -0
- stackit/loadbalancer/exceptions.py +198 -0
- stackit/loadbalancer/models/__init__.py +75 -0
- stackit/loadbalancer/models/active_health_check.py +142 -0
- stackit/loadbalancer/models/create_credentials_payload.py +104 -0
- stackit/loadbalancer/models/create_credentials_response.py +92 -0
- stackit/loadbalancer/models/create_load_balancer_payload.py +231 -0
- stackit/loadbalancer/models/credentials_response.py +106 -0
- stackit/loadbalancer/models/get_credentials_response.py +92 -0
- stackit/loadbalancer/models/get_quota_response.py +106 -0
- stackit/loadbalancer/models/get_service_status_response.py +103 -0
- stackit/loadbalancer/models/google_protobuf_any.py +97 -0
- stackit/loadbalancer/models/list_credentials_response.py +98 -0
- stackit/loadbalancer/models/list_load_balancers_response.py +115 -0
- stackit/loadbalancer/models/list_plans_response.py +98 -0
- stackit/loadbalancer/models/listener.py +162 -0
- stackit/loadbalancer/models/load_balancer.py +231 -0
- stackit/loadbalancer/models/load_balancer_error.py +113 -0
- stackit/loadbalancer/models/load_balancer_options.py +116 -0
- stackit/loadbalancer/models/loadbalancer_option_access_control.py +85 -0
- stackit/loadbalancer/models/loadbalancer_option_logs.py +90 -0
- stackit/loadbalancer/models/loadbalancer_option_metrics.py +90 -0
- stackit/loadbalancer/models/loadbalancer_option_observability.py +100 -0
- stackit/loadbalancer/models/network.py +112 -0
- stackit/loadbalancer/models/options_tcp.py +96 -0
- stackit/loadbalancer/models/options_udp.py +96 -0
- stackit/loadbalancer/models/plan_details.py +97 -0
- stackit/loadbalancer/models/server_name_indicator.py +81 -0
- stackit/loadbalancer/models/session_persistence.py +85 -0
- stackit/loadbalancer/models/status.py +111 -0
- stackit/loadbalancer/models/target.py +97 -0
- stackit/loadbalancer/models/target_pool.py +137 -0
- stackit/loadbalancer/models/update_credentials_payload.py +104 -0
- stackit/loadbalancer/models/update_credentials_response.py +92 -0
- stackit/loadbalancer/models/update_load_balancer_payload.py +231 -0
- stackit/loadbalancer/models/update_target_pool_payload.py +137 -0
- stackit/loadbalancer/py.typed +0 -0
- stackit/loadbalancer/rest.py +148 -0
- stackit_loadbalancer-0.0.1a1.dist-info/METADATA +46 -0
- stackit_loadbalancer-0.0.1a1.dist-info/RECORD +46 -0
- stackit_loadbalancer-0.0.1a1.dist-info/WHEEL +4 -0
|
@@ -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 LoadBalancer(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
LoadBalancer
|
|
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 LoadBalancer 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 LoadBalancer 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,113 @@
|
|
|
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, Field, StrictStr, field_validator
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class LoadBalancerError(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
LoadBalancerError
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
description: Optional[StrictStr] = Field(
|
|
30
|
+
default=None,
|
|
31
|
+
description='The error description contains additional helpful user information to fix the error state of the load balancer. For example the IP 45.135.247.139 does not exist in the project, then the description will report: Floating IP "45.135.247.139" could not be found or if the IP was deleted then you will get a proper error message.',
|
|
32
|
+
)
|
|
33
|
+
type: Optional[StrictStr] = Field(
|
|
34
|
+
default=None,
|
|
35
|
+
description="The error type specifies which part of the load balancer encountered the error. I.e. the API will not check if a provided public IP is actually available in the project. Instead the load balancer with try to use the provided IP and if not available reports TYPE_FIP_NOT_CONFIGURED error or TYPE_FIP_NOT_FOUND if the IP was deleted.",
|
|
36
|
+
)
|
|
37
|
+
__properties: ClassVar[List[str]] = ["description", "type"]
|
|
38
|
+
|
|
39
|
+
@field_validator("type")
|
|
40
|
+
def type_validate_enum(cls, value):
|
|
41
|
+
"""Validates the enum"""
|
|
42
|
+
if value is None:
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
if value not in set(
|
|
46
|
+
[
|
|
47
|
+
"TYPE_UNSPECIFIED",
|
|
48
|
+
"TYPE_INTERNAL",
|
|
49
|
+
"TYPE_QUOTA_SECGROUP_EXCEEDED",
|
|
50
|
+
"TYPE_QUOTA_SECGROUPRULE_EXCEEDED",
|
|
51
|
+
"TYPE_PORT_NOT_CONFIGURED",
|
|
52
|
+
"TYPE_FIP_NOT_CONFIGURED",
|
|
53
|
+
"TYPE_TARGET_NOT_ACTIVE",
|
|
54
|
+
"TYPE_METRICS_MISCONFIGURED",
|
|
55
|
+
"TYPE_LOGS_MISCONFIGURED",
|
|
56
|
+
"TYPE_FIP_NOT_FOUND",
|
|
57
|
+
]
|
|
58
|
+
):
|
|
59
|
+
raise ValueError(
|
|
60
|
+
"must be one of enum values ('TYPE_UNSPECIFIED', 'TYPE_INTERNAL', 'TYPE_QUOTA_SECGROUP_EXCEEDED', 'TYPE_QUOTA_SECGROUPRULE_EXCEEDED', 'TYPE_PORT_NOT_CONFIGURED', 'TYPE_FIP_NOT_CONFIGURED', 'TYPE_TARGET_NOT_ACTIVE', 'TYPE_METRICS_MISCONFIGURED', 'TYPE_LOGS_MISCONFIGURED', 'TYPE_FIP_NOT_FOUND')"
|
|
61
|
+
)
|
|
62
|
+
return value
|
|
63
|
+
|
|
64
|
+
model_config = ConfigDict(
|
|
65
|
+
populate_by_name=True,
|
|
66
|
+
validate_assignment=True,
|
|
67
|
+
protected_namespaces=(),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
def to_str(self) -> str:
|
|
71
|
+
"""Returns the string representation of the model using alias"""
|
|
72
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
73
|
+
|
|
74
|
+
def to_json(self) -> str:
|
|
75
|
+
"""Returns the JSON representation of the model using alias"""
|
|
76
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
77
|
+
return json.dumps(self.to_dict())
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of LoadBalancerError from a JSON string"""
|
|
82
|
+
return cls.from_dict(json.loads(json_str))
|
|
83
|
+
|
|
84
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
85
|
+
"""Return the dictionary representation of the model using alias.
|
|
86
|
+
|
|
87
|
+
This has the following differences from calling pydantic's
|
|
88
|
+
`self.model_dump(by_alias=True)`:
|
|
89
|
+
|
|
90
|
+
* `None` is only added to the output dict for nullable fields that
|
|
91
|
+
were set at model initialization. Other fields with value `None`
|
|
92
|
+
are ignored.
|
|
93
|
+
"""
|
|
94
|
+
excluded_fields: Set[str] = set([])
|
|
95
|
+
|
|
96
|
+
_dict = self.model_dump(
|
|
97
|
+
by_alias=True,
|
|
98
|
+
exclude=excluded_fields,
|
|
99
|
+
exclude_none=True,
|
|
100
|
+
)
|
|
101
|
+
return _dict
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
105
|
+
"""Create an instance of LoadBalancerError from a dict"""
|
|
106
|
+
if obj is None:
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
if not isinstance(obj, dict):
|
|
110
|
+
return cls.model_validate(obj)
|
|
111
|
+
|
|
112
|
+
_obj = cls.model_validate({"description": obj.get("description"), "type": obj.get("type")})
|
|
113
|
+
return _obj
|
|
@@ -0,0 +1,116 @@
|
|
|
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, Field, StrictBool
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
from stackit.loadbalancer.models.loadbalancer_option_access_control import (
|
|
24
|
+
LoadbalancerOptionAccessControl,
|
|
25
|
+
)
|
|
26
|
+
from stackit.loadbalancer.models.loadbalancer_option_observability import (
|
|
27
|
+
LoadbalancerOptionObservability,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class LoadBalancerOptions(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
Defines any optional functionality you want to have enabled on your load balancer.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
access_control: Optional[LoadbalancerOptionAccessControl] = Field(default=None, alias="accessControl")
|
|
37
|
+
ephemeral_address: Optional[StrictBool] = Field(default=None, alias="ephemeralAddress")
|
|
38
|
+
observability: Optional[LoadbalancerOptionObservability] = None
|
|
39
|
+
private_network_only: Optional[StrictBool] = Field(
|
|
40
|
+
default=None,
|
|
41
|
+
description="Load Balancer is accessible only via a private network ip address. Not changeable after creation.",
|
|
42
|
+
alias="privateNetworkOnly",
|
|
43
|
+
)
|
|
44
|
+
__properties: ClassVar[List[str]] = ["accessControl", "ephemeralAddress", "observability", "privateNetworkOnly"]
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
populate_by_name=True,
|
|
48
|
+
validate_assignment=True,
|
|
49
|
+
protected_namespaces=(),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
59
|
+
return json.dumps(self.to_dict())
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
|
+
"""Create an instance of LoadBalancerOptions from a JSON string"""
|
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
|
65
|
+
|
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
|
68
|
+
|
|
69
|
+
This has the following differences from calling pydantic's
|
|
70
|
+
`self.model_dump(by_alias=True)`:
|
|
71
|
+
|
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
|
73
|
+
were set at model initialization. Other fields with value `None`
|
|
74
|
+
are ignored.
|
|
75
|
+
"""
|
|
76
|
+
excluded_fields: Set[str] = set([])
|
|
77
|
+
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude=excluded_fields,
|
|
81
|
+
exclude_none=True,
|
|
82
|
+
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of access_control
|
|
84
|
+
if self.access_control:
|
|
85
|
+
_dict["accessControl"] = self.access_control.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of observability
|
|
87
|
+
if self.observability:
|
|
88
|
+
_dict["observability"] = self.observability.to_dict()
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of LoadBalancerOptions from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate(
|
|
101
|
+
{
|
|
102
|
+
"accessControl": (
|
|
103
|
+
LoadbalancerOptionAccessControl.from_dict(obj["accessControl"])
|
|
104
|
+
if obj.get("accessControl") is not None
|
|
105
|
+
else None
|
|
106
|
+
),
|
|
107
|
+
"ephemeralAddress": obj.get("ephemeralAddress"),
|
|
108
|
+
"observability": (
|
|
109
|
+
LoadbalancerOptionObservability.from_dict(obj["observability"])
|
|
110
|
+
if obj.get("observability") is not None
|
|
111
|
+
else None
|
|
112
|
+
),
|
|
113
|
+
"privateNetworkOnly": obj.get("privateNetworkOnly"),
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
return _obj
|
|
@@ -0,0 +1,85 @@
|
|
|
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, Field, StrictStr
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class LoadbalancerOptionAccessControl(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
Use this option to limit the IP ranges that can use the load balancer.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
allowed_source_ranges: Optional[List[StrictStr]] = Field(
|
|
30
|
+
default=None,
|
|
31
|
+
description="Load Balancer is accessible only from an IP address in this range",
|
|
32
|
+
alias="allowedSourceRanges",
|
|
33
|
+
)
|
|
34
|
+
__properties: ClassVar[List[str]] = ["allowedSourceRanges"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of LoadbalancerOptionAccessControl from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of LoadbalancerOptionAccessControl from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({"allowedSourceRanges": obj.get("allowedSourceRanges")})
|
|
85
|
+
return _obj
|
|
@@ -0,0 +1,90 @@
|
|
|
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, Field, StrictStr
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class LoadbalancerOptionLogs(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
LoadbalancerOptionLogs
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
credentials_ref: Optional[StrictStr] = Field(
|
|
30
|
+
default=None,
|
|
31
|
+
description="Credentials reference for logging. This reference is created via the observability create endpoint and the credential needs to contain the basic auth username and password for the logging solution the push URL points to. Then this enables monitoring via remote write for the Load Balancer.",
|
|
32
|
+
alias="credentialsRef",
|
|
33
|
+
)
|
|
34
|
+
push_url: Optional[StrictStr] = Field(
|
|
35
|
+
default=None,
|
|
36
|
+
description="The ARGUS/Loki remote write Push URL you want the logs to be shipped to.",
|
|
37
|
+
alias="pushUrl",
|
|
38
|
+
)
|
|
39
|
+
__properties: ClassVar[List[str]] = ["credentialsRef", "pushUrl"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of LoadbalancerOptionLogs from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of LoadbalancerOptionLogs 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({"credentialsRef": obj.get("credentialsRef"), "pushUrl": obj.get("pushUrl")})
|
|
90
|
+
return _obj
|