Skip to content

Commit 57fa740

Browse files
Generator: Update SDK /services/postgresflex (#9212)
* Generate postgresflex * chore(postgresflex): Add changelog Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> --------- Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> Co-authored-by: Alexander Dahmen <alexander.dahmen@inovex.de>
1 parent e7d5564 commit 57fa740

12 files changed

Lines changed: 111 additions & 22 deletions

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
- **Breaking Change/Fix:** `create_backup` operation now returns `CreateBackupResponseItem` instead of `List[CreateBackupResponseItem]`
3232
The return type now correctly models the actual JSON response, this operation was broken beforehand.
3333
- `postgresflex`:
34+
- [v1.6.1](services/postgresflex/CHANGELOG.md#v161)
35+
- **Improvement:** Add validation for `name` field in `CreateDatabasePayload`, `DatabaseRoles`, `GetDatabaseResponse`, `ListDatabase`, `PartialUpdateDatabasePayload` and `UpdateDatabasePayload` models
36+
- **Docs:** Extend description of `InstanceNetworkAccessScope` enum to note that the `SNA` value is only permitted for enabled accounts
3437
- [v1.6.0](services/postgresflex/CHANGELOG.md#v160)
3538
- **Breaking Change:** `class` attribute in `CloneInstanceOverrides` and `StorageCreate` model is now required (previously optional)
3639
- `rabbitmq`:

services/postgresflex/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.6.1
2+
- **Improvement:** Add validation for `name` field in `CreateDatabasePayload`, `DatabaseRoles`, `GetDatabaseResponse`, `ListDatabase`, `PartialUpdateDatabasePayload` and `UpdateDatabasePayload` models
3+
- **Docs:** Extend description of `InstanceNetworkAccessScope` enum to note that the `SNA` value is only permitted for enabled accounts
4+
15
## v1.6.0
26
- **Breaking Change:** `class` attribute in `CloneInstanceOverrides` and `StorageCreate` model is now required (previously optional)
37

services/postgresflex/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
da4701b7dbe20e984aef89711bb9ba716e19fcba
1+
1fdef398bea59d49731a7d9ac39394ba5b6bb72c

services/postgresflex/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "stackit-postgresflex"
3-
version = "v1.6.0"
3+
version = "v1.6.1"
44
description = "STACKIT PostgreSQL Flex API"
55
authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
66
requires-python = ">=3.10,<4.0"

services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,35 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
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 pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class CreateDatabasePayload(BaseModel):
2728
"""
2829
CreateDatabasePayload
2930
""" # noqa: E501
3031

31-
name: StrictStr = Field(description="The name of the database.")
32+
name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field(
33+
description='"The name of the database." "Database name must be 1–63 characters long, start with a lowercase letter or underscore, and contain only lowercase letters, numbers, or underscores." '
34+
)
3235
owner: Optional[StrictStr] = Field(default=None, description="The owner of the database.")
3336
__properties: ClassVar[List[str]] = ["name", "owner"]
3437

38+
@field_validator("name")
39+
def name_validate_regular_expression(cls, value):
40+
"""Validates the regular expression"""
41+
if not isinstance(value, str):
42+
value = str(value)
43+
44+
if not re.match(r"^[a-z_][a-z0-9_]*$", value):
45+
raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/")
46+
return value
47+
3548
model_config = ConfigDict(
3649
validate_by_name=True,
3750
validate_by_alias=True,

services/postgresflex/src/stackit/postgresflex/models/database_roles.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,35 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
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 pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class DatabaseRoles(BaseModel):
2728
"""
2829
The name and the roles for a database for a user.
2930
""" # noqa: E501
3031

31-
name: StrictStr = Field(description="The name of the database.")
32+
name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field(
33+
description='"The name of the database." "Database name must be 1–63 characters long, start with a lowercase letter or underscore, and contain only lowercase letters, numbers, or underscores." '
34+
)
3235
roles: List[StrictStr] = Field(description="The name and the roles for a database")
3336
__properties: ClassVar[List[str]] = ["name", "roles"]
3437

38+
@field_validator("name")
39+
def name_validate_regular_expression(cls, value):
40+
"""Validates the regular expression"""
41+
if not isinstance(value, str):
42+
value = str(value)
43+
44+
if not re.match(r"^[a-z_][a-z0-9_]*$", value):
45+
raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/")
46+
return value
47+
3548
model_config = ConfigDict(
3649
validate_by_name=True,
3750
validate_by_alias=True,

services/postgresflex/src/stackit/postgresflex/models/get_database_response.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

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

21-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class GetDatabaseResponse(BaseModel):
@@ -29,10 +30,22 @@ class GetDatabaseResponse(BaseModel):
2930
""" # noqa: E501
3031

3132
id: StrictInt = Field(description="The id of the database.")
32-
name: StrictStr = Field(description="The name of the database.")
33+
name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field(
34+
description='"The name of the database." "Database name must be 1–63 characters long, start with a lowercase letter or underscore, and contain only lowercase letters, numbers, or underscores." '
35+
)
3336
owner: StrictStr = Field(description="The owner of the database.")
3437
__properties: ClassVar[List[str]] = ["id", "name", "owner"]
3538

39+
@field_validator("name")
40+
def name_validate_regular_expression(cls, value):
41+
"""Validates the regular expression"""
42+
if not isinstance(value, str):
43+
value = str(value)
44+
45+
if not re.match(r"^[a-z_][a-z0-9_]*$", value):
46+
raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/")
47+
return value
48+
3649
model_config = ConfigDict(
3750
validate_by_name=True,
3851
validate_by_alias=True,

services/postgresflex/src/stackit/postgresflex/models/instance_network_access_scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class InstanceNetworkAccessScope(str, Enum):
2424
"""
25-
The access scope of the instance. It defines if the instance is public or airgapped.
25+
The access scope of the instance. It defines if the instance is public or airgapped. ⚠️ **Note:** \"SNA\" value for the \"network.accessScope\" field is only permitted for enabled accounts. If your account does not have access, the request will be rejected.
2626
"""
2727

2828
"""

services/postgresflex/src/stackit/postgresflex/models/list_database.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

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

21-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
2223
from pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class ListDatabase(BaseModel):
@@ -29,10 +30,22 @@ class ListDatabase(BaseModel):
2930
""" # noqa: E501
3031

3132
id: StrictInt = Field(description="The id of the database.")
32-
name: StrictStr = Field(description="The name of the database.")
33+
name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field(
34+
description='"The name of the database." "Database name must be 1–63 characters long, start with a lowercase letter or underscore, and contain only lowercase letters, numbers, or underscores." '
35+
)
3336
owner: StrictStr = Field(description="The owner of the database.")
3437
__properties: ClassVar[List[str]] = ["id", "name", "owner"]
3538

39+
@field_validator("name")
40+
def name_validate_regular_expression(cls, value):
41+
"""Validates the regular expression"""
42+
if not isinstance(value, str):
43+
value = str(value)
44+
45+
if not re.match(r"^[a-z_][a-z0-9_]*$", value):
46+
raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/")
47+
return value
48+
3649
model_config = ConfigDict(
3750
validate_by_name=True,
3851
validate_by_alias=True,

services/postgresflex/src/stackit/postgresflex/models/partial_update_database_payload.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,39 @@
1616

1717
import json
1818
import pprint
19+
import re # noqa: F401
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 pydantic_core import to_jsonable_python
23-
from typing_extensions import Self
24+
from typing_extensions import Annotated, Self
2425

2526

2627
class PartialUpdateDatabasePayload(BaseModel):
2728
"""
2829
PartialUpdateDatabasePayload
2930
""" # noqa: E501
3031

31-
name: Optional[StrictStr] = Field(default=None, description="The name of the database.")
32+
name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=63)]] = Field(
33+
default=None,
34+
description='"The name of the database." "Database name must be 1–63 characters long, start with a lowercase letter or underscore, and contain only lowercase letters, numbers, or underscores." ',
35+
)
3236
owner: Optional[StrictStr] = Field(default=None, description="The owner of the database.")
3337
__properties: ClassVar[List[str]] = ["name", "owner"]
3438

39+
@field_validator("name")
40+
def name_validate_regular_expression(cls, value):
41+
"""Validates the regular expression"""
42+
if value is None:
43+
return value
44+
45+
if not isinstance(value, str):
46+
value = str(value)
47+
48+
if not re.match(r"^[a-z_][a-z0-9_]*$", value):
49+
raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/")
50+
return value
51+
3552
model_config = ConfigDict(
3653
validate_by_name=True,
3754
validate_by_alias=True,

0 commit comments

Comments
 (0)