Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class CreateLoadBalancerPayload(BaseModel):
description="External application load balancer IP address where this application load balancer is exposed. Not changeable after creation.",
alias="externalAddress",
)
labels: Optional[Dict[str, StrictStr]] = Field(
default=None,
description="Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per ALB. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. ",
)
listeners: Optional[List[Listener]] = Field(default=None, description="There is a maximum listener count of 20. ")
load_balancer_security_group: Optional[SecurityGroup] = Field(
default=None,
Expand Down Expand Up @@ -98,6 +102,7 @@ class CreateLoadBalancerPayload(BaseModel):
"disableTargetSecurityGroupAssignment",
"errors",
"externalAddress",
"labels",
"listeners",
"loadBalancerSecurityGroup",
"name",
Expand Down Expand Up @@ -245,6 +250,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
else None
),
"externalAddress": obj.get("externalAddress"),
"labels": obj.get("labels"),
"listeners": (
[Listener.from_dict(_item) for _item in obj["listeners"]]
if obj.get("listeners") is not None
Expand Down
19 changes: 18 additions & 1 deletion services/alb/src/stackit/alb/models/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
Expand Down Expand Up @@ -42,7 +43,12 @@ class Listener(BaseModel):
default=None,
description="Protocol is the highest network protocol we understand to load balance. Currently PROTOCOL_HTTP and PROTOCOL_HTTPS are supported.",
)
__properties: ClassVar[List[str]] = ["http", "https", "name", "port", "protocol"]
waf_config_name: Optional[Annotated[str, Field(strict=True)]] = Field(
default=None,
description='Enable Web Application Firewall (WAF), referenced to a by name. See "Application Load Balancer - Web Application Firewall API" for more information.',
alias="wafConfigName",
)
__properties: ClassVar[List[str]] = ["http", "https", "name", "port", "protocol", "wafConfigName"]

@field_validator("protocol")
def protocol_validate_enum(cls, value):
Expand All @@ -54,6 +60,16 @@ def protocol_validate_enum(cls, value):
raise ValueError("must be one of enum values ('PROTOCOL_UNSPECIFIED', 'PROTOCOL_HTTP', 'PROTOCOL_HTTPS')")
return value

@field_validator("waf_config_name")
def waf_config_name_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down Expand Up @@ -120,6 +136,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"name": obj.get("name"),
"port": obj.get("port"),
"protocol": obj.get("protocol"),
"wafConfigName": obj.get("wafConfigName"),
}
)
return _obj
6 changes: 6 additions & 0 deletions services/alb/src/stackit/alb/models/load_balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class LoadBalancer(BaseModel):
description="External application load balancer IP address where this application load balancer is exposed. Not changeable after creation.",
alias="externalAddress",
)
labels: Optional[Dict[str, StrictStr]] = Field(
default=None,
description="Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per ALB. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. ",
)
listeners: Optional[List[Listener]] = Field(default=None, description="There is a maximum listener count of 20. ")
load_balancer_security_group: Optional[SecurityGroup] = Field(
default=None,
Expand Down Expand Up @@ -98,6 +102,7 @@ class LoadBalancer(BaseModel):
"disableTargetSecurityGroupAssignment",
"errors",
"externalAddress",
"labels",
"listeners",
"loadBalancerSecurityGroup",
"name",
Expand Down Expand Up @@ -245,6 +250,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
else None
),
"externalAddress": obj.get("externalAddress"),
"labels": obj.get("labels"),
"listeners": (
[Listener.from_dict(_item) for _item in obj["listeners"]]
if obj.get("listeners") is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class UpdateLoadBalancerPayload(BaseModel):
description="External application load balancer IP address where this application load balancer is exposed. Not changeable after creation.",
alias="externalAddress",
)
labels: Optional[Dict[str, StrictStr]] = Field(
default=None,
description="Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per ALB. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. ",
)
listeners: Optional[List[Listener]] = Field(default=None, description="There is a maximum listener count of 20. ")
load_balancer_security_group: Optional[SecurityGroup] = Field(
default=None,
Expand Down Expand Up @@ -98,6 +102,7 @@ class UpdateLoadBalancerPayload(BaseModel):
"disableTargetSecurityGroupAssignment",
"errors",
"externalAddress",
"labels",
"listeners",
"loadBalancerSecurityGroup",
"name",
Expand Down Expand Up @@ -245,6 +250,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
else None
),
"externalAddress": obj.get("externalAddress"),
"labels": obj.get("labels"),
"listeners": (
[Listener.from_dict(_item) for _item in obj["listeners"]]
if obj.get("listeners") is not None
Expand Down