Skip to content

Commit 2144abe

Browse files
Generate loadbalancer
1 parent 891ddb4 commit 2144abe

File tree

6 files changed

+229
-2
lines changed

6 files changed

+229
-2
lines changed

services/loadbalancer/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9916269dab33d42aa2f1a5f30c80b954b6c1221f
1+
10774896634990c655a523f5f0fabd6e2be9e216

services/loadbalancer/src/stackit/loadbalancer/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"GetCredentialsResponse",
3737
"GetQuotaResponse",
3838
"GoogleProtobufAny",
39+
"HttpHealthChecks",
3940
"ListCredentialsResponse",
4041
"ListLoadBalancersResponse",
4142
"ListPlansResponse",
@@ -57,6 +58,7 @@
5758
"Status",
5859
"Target",
5960
"TargetPool",
61+
"TlsConfig",
6062
"UpdateCredentialsPayload",
6163
"UpdateCredentialsResponse",
6264
"UpdateLoadBalancerPayload",
@@ -102,6 +104,9 @@
102104
from stackit.loadbalancer.models.google_protobuf_any import (
103105
GoogleProtobufAny as GoogleProtobufAny,
104106
)
107+
from stackit.loadbalancer.models.http_health_checks import (
108+
HttpHealthChecks as HttpHealthChecks,
109+
)
105110
from stackit.loadbalancer.models.list_credentials_response import (
106111
ListCredentialsResponse as ListCredentialsResponse,
107112
)
@@ -145,6 +150,7 @@
145150
from stackit.loadbalancer.models.status import Status as Status
146151
from stackit.loadbalancer.models.target import Target as Target
147152
from stackit.loadbalancer.models.target_pool import TargetPool as TargetPool
153+
from stackit.loadbalancer.models.tls_config import TlsConfig as TlsConfig
148154
from stackit.loadbalancer.models.update_credentials_payload import (
149155
UpdateCredentialsPayload as UpdateCredentialsPayload,
150156
)

services/loadbalancer/src/stackit/loadbalancer/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from stackit.loadbalancer.models.get_credentials_response import GetCredentialsResponse
2929
from stackit.loadbalancer.models.get_quota_response import GetQuotaResponse
3030
from stackit.loadbalancer.models.google_protobuf_any import GoogleProtobufAny
31+
from stackit.loadbalancer.models.http_health_checks import HttpHealthChecks
3132
from stackit.loadbalancer.models.list_credentials_response import (
3233
ListCredentialsResponse,
3334
)
@@ -59,6 +60,7 @@
5960
from stackit.loadbalancer.models.status import Status
6061
from stackit.loadbalancer.models.target import Target
6162
from stackit.loadbalancer.models.target_pool import TargetPool
63+
from stackit.loadbalancer.models.tls_config import TlsConfig
6264
from stackit.loadbalancer.models.update_credentials_payload import (
6365
UpdateCredentialsPayload,
6466
)

services/loadbalancer/src/stackit/loadbalancer/models/active_health_check.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,24 @@
1818
import re # noqa: F401
1919
from typing import Any, ClassVar, Dict, List, Optional, Set
2020

21-
from pydantic import BaseModel, ConfigDict, Field, field_validator
21+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, field_validator
2222
from typing_extensions import Annotated, Self
2323

24+
from stackit.loadbalancer.models.http_health_checks import HttpHealthChecks
25+
2426

2527
class ActiveHealthCheck(BaseModel):
2628
"""
2729
ActiveHealthCheck
2830
""" # noqa: E501
2931

32+
alt_port: Optional[StrictInt] = Field(
33+
default=None, description="Overrides the default port used for health check probes.", alias="altPort"
34+
)
3035
healthy_threshold: Optional[Annotated[int, Field(le=1000000, strict=True, ge=1)]] = Field(
3136
default=None, description="Healthy threshold of the health checking", alias="healthyThreshold"
3237
)
38+
http_health_checks: Optional[HttpHealthChecks] = Field(default=None, alias="httpHealthChecks")
3339
interval: Optional[Annotated[str, Field(strict=True)]] = Field(
3440
default=None, description="Interval duration of health checking in seconds"
3541
)
@@ -45,7 +51,9 @@ class ActiveHealthCheck(BaseModel):
4551
default=None, description="Unhealthy threshold of the health checking", alias="unhealthyThreshold"
4652
)
4753
__properties: ClassVar[List[str]] = [
54+
"altPort",
4855
"healthyThreshold",
56+
"httpHealthChecks",
4957
"interval",
5058
"intervalJitter",
5159
"timeout",
@@ -119,6 +127,9 @@ def to_dict(self) -> Dict[str, Any]:
119127
exclude=excluded_fields,
120128
exclude_none=True,
121129
)
130+
# override the default output from pydantic by calling `to_dict()` of http_health_checks
131+
if self.http_health_checks:
132+
_dict["httpHealthChecks"] = self.http_health_checks.to_dict()
122133
return _dict
123134

124135
@classmethod
@@ -132,7 +143,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
132143

133144
_obj = cls.model_validate(
134145
{
146+
"altPort": obj.get("altPort"),
135147
"healthyThreshold": obj.get("healthyThreshold"),
148+
"httpHealthChecks": (
149+
HttpHealthChecks.from_dict(obj["httpHealthChecks"])
150+
if obj.get("httpHealthChecks") is not None
151+
else None
152+
),
136153
"interval": obj.get("interval"),
137154
"intervalJitter": obj.get("intervalJitter"),
138155
"timeout": obj.get("timeout"),
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Network 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: 2.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
from __future__ import annotations
15+
16+
import json
17+
import pprint
18+
from typing import Any, ClassVar, Dict, List, Optional, Set
19+
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
21+
from typing_extensions import Self
22+
23+
from stackit.loadbalancer.models.tls_config import TlsConfig
24+
25+
26+
class HttpHealthChecks(BaseModel):
27+
"""
28+
Options for the HTTP health checking.
29+
""" # noqa: E501
30+
31+
ok_statuses: Optional[List[StrictStr]] = Field(
32+
default=None, description="List of HTTP status codes that indicate a healthy response", alias="okStatuses"
33+
)
34+
path: Optional[StrictStr] = Field(default=None, description="Path to send the health check request to")
35+
tls: Optional[TlsConfig] = None
36+
__properties: ClassVar[List[str]] = ["okStatuses", "path", "tls"]
37+
38+
model_config = ConfigDict(
39+
populate_by_name=True,
40+
validate_assignment=True,
41+
protected_namespaces=(),
42+
)
43+
44+
def to_str(self) -> str:
45+
"""Returns the string representation of the model using alias"""
46+
return pprint.pformat(self.model_dump(by_alias=True))
47+
48+
def to_json(self) -> str:
49+
"""Returns the JSON representation of the model using alias"""
50+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51+
return json.dumps(self.to_dict())
52+
53+
@classmethod
54+
def from_json(cls, json_str: str) -> Optional[Self]:
55+
"""Create an instance of HttpHealthChecks from a JSON string"""
56+
return cls.from_dict(json.loads(json_str))
57+
58+
def to_dict(self) -> Dict[str, Any]:
59+
"""Return the dictionary representation of the model using alias.
60+
61+
This has the following differences from calling pydantic's
62+
`self.model_dump(by_alias=True)`:
63+
64+
* `None` is only added to the output dict for nullable fields that
65+
were set at model initialization. Other fields with value `None`
66+
are ignored.
67+
"""
68+
excluded_fields: Set[str] = set([])
69+
70+
_dict = self.model_dump(
71+
by_alias=True,
72+
exclude=excluded_fields,
73+
exclude_none=True,
74+
)
75+
# override the default output from pydantic by calling `to_dict()` of tls
76+
if self.tls:
77+
_dict["tls"] = self.tls.to_dict()
78+
return _dict
79+
80+
@classmethod
81+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82+
"""Create an instance of HttpHealthChecks 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(
90+
{
91+
"okStatuses": obj.get("okStatuses"),
92+
"path": obj.get("path"),
93+
"tls": TlsConfig.from_dict(obj["tls"]) if obj.get("tls") is not None else None,
94+
}
95+
)
96+
return _obj
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Network 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: 2.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
from __future__ import annotations
15+
16+
import json
17+
import pprint
18+
from typing import Any, ClassVar, Dict, List, Optional, Set
19+
20+
from pydantic import (
21+
BaseModel,
22+
ConfigDict,
23+
Field,
24+
StrictBool,
25+
StrictStr,
26+
)
27+
from typing_extensions import Self
28+
29+
30+
class TlsConfig(BaseModel):
31+
"""
32+
Set this to configure TLS settings.
33+
""" # noqa: E501
34+
35+
custom_ca: Optional[StrictStr] = Field(
36+
default=None,
37+
description="Specifies a custom Certificate Authority (CA). When provided, the target pool will trust certificates signed by this CA, in addition to any system-trusted CAs. This is useful for scenarios where the target pool needs to communicate with servers using self-signed or internally-issued certificates. Enabled needs to be set to true and skip validation to false for this option.",
38+
alias="customCa",
39+
)
40+
enabled: Optional[StrictBool] = Field(
41+
default=None,
42+
description="Enable TLS (Transport Layer Security) bridging for the connection between Application Load Balancer and targets in this pool. When enabled, public CAs are trusted. Can be used in tandem with the options either custom CA or skip validation or alone.",
43+
)
44+
skip_certificate_validation: Optional[StrictBool] = Field(
45+
default=None,
46+
description="Bypass certificate validation for TLS bridging in this target pool. This option is insecure and can only be used with public CAs by setting enabled true. Meant to be used for testing purposes only!",
47+
alias="skipCertificateValidation",
48+
)
49+
__properties: ClassVar[List[str]] = ["customCa", "enabled", "skipCertificateValidation"]
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 TlsConfig 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 TlsConfig 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+
"customCa": obj.get("customCa"),
102+
"enabled": obj.get("enabled"),
103+
"skipCertificateValidation": obj.get("skipCertificateValidation"),
104+
}
105+
)
106+
return _obj

0 commit comments

Comments
 (0)