Skip to content

Commit bfd5a18

Browse files
Generate iaasalpha
1 parent a8e19f6 commit bfd5a18

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

services/iaasalpha/src/stackit/iaasalpha/models/add_routing_table_to_area_payload.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ class AddRoutingTableToAreaPayload(BaseModel):
6464
"updatedAt",
6565
]
6666

67+
@field_validator("created_at", mode="before")
68+
def created_at_change_year_zero_to_one(cls, value):
69+
"""Workaround which prevents year 0 issue"""
70+
if isinstance(value, str):
71+
# Check for year "0000" at the beginning of the string
72+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
73+
if value.startswith("0000-01-01T") and re.match(
74+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
75+
):
76+
# Workaround: Replace "0000" with "0001"
77+
return "0001" + value[4:] # Take "0001" and append the rest of the string
78+
return value
79+
6780
@field_validator("id")
6881
def id_validate_regular_expression(cls, value):
6982
"""Validates the regular expression"""
@@ -83,6 +96,19 @@ def name_validate_regular_expression(cls, value):
8396
raise ValueError(r"must validate the regular expression /^[A-Za-z0-9]+([ \/._-]*[A-Za-z0-9]+)*$/")
8497
return value
8598

99+
@field_validator("updated_at", mode="before")
100+
def updated_at_change_year_zero_to_one(cls, value):
101+
"""Workaround which prevents year 0 issue"""
102+
if isinstance(value, str):
103+
# Check for year "0000" at the beginning of the string
104+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
105+
if value.startswith("0000-01-01T") and re.match(
106+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
107+
):
108+
# Workaround: Replace "0000" with "0001"
109+
return "0001" + value[4:] # Take "0001" and append the rest of the string
110+
return value
111+
86112
model_config = ConfigDict(
87113
populate_by_name=True,
88114
validate_assignment=True,

services/iaasalpha/src/stackit/iaasalpha/models/network.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ class Network(BaseModel):
7979
"updatedAt",
8080
]
8181

82+
@field_validator("created_at", mode="before")
83+
def created_at_change_year_zero_to_one(cls, value):
84+
"""Workaround which prevents year 0 issue"""
85+
if isinstance(value, str):
86+
# Check for year "0000" at the beginning of the string
87+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
88+
if value.startswith("0000-01-01T") and re.match(
89+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
90+
):
91+
# Workaround: Replace "0000" with "0001"
92+
return "0001" + value[4:] # Take "0001" and append the rest of the string
93+
return value
94+
8295
@field_validator("id")
8396
def id_validate_regular_expression(cls, value):
8497
"""Validates the regular expression"""
@@ -100,6 +113,19 @@ def routing_table_id_validate_regular_expression(cls, value):
100113
)
101114
return value
102115

116+
@field_validator("updated_at", mode="before")
117+
def updated_at_change_year_zero_to_one(cls, value):
118+
"""Workaround which prevents year 0 issue"""
119+
if isinstance(value, str):
120+
# Check for year "0000" at the beginning of the string
121+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
122+
if value.startswith("0000-01-01T") and re.match(
123+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
124+
):
125+
# Workaround: Replace "0000" with "0001"
126+
return "0001" + value[4:] # Take "0001" and append the rest of the string
127+
return value
128+
103129
model_config = ConfigDict(
104130
populate_by_name=True,
105131
validate_assignment=True,

services/iaasalpha/src/stackit/iaasalpha/models/route.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ class Route(BaseModel):
4949
)
5050
__properties: ClassVar[List[str]] = ["createdAt", "destination", "id", "labels", "nexthop", "updatedAt"]
5151

52+
@field_validator("created_at", mode="before")
53+
def created_at_change_year_zero_to_one(cls, value):
54+
"""Workaround which prevents year 0 issue"""
55+
if isinstance(value, str):
56+
# Check for year "0000" at the beginning of the string
57+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
58+
if value.startswith("0000-01-01T") and re.match(
59+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
60+
):
61+
# Workaround: Replace "0000" with "0001"
62+
return "0001" + value[4:] # Take "0001" and append the rest of the string
63+
return value
64+
5265
@field_validator("id")
5366
def id_validate_regular_expression(cls, value):
5467
"""Validates the regular expression"""
@@ -61,6 +74,19 @@ def id_validate_regular_expression(cls, value):
6174
)
6275
return value
6376

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

services/iaasalpha/src/stackit/iaasalpha/models/routing_table.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ class RoutingTable(BaseModel):
6464
"updatedAt",
6565
]
6666

67+
@field_validator("created_at", mode="before")
68+
def created_at_change_year_zero_to_one(cls, value):
69+
"""Workaround which prevents year 0 issue"""
70+
if isinstance(value, str):
71+
# Check for year "0000" at the beginning of the string
72+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
73+
if value.startswith("0000-01-01T") and re.match(
74+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
75+
):
76+
# Workaround: Replace "0000" with "0001"
77+
return "0001" + value[4:] # Take "0001" and append the rest of the string
78+
return value
79+
6780
@field_validator("id")
6881
def id_validate_regular_expression(cls, value):
6982
"""Validates the regular expression"""
@@ -83,6 +96,19 @@ def name_validate_regular_expression(cls, value):
8396
raise ValueError(r"must validate the regular expression /^[A-Za-z0-9]+([ \/._-]*[A-Za-z0-9]+)*$/")
8497
return value
8598

99+
@field_validator("updated_at", mode="before")
100+
def updated_at_change_year_zero_to_one(cls, value):
101+
"""Workaround which prevents year 0 issue"""
102+
if isinstance(value, str):
103+
# Check for year "0000" at the beginning of the string
104+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
105+
if value.startswith("0000-01-01T") and re.match(
106+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
107+
):
108+
# Workaround: Replace "0000" with "0001"
109+
return "0001" + value[4:] # Take "0001" and append the rest of the string
110+
return value
111+
86112
model_config = ConfigDict(
87113
populate_by_name=True,
88114
validate_assignment=True,

0 commit comments

Comments
 (0)