diff --git a/services/postgresflex/oas_commit b/services/postgresflex/oas_commit index e05d493f3..77bad3ba6 100644 --- a/services/postgresflex/oas_commit +++ b/services/postgresflex/oas_commit @@ -1 +1 @@ -da4701b7dbe20e984aef89711bb9ba716e19fcba +7ef816d0b66577a45f96dc95258adf805ca5b005 diff --git a/services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py b/services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py index 4229b1b9b..7ab4b83d3 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py @@ -16,11 +16,12 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic_core import to_jsonable_python -from typing_extensions import Self +from typing_extensions import Annotated, Self class CreateDatabasePayload(BaseModel): @@ -28,10 +29,22 @@ class CreateDatabasePayload(BaseModel): CreateDatabasePayload """ # noqa: E501 - name: StrictStr = Field(description="The name of the database.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field( + 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." ' + ) owner: Optional[StrictStr] = Field(default=None, description="The owner of the database.") __properties: ClassVar[List[str]] = ["name", "owner"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z_][a-z0-9_]*$", value): + raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/postgresflex/src/stackit/postgresflex/models/database_roles.py b/services/postgresflex/src/stackit/postgresflex/models/database_roles.py index a3398b631..549900d90 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/database_roles.py +++ b/services/postgresflex/src/stackit/postgresflex/models/database_roles.py @@ -16,11 +16,12 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic_core import to_jsonable_python -from typing_extensions import Self +from typing_extensions import Annotated, Self class DatabaseRoles(BaseModel): @@ -28,10 +29,22 @@ class DatabaseRoles(BaseModel): The name and the roles for a database for a user. """ # noqa: E501 - name: StrictStr = Field(description="The name of the database.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field( + 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." ' + ) roles: List[StrictStr] = Field(description="The name and the roles for a database") __properties: ClassVar[List[str]] = ["name", "roles"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z_][a-z0-9_]*$", value): + raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/postgresflex/src/stackit/postgresflex/models/get_database_response.py b/services/postgresflex/src/stackit/postgresflex/models/get_database_response.py index 7e04ec741..9a3dbac2f 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/get_database_response.py +++ b/services/postgresflex/src/stackit/postgresflex/models/get_database_response.py @@ -16,11 +16,12 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from pydantic_core import to_jsonable_python -from typing_extensions import Self +from typing_extensions import Annotated, Self class GetDatabaseResponse(BaseModel): @@ -29,10 +30,22 @@ class GetDatabaseResponse(BaseModel): """ # noqa: E501 id: StrictInt = Field(description="The id of the database.") - name: StrictStr = Field(description="The name of the database.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field( + 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." ' + ) owner: StrictStr = Field(description="The owner of the database.") __properties: ClassVar[List[str]] = ["id", "name", "owner"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z_][a-z0-9_]*$", value): + raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/postgresflex/src/stackit/postgresflex/models/instance_network_access_scope.py b/services/postgresflex/src/stackit/postgresflex/models/instance_network_access_scope.py index 5e28a9cd1..f8a956a89 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/instance_network_access_scope.py +++ b/services/postgresflex/src/stackit/postgresflex/models/instance_network_access_scope.py @@ -22,7 +22,7 @@ class InstanceNetworkAccessScope(str, Enum): """ - The access scope of the instance. It defines if the instance is public or airgapped. + 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. """ """ diff --git a/services/postgresflex/src/stackit/postgresflex/models/list_database.py b/services/postgresflex/src/stackit/postgresflex/models/list_database.py index d6224ae3d..e52794197 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/list_database.py +++ b/services/postgresflex/src/stackit/postgresflex/models/list_database.py @@ -16,11 +16,12 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from pydantic_core import to_jsonable_python -from typing_extensions import Self +from typing_extensions import Annotated, Self class ListDatabase(BaseModel): @@ -29,10 +30,22 @@ class ListDatabase(BaseModel): """ # noqa: E501 id: StrictInt = Field(description="The id of the database.") - name: StrictStr = Field(description="The name of the database.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field( + 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." ' + ) owner: StrictStr = Field(description="The owner of the database.") __properties: ClassVar[List[str]] = ["id", "name", "owner"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z_][a-z0-9_]*$", value): + raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/postgresflex/src/stackit/postgresflex/models/partial_update_database_payload.py b/services/postgresflex/src/stackit/postgresflex/models/partial_update_database_payload.py index 84077dd5d..b04d0aa64 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/partial_update_database_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/partial_update_database_payload.py @@ -16,11 +16,12 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic_core import to_jsonable_python -from typing_extensions import Self +from typing_extensions import Annotated, Self class PartialUpdateDatabasePayload(BaseModel): @@ -28,10 +29,26 @@ class PartialUpdateDatabasePayload(BaseModel): PartialUpdateDatabasePayload """ # noqa: E501 - name: Optional[StrictStr] = Field(default=None, description="The name of the database.") + name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=63)]] = Field( + default=None, + 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." ', + ) owner: Optional[StrictStr] = Field(default=None, description="The owner of the database.") __properties: ClassVar[List[str]] = ["name", "owner"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z_][a-z0-9_]*$", value): + raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/postgresflex/src/stackit/postgresflex/models/update_database_payload.py b/services/postgresflex/src/stackit/postgresflex/models/update_database_payload.py index f0dd46873..cb662b742 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/update_database_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/update_database_payload.py @@ -16,11 +16,12 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic_core import to_jsonable_python -from typing_extensions import Self +from typing_extensions import Annotated, Self class UpdateDatabasePayload(BaseModel): @@ -28,10 +29,22 @@ class UpdateDatabasePayload(BaseModel): UpdateDatabasePayload """ # noqa: E501 - name: StrictStr = Field(description="The name of the database.") + name: Annotated[str, Field(min_length=1, strict=True, max_length=63)] = Field( + 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." ' + ) owner: StrictStr = Field(description="The owner of the database.") __properties: ClassVar[List[str]] = ["name", "owner"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z_][a-z0-9_]*$", value): + raise ValueError(r"must validate the regular expression /^[a-z_][a-z0-9_]*$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True,