Skip to content

Commit a1cf4fd

Browse files
Generate resourcemanager
1 parent e731cb6 commit a1cf4fd

File tree

8 files changed

+219
-8
lines changed

8 files changed

+219
-8
lines changed

services/resourcemanager/src/stackit/resourcemanager/models/error_response.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,19 @@
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, Union
2021

21-
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
22+
from pydantic import (
23+
BaseModel,
24+
ConfigDict,
25+
Field,
26+
StrictFloat,
27+
StrictInt,
28+
StrictStr,
29+
field_validator,
30+
)
2231
from typing_extensions import Self
2332

2433

@@ -34,6 +43,19 @@ class ErrorResponse(BaseModel):
3443
time_stamp: datetime = Field(description="Timestamp at which the error occurred.", alias="timeStamp")
3544
__properties: ClassVar[List[str]] = ["error", "message", "path", "status", "timeStamp"]
3645

46+
@field_validator("time_stamp", mode="before")
47+
def time_stamp_change_year_zero_to_one(cls, value):
48+
"""Workaround which prevents year 0 issue"""
49+
if isinstance(value, str):
50+
# Check for year "0000" at the beginning of the string
51+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
52+
if value.startswith("0000-01-01T") and re.match(
53+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
54+
):
55+
# Workaround: Replace "0000" with "0001"
56+
return "0001" + value[4:] # Take "0001" and append the rest of the string
57+
return value
58+
3759
model_config = ConfigDict(
3860
populate_by_name=True,
3961
validate_assignment=True,

services/resourcemanager/src/stackit/resourcemanager/models/folder_response.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.parent import Parent
@@ -49,6 +50,32 @@ class FolderResponse(BaseModel):
4950
"updateTime",
5051
]
5152

53+
@field_validator("creation_time", mode="before")
54+
def creation_time_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("update_time", mode="before")
67+
def update_time_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/resourcemanager/src/stackit/resourcemanager/models/get_folder_details_response.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.parent import Parent
@@ -52,6 +53,32 @@ class GetFolderDetailsResponse(BaseModel):
5253
"updateTime",
5354
]
5455

56+
@field_validator("creation_time", mode="before")
57+
def creation_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+
69+
@field_validator("update_time", mode="before")
70+
def update_time_change_year_zero_to_one(cls, value):
71+
"""Workaround which prevents year 0 issue"""
72+
if isinstance(value, str):
73+
# Check for year "0000" at the beginning of the string
74+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
75+
if value.startswith("0000-01-01T") and re.match(
76+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
77+
):
78+
# Workaround: Replace "0000" with "0001"
79+
return "0001" + value[4:] # Take "0001" and append the rest of the string
80+
return value
81+
5582
model_config = ConfigDict(
5683
populate_by_name=True,
5784
validate_assignment=True,

services/resourcemanager/src/stackit/resourcemanager/models/get_project_response.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -55,6 +56,32 @@ class GetProjectResponse(BaseModel):
5556
"updateTime",
5657
]
5758

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

services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response_items_inner.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.parent import Parent
@@ -49,6 +50,32 @@ class ListFoldersResponseItemsInner(BaseModel):
4950
"updateTime",
5051
]
5152

53+
@field_validator("creation_time", mode="before")
54+
def creation_time_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("update_time", mode="before")
67+
def update_time_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/resourcemanager/src/stackit/resourcemanager/models/list_organizations_response_items_inner.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -53,6 +54,32 @@ class ListOrganizationsResponseItemsInner(BaseModel):
5354
"updateTime",
5455
]
5556

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

services/resourcemanager/src/stackit/resourcemanager/models/organization_response.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -53,6 +54,32 @@ class OrganizationResponse(BaseModel):
5354
"updateTime",
5455
]
5556

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

services/resourcemanager/src/stackit/resourcemanager/models/project.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, Field, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2223
from typing_extensions import Self
2324

2425
from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -52,6 +53,32 @@ class Project(BaseModel):
5253
"updateTime",
5354
]
5455

56+
@field_validator("creation_time", mode="before")
57+
def creation_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+
69+
@field_validator("update_time", mode="before")
70+
def update_time_change_year_zero_to_one(cls, value):
71+
"""Workaround which prevents year 0 issue"""
72+
if isinstance(value, str):
73+
# Check for year "0000" at the beginning of the string
74+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
75+
if value.startswith("0000-01-01T") and re.match(
76+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
77+
):
78+
# Workaround: Replace "0000" with "0001"
79+
return "0001" + value[4:] # Take "0001" and append the rest of the string
80+
return value
81+
5582
model_config = ConfigDict(
5683
populate_by_name=True,
5784
validate_assignment=True,

0 commit comments

Comments
 (0)