Skip to content

Commit 8350af8

Browse files
Generate scf
1 parent e731cb6 commit 8350af8

File tree

6 files changed

+182
-6
lines changed

6 files changed

+182
-6
lines changed

services/scf/src/stackit/scf/models/org_manager.py

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

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from datetime import datetime
2021
from typing import Any, ClassVar, Dict, List, Optional, Set
2122

22-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
23+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2324
from typing_extensions import Self
2425

2526

@@ -47,6 +48,32 @@ class OrgManager(BaseModel):
4748
"username",
4849
]
4950

51+
@field_validator("created_at", mode="before")
52+
def created_at_change_year_zero_to_one(cls, value):
53+
"""Workaround which prevents year 0 issue"""
54+
if isinstance(value, str):
55+
# Check for year "0000" at the beginning of the string
56+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
57+
if value.startswith("0000-01-01T") and re.match(
58+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
59+
):
60+
# Workaround: Replace "0000" with "0001"
61+
return "0001" + value[4:] # Take "0001" and append the rest of the string
62+
return value
63+
64+
@field_validator("updated_at", mode="before")
65+
def updated_at_change_year_zero_to_one(cls, value):
66+
"""Workaround which prevents year 0 issue"""
67+
if isinstance(value, str):
68+
# Check for year "0000" at the beginning of the string
69+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
70+
if value.startswith("0000-01-01T") and re.match(
71+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
72+
):
73+
# Workaround: Replace "0000" with "0001"
74+
return "0001" + value[4:] # Take "0001" and append the rest of the string
75+
return value
76+
5077
model_config = ConfigDict(
5178
populate_by_name=True,
5279
validate_assignment=True,

services/scf/src/stackit/scf/models/org_manager_response.py

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

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from datetime import datetime
2021
from typing import Any, ClassVar, Dict, List, Optional, Set
2122

22-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
23+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2324
from typing_extensions import Self
2425

2526

@@ -49,6 +50,32 @@ class OrgManagerResponse(BaseModel):
4950
"username",
5051
]
5152

53+
@field_validator("created_at", mode="before")
54+
def created_at_change_year_zero_to_one(cls, value):
55+
"""Workaround which prevents year 0 issue"""
56+
if isinstance(value, str):
57+
# Check for year "0000" at the beginning of the string
58+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
59+
if value.startswith("0000-01-01T") and re.match(
60+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
61+
):
62+
# Workaround: Replace "0000" with "0001"
63+
return "0001" + value[4:] # Take "0001" and append the rest of the string
64+
return value
65+
66+
@field_validator("updated_at", mode="before")
67+
def updated_at_change_year_zero_to_one(cls, value):
68+
"""Workaround which prevents year 0 issue"""
69+
if isinstance(value, str):
70+
# Check for year "0000" at the beginning of the string
71+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
72+
if value.startswith("0000-01-01T") and re.match(
73+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
74+
):
75+
# Workaround: Replace "0000" with "0001"
76+
return "0001" + value[4:] # Take "0001" and append the rest of the string
77+
return value
78+
5279
model_config = ConfigDict(
5380
populate_by_name=True,
5481
validate_assignment=True,

services/scf/src/stackit/scf/models/organization.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from datetime import datetime
2021
from typing import Any, ClassVar, Dict, List, Optional, Set
2122

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

2533

@@ -53,6 +61,32 @@ class Organization(BaseModel):
5361
"updatedAt",
5462
]
5563

64+
@field_validator("created_at", mode="before")
65+
def created_at_change_year_zero_to_one(cls, value):
66+
"""Workaround which prevents year 0 issue"""
67+
if isinstance(value, str):
68+
# Check for year "0000" at the beginning of the string
69+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
70+
if value.startswith("0000-01-01T") and re.match(
71+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
72+
):
73+
# Workaround: Replace "0000" with "0001"
74+
return "0001" + value[4:] # Take "0001" and append the rest of the string
75+
return value
76+
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+
5690
model_config = ConfigDict(
5791
populate_by_name=True,
5892
validate_assignment=True,

services/scf/src/stackit/scf/models/organizations_list_item.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from datetime import datetime
2021
from typing import Any, ClassVar, Dict, List, Optional, Set
2122

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

2533

@@ -53,6 +61,32 @@ class OrganizationsListItem(BaseModel):
5361
"updatedAt",
5462
]
5563

64+
@field_validator("created_at", mode="before")
65+
def created_at_change_year_zero_to_one(cls, value):
66+
"""Workaround which prevents year 0 issue"""
67+
if isinstance(value, str):
68+
# Check for year "0000" at the beginning of the string
69+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
70+
if value.startswith("0000-01-01T") and re.match(
71+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
72+
):
73+
# Workaround: Replace "0000" with "0001"
74+
return "0001" + value[4:] # Take "0001" and append the rest of the string
75+
return value
76+
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+
5690
model_config = ConfigDict(
5791
populate_by_name=True,
5892
validate_assignment=True,

services/scf/src/stackit/scf/models/quota.py

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

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from datetime import datetime
2021
from typing import Any, ClassVar, Dict, List, Optional, Set
2122

22-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
23+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2324
from typing_extensions import Self
2425

2526
from stackit.scf.models.quota_apps import QuotaApps
@@ -60,6 +61,32 @@ class Quota(BaseModel):
6061
"updatedAt",
6162
]
6263

64+
@field_validator("created_at", mode="before")
65+
def created_at_change_year_zero_to_one(cls, value):
66+
"""Workaround which prevents year 0 issue"""
67+
if isinstance(value, str):
68+
# Check for year "0000" at the beginning of the string
69+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
70+
if value.startswith("0000-01-01T") and re.match(
71+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
72+
):
73+
# Workaround: Replace "0000" with "0001"
74+
return "0001" + value[4:] # Take "0001" and append the rest of the string
75+
return value
76+
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+
6390
model_config = ConfigDict(
6491
populate_by_name=True,
6592
validate_assignment=True,

services/scf/src/stackit/scf/models/space.py

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

1717
import json
1818
import pprint
19+
import re # noqa: F401
1920
from datetime import datetime
2021
from typing import Any, ClassVar, Dict, List, Optional, Set
2122

22-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
23+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2324
from typing_extensions import Self
2425

2526

@@ -47,6 +48,32 @@ class Space(BaseModel):
4748
"updatedAt",
4849
]
4950

51+
@field_validator("created_at", mode="before")
52+
def created_at_change_year_zero_to_one(cls, value):
53+
"""Workaround which prevents year 0 issue"""
54+
if isinstance(value, str):
55+
# Check for year "0000" at the beginning of the string
56+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
57+
if value.startswith("0000-01-01T") and re.match(
58+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
59+
):
60+
# Workaround: Replace "0000" with "0001"
61+
return "0001" + value[4:] # Take "0001" and append the rest of the string
62+
return value
63+
64+
@field_validator("updated_at", mode="before")
65+
def updated_at_change_year_zero_to_one(cls, value):
66+
"""Workaround which prevents year 0 issue"""
67+
if isinstance(value, str):
68+
# Check for year "0000" at the beginning of the string
69+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
70+
if value.startswith("0000-01-01T") and re.match(
71+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
72+
):
73+
# Workaround: Replace "0000" with "0001"
74+
return "0001" + value[4:] # Take "0001" and append the rest of the string
75+
return value
76+
5077
model_config = ConfigDict(
5178
populate_by_name=True,
5279
validate_assignment=True,

0 commit comments

Comments
 (0)