stackit-resourcemanager 0.6.0__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/PKG-INFO +5 -2
  2. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/pyproject.toml +1 -1
  3. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/__init__.py +4 -0
  4. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/__init__.py +1 -0
  5. stackit_resourcemanager-0.7.0/src/stackit/resourcemanager/models/container_search_result.py +113 -0
  6. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/error_response.py +23 -1
  7. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/folder_response.py +28 -1
  8. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/get_folder_details_response.py +28 -1
  9. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/get_project_response.py +28 -1
  10. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/list_folders_response_items_inner.py +28 -1
  11. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/list_organizations_response_items_inner.py +28 -1
  12. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/organization_response.py +28 -1
  13. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/project.py +28 -1
  14. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/LICENSE.md +0 -0
  15. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/NOTICE.txt +0 -0
  16. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/README.md +0 -0
  17. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/api/__init__.py +0 -0
  18. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/api/default_api.py +0 -0
  19. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/api_client.py +0 -0
  20. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/api_response.py +0 -0
  21. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/configuration.py +0 -0
  22. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/exceptions.py +0 -0
  23. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/create_folder_payload.py +0 -0
  24. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/create_project_payload.py +0 -0
  25. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/lifecycle_state.py +0 -0
  26. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/list_folders_response.py +0 -0
  27. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/list_organizations_response.py +0 -0
  28. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/list_projects_response.py +0 -0
  29. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/member.py +0 -0
  30. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/parent.py +0 -0
  31. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/parent_list_inner.py +0 -0
  32. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/partial_update_folder_payload.py +0 -0
  33. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/partial_update_organization_payload.py +0 -0
  34. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/models/partial_update_project_payload.py +0 -0
  35. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/py.typed +0 -0
  36. {stackit_resourcemanager-0.6.0 → stackit_resourcemanager-0.7.0}/src/stackit/resourcemanager/rest.py +0 -0
@@ -1,7 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: stackit-resourcemanager
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Resource Manager API
5
+ License-File: LICENSE.md
6
+ License-File: NOTICE.txt
5
7
  Author: STACKIT Developer Tools
6
8
  Author-email: developer-tools@stackit.cloud
7
9
  Requires-Python: >=3.9,<4.0
@@ -13,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
13
15
  Classifier: Programming Language :: Python :: 3.11
14
16
  Classifier: Programming Language :: Python :: 3.12
15
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
16
19
  Requires-Dist: pydantic (>=2.9.2)
17
20
  Requires-Dist: python-dateutil (>=2.9.0.post0)
18
21
  Requires-Dist: requests (>=2.32.3)
@@ -3,7 +3,7 @@ name = "stackit-resourcemanager"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "stackit-resourcemanager"
6
- version = "v0.6.0"
6
+ version = "v0.7.0"
7
7
  authors = [
8
8
  "STACKIT Developer Tools <developer-tools@stackit.cloud>",
9
9
  ]
@@ -28,6 +28,7 @@ __all__ = [
28
28
  "ApiKeyError",
29
29
  "ApiAttributeError",
30
30
  "ApiException",
31
+ "ContainerSearchResult",
31
32
  "CreateFolderPayload",
32
33
  "CreateProjectPayload",
33
34
  "ErrorResponse",
@@ -65,6 +66,9 @@ from stackit.resourcemanager.exceptions import ApiValueError as ApiValueError
65
66
  from stackit.resourcemanager.exceptions import OpenApiException as OpenApiException
66
67
 
67
68
  # import models into sdk package
69
+ from stackit.resourcemanager.models.container_search_result import (
70
+ ContainerSearchResult as ContainerSearchResult,
71
+ )
68
72
  from stackit.resourcemanager.models.create_folder_payload import (
69
73
  CreateFolderPayload as CreateFolderPayload,
70
74
  )
@@ -14,6 +14,7 @@
14
14
 
15
15
 
16
16
  # import models into model package
17
+ from stackit.resourcemanager.models.container_search_result import ContainerSearchResult
17
18
  from stackit.resourcemanager.models.create_folder_payload import CreateFolderPayload
18
19
  from stackit.resourcemanager.models.create_project_payload import CreateProjectPayload
19
20
  from stackit.resourcemanager.models.error_response import ErrorResponse
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Resource Manager API
5
+
6
+ API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists
7
+
8
+ The version of the OpenAPI document: 2.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing_extensions import Self
22
+
23
+ from stackit.resourcemanager.models.lifecycle_state import LifecycleState
24
+
25
+
26
+ class ContainerSearchResult(BaseModel):
27
+ """
28
+ ContainerSearchResult
29
+ """ # noqa: E501
30
+
31
+ container_id: StrictStr = Field(description="Globally unique user-friendly identifier.", alias="containerId")
32
+ container_type: StrictStr = Field(description="Resource container type.", alias="containerType")
33
+ id: StrictStr = Field(description="Globally unique identifier.")
34
+ lifecycle_state: Optional[LifecycleState] = Field(default=None, alias="lifecycleState")
35
+ name: StrictStr = Field(description="Resource container name.")
36
+ organization_id: Optional[StrictStr] = Field(
37
+ default=None, description="Id of the organization the container is in.", alias="organizationId"
38
+ )
39
+ __properties: ClassVar[List[str]] = [
40
+ "containerId",
41
+ "containerType",
42
+ "id",
43
+ "lifecycleState",
44
+ "name",
45
+ "organizationId",
46
+ ]
47
+
48
+ @field_validator("container_type")
49
+ def container_type_validate_enum(cls, value):
50
+ """Validates the enum"""
51
+ if value not in set(["PROJECT", "FOLDER"]):
52
+ raise ValueError("must be one of enum values ('PROJECT', 'FOLDER')")
53
+ return value
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ )
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
+ return json.dumps(self.to_dict())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of ContainerSearchResult from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ """
85
+ excluded_fields: Set[str] = set([])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of ContainerSearchResult from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate(
104
+ {
105
+ "containerId": obj.get("containerId"),
106
+ "containerType": obj.get("containerType"),
107
+ "id": obj.get("id"),
108
+ "lifecycleState": obj.get("lifecycleState"),
109
+ "name": obj.get("name"),
110
+ "organizationId": obj.get("organizationId"),
111
+ }
112
+ )
113
+ return _obj
@@ -15,10 +15,19 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set, Union
20
21
 
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
+ )
22
31
  from typing_extensions import Self
23
32
 
24
33
 
@@ -34,6 +43,19 @@ class ErrorResponse(BaseModel):
34
43
  time_stamp: datetime = Field(description="Timestamp at which the error occurred.", alias="timeStamp")
35
44
  __properties: ClassVar[List[str]] = ["error", "message", "path", "status", "timeStamp"]
36
45
 
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
+
37
59
  model_config = ConfigDict(
38
60
  populate_by_name=True,
39
61
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.parent import Parent
@@ -49,6 +50,32 @@ class FolderResponse(BaseModel):
49
50
  "updateTime",
50
51
  ]
51
52
 
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
+
52
79
  model_config = ConfigDict(
53
80
  populate_by_name=True,
54
81
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.parent import Parent
@@ -52,6 +53,32 @@ class GetFolderDetailsResponse(BaseModel):
52
53
  "updateTime",
53
54
  ]
54
55
 
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
+
55
82
  model_config = ConfigDict(
56
83
  populate_by_name=True,
57
84
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -55,6 +56,32 @@ class GetProjectResponse(BaseModel):
55
56
  "updateTime",
56
57
  ]
57
58
 
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
+
58
85
  model_config = ConfigDict(
59
86
  populate_by_name=True,
60
87
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.parent import Parent
@@ -49,6 +50,32 @@ class ListFoldersResponseItemsInner(BaseModel):
49
50
  "updateTime",
50
51
  ]
51
52
 
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
+
52
79
  model_config = ConfigDict(
53
80
  populate_by_name=True,
54
81
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -53,6 +54,32 @@ class ListOrganizationsResponseItemsInner(BaseModel):
53
54
  "updateTime",
54
55
  ]
55
56
 
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
+
56
83
  model_config = ConfigDict(
57
84
  populate_by_name=True,
58
85
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -53,6 +54,32 @@ class OrganizationResponse(BaseModel):
53
54
  "updateTime",
54
55
  ]
55
56
 
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
+
56
83
  model_config = ConfigDict(
57
84
  populate_by_name=True,
58
85
  validate_assignment=True,
@@ -15,10 +15,11 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import pprint
18
+ import re # noqa: F401
18
19
  from datetime import datetime
19
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
21
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Self
23
24
 
24
25
  from stackit.resourcemanager.models.lifecycle_state import LifecycleState
@@ -52,6 +53,32 @@ class Project(BaseModel):
52
53
  "updateTime",
53
54
  ]
54
55
 
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
+
55
82
  model_config = ConfigDict(
56
83
  populate_by_name=True,
57
84
  validate_assignment=True,