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 UpdateLoadBalancerPayload(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
UpdateLoadBalancerPayload
|
|
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 UpdateLoadBalancerPayload 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 UpdateLoadBalancerPayload 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,137 @@
|
|
|
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
|
+
from stackit.loadbalancer.models.active_health_check import ActiveHealthCheck
|
|
25
|
+
from stackit.loadbalancer.models.session_persistence import SessionPersistence
|
|
26
|
+
from stackit.loadbalancer.models.target import Target
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class UpdateTargetPoolPayload(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
UpdateTargetPoolPayload
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
active_health_check: Optional[ActiveHealthCheck] = Field(default=None, alias="activeHealthCheck")
|
|
35
|
+
name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Target pool name")
|
|
36
|
+
session_persistence: Optional[SessionPersistence] = Field(default=None, alias="sessionPersistence")
|
|
37
|
+
target_port: Optional[Annotated[int, Field(le=65535, strict=True, ge=1)]] = Field(
|
|
38
|
+
default=None,
|
|
39
|
+
description="The number identifying the port where each target listens for traffic.",
|
|
40
|
+
alias="targetPort",
|
|
41
|
+
)
|
|
42
|
+
targets: Optional[List[Target]] = Field(
|
|
43
|
+
default=None, description="List of all targets which will be used in the pool. Limited to 250."
|
|
44
|
+
)
|
|
45
|
+
__properties: ClassVar[List[str]] = ["activeHealthCheck", "name", "sessionPersistence", "targetPort", "targets"]
|
|
46
|
+
|
|
47
|
+
@field_validator("name")
|
|
48
|
+
def name_validate_regular_expression(cls, value):
|
|
49
|
+
"""Validates the regular expression"""
|
|
50
|
+
if value is None:
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,18}[0-9a-z])?$", value):
|
|
54
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,18}[0-9a-z])?$/")
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(
|
|
58
|
+
populate_by_name=True,
|
|
59
|
+
validate_assignment=True,
|
|
60
|
+
protected_namespaces=(),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
def to_str(self) -> str:
|
|
64
|
+
"""Returns the string representation of the model using alias"""
|
|
65
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
66
|
+
|
|
67
|
+
def to_json(self) -> str:
|
|
68
|
+
"""Returns the JSON representation of the model using alias"""
|
|
69
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
70
|
+
return json.dumps(self.to_dict())
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of UpdateTargetPoolPayload from a JSON string"""
|
|
75
|
+
return cls.from_dict(json.loads(json_str))
|
|
76
|
+
|
|
77
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
78
|
+
"""Return the dictionary representation of the model using alias.
|
|
79
|
+
|
|
80
|
+
This has the following differences from calling pydantic's
|
|
81
|
+
`self.model_dump(by_alias=True)`:
|
|
82
|
+
|
|
83
|
+
* `None` is only added to the output dict for nullable fields that
|
|
84
|
+
were set at model initialization. Other fields with value `None`
|
|
85
|
+
are ignored.
|
|
86
|
+
"""
|
|
87
|
+
excluded_fields: Set[str] = set([])
|
|
88
|
+
|
|
89
|
+
_dict = self.model_dump(
|
|
90
|
+
by_alias=True,
|
|
91
|
+
exclude=excluded_fields,
|
|
92
|
+
exclude_none=True,
|
|
93
|
+
)
|
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of active_health_check
|
|
95
|
+
if self.active_health_check:
|
|
96
|
+
_dict["activeHealthCheck"] = self.active_health_check.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of session_persistence
|
|
98
|
+
if self.session_persistence:
|
|
99
|
+
_dict["sessionPersistence"] = self.session_persistence.to_dict()
|
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of each item in targets (list)
|
|
101
|
+
_items = []
|
|
102
|
+
if self.targets:
|
|
103
|
+
for _item in self.targets:
|
|
104
|
+
if _item:
|
|
105
|
+
_items.append(_item.to_dict())
|
|
106
|
+
_dict["targets"] = _items
|
|
107
|
+
return _dict
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
111
|
+
"""Create an instance of UpdateTargetPoolPayload 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
|
+
"activeHealthCheck": (
|
|
121
|
+
ActiveHealthCheck.from_dict(obj["activeHealthCheck"])
|
|
122
|
+
if obj.get("activeHealthCheck") is not None
|
|
123
|
+
else None
|
|
124
|
+
),
|
|
125
|
+
"name": obj.get("name"),
|
|
126
|
+
"sessionPersistence": (
|
|
127
|
+
SessionPersistence.from_dict(obj["sessionPersistence"])
|
|
128
|
+
if obj.get("sessionPersistence") is not None
|
|
129
|
+
else None
|
|
130
|
+
),
|
|
131
|
+
"targetPort": obj.get("targetPort"),
|
|
132
|
+
"targets": (
|
|
133
|
+
[Target.from_dict(_item) for _item in obj["targets"]] if obj.get("targets") is not None else None
|
|
134
|
+
),
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
return _obj
|
|
File without changes
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
import io
|
|
15
|
+
import json
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
import requests
|
|
19
|
+
from stackit.core.authorization import Authorization
|
|
20
|
+
from stackit.core.configuration import Configuration
|
|
21
|
+
|
|
22
|
+
from stackit.loadbalancer.exceptions import ApiException, ApiValueError
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
RESTResponseType = requests.Response
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RESTResponse(io.IOBase):
|
|
29
|
+
|
|
30
|
+
def __init__(self, resp) -> None:
|
|
31
|
+
self.response = resp
|
|
32
|
+
self.status = resp.status_code
|
|
33
|
+
self.reason = resp.reason
|
|
34
|
+
self.data = None
|
|
35
|
+
|
|
36
|
+
def read(self):
|
|
37
|
+
if self.data is None:
|
|
38
|
+
self.data = self.response.content
|
|
39
|
+
return self.data
|
|
40
|
+
|
|
41
|
+
def getheaders(self):
|
|
42
|
+
"""Returns a dictionary of the response headers."""
|
|
43
|
+
return self.response.headers
|
|
44
|
+
|
|
45
|
+
def getheader(self, name, default=None):
|
|
46
|
+
"""Returns a given response header."""
|
|
47
|
+
return self.response.headers.get(name, default)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class RESTClientObject:
|
|
51
|
+
def __init__(self, config: Configuration) -> None:
|
|
52
|
+
self.session = config.custom_http_session if config.custom_http_session else requests.Session()
|
|
53
|
+
authorization = Authorization(config)
|
|
54
|
+
self.session.auth = authorization.auth_method
|
|
55
|
+
|
|
56
|
+
def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
|
|
57
|
+
"""Perform requests.
|
|
58
|
+
|
|
59
|
+
:param method: http request method
|
|
60
|
+
:param url: http request url
|
|
61
|
+
:param headers: http request headers
|
|
62
|
+
:param body: request json body, for `application/json`
|
|
63
|
+
:param post_params: request post parameters,
|
|
64
|
+
`application/x-www-form-urlencoded`
|
|
65
|
+
and `multipart/form-data`
|
|
66
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
67
|
+
number provided, it will be total request
|
|
68
|
+
timeout. It can also be a pair (tuple) of
|
|
69
|
+
(connection, read) timeouts.
|
|
70
|
+
"""
|
|
71
|
+
method = method.upper()
|
|
72
|
+
if method not in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]:
|
|
73
|
+
raise ValueError("Method %s not allowed", method)
|
|
74
|
+
|
|
75
|
+
if post_params and body:
|
|
76
|
+
raise ApiValueError("body parameter cannot be used with post_params parameter.")
|
|
77
|
+
|
|
78
|
+
post_params = post_params or {}
|
|
79
|
+
headers = headers or {}
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
83
|
+
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
|
84
|
+
|
|
85
|
+
# no content type provided or payload is json
|
|
86
|
+
content_type = headers.get("Content-Type")
|
|
87
|
+
if not content_type or re.search("json", content_type, re.IGNORECASE):
|
|
88
|
+
request_body = None
|
|
89
|
+
if body is not None:
|
|
90
|
+
request_body = json.dumps(body)
|
|
91
|
+
r = self.session.request(
|
|
92
|
+
method,
|
|
93
|
+
url,
|
|
94
|
+
data=request_body,
|
|
95
|
+
headers=headers,
|
|
96
|
+
)
|
|
97
|
+
elif content_type == "application/x-www-form-urlencoded":
|
|
98
|
+
r = self.session.request(
|
|
99
|
+
method,
|
|
100
|
+
url,
|
|
101
|
+
params=post_params,
|
|
102
|
+
headers=headers,
|
|
103
|
+
)
|
|
104
|
+
elif content_type == "multipart/form-data":
|
|
105
|
+
# must del headers['Content-Type'], or the correct
|
|
106
|
+
# Content-Type which generated by urllib3 will be
|
|
107
|
+
# overwritten.
|
|
108
|
+
del headers["Content-Type"]
|
|
109
|
+
# Ensures that dict objects are serialized
|
|
110
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
|
|
111
|
+
r = self.session.request(
|
|
112
|
+
method,
|
|
113
|
+
url,
|
|
114
|
+
files=post_params,
|
|
115
|
+
headers=headers,
|
|
116
|
+
)
|
|
117
|
+
# Pass a `string` parameter directly in the body to support
|
|
118
|
+
# other content types than JSON when `body` argument is
|
|
119
|
+
# provided in serialized form.
|
|
120
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
121
|
+
r = self.session.request(
|
|
122
|
+
method,
|
|
123
|
+
url,
|
|
124
|
+
data=body,
|
|
125
|
+
headers=headers,
|
|
126
|
+
)
|
|
127
|
+
elif headers["Content-Type"] == "text/plain" and isinstance(body, bool):
|
|
128
|
+
request_body = "true" if body else "false"
|
|
129
|
+
r = self.session.request(method, url, data=request_body, headers=headers)
|
|
130
|
+
else:
|
|
131
|
+
# Cannot generate the request from given parameters
|
|
132
|
+
msg = """Cannot prepare a request message for provided
|
|
133
|
+
arguments. Please check that your arguments match
|
|
134
|
+
declared content type."""
|
|
135
|
+
raise ApiException(status=0, reason=msg)
|
|
136
|
+
# For `GET`, `HEAD`
|
|
137
|
+
else:
|
|
138
|
+
r = self.session.request(
|
|
139
|
+
method,
|
|
140
|
+
url,
|
|
141
|
+
params={},
|
|
142
|
+
headers=headers,
|
|
143
|
+
)
|
|
144
|
+
except requests.exceptions.SSLError as e:
|
|
145
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
146
|
+
raise ApiException(status=0, reason=msg)
|
|
147
|
+
|
|
148
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: stackit-loadbalancer
|
|
3
|
+
Version: 0.0.1a1
|
|
4
|
+
Summary: Load Balancer API
|
|
5
|
+
Author: STACKIT Developer Tools
|
|
6
|
+
Author-email: developer-tools@stackit.cloud
|
|
7
|
+
Requires-Python: >=3.8,<4.0
|
|
8
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Dist: pydantic (>=2.9.2)
|
|
18
|
+
Requires-Dist: python-dateutil (>=2.9.0.post0)
|
|
19
|
+
Requires-Dist: requests (>=2.32.3)
|
|
20
|
+
Requires-Dist: stackit-core (>=0.0.1a)
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# stackit.loadbalancer
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
This package is part of the STACKIT Python SDK. For additional information, please visit the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Installation & Usage
|
|
33
|
+
### pip install
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pip install stackit-loadbalancer
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then import the package:
|
|
40
|
+
```python
|
|
41
|
+
import stackit.loadbalancer
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Getting Started
|
|
45
|
+
|
|
46
|
+
[Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
stackit/loadbalancer/__init__.py,sha256=ETGQfXZTS5HoFPqbFRrxvSOGe6Ds3ma39RBE9fFL-74,3844
|
|
2
|
+
stackit/loadbalancer/api/__init__.py,sha256=LrQHNF8YxP--QIQt14doXYDeMDKn6YRyy0-_D9ZXYI4,107
|
|
3
|
+
stackit/loadbalancer/api/default_api.py,sha256=SciHODW9ZxVc5J5dHGLLwjMzsrHl0sAbhDPQhGypTbA,182659
|
|
4
|
+
stackit/loadbalancer/api_client.py,sha256=tkBSyPbAdWP6Hc4-n4ww-2FyxxLcSyk0jAam2TyV1ls,22926
|
|
5
|
+
stackit/loadbalancer/api_response.py,sha256=HRYkVqMNIlfODacTQPTbiVj2YdcnutpQrKJdeAoCSpM,642
|
|
6
|
+
stackit/loadbalancer/configuration.py,sha256=sdD28fNDGlcHTw5CqB2lSwM9njZe59N2HBSy7hrH2vM,4048
|
|
7
|
+
stackit/loadbalancer/exceptions.py,sha256=maVmqrT3jMjzdyR0QW2gBDaYTaDw74js0A8EJgfofgQ,6135
|
|
8
|
+
stackit/loadbalancer/models/__init__.py,sha256=ie2e3YrWKlbot6t7--LX94pjwEg8G_J91gfWH3rOmMA,3368
|
|
9
|
+
stackit/loadbalancer/models/active_health_check.py,sha256=VgYdTKylpPBfENqASDJu204uvc7yQFzzn5N30DdvdF4,5169
|
|
10
|
+
stackit/loadbalancer/models/create_credentials_payload.py,sha256=xL-T0zdVYMrbUNkVPp6VSrZ27LAKPtTvyx5N1UyjtDo,3728
|
|
11
|
+
stackit/loadbalancer/models/create_credentials_response.py,sha256=hQoBAV0b7U9JFNx1yI4xtxmI3Bor13VNgHfYfbnptQM,3108
|
|
12
|
+
stackit/loadbalancer/models/create_load_balancer_payload.py,sha256=MaonGb7_YOtH2jN0stFld2jCgrK_dVHHxDoGcaWcwF8,10517
|
|
13
|
+
stackit/loadbalancer/models/credentials_response.py,sha256=kTwwC_YOJlBfpC1kpeMjLdfwXIhhBc-5ileV8w4tSFo,3748
|
|
14
|
+
stackit/loadbalancer/models/get_credentials_response.py,sha256=NbEZCqkN7YseCMIzT8LdkdeS69FYdhRg2MBr_OLz7dk,3096
|
|
15
|
+
stackit/loadbalancer/models/get_quota_response.py,sha256=PUE6cDd7XRrCeoIy2C_HtWv-PcDyRGEFs8-k_xh3ndI,3732
|
|
16
|
+
stackit/loadbalancer/models/get_service_status_response.py,sha256=PmZSa4aIR4XV3Uw5xtpIfsK4gq7cOUWf8I7xQYqBvsg,3480
|
|
17
|
+
stackit/loadbalancer/models/google_protobuf_any.py,sha256=ssB0Ct165qr1TBAEc0ebBSmk5_ohwcw0rAd5XbGEsEs,3446
|
|
18
|
+
stackit/loadbalancer/models/list_credentials_response.py,sha256=T2JCvp9ucAGJiFrY7pjwbnpKY47GiiA1dO6FdRkC5AM,3316
|
|
19
|
+
stackit/loadbalancer/models/list_load_balancers_response.py,sha256=OkS5XTqeZx6V_0dPKBxRgv-I75yoOE4gFxCJ8ipNJo0,4103
|
|
20
|
+
stackit/loadbalancer/models/list_plans_response.py,sha256=xvUnxKdw24fsbKtPsNduBxPFuCV-LNb8reEF3W-nlF4,3297
|
|
21
|
+
stackit/loadbalancer/models/listener.py,sha256=9ms0O04Z0XpnmBefdxzcBj3TsxEbZgjwzfdYIWigHqM,6203
|
|
22
|
+
stackit/loadbalancer/models/load_balancer.py,sha256=FIhm2BVq5PX5KpJGXvERLmMLayKZ0h726spHh7t2ZAo,10465
|
|
23
|
+
stackit/loadbalancer/models/load_balancer_error.py,sha256=0y-9r_v4gFYdh6RfRwslqfeEjsGmruaAmPUJ878g3x4,4538
|
|
24
|
+
stackit/loadbalancer/models/load_balancer_options.py,sha256=KyOzumFmvVH4xnaqBKOIFnG57J__uyQF883k89Y8xlk,4461
|
|
25
|
+
stackit/loadbalancer/models/loadbalancer_option_access_control.py,sha256=BJLTrWTLuLuBKpJnYPa7ACCwI7teDb1hT_K75Gcfyno,2954
|
|
26
|
+
stackit/loadbalancer/models/loadbalancer_option_logs.py,sha256=F2LXz84mims9D9krztq15JAwINz6ZmVupO4SRAN-bio,3305
|
|
27
|
+
stackit/loadbalancer/models/loadbalancer_option_metrics.py,sha256=s8M_2CkHhRiQ77mJfvs8rLNDt3JnJDu6pJsNiO68cm4,3326
|
|
28
|
+
stackit/loadbalancer/models/loadbalancer_option_observability.py,sha256=v0M1F10AKPkUN0Es9sYVc_3ySnVtVMMx6MixmOjTTas,3628
|
|
29
|
+
stackit/loadbalancer/models/network.py,sha256=x9TF2NtvW1bdft2Kf9cCwqSbfmzt7W6-FFsfvqrsN1Q,3962
|
|
30
|
+
stackit/loadbalancer/models/options_tcp.py,sha256=aUOsmVMsHed5i1JMtian5GvbQvnaRttWfLi8Vzw3x_U,3320
|
|
31
|
+
stackit/loadbalancer/models/options_udp.py,sha256=udHQ_LsTwD6gcHyEiBCYBZVwflYpO_2pFYLYfsVwnt4,3320
|
|
32
|
+
stackit/loadbalancer/models/plan_details.py,sha256=bv1FhzopKVT7ETTOD3MTZgU2-KANpCC1SkzsiWU2mL0,3501
|
|
33
|
+
stackit/loadbalancer/models/server_name_indicator.py,sha256=CdVVMGx2pKi6eKljGGxCGd2irKX56KWixNntsdT4T9E,2710
|
|
34
|
+
stackit/loadbalancer/models/session_persistence.py,sha256=e-O4jL666XAr3yjaMD8t_UyztYJpDA_kapvY1ZTO34g,2944
|
|
35
|
+
stackit/loadbalancer/models/status.py,sha256=Ql63eu_Q5xaljZrFPFbKYLjcUH2Vbajv6EY1Zt0yyl8,4407
|
|
36
|
+
stackit/loadbalancer/models/target.py,sha256=lf_BQVEuGaxx06-uKvvNKBGXqxzRzMaT_T6pg0DPH00,3364
|
|
37
|
+
stackit/loadbalancer/models/target_pool.py,sha256=URHaqPSoSvxzQZLZi510GwI_L1ebsxa3ik5RHh_jKKs,5440
|
|
38
|
+
stackit/loadbalancer/models/update_credentials_payload.py,sha256=SEPBLRX9U3bCCnakGYK8dVGUAHnwMj-AMBgpgRmt_gM,3728
|
|
39
|
+
stackit/loadbalancer/models/update_credentials_response.py,sha256=2wO5dSIqOA3NZ7O4DT1ctceQ6NKCbkT-Abi7iufNLHc,3108
|
|
40
|
+
stackit/loadbalancer/models/update_load_balancer_payload.py,sha256=jcJfx3MqWVDWRWAf0rX5SX1aXqWGtrGGHemD_anvzTE,10517
|
|
41
|
+
stackit/loadbalancer/models/update_target_pool_payload.py,sha256=quO2qOb0W_GMbkULBE4fRVYStQFnfVNhrAegq8cyhTs,5492
|
|
42
|
+
stackit/loadbalancer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
+
stackit/loadbalancer/rest.py,sha256=vmxJ-W1Qc1j2reuLHv5CL6Of8CDPU1mESW6ug_XVDB4,6020
|
|
44
|
+
stackit_loadbalancer-0.0.1a1.dist-info/METADATA,sha256=xHKeGOtjPEkoZzWaCBTRGXvl-pCO4dApf2-Izz-7g30,1730
|
|
45
|
+
stackit_loadbalancer-0.0.1a1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
46
|
+
stackit_loadbalancer-0.0.1a1.dist-info/RECORD,,
|