From c6ac7cd2d69613d7a81640ca59c445471f4d7171 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Oct 2025 10:26:29 +0000 Subject: [PATCH] Generate ske --- services/ske/src/stackit/ske/models/acl.py | 8 ++++- .../src/stackit/ske/models/cluster_status.py | 23 ++++++++++++++- .../ske/models/credentials_rotation_state.py | 27 +++++++++++++++++ .../ske/src/stackit/ske/models/kubeconfig.py | 16 +++++++++- .../stackit/ske/models/kubernetes_version.py | 13 +++++++++ .../ske/models/machine_image_version.py | 13 +++++++++ .../ske/src/stackit/ske/models/nodepool.py | 9 +++++- .../src/stackit/ske/models/observability.py | 8 ++++- .../ske/src/stackit/ske/models/time_window.py | 29 ++++++++++++++++++- 9 files changed, 140 insertions(+), 6 deletions(-) diff --git a/services/ske/src/stackit/ske/models/acl.py b/services/ske/src/stackit/ske/models/acl.py index 8d1331349..7a0536ec6 100644 --- a/services/ske/src/stackit/ske/models/acl.py +++ b/services/ske/src/stackit/ske/models/acl.py @@ -17,7 +17,13 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, +) from typing_extensions import Annotated, Self diff --git a/services/ske/src/stackit/ske/models/cluster_status.py b/services/ske/src/stackit/ske/models/cluster_status.py index 4c2a9b37d..1c79adbc7 100644 --- a/services/ske/src/stackit/ske/models/cluster_status.py +++ b/services/ske/src/stackit/ske/models/cluster_status.py @@ -15,10 +15,18 @@ import json import pprint +import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) from typing_extensions import Self from stackit.ske.models.cluster_error import ClusterError @@ -61,6 +69,19 @@ class ClusterStatus(BaseModel): "podAddressRanges", ] + @field_validator("creation_time", mode="before") + def creation_time_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/ske/src/stackit/ske/models/credentials_rotation_state.py b/services/ske/src/stackit/ske/models/credentials_rotation_state.py index adda37e8f..e111bfdad 100644 --- a/services/ske/src/stackit/ske/models/credentials_rotation_state.py +++ b/services/ske/src/stackit/ske/models/credentials_rotation_state.py @@ -15,6 +15,7 @@ import json import pprint +import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set @@ -39,6 +40,32 @@ class CredentialsRotationState(BaseModel): ) __properties: ClassVar[List[str]] = ["lastCompletionTime", "lastInitiationTime", "phase"] + @field_validator("last_completion_time", mode="before") + def last_completion_time_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + + @field_validator("last_initiation_time", mode="before") + def last_initiation_time_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + @field_validator("phase") def phase_validate_enum(cls, value): """Validates the enum""" diff --git a/services/ske/src/stackit/ske/models/kubeconfig.py b/services/ske/src/stackit/ske/models/kubeconfig.py index e1bcc9018..b40eb485e 100644 --- a/services/ske/src/stackit/ske/models/kubeconfig.py +++ b/services/ske/src/stackit/ske/models/kubeconfig.py @@ -15,10 +15,11 @@ import json import pprint +import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing_extensions import Self @@ -31,6 +32,19 @@ class Kubeconfig(BaseModel): kubeconfig: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["expirationTimestamp", "kubeconfig"] + @field_validator("expiration_timestamp", mode="before") + def expiration_timestamp_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/ske/src/stackit/ske/models/kubernetes_version.py b/services/ske/src/stackit/ske/models/kubernetes_version.py index b5d506e75..628ee5e08 100644 --- a/services/ske/src/stackit/ske/models/kubernetes_version.py +++ b/services/ske/src/stackit/ske/models/kubernetes_version.py @@ -34,6 +34,19 @@ class KubernetesVersion(BaseModel): version: Optional[Annotated[str, Field(strict=True)]] = None __properties: ClassVar[List[str]] = ["expirationDate", "featureGates", "state", "version"] + @field_validator("expiration_date", mode="before") + def expiration_date_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + @field_validator("version") def version_validate_regular_expression(cls, value): """Validates the regular expression""" diff --git a/services/ske/src/stackit/ske/models/machine_image_version.py b/services/ske/src/stackit/ske/models/machine_image_version.py index 22939cbc2..c2fcf2266 100644 --- a/services/ske/src/stackit/ske/models/machine_image_version.py +++ b/services/ske/src/stackit/ske/models/machine_image_version.py @@ -36,6 +36,19 @@ class MachineImageVersion(BaseModel): version: Optional[Annotated[str, Field(strict=True)]] = None __properties: ClassVar[List[str]] = ["cri", "expirationDate", "state", "version"] + @field_validator("expiration_date", mode="before") + def expiration_date_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + @field_validator("version") def version_validate_regular_expression(cls, value): """Validates the regular expression""" diff --git a/services/ske/src/stackit/ske/models/nodepool.py b/services/ske/src/stackit/ske/models/nodepool.py index 57344aa66..b856971a5 100644 --- a/services/ske/src/stackit/ske/models/nodepool.py +++ b/services/ske/src/stackit/ske/models/nodepool.py @@ -17,7 +17,14 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictInt, + StrictStr, +) from typing_extensions import Annotated, Self from stackit.ske.models.cri import CRI diff --git a/services/ske/src/stackit/ske/models/observability.py b/services/ske/src/stackit/ske/models/observability.py index 9c28159d8..ff819a83c 100644 --- a/services/ske/src/stackit/ske/models/observability.py +++ b/services/ske/src/stackit/ske/models/observability.py @@ -17,7 +17,13 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, +) from typing_extensions import Self diff --git a/services/ske/src/stackit/ske/models/time_window.py b/services/ske/src/stackit/ske/models/time_window.py index 47e6964dc..2df0fb352 100644 --- a/services/ske/src/stackit/ske/models/time_window.py +++ b/services/ske/src/stackit/ske/models/time_window.py @@ -15,10 +15,11 @@ import json import pprint +import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, field_validator from typing_extensions import Self @@ -31,6 +32,32 @@ class TimeWindow(BaseModel): start: datetime __properties: ClassVar[List[str]] = ["end", "start"] + @field_validator("end", mode="before") + def end_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + + @field_validator("start", mode="before") + def start_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True,