Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/alb/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9916269dab33d42aa2f1a5f30c80b954b6c1221f
a0507fbc8a743f261058ef285885928d2e8e0355
6 changes: 2 additions & 4 deletions services/alb/src/stackit/alb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"Status",
"Target",
"TargetPool",
"TargetPoolTlsConfig",
"TlsConfig",
"UpdateCredentialsPayload",
"UpdateCredentialsResponse",
"UpdateLoadBalancerPayload",
Expand Down Expand Up @@ -156,9 +156,7 @@
from stackit.alb.models.status import Status as Status
from stackit.alb.models.target import Target as Target
from stackit.alb.models.target_pool import TargetPool as TargetPool
from stackit.alb.models.target_pool_tls_config import (
TargetPoolTlsConfig as TargetPoolTlsConfig,
)
from stackit.alb.models.tls_config import TlsConfig as TlsConfig
from stackit.alb.models.update_credentials_payload import (
UpdateCredentialsPayload as UpdateCredentialsPayload,
)
Expand Down
2 changes: 1 addition & 1 deletion services/alb/src/stackit/alb/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from stackit.alb.models.status import Status
from stackit.alb.models.target import Target
from stackit.alb.models.target_pool import TargetPool
from stackit.alb.models.target_pool_tls_config import TargetPoolTlsConfig
from stackit.alb.models.tls_config import TlsConfig
from stackit.alb.models.update_credentials_payload import UpdateCredentialsPayload
from stackit.alb.models.update_credentials_response import UpdateCredentialsResponse
from stackit.alb.models.update_load_balancer_payload import UpdateLoadBalancerPayload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, field_validator
from pydantic import BaseModel, ConfigDict, Field, StrictInt, field_validator
from typing_extensions import Annotated, Self

from stackit.alb.models.http_health_checks import HttpHealthChecks
Expand All @@ -29,6 +29,9 @@ class ActiveHealthCheck(BaseModel):
Set this to customize active health checks for targets in this pool.
""" # noqa: E501

alt_port: Optional[StrictInt] = Field(
default=None, description="Overrides the default port used for health check probes.", alias="altPort"
)
healthy_threshold: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(
default=None, description="Healthy threshold of the health checking", alias="healthyThreshold"
)
Expand All @@ -48,6 +51,7 @@ class ActiveHealthCheck(BaseModel):
default=None, description="Unhealthy threshold of the health checking", alias="unhealthyThreshold"
)
__properties: ClassVar[List[str]] = [
"altPort",
"healthyThreshold",
"httpHealthChecks",
"interval",
Expand Down Expand Up @@ -139,6 +143,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate(
{
"altPort": obj.get("altPort"),
"healthyThreshold": obj.get("healthyThreshold"),
"httpHealthChecks": (
HttpHealthChecks.from_dict(obj["httpHealthChecks"])
Expand Down
16 changes: 14 additions & 2 deletions services/alb/src/stackit/alb/models/http_health_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing_extensions import Self

from stackit.alb.models.tls_config import TlsConfig


class HttpHealthChecks(BaseModel):
"""
Expand All @@ -30,7 +32,8 @@ class HttpHealthChecks(BaseModel):
default=None, description="List of HTTP status codes that indicate a healthy response", alias="okStatuses"
)
path: Optional[StrictStr] = Field(default=None, description="Path to send the health check request to")
__properties: ClassVar[List[str]] = ["okStatuses", "path"]
tls: Optional[TlsConfig] = None
__properties: ClassVar[List[str]] = ["okStatuses", "path", "tls"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -69,6 +72,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of tls
if self.tls:
_dict["tls"] = self.tls.to_dict()
return _dict

@classmethod
Expand All @@ -80,5 +86,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"okStatuses": obj.get("okStatuses"), "path": obj.get("path")})
_obj = cls.model_validate(
{
"okStatuses": obj.get("okStatuses"),
"path": obj.get("path"),
"tls": TlsConfig.from_dict(obj["tls"]) if obj.get("tls") is not None else None,
}
)
return _obj
8 changes: 3 additions & 5 deletions services/alb/src/stackit/alb/models/target_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from stackit.alb.models.active_health_check import ActiveHealthCheck
from stackit.alb.models.target import Target
from stackit.alb.models.target_pool_tls_config import TargetPoolTlsConfig
from stackit.alb.models.tls_config import TlsConfig


class TargetPool(BaseModel):
Expand All @@ -41,7 +41,7 @@ class TargetPool(BaseModel):
targets: Optional[List[Target]] = Field(
default=None, description="List of all targets which will be used in the pool. Limited to 250."
)
tls_config: Optional[TargetPoolTlsConfig] = Field(default=None, alias="tlsConfig")
tls_config: Optional[TlsConfig] = Field(default=None, alias="tlsConfig")
__properties: ClassVar[List[str]] = ["activeHealthCheck", "name", "targetPort", "targets", "tlsConfig"]

@field_validator("name")
Expand Down Expand Up @@ -127,9 +127,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"targets": (
[Target.from_dict(_item) for _item in obj["targets"]] if obj.get("targets") is not None else None
),
"tlsConfig": (
TargetPoolTlsConfig.from_dict(obj["tlsConfig"]) if obj.get("tlsConfig") is not None else None
),
"tlsConfig": TlsConfig.from_dict(obj["tlsConfig"]) if obj.get("tlsConfig") is not None else None,
}
)
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
from typing_extensions import Self


class TargetPoolTlsConfig(BaseModel):
class TlsConfig(BaseModel):
"""
TLSConfig used for the target pool.
Set this to configure TLS settings.
""" # noqa: E501

custom_ca: Optional[StrictStr] = Field(
Expand Down Expand Up @@ -65,7 +65,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of TargetPoolTlsConfig from a JSON string"""
"""Create an instance of TlsConfig from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -89,7 +89,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of TargetPoolTlsConfig from a dict"""
"""Create an instance of TlsConfig from a dict"""
if obj is None:
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from stackit.alb.models.active_health_check import ActiveHealthCheck
from stackit.alb.models.target import Target
from stackit.alb.models.target_pool_tls_config import TargetPoolTlsConfig
from stackit.alb.models.tls_config import TlsConfig


class UpdateTargetPoolPayload(BaseModel):
Expand All @@ -41,7 +41,7 @@ class UpdateTargetPoolPayload(BaseModel):
targets: Optional[List[Target]] = Field(
default=None, description="List of all targets which will be used in the pool. Limited to 250."
)
tls_config: Optional[TargetPoolTlsConfig] = Field(default=None, alias="tlsConfig")
tls_config: Optional[TlsConfig] = Field(default=None, alias="tlsConfig")
__properties: ClassVar[List[str]] = ["activeHealthCheck", "name", "targetPort", "targets", "tlsConfig"]

@field_validator("name")
Expand Down Expand Up @@ -127,9 +127,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"targets": (
[Target.from_dict(_item) for _item in obj["targets"]] if obj.get("targets") is not None else None
),
"tlsConfig": (
TargetPoolTlsConfig.from_dict(obj["tlsConfig"]) if obj.get("tlsConfig") is not None else None
),
"tlsConfig": TlsConfig.from_dict(obj["tlsConfig"]) if obj.get("tlsConfig") is not None else None,
}
)
return _obj
Loading