Skip to content

Commit 1dcfda9

Browse files
Generate ske
1 parent 47c74d2 commit 1dcfda9

3 files changed

Lines changed: 41 additions & 9 deletions

File tree

services/ske/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d2755fb2bda0e2105f920af64d7176d184b2bcb7
1+
bdfbc5de2dbc53be568791d0c09a911d294b3eb3

services/ske/src/stackit/ske/api/default_api.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,12 @@ def create_or_update_cluster(
609609
self,
610610
project_id: StrictStr,
611611
region: StrictStr,
612-
cluster_name: StrictStr,
612+
cluster_name: Annotated[
613+
StrictStr,
614+
Field(
615+
description="Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long."
616+
),
617+
],
613618
create_or_update_cluster_payload: CreateOrUpdateClusterPayload,
614619
_request_timeout: Union[
615620
None,
@@ -629,7 +634,7 @@ def create_or_update_cluster(
629634
:type project_id: str
630635
:param region: (required)
631636
:type region: str
632-
:param cluster_name: (required)
637+
:param cluster_name: Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long. (required)
633638
:type cluster_name: str
634639
:param create_or_update_cluster_payload: (required)
635640
:type create_or_update_cluster_payload: CreateOrUpdateClusterPayload
@@ -684,7 +689,12 @@ def create_or_update_cluster_with_http_info(
684689
self,
685690
project_id: StrictStr,
686691
region: StrictStr,
687-
cluster_name: StrictStr,
692+
cluster_name: Annotated[
693+
StrictStr,
694+
Field(
695+
description="Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long."
696+
),
697+
],
688698
create_or_update_cluster_payload: CreateOrUpdateClusterPayload,
689699
_request_timeout: Union[
690700
None,
@@ -704,7 +714,7 @@ def create_or_update_cluster_with_http_info(
704714
:type project_id: str
705715
:param region: (required)
706716
:type region: str
707-
:param cluster_name: (required)
717+
:param cluster_name: Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long. (required)
708718
:type cluster_name: str
709719
:param create_or_update_cluster_payload: (required)
710720
:type create_or_update_cluster_payload: CreateOrUpdateClusterPayload
@@ -759,7 +769,12 @@ def create_or_update_cluster_without_preload_content(
759769
self,
760770
project_id: StrictStr,
761771
region: StrictStr,
762-
cluster_name: StrictStr,
772+
cluster_name: Annotated[
773+
StrictStr,
774+
Field(
775+
description="Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long."
776+
),
777+
],
763778
create_or_update_cluster_payload: CreateOrUpdateClusterPayload,
764779
_request_timeout: Union[
765780
None,
@@ -779,7 +794,7 @@ def create_or_update_cluster_without_preload_content(
779794
:type project_id: str
780795
:param region: (required)
781796
:type region: str
782-
:param cluster_name: (required)
797+
:param cluster_name: Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long. (required)
783798
:type cluster_name: str
784799
:param create_or_update_cluster_payload: (required)
785800
:type create_or_update_cluster_payload: CreateOrUpdateClusterPayload

services/ske/src/stackit/ske/models/cluster.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
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, field_validator
2122
from pydantic_core import to_jsonable_python
2223
from typing_extensions import Annotated, Self
2324

@@ -41,7 +42,10 @@ class Cluster(BaseModel):
4142
hibernation: Optional[Hibernation] = None
4243
kubernetes: Kubernetes
4344
maintenance: Optional[Maintenance] = None
44-
name: Optional[StrictStr] = None
45+
name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=11)]] = Field(
46+
default=None,
47+
description="Use lowercase alphanumeric characters or -, must start and end with an alphanumeric character, and be between 1 and 11 characters long.",
48+
)
4549
network: Optional[Network] = None
4650
nodepools: Annotated[List[Nodepool], Field(min_length=1, max_length=50)]
4751
status: Optional[ClusterStatus] = None
@@ -57,6 +61,19 @@ class Cluster(BaseModel):
5761
"status",
5862
]
5963

64+
@field_validator("name")
65+
def name_validate_regular_expression(cls, value):
66+
"""Validates the regular expression"""
67+
if value is None:
68+
return value
69+
70+
if not isinstance(value, str):
71+
value = str(value)
72+
73+
if not re.match(r"^[a-z0-9]([a-z0-9-]{0,9}[a-z0-9])?$", value):
74+
raise ValueError(r"must validate the regular expression /^[a-z0-9]([a-z0-9-]{0,9}[a-z0-9])?$/")
75+
return value
76+
6077
model_config = ConfigDict(
6178
validate_by_name=True,
6279
validate_by_alias=True,

0 commit comments

Comments
 (0)