diff --git a/services/postgresflex/oas_commit b/services/postgresflex/oas_commit index 3df2932d2..687bd56c1 100644 --- a/services/postgresflex/oas_commit +++ b/services/postgresflex/oas_commit @@ -1 +1 @@ -1fdef398bea59d49731a7d9ac39394ba5b6bb72c +7c9ee6e47bfd11f1578a4636f428b3deaaca318e diff --git a/services/postgresflex/src/stackit/postgresflex/api/default_api.py b/services/postgresflex/src/stackit/postgresflex/api/default_api.py index 5f1067ed0..d3b369538 100644 --- a/services/postgresflex/src/stackit/postgresflex/api/default_api.py +++ b/services/postgresflex/src/stackit/postgresflex/api/default_api.py @@ -1095,6 +1095,7 @@ def create_user( "403": "Error", "404": "Error", "409": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -1178,6 +1179,7 @@ def create_user_with_http_info( "403": "Error", "404": "Error", "409": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -1261,6 +1263,7 @@ def create_user_without_preload_content( "403": "Error", "404": "Error", "409": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -1404,6 +1407,7 @@ def delete_database( "401": "Error", "403": "Error", "404": "Error", + "409": "Error", "423": "Error", "500": "Error", "503": "Error", @@ -1483,6 +1487,7 @@ def delete_database_with_http_info( "401": "Error", "403": "Error", "404": "Error", + "409": "Error", "423": "Error", "500": "Error", "503": "Error", @@ -1562,6 +1567,7 @@ def delete_database_without_preload_content( "401": "Error", "403": "Error", "404": "Error", + "409": "Error", "423": "Error", "500": "Error", "503": "Error", @@ -1924,7 +1930,7 @@ def delete_user( ) -> None: """Delete User - Delete an user from a specific instance. + Delete a user from a specific instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -2004,7 +2010,7 @@ def delete_user_with_http_info( ) -> ApiResponse[None]: """Delete User - Delete an user from a specific instance. + Delete a user from a specific instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -2084,7 +2090,7 @@ def delete_user_without_preload_content( ) -> RESTResponseType: """Delete User - Delete an user from a specific instance. + Delete a user from a specific instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -3367,7 +3373,7 @@ def list_backups( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ListBackupsResponse: - """List backups + """List Backups List all backups which are available for a specific instance. @@ -3458,7 +3464,7 @@ def list_backups_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[ListBackupsResponse]: - """List backups + """List Backups List all backups which are available for a specific instance. @@ -3549,7 +3555,7 @@ def list_backups_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List backups + """List Backups List all backups which are available for a specific instance. @@ -6482,7 +6488,7 @@ def partial_update_user( ) -> None: """Update User Partially - Update an user partially for an instance. + Update a user partially for an instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -6534,6 +6540,7 @@ def partial_update_user( "401": "Error", "403": "Error", "404": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -6571,7 +6578,7 @@ def partial_update_user_with_http_info( ) -> ApiResponse[None]: """Update User Partially - Update an user partially for an instance. + Update a user partially for an instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -6623,6 +6630,7 @@ def partial_update_user_with_http_info( "401": "Error", "403": "Error", "404": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -6660,7 +6668,7 @@ def partial_update_user_without_preload_content( ) -> RESTResponseType: """Update User Partially - Update an user partially for an instance. + Update a user partially for an instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -6712,6 +6720,7 @@ def partial_update_user_without_preload_content( "401": "Error", "403": "Error", "404": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -6809,7 +6818,7 @@ def reset_user_password( ) -> ResetUserPasswordResponse: """Reset User - Reset an user from an specific instance. + Reset a user from a specific instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -6889,7 +6898,7 @@ def reset_user_password_with_http_info( ) -> ApiResponse[ResetUserPasswordResponse]: """Reset User - Reset an user from an specific instance. + Reset a user from a specific instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -6969,7 +6978,7 @@ def reset_user_password_without_preload_content( ) -> RESTResponseType: """Reset User - Reset an user from an specific instance. + Reset a user from a specific instance. :param project_id: The STACKIT project ID. (required) :type project_id: str @@ -7732,7 +7741,7 @@ def update_instance_protection( instance_id: Annotated[StrictStr, Field(description="The ID of the instance.")], update_instance_protection_payload: Annotated[ UpdateInstanceProtectionPayload, - Field(description="The request body with flag isDeletable. Parameter is required."), + Field(description="The request body containing the isDeletable flag. This parameter is required."), ], _request_timeout: Union[ None, @@ -7754,7 +7763,7 @@ def update_instance_protection( :type region: str :param instance_id: The ID of the instance. (required) :type instance_id: str - :param update_instance_protection_payload: The request body with flag isDeletable. Parameter is required. (required) + :param update_instance_protection_payload: The request body containing the isDeletable flag. This parameter is required. (required) :type update_instance_protection_payload: UpdateInstanceProtectionPayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -7815,7 +7824,7 @@ def update_instance_protection_with_http_info( instance_id: Annotated[StrictStr, Field(description="The ID of the instance.")], update_instance_protection_payload: Annotated[ UpdateInstanceProtectionPayload, - Field(description="The request body with flag isDeletable. Parameter is required."), + Field(description="The request body containing the isDeletable flag. This parameter is required."), ], _request_timeout: Union[ None, @@ -7837,7 +7846,7 @@ def update_instance_protection_with_http_info( :type region: str :param instance_id: The ID of the instance. (required) :type instance_id: str - :param update_instance_protection_payload: The request body with flag isDeletable. Parameter is required. (required) + :param update_instance_protection_payload: The request body containing the isDeletable flag. This parameter is required. (required) :type update_instance_protection_payload: UpdateInstanceProtectionPayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -7898,7 +7907,7 @@ def update_instance_protection_without_preload_content( instance_id: Annotated[StrictStr, Field(description="The ID of the instance.")], update_instance_protection_payload: Annotated[ UpdateInstanceProtectionPayload, - Field(description="The request body with flag isDeletable. Parameter is required."), + Field(description="The request body containing the isDeletable flag. This parameter is required."), ], _request_timeout: Union[ None, @@ -7920,7 +7929,7 @@ def update_instance_protection_without_preload_content( :type region: str :param instance_id: The ID of the instance. (required) :type instance_id: str - :param update_instance_protection_payload: The request body with flag isDeletable. Parameter is required. (required) + :param update_instance_protection_payload: The request body containing the isDeletable flag. This parameter is required. (required) :type update_instance_protection_payload: UpdateInstanceProtectionPayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -8110,6 +8119,7 @@ def update_user( "401": "Error", "403": "Error", "404": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -8196,6 +8206,7 @@ def update_user_with_http_info( "401": "Error", "403": "Error", "404": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", @@ -8282,6 +8293,7 @@ def update_user_without_preload_content( "401": "Error", "403": "Error", "404": "Error", + "412": "Error", "422": "ValidationError", "423": "Error", "500": "Error", diff --git a/services/postgresflex/src/stackit/postgresflex/models/backup_data.py b/services/postgresflex/src/stackit/postgresflex/models/backup_data.py index c23fb7440..cc8fe61fa 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/backup_data.py +++ b/services/postgresflex/src/stackit/postgresflex/models/backup_data.py @@ -35,7 +35,7 @@ class BackupData(BaseModel): name: StrictStr = Field(description="The name of the backup.") retained_until: StrictStr = Field(description="The time until the backup will be retained.", alias="retainedUntil") size: StrictInt = Field(description="The size of the backup in bytes.") - type: StrictStr = Field(description="The type of the backup, which can be automated or manual triggered.") + type: StrictStr = Field(description="The type of the backup, which can be automated or manually triggered.") __properties: ClassVar[List[str]] = ["completionTime", "id", "name", "retainedUntil", "size", "type"] model_config = ConfigDict( 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 7ab4b83d3..d9a36d811 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/create_database_payload.py @@ -30,7 +30,7 @@ class CreateDatabasePayload(BaseModel): """ # noqa: E501 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." ' + 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, underscores, or hyphens. It cannot end with a hyphen." ' ) owner: Optional[StrictStr] = Field(default=None, description="The owner of the database.") __properties: ClassVar[List[str]] = ["name", "owner"] @@ -41,8 +41,8 @@ def name_validate_regular_expression(cls, 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_]*$/") + if not re.match(r"^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$", value): + raise ValueError(r"must validate the regular expression /^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$/") return value model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/create_instance_payload.py b/services/postgresflex/src/stackit/postgresflex/models/create_instance_payload.py index 026a66a58..1fec17892 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/create_instance_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/create_instance_payload.py @@ -46,7 +46,7 @@ class CreateInstancePayload(BaseModel): description="The name of the instance." ) network: InstanceNetworkCreate - retention_days: Optional[Annotated[int, Field(le=365, strict=True, ge=32)]] = Field( + retention_days: Optional[Annotated[int, Field(le=90, strict=True, ge=32)]] = Field( description="How long backups are retained. The value can only be between 32 and 90 days.", alias="retentionDays", ) diff --git a/services/postgresflex/src/stackit/postgresflex/models/database_roles.py b/services/postgresflex/src/stackit/postgresflex/models/database_roles.py index 549900d90..b66ab531a 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/database_roles.py +++ b/services/postgresflex/src/stackit/postgresflex/models/database_roles.py @@ -30,7 +30,7 @@ class DatabaseRoles(BaseModel): """ # noqa: E501 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." ' + 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, underscores, or hyphens. It cannot end with a hyphen." ' ) roles: List[StrictStr] = Field(description="The name and the roles for a database") __properties: ClassVar[List[str]] = ["name", "roles"] @@ -41,8 +41,8 @@ def name_validate_regular_expression(cls, 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_]*$/") + if not re.match(r"^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$", value): + raise ValueError(r"must validate the regular expression /^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$/") return value model_config = ConfigDict( 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 9a3dbac2f..e31fbe676 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/get_database_response.py +++ b/services/postgresflex/src/stackit/postgresflex/models/get_database_response.py @@ -31,7 +31,7 @@ class GetDatabaseResponse(BaseModel): id: StrictInt = Field(description="The id 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." ' + 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, underscores, or hyphens. It cannot end with a hyphen." ' ) owner: StrictStr = Field(description="The owner of the database.") __properties: ClassVar[List[str]] = ["id", "name", "owner"] @@ -42,8 +42,8 @@ def name_validate_regular_expression(cls, 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_]*$/") + if not re.match(r"^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$", value): + raise ValueError(r"must validate the regular expression /^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$/") return value model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/get_instance_response.py b/services/postgresflex/src/stackit/postgresflex/models/get_instance_response.py index 8429cb819..106c4b4c8 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/get_instance_response.py +++ b/services/postgresflex/src/stackit/postgresflex/models/get_instance_response.py @@ -58,7 +58,7 @@ class GetInstanceResponse(BaseModel): description="The name of the instance." ) network: InstanceNetwork - retention_days: Optional[Annotated[int, Field(le=365, strict=True, ge=32)]] = Field( + retention_days: Optional[Annotated[int, Field(le=90, strict=True, ge=32)]] = Field( description="How long backups are retained. The value can only be between 32 and 90 days.", alias="retentionDays", ) diff --git a/services/postgresflex/src/stackit/postgresflex/models/instance_network.py b/services/postgresflex/src/stackit/postgresflex/models/instance_network.py index 72e3c4b9f..850b1f359 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/instance_network.py +++ b/services/postgresflex/src/stackit/postgresflex/models/instance_network.py @@ -35,7 +35,7 @@ class InstanceNetwork(BaseModel): access_scope: Optional[InstanceNetworkAccessScope] = Field( default=InstanceNetworkAccessScope.PUBLIC, alias="accessScope" ) - acl: List[StrictStr] = Field(description="List of IPV4 cidr.") + acl: List[StrictStr] = Field(description="List of IPv4 CIDR addresses.") instance_address: Optional[StrictStr] = Field(default=None, alias="instanceAddress") router_address: Optional[StrictStr] = Field(default=None, alias="routerAddress") __properties: ClassVar[List[str]] = ["accessScope", "acl", "instanceAddress", "routerAddress"] diff --git a/services/postgresflex/src/stackit/postgresflex/models/instance_network_create.py b/services/postgresflex/src/stackit/postgresflex/models/instance_network_create.py index 4d9ee53c8..2587248c9 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/instance_network_create.py +++ b/services/postgresflex/src/stackit/postgresflex/models/instance_network_create.py @@ -35,7 +35,7 @@ class InstanceNetworkCreate(BaseModel): access_scope: Optional[InstanceNetworkAccessScope] = Field( default=InstanceNetworkAccessScope.PUBLIC, alias="accessScope" ) - acl: List[StrictStr] = Field(description="List of IPV4 cidr.") + acl: List[StrictStr] = Field(description="List of IPv4 CIDR addresses.") __properties: ClassVar[List[str]] = ["accessScope", "acl"] model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/instance_network_opt.py b/services/postgresflex/src/stackit/postgresflex/models/instance_network_opt.py index ad5324b75..0ef2ce917 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/instance_network_opt.py +++ b/services/postgresflex/src/stackit/postgresflex/models/instance_network_opt.py @@ -28,7 +28,7 @@ class InstanceNetworkOpt(BaseModel): The access configuration of the instance """ # noqa: E501 - acl: Optional[List[StrictStr]] = Field(default=None, description="List of IPV4 cidr.") + acl: Optional[List[StrictStr]] = Field(default=None, description="List of IPv4 CIDR addresses.") __properties: ClassVar[List[str]] = ["acl"] model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/instance_network_update.py b/services/postgresflex/src/stackit/postgresflex/models/instance_network_update.py index ec57a4d3e..2e920c170 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/instance_network_update.py +++ b/services/postgresflex/src/stackit/postgresflex/models/instance_network_update.py @@ -28,7 +28,7 @@ class InstanceNetworkUpdate(BaseModel): The access configuration of the instance """ # noqa: E501 - acl: List[StrictStr] = Field(description="List of IPV4 cidr.") + acl: List[StrictStr] = Field(description="List of IPv4 CIDR addresses.") __properties: ClassVar[List[str]] = ["acl"] model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/list_database.py b/services/postgresflex/src/stackit/postgresflex/models/list_database.py index e52794197..fed0b6bca 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/list_database.py +++ b/services/postgresflex/src/stackit/postgresflex/models/list_database.py @@ -31,7 +31,7 @@ class ListDatabase(BaseModel): id: StrictInt = Field(description="The id 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." ' + 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, underscores, or hyphens. It cannot end with a hyphen." ' ) owner: StrictStr = Field(description="The owner of the database.") __properties: ClassVar[List[str]] = ["id", "name", "owner"] @@ -42,8 +42,8 @@ def name_validate_regular_expression(cls, 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_]*$/") + if not re.match(r"^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$", value): + raise ValueError(r"must validate the regular expression /^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$/") return value model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/list_flavors.py b/services/postgresflex/src/stackit/postgresflex/models/list_flavors.py index 82c9a2725..900d213b4 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/list_flavors.py +++ b/services/postgresflex/src/stackit/postgresflex/models/list_flavors.py @@ -36,15 +36,17 @@ class ListFlavors(BaseModel): description: StrictStr = Field(description="The flavor description.") id: StrictStr = Field(description="The id of the instance flavor.") max_gb: StrictInt = Field( - description="maximum storage which can be ordered for the flavor in Gigabyte.", alias="maxGB" + description="The maximum storage size in gigabytes that can be ordered for this flavor.", alias="maxGB" ) memory: StrictInt = Field(description="The memory of the instance in Gibibyte.") - min_gb: StrictInt = Field(description="minimum storage which is required to order in Gigabyte.", alias="minGB") + min_gb: StrictInt = Field( + description="The minimum storage size in gigabytes required for this flavor.", alias="minGB" + ) node_type: StrictStr = Field( description="defines the nodeType it can be either single or replica", alias="nodeType" ) storage_classes: List[FlavorStorageClassesStorageClass] = Field( - description="maximum storage which can be ordered for the flavor in Gigabyte.", alias="storageClasses" + description="The storage classes available for the flavor.", alias="storageClasses" ) __properties: ClassVar[List[str]] = [ "cpu", diff --git a/services/postgresflex/src/stackit/postgresflex/models/list_instance.py b/services/postgresflex/src/stackit/postgresflex/models/list_instance.py index cfec8ed9f..a402befbf 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/list_instance.py +++ b/services/postgresflex/src/stackit/postgresflex/models/list_instance.py @@ -16,14 +16,24 @@ import json import pprint +import re # noqa: F401 +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field, StrictBool +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self from stackit.postgresflex.models.state import State +from stackit.postgresflex.models.storage import Storage class ListInstance(BaseModel): @@ -31,13 +41,42 @@ class ListInstance(BaseModel): ListInstance """ # noqa: E501 + created: Optional[datetime] = Field(default=None, description="The timestamp at which this instance was created.") + flavor_id: Optional[StrictStr] = Field(default=None, description="The id of the instance flavor.", alias="flavorId") id: UUID = Field(description="The ID of the instance.") is_deletable: StrictBool = Field(description="Whether the instance can be deleted or not.", alias="isDeletable") name: Annotated[str, Field(min_length=3, strict=True, max_length=63)] = Field( description="The name of the instance." ) state: State - __properties: ClassVar[List[str]] = ["id", "isDeletable", "name", "state"] + storage: Optional[Storage] = None + version: Optional[StrictStr] = Field( + default=None, + description="The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3#tag/Version) for supported version parameters.", + ) + __properties: ClassVar[List[str]] = [ + "created", + "flavorId", + "id", + "isDeletable", + "name", + "state", + "storage", + "version", + ] + + @field_validator("created", mode="before") + def created_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value model_config = ConfigDict( validate_by_name=True, @@ -76,6 +115,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of storage + if self.storage: + _dict["storage"] = self.storage.to_dict() return _dict @classmethod @@ -89,10 +131,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { + "created": obj.get("created"), + "flavorId": obj.get("flavorId"), "id": obj.get("id"), "isDeletable": obj.get("isDeletable"), "name": obj.get("name"), "state": obj.get("state"), + "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, + "version": obj.get("version"), } ) return _obj 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 b04d0aa64..f3c082661 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 @@ -31,7 +31,7 @@ class PartialUpdateDatabasePayload(BaseModel): 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." ', + 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, underscores, or hyphens. It cannot end with a hyphen." ', ) owner: Optional[StrictStr] = Field(default=None, description="The owner of the database.") __properties: ClassVar[List[str]] = ["name", "owner"] @@ -45,8 +45,8 @@ def name_validate_regular_expression(cls, 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_]*$/") + if not re.match(r"^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$", value): + raise ValueError(r"must validate the regular expression /^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$/") return value model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/partial_update_instance_payload.py b/services/postgresflex/src/stackit/postgresflex/models/partial_update_instance_payload.py index de62b2404..d07850550 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/partial_update_instance_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/partial_update_instance_payload.py @@ -45,7 +45,7 @@ class PartialUpdateInstancePayload(BaseModel): default=None, description="The name of the instance." ) network: Optional[InstanceNetworkOpt] = None - retention_days: Optional[Annotated[int, Field(le=365, strict=True, ge=32)]] = Field( + retention_days: Optional[Annotated[int, Field(le=90, strict=True, ge=32)]] = Field( default=None, description="How long backups are retained. The value can only be between 32 and 90 days.", alias="retentionDays", 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 cb662b742..99cd5f579 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/update_database_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/update_database_payload.py @@ -30,7 +30,7 @@ class UpdateDatabasePayload(BaseModel): """ # noqa: E501 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." ' + 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, underscores, or hyphens. It cannot end with a hyphen." ' ) owner: StrictStr = Field(description="The owner of the database.") __properties: ClassVar[List[str]] = ["name", "owner"] @@ -41,8 +41,8 @@ def name_validate_regular_expression(cls, 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_]*$/") + if not re.match(r"^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$", value): + raise ValueError(r"must validate the regular expression /^[a-z_]([a-z0-9_\-]{0,61}[a-z0-9_])?$/") return value model_config = ConfigDict( diff --git a/services/postgresflex/src/stackit/postgresflex/models/update_instance_payload.py b/services/postgresflex/src/stackit/postgresflex/models/update_instance_payload.py index 6c15931ac..af1e086c0 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/update_instance_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/update_instance_payload.py @@ -44,7 +44,7 @@ class UpdateInstancePayload(BaseModel): description="The name of the instance." ) network: InstanceNetworkUpdate - retention_days: Optional[Annotated[int, Field(le=365, strict=True, ge=32)]] = Field( + retention_days: Optional[Annotated[int, Field(le=90, strict=True, ge=32)]] = Field( description="How long backups are retained. The value can only be between 32 and 90 days.", alias="retentionDays", ) diff --git a/services/postgresflex/src/stackit/postgresflex/models/version.py b/services/postgresflex/src/stackit/postgresflex/models/version.py index 349c61d93..b6c444da5 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/version.py +++ b/services/postgresflex/src/stackit/postgresflex/models/version.py @@ -35,12 +35,12 @@ class Version(BaseModel): """ # noqa: E501 beta: StrictBool = Field( - description="Flag if the version is a beta version. If set the version may contain bugs and is not fully tested." + description="Flag indicating whether the version is a beta version. Beta versions may contain bugs and are not fully tested." ) deprecated: StrictStr = Field( - description="Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT." + description="Timestamp in RFC3339 format indicating when the version will no longer be supported by STACKIT." ) - recommend: StrictBool = Field(description="Flag if the version is recommend by the STACKIT Team.") + recommend: StrictBool = Field(description="Flag indicating whether the version is recommended by the STACKIT Team.") version: StrictStr = Field(description="The postgres version used for the instance.") __properties: ClassVar[List[str]] = ["beta", "deprecated", "recommend", "version"]