Skip to content

Commit f49dc3a

Browse files
Generator: Update SDK /services/kms (#2650)
Co-authored-by: Ruben Hoenle <[email protected]>
1 parent 7c44c0e commit f49dc3a

File tree

6 files changed

+39
-6
lines changed

6 files changed

+39
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- **Feature:** Add `CreateIsolatedNetwork` functionality
66
- **Feature:** Add `ImageFromVolumePayload` functionality
77
- **Feature:** Add `SystemRoutes` to `UpdateRoutingTableOfAreaPayload`
8+
- `kms`: [v0.5.0](services/kms/CHANGELOG.md#v050)
9+
- **Feature:** Add regex field validator for `display_name` attribute in model classes `CreateKeyPayload`, `CreateKeyRingPayload`, `CreateWrappingKeyPayload`
810

911
## Release (2025-12-08)
1012
- `scf`: [v0.3.0](services/scf/CHANGELOG.md#v030)

services/kms/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.5.0
2+
- **Feature:** Add regex field validator for `display_name` attribute in model classes `CreateKeyPayload`, `CreateKeyRingPayload`, `CreateWrappingKeyPayload`
3+
14
## v0.4.1
25
- **Bugfix:** Prevent year 0 timestamp issue
36

services/kms/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "stackit-kms"
33

44
[tool.poetry]
55
name = "stackit-kms"
6-
version = "v0.4.1"
6+
version = "v0.5.0"
77
authors = [
88
"STACKIT Developer Tools <[email protected]>",
99
]

services/kms/src/stackit/kms/models/create_key_payload.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import json
1717
import pprint
18+
import re # noqa: F401
1819
from typing import Any, ClassVar, Dict, List, Optional, Set
1920

2021
from pydantic import (
@@ -23,6 +24,7 @@
2324
Field,
2425
StrictBool,
2526
StrictStr,
27+
field_validator,
2628
)
2729
from typing_extensions import Annotated, Self
2830

@@ -43,7 +45,8 @@ class CreateKeyPayload(BaseModel):
4345
default=None, description="A user chosen description to distinguish multiple keys."
4446
)
4547
display_name: Annotated[str, Field(strict=True, max_length=64)] = Field(
46-
description="The display name to distinguish multiple keys.", alias="displayName"
48+
description="The display name to distinguish multiple keys. Valid characters: letters, digits, underscores and hyphens.",
49+
alias="displayName",
4750
)
4851
import_only: Optional[StrictBool] = Field(
4952
default=False, description="States whether versions can be created or only imported.", alias="importOnly"
@@ -60,6 +63,13 @@ class CreateKeyPayload(BaseModel):
6063
"purpose",
6164
]
6265

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+
6373
model_config = ConfigDict(
6474
populate_by_name=True,
6575
validate_assignment=True,

services/kms/src/stackit/kms/models/create_key_ring_payload.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
import json
1717
import pprint
18+
import re # noqa: F401
1819
from typing import Any, ClassVar, Dict, List, Optional, Set
1920

20-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
21+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2122
from typing_extensions import Annotated, Self
2223

2324

@@ -30,10 +31,18 @@ class CreateKeyRingPayload(BaseModel):
3031
default=None, description="A user chosen description to distinguish multiple key rings."
3132
)
3233
display_name: Annotated[str, Field(strict=True, max_length=64)] = Field(
33-
description="The display name to distinguish multiple key rings.", alias="displayName"
34+
description="The display name to distinguish multiple key rings. Valid characters: letters, digits, underscores and hyphens.",
35+
alias="displayName",
3436
)
3537
__properties: ClassVar[List[str]] = ["description", "displayName"]
3638

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+
3746
model_config = ConfigDict(
3847
populate_by_name=True,
3948
validate_assignment=True,

services/kms/src/stackit/kms/models/create_wrapping_key_payload.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
import json
1717
import pprint
18+
import re # noqa: F401
1819
from typing import Any, ClassVar, Dict, List, Optional, Set
1920

20-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
21+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2122
from typing_extensions import Annotated, Self
2223

2324
from stackit.kms.models.access_scope import AccessScope
@@ -37,7 +38,8 @@ class CreateWrappingKeyPayload(BaseModel):
3738
default=None, description="A user chosen description to distinguish multiple wrapping keys."
3839
)
3940
display_name: Annotated[str, Field(strict=True, max_length=64)] = Field(
40-
description="The display name to distinguish multiple wrapping keys.", alias="displayName"
41+
description="The display name to distinguish multiple wrapping keys. Valid characters: letters, digits, underscores and hyphens.",
42+
alias="displayName",
4143
)
4244
protection: Protection
4345
purpose: WrappingPurpose
@@ -50,6 +52,13 @@ class CreateWrappingKeyPayload(BaseModel):
5052
"purpose",
5153
]
5254

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+
5362
model_config = ConfigDict(
5463
populate_by_name=True,
5564
validate_assignment=True,

0 commit comments

Comments
 (0)