stackit-kms 0.4.0__tar.gz → 0.5.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.
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/PKG-INFO +5 -2
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/pyproject.toml +1 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/create_key_payload.py +18 -2
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/create_key_ring_payload.py +11 -2
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/create_wrapping_key_payload.py +11 -2
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/decrypt_payload.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/decrypted_data.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/encrypt_payload.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/encrypted_data.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/key.py +27 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/key_ring.py +14 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/sign_payload.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/signed_data.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/verify_payload.py +7 -1
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/version.py +27 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/wrapping_key.py +27 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/LICENSE.md +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/NOTICE.txt +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/README.md +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/__init__.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/api/__init__.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/api/default_api.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/api_client.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/api_response.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/configuration.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/exceptions.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/__init__.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/access_scope.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/algorithm.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/http_error.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/import_key_payload.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/key_list.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/key_ring_list.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/protection.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/purpose.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/verified_data.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/version_list.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/wrapping_algorithm.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/wrapping_key_list.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/wrapping_purpose.py +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/py.typed +0 -0
- {stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/rest.py +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: stackit-kms
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: STACKIT Key Management Service 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)
|
|
@@ -15,9 +15,17 @@ from __future__ import annotations
|
|
|
15
15
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
18
19
|
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
20
|
|
|
20
|
-
from pydantic import
|
|
21
|
+
from pydantic import (
|
|
22
|
+
BaseModel,
|
|
23
|
+
ConfigDict,
|
|
24
|
+
Field,
|
|
25
|
+
StrictBool,
|
|
26
|
+
StrictStr,
|
|
27
|
+
field_validator,
|
|
28
|
+
)
|
|
21
29
|
from typing_extensions import Annotated, Self
|
|
22
30
|
|
|
23
31
|
from stackit.kms.models.access_scope import AccessScope
|
|
@@ -37,7 +45,8 @@ class CreateKeyPayload(BaseModel):
|
|
|
37
45
|
default=None, description="A user chosen description to distinguish multiple keys."
|
|
38
46
|
)
|
|
39
47
|
display_name: Annotated[str, Field(strict=True, max_length=64)] = Field(
|
|
40
|
-
description="The display name to distinguish multiple keys.
|
|
48
|
+
description="The display name to distinguish multiple keys. Valid characters: letters, digits, underscores and hyphens.",
|
|
49
|
+
alias="displayName",
|
|
41
50
|
)
|
|
42
51
|
import_only: Optional[StrictBool] = Field(
|
|
43
52
|
default=False, description="States whether versions can be created or only imported.", alias="importOnly"
|
|
@@ -54,6 +63,13 @@ class CreateKeyPayload(BaseModel):
|
|
|
54
63
|
"purpose",
|
|
55
64
|
]
|
|
56
65
|
|
|
66
|
+
@field_validator("display_name")
|
|
67
|
+
def display_name_validate_regular_expression(cls, value):
|
|
68
|
+
"""Validates the regular expression"""
|
|
69
|
+
if not re.match(r"^[a-zA-Z0-9_-]+$", value):
|
|
70
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_-]+$/")
|
|
71
|
+
return value
|
|
72
|
+
|
|
57
73
|
model_config = ConfigDict(
|
|
58
74
|
populate_by_name=True,
|
|
59
75
|
validate_assignment=True,
|
|
@@ -15,9 +15,10 @@ from __future__ import annotations
|
|
|
15
15
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
18
19
|
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
20
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
22
|
from typing_extensions import Annotated, Self
|
|
22
23
|
|
|
23
24
|
|
|
@@ -30,10 +31,18 @@ class CreateKeyRingPayload(BaseModel):
|
|
|
30
31
|
default=None, description="A user chosen description to distinguish multiple key rings."
|
|
31
32
|
)
|
|
32
33
|
display_name: Annotated[str, Field(strict=True, max_length=64)] = Field(
|
|
33
|
-
description="The display name to distinguish multiple key rings.
|
|
34
|
+
description="The display name to distinguish multiple key rings. Valid characters: letters, digits, underscores and hyphens.",
|
|
35
|
+
alias="displayName",
|
|
34
36
|
)
|
|
35
37
|
__properties: ClassVar[List[str]] = ["description", "displayName"]
|
|
36
38
|
|
|
39
|
+
@field_validator("display_name")
|
|
40
|
+
def display_name_validate_regular_expression(cls, value):
|
|
41
|
+
"""Validates the regular expression"""
|
|
42
|
+
if not re.match(r"^[a-zA-Z0-9_-]+$", value):
|
|
43
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_-]+$/")
|
|
44
|
+
return value
|
|
45
|
+
|
|
37
46
|
model_config = ConfigDict(
|
|
38
47
|
populate_by_name=True,
|
|
39
48
|
validate_assignment=True,
|
{stackit_kms-0.4.0 → stackit_kms-0.5.0}/src/stackit/kms/models/create_wrapping_key_payload.py
RENAMED
|
@@ -15,9 +15,10 @@ from __future__ import annotations
|
|
|
15
15
|
|
|
16
16
|
import json
|
|
17
17
|
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
18
19
|
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
20
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
22
|
from typing_extensions import Annotated, Self
|
|
22
23
|
|
|
23
24
|
from stackit.kms.models.access_scope import AccessScope
|
|
@@ -37,7 +38,8 @@ class CreateWrappingKeyPayload(BaseModel):
|
|
|
37
38
|
default=None, description="A user chosen description to distinguish multiple wrapping keys."
|
|
38
39
|
)
|
|
39
40
|
display_name: Annotated[str, Field(strict=True, max_length=64)] = Field(
|
|
40
|
-
description="The display name to distinguish multiple wrapping keys.
|
|
41
|
+
description="The display name to distinguish multiple wrapping keys. Valid characters: letters, digits, underscores and hyphens.",
|
|
42
|
+
alias="displayName",
|
|
41
43
|
)
|
|
42
44
|
protection: Protection
|
|
43
45
|
purpose: WrappingPurpose
|
|
@@ -50,6 +52,13 @@ class CreateWrappingKeyPayload(BaseModel):
|
|
|
50
52
|
"purpose",
|
|
51
53
|
]
|
|
52
54
|
|
|
55
|
+
@field_validator("display_name")
|
|
56
|
+
def display_name_validate_regular_expression(cls, value):
|
|
57
|
+
"""Validates the regular expression"""
|
|
58
|
+
if not re.match(r"^[a-zA-Z0-9_-]+$", value):
|
|
59
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9_-]+$/")
|
|
60
|
+
return value
|
|
61
|
+
|
|
53
62
|
model_config = ConfigDict(
|
|
54
63
|
populate_by_name=True,
|
|
55
64
|
validate_assignment=True,
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -15,6 +15,7 @@ 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
|
|
|
@@ -80,6 +81,32 @@ class Key(BaseModel):
|
|
|
80
81
|
"state",
|
|
81
82
|
]
|
|
82
83
|
|
|
84
|
+
@field_validator("created_at", mode="before")
|
|
85
|
+
def created_at_change_year_zero_to_one(cls, value):
|
|
86
|
+
"""Workaround which prevents year 0 issue"""
|
|
87
|
+
if isinstance(value, str):
|
|
88
|
+
# Check for year "0000" at the beginning of the string
|
|
89
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
90
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
91
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
92
|
+
):
|
|
93
|
+
# Workaround: Replace "0000" with "0001"
|
|
94
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
95
|
+
return value
|
|
96
|
+
|
|
97
|
+
@field_validator("deletion_date", mode="before")
|
|
98
|
+
def deletion_date_change_year_zero_to_one(cls, value):
|
|
99
|
+
"""Workaround which prevents year 0 issue"""
|
|
100
|
+
if isinstance(value, str):
|
|
101
|
+
# Check for year "0000" at the beginning of the string
|
|
102
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
103
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
104
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
105
|
+
):
|
|
106
|
+
# Workaround: Replace "0000" with "0001"
|
|
107
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
108
|
+
return value
|
|
109
|
+
|
|
83
110
|
@field_validator("state")
|
|
84
111
|
def state_validate_enum(cls, value):
|
|
85
112
|
"""Validates the enum"""
|
|
@@ -15,6 +15,7 @@ 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
|
|
|
@@ -40,6 +41,19 @@ class KeyRing(BaseModel):
|
|
|
40
41
|
state: StrictStr = Field(description="The current state of the key ring.")
|
|
41
42
|
__properties: ClassVar[List[str]] = ["createdAt", "description", "displayName", "id", "state"]
|
|
42
43
|
|
|
44
|
+
@field_validator("created_at", mode="before")
|
|
45
|
+
def created_at_change_year_zero_to_one(cls, value):
|
|
46
|
+
"""Workaround which prevents year 0 issue"""
|
|
47
|
+
if isinstance(value, str):
|
|
48
|
+
# Check for year "0000" at the beginning of the string
|
|
49
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
50
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
51
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
52
|
+
):
|
|
53
|
+
# Workaround: Replace "0000" with "0001"
|
|
54
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
55
|
+
return value
|
|
56
|
+
|
|
43
57
|
@field_validator("state")
|
|
44
58
|
def state_validate_enum(cls, value):
|
|
45
59
|
"""Validates the enum"""
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -17,7 +17,13 @@ import json
|
|
|
17
17
|
import pprint
|
|
18
18
|
from typing import Any, ClassVar, Dict, List, Optional, Set, Union
|
|
19
19
|
|
|
20
|
-
from pydantic import
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBytes,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
21
27
|
from typing_extensions import Self
|
|
22
28
|
|
|
23
29
|
|
|
@@ -15,6 +15,7 @@ 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
|
|
|
@@ -66,6 +67,32 @@ class Version(BaseModel):
|
|
|
66
67
|
"state",
|
|
67
68
|
]
|
|
68
69
|
|
|
70
|
+
@field_validator("created_at", mode="before")
|
|
71
|
+
def created_at_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
|
+
|
|
83
|
+
@field_validator("destroy_date", mode="before")
|
|
84
|
+
def destroy_date_change_year_zero_to_one(cls, value):
|
|
85
|
+
"""Workaround which prevents year 0 issue"""
|
|
86
|
+
if isinstance(value, str):
|
|
87
|
+
# Check for year "0000" at the beginning of the string
|
|
88
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
89
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
90
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
91
|
+
):
|
|
92
|
+
# Workaround: Replace "0000" with "0001"
|
|
93
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
94
|
+
return value
|
|
95
|
+
|
|
69
96
|
@field_validator("state")
|
|
70
97
|
def state_validate_enum(cls, value):
|
|
71
98
|
"""Validates the enum"""
|
|
@@ -15,6 +15,7 @@ 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
|
|
|
@@ -69,6 +70,32 @@ class WrappingKey(BaseModel):
|
|
|
69
70
|
"state",
|
|
70
71
|
]
|
|
71
72
|
|
|
73
|
+
@field_validator("created_at", mode="before")
|
|
74
|
+
def created_at_change_year_zero_to_one(cls, value):
|
|
75
|
+
"""Workaround which prevents year 0 issue"""
|
|
76
|
+
if isinstance(value, str):
|
|
77
|
+
# Check for year "0000" at the beginning of the string
|
|
78
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
79
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
80
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
81
|
+
):
|
|
82
|
+
# Workaround: Replace "0000" with "0001"
|
|
83
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
84
|
+
return value
|
|
85
|
+
|
|
86
|
+
@field_validator("expires_at", mode="before")
|
|
87
|
+
def expires_at_change_year_zero_to_one(cls, value):
|
|
88
|
+
"""Workaround which prevents year 0 issue"""
|
|
89
|
+
if isinstance(value, str):
|
|
90
|
+
# Check for year "0000" at the beginning of the string
|
|
91
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
92
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
93
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
94
|
+
):
|
|
95
|
+
# Workaround: Replace "0000" with "0001"
|
|
96
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
97
|
+
return value
|
|
98
|
+
|
|
72
99
|
@field_validator("state")
|
|
73
100
|
def state_validate_enum(cls, value):
|
|
74
101
|
"""Validates the enum"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|