Skip to content

Commit aeaa93c

Browse files
stackit-pipelineFyusel
authored andcommitted
Generate ske
1 parent 6a7c3df commit aeaa93c

File tree

9 files changed

+140
-6
lines changed

9 files changed

+140
-6
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
import pprint
1818
from typing import Any, ClassVar, Dict, List, Optional, Set
1919

20-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
20+
from pydantic import (
21+
BaseModel,
22+
ConfigDict,
23+
Field,
24+
StrictBool,
25+
StrictStr,
26+
)
2127
from typing_extensions import Annotated, Self
2228

2329

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@
1515

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

21-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
22+
from pydantic import (
23+
BaseModel,
24+
ConfigDict,
25+
Field,
26+
StrictBool,
27+
StrictStr,
28+
field_validator,
29+
)
2230
from typing_extensions import Self
2331

2432
from stackit.ske.models.cluster_error import ClusterError
@@ -61,6 +69,19 @@ class ClusterStatus(BaseModel):
6169
"podAddressRanges",
6270
]
6371

72+
@field_validator("creation_time", mode="before")
73+
def creation_time_change_year_zero_to_one(cls, value):
74+
"""Workaround which prevents year 0 issue"""
75+
if isinstance(value, str):
76+
# Check for year "0000" at the beginning of the string
77+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
78+
if value.startswith("0000-01-01T") and re.match(
79+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
80+
):
81+
# Workaround: Replace "0000" with "0001"
82+
return "0001" + value[4:] # Take "0001" and append the rest of the string
83+
return value
84+
6485
model_config = ConfigDict(
6586
populate_by_name=True,
6687
validate_assignment=True,

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

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

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

@@ -39,6 +40,32 @@ class CredentialsRotationState(BaseModel):
3940
)
4041
__properties: ClassVar[List[str]] = ["lastCompletionTime", "lastInitiationTime", "phase"]
4142

43+
@field_validator("last_completion_time", mode="before")
44+
def last_completion_time_change_year_zero_to_one(cls, value):
45+
"""Workaround which prevents year 0 issue"""
46+
if isinstance(value, str):
47+
# Check for year "0000" at the beginning of the string
48+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
49+
if value.startswith("0000-01-01T") and re.match(
50+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
51+
):
52+
# Workaround: Replace "0000" with "0001"
53+
return "0001" + value[4:] # Take "0001" and append the rest of the string
54+
return value
55+
56+
@field_validator("last_initiation_time", mode="before")
57+
def last_initiation_time_change_year_zero_to_one(cls, value):
58+
"""Workaround which prevents year 0 issue"""
59+
if isinstance(value, str):
60+
# Check for year "0000" at the beginning of the string
61+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
62+
if value.startswith("0000-01-01T") and re.match(
63+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
64+
):
65+
# Workaround: Replace "0000" with "0001"
66+
return "0001" + value[4:] # Take "0001" and append the rest of the string
67+
return value
68+
4269
@field_validator("phase")
4370
def phase_validate_enum(cls, value):
4471
"""Validates the enum"""

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515

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

21-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425

@@ -31,6 +32,19 @@ class Kubeconfig(BaseModel):
3132
kubeconfig: Optional[StrictStr] = None
3233
__properties: ClassVar[List[str]] = ["expirationTimestamp", "kubeconfig"]
3334

35+
@field_validator("expiration_timestamp", mode="before")
36+
def expiration_timestamp_change_year_zero_to_one(cls, value):
37+
"""Workaround which prevents year 0 issue"""
38+
if isinstance(value, str):
39+
# Check for year "0000" at the beginning of the string
40+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
41+
if value.startswith("0000-01-01T") and re.match(
42+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
43+
):
44+
# Workaround: Replace "0000" with "0001"
45+
return "0001" + value[4:] # Take "0001" and append the rest of the string
46+
return value
47+
3448
model_config = ConfigDict(
3549
populate_by_name=True,
3650
validate_assignment=True,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ class KubernetesVersion(BaseModel):
3434
version: Optional[Annotated[str, Field(strict=True)]] = None
3535
__properties: ClassVar[List[str]] = ["expirationDate", "featureGates", "state", "version"]
3636

37+
@field_validator("expiration_date", mode="before")
38+
def expiration_date_change_year_zero_to_one(cls, value):
39+
"""Workaround which prevents year 0 issue"""
40+
if isinstance(value, str):
41+
# Check for year "0000" at the beginning of the string
42+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
43+
if value.startswith("0000-01-01T") and re.match(
44+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
45+
):
46+
# Workaround: Replace "0000" with "0001"
47+
return "0001" + value[4:] # Take "0001" and append the rest of the string
48+
return value
49+
3750
@field_validator("version")
3851
def version_validate_regular_expression(cls, value):
3952
"""Validates the regular expression"""

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ class MachineImageVersion(BaseModel):
3636
version: Optional[Annotated[str, Field(strict=True)]] = None
3737
__properties: ClassVar[List[str]] = ["cri", "expirationDate", "state", "version"]
3838

39+
@field_validator("expiration_date", mode="before")
40+
def expiration_date_change_year_zero_to_one(cls, value):
41+
"""Workaround which prevents year 0 issue"""
42+
if isinstance(value, str):
43+
# Check for year "0000" at the beginning of the string
44+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
45+
if value.startswith("0000-01-01T") and re.match(
46+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
47+
):
48+
# Workaround: Replace "0000" with "0001"
49+
return "0001" + value[4:] # Take "0001" and append the rest of the string
50+
return value
51+
3952
@field_validator("version")
4053
def version_validate_regular_expression(cls, value):
4154
"""Validates the regular expression"""

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717
import pprint
1818
from typing import Any, ClassVar, Dict, List, Optional, Set
1919

20-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
20+
from pydantic import (
21+
BaseModel,
22+
ConfigDict,
23+
Field,
24+
StrictBool,
25+
StrictInt,
26+
StrictStr,
27+
)
2128
from typing_extensions import Annotated, Self
2229

2330
from stackit.ske.models.cri import CRI

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
import pprint
1818
from typing import Any, ClassVar, Dict, List, Optional, Set
1919

20-
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
20+
from pydantic import (
21+
BaseModel,
22+
ConfigDict,
23+
Field,
24+
StrictBool,
25+
StrictStr,
26+
)
2127
from typing_extensions import Self
2228

2329

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515

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

21-
from pydantic import BaseModel, ConfigDict
22+
from pydantic import BaseModel, ConfigDict, field_validator
2223
from typing_extensions import Self
2324

2425

@@ -31,6 +32,32 @@ class TimeWindow(BaseModel):
3132
start: datetime
3233
__properties: ClassVar[List[str]] = ["end", "start"]
3334

35+
@field_validator("end", mode="before")
36+
def end_change_year_zero_to_one(cls, value):
37+
"""Workaround which prevents year 0 issue"""
38+
if isinstance(value, str):
39+
# Check for year "0000" at the beginning of the string
40+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
41+
if value.startswith("0000-01-01T") and re.match(
42+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
43+
):
44+
# Workaround: Replace "0000" with "0001"
45+
return "0001" + value[4:] # Take "0001" and append the rest of the string
46+
return value
47+
48+
@field_validator("start", mode="before")
49+
def start_change_year_zero_to_one(cls, value):
50+
"""Workaround which prevents year 0 issue"""
51+
if isinstance(value, str):
52+
# Check for year "0000" at the beginning of the string
53+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
54+
if value.startswith("0000-01-01T") and re.match(
55+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
56+
):
57+
# Workaround: Replace "0000" with "0001"
58+
return "0001" + value[4:] # Take "0001" and append the rest of the string
59+
return value
60+
3461
model_config = ConfigDict(
3562
populate_by_name=True,
3663
validate_assignment=True,

0 commit comments

Comments
 (0)