Skip to content

Commit 234859a

Browse files
Generate alb
1 parent f4a8258 commit 234859a

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

services/alb/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1deab1542e767cd08525dfd6c2cd0b65b9c923c3
1+
43f467b6558ae9272562a18cdc63cb850b918bae

services/alb/src/stackit/alb/models/loadbalancer_option_access_control.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,43 @@
1515

1616
import json
1717
import pprint
18+
import re # noqa: F401
1819
from typing import Any, ClassVar, Dict, List, Optional, Set
1920

20-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
21+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2122
from pydantic_core import to_jsonable_python
22-
from typing_extensions import Self
23+
from typing_extensions import Annotated, Self
2324

2425

2526
class LoadbalancerOptionAccessControl(BaseModel):
2627
"""
27-
Use this option to limit the IP ranges that can use the Application Load Balancer.
28+
Use this option to limit the IP ranges that can use the Application Load Balancer. Only one of `allowed_source_ranges` or `ip_block_list_name` may be set at the same time.
2829
""" # noqa: E501
2930

3031
allowed_source_ranges: Optional[List[StrictStr]] = Field(
3132
default=None,
32-
description="Application Load Balancer is accessible only from an IP address in this range",
33+
description="Application Load Balancer is accessible only from an IP address in this range. Mutually exclusive with `ipBlockListName`.",
3334
alias="allowedSourceRanges",
3435
)
35-
__properties: ClassVar[List[str]] = ["allowedSourceRanges"]
36+
ip_block_list_name: Optional[Annotated[str, Field(strict=True)]] = Field(
37+
default=None,
38+
description='Reference to an IP block list by name. Traffic originating from any IP in the referenced list is denied access to the Application Load Balancer. See "IP Lists API" for how to manage IP block lists. Mutually exclusive with `allowedSourceRanges`.',
39+
alias="ipBlockListName",
40+
)
41+
__properties: ClassVar[List[str]] = ["allowedSourceRanges", "ipBlockListName"]
42+
43+
@field_validator("ip_block_list_name")
44+
def ip_block_list_name_validate_regular_expression(cls, value):
45+
"""Validates the regular expression"""
46+
if value is None:
47+
return value
48+
49+
if not isinstance(value, str):
50+
value = str(value)
51+
52+
if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,49}[0-9a-z])?$", value):
53+
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,49}[0-9a-z])?$/")
54+
return value
3655

3756
model_config = ConfigDict(
3857
validate_by_name=True,
@@ -82,5 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82101
if not isinstance(obj, dict):
83102
return cls.model_validate(obj)
84103

85-
_obj = cls.model_validate({"allowedSourceRanges": obj.get("allowedSourceRanges")})
104+
_obj = cls.model_validate(
105+
{"allowedSourceRanges": obj.get("allowedSourceRanges"), "ipBlockListName": obj.get("ipBlockListName")}
106+
)
86107
return _obj

0 commit comments

Comments
 (0)