diff --git a/CHANGELOG.md b/CHANGELOG.md index fa60a18e4..49e761fc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## Release (2025-xx-xx) +- `postgresflex`: [v1.2.0](services/postgresflex/CHANGELOG.md#v120) + - **Breaking Change:** The attribute type for `PartialUpdateInstancePayload` and `UpdateInstancePayload` changed from `Storage` to `StorageUpdate`. + - **Deprecation:** `StorageUpdate`: updating the performance class field is not possible. - `auditlog`: [v0.1.1](services/auditlog/CHANGELOG.md#v011) - **Bugfix:** Prevent year 0 timestamp issue - `authorization`: [v0.4.1](services/authorization/CHANGELOG.md#v041) diff --git a/services/postgresflex/CHANGELOG.md b/services/postgresflex/CHANGELOG.md index d777db808..178e0db16 100644 --- a/services/postgresflex/CHANGELOG.md +++ b/services/postgresflex/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.2.0 +- **Breaking Change:** The attribute type for `PartialUpdateInstancePayload` and `UpdateInstancePayload` changed from `Storage` to `StorageUpdate`. +- **Deprecation:** `StorageUpdate`: updating the performance class field is not possible. + ## v1.1.0 - **Version**: Minimal version is now python 3.9 diff --git a/services/postgresflex/pyproject.toml b/services/postgresflex/pyproject.toml index 8a188c403..9dcd8fab5 100644 --- a/services/postgresflex/pyproject.toml +++ b/services/postgresflex/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-postgresflex" [tool.poetry] name = "stackit-postgresflex" -version = "v1.1.0" +version = "v1.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/postgresflex/src/stackit/postgresflex/__init__.py b/services/postgresflex/src/stackit/postgresflex/__init__.py index dc98383f2..8abff3da0 100644 --- a/services/postgresflex/src/stackit/postgresflex/__init__.py +++ b/services/postgresflex/src/stackit/postgresflex/__init__.py @@ -78,6 +78,7 @@ "ResetUserResponse", "Storage", "StorageRange", + "StorageUpdate", "UpdateBackupSchedulePayload", "UpdateInstancePayload", "UpdateUserPayload", @@ -231,6 +232,7 @@ ) from stackit.postgresflex.models.storage import Storage as Storage from stackit.postgresflex.models.storage_range import StorageRange as StorageRange +from stackit.postgresflex.models.storage_update import StorageUpdate as StorageUpdate from stackit.postgresflex.models.update_backup_schedule_payload import ( UpdateBackupSchedulePayload as UpdateBackupSchedulePayload, ) diff --git a/services/postgresflex/src/stackit/postgresflex/models/__init__.py b/services/postgresflex/src/stackit/postgresflex/models/__init__.py index f7a8fbaf5..b7612075b 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/__init__.py +++ b/services/postgresflex/src/stackit/postgresflex/models/__init__.py @@ -92,6 +92,7 @@ from stackit.postgresflex.models.reset_user_response import ResetUserResponse from stackit.postgresflex.models.storage import Storage from stackit.postgresflex.models.storage_range import StorageRange +from stackit.postgresflex.models.storage_update import StorageUpdate from stackit.postgresflex.models.update_backup_schedule_payload import ( UpdateBackupSchedulePayload, ) diff --git a/services/postgresflex/src/stackit/postgresflex/models/instance_data_point.py b/services/postgresflex/src/stackit/postgresflex/models/instance_data_point.py index 1ad978051..8ebb41645 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/instance_data_point.py +++ b/services/postgresflex/src/stackit/postgresflex/models/instance_data_point.py @@ -18,7 +18,13 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set, Union -from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + StrictFloat, + StrictInt, + StrictStr, +) from typing_extensions import Self 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 e8a6ef7ae..b90ddd023 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 @@ -22,7 +22,7 @@ from typing_extensions import Self from stackit.postgresflex.models.acl import ACL -from stackit.postgresflex.models.storage import Storage +from stackit.postgresflex.models.storage_update import StorageUpdate class PartialUpdateInstancePayload(BaseModel): @@ -37,7 +37,7 @@ class PartialUpdateInstancePayload(BaseModel): name: Optional[StrictStr] = None options: Optional[Dict[str, StrictStr]] = None replicas: Optional[StrictInt] = None - storage: Optional[Storage] = None + storage: Optional[StorageUpdate] = None version: Optional[StrictStr] = None __properties: ClassVar[List[str]] = [ "acl", @@ -114,7 +114,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "options": obj.get("options"), "replicas": obj.get("replicas"), - "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, + "storage": StorageUpdate.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "version": obj.get("version"), } ) diff --git a/services/postgresflex/src/stackit/postgresflex/models/postgres_database_parameter.py b/services/postgresflex/src/stackit/postgresflex/models/postgres_database_parameter.py index b5bd1a1c7..a4a14f17b 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/postgres_database_parameter.py +++ b/services/postgresflex/src/stackit/postgresflex/models/postgres_database_parameter.py @@ -18,7 +18,13 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, +) from typing_extensions import Self diff --git a/services/postgresflex/src/stackit/postgresflex/models/storage_update.py b/services/postgresflex/src/stackit/postgresflex/models/storage_update.py new file mode 100644 index 000000000..d7dc0de24 --- /dev/null +++ b/services/postgresflex/src/stackit/postgresflex/models/storage_update.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + STACKIT PostgreSQL Flex API + + This is the documentation for the STACKIT postgres service + + The version of the OpenAPI document: 2.0.0 + Contact: support@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing_extensions import Self + + +class StorageUpdate(BaseModel): + """ + StorageUpdate + """ # noqa: E501 + + var_class: Optional[StrictStr] = Field( + default=None, + description=" ⚠️ **DEPRECATED AND NON-FUNCTIONAL:** Updating the performance class field is not possible. ", + alias="class", + ) + size: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["class", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StorageUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StorageUpdate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"class": obj.get("class"), "size": obj.get("size")}) + return _obj 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 52c40f616..bd7e8a93a 100644 --- a/services/postgresflex/src/stackit/postgresflex/models/update_instance_payload.py +++ b/services/postgresflex/src/stackit/postgresflex/models/update_instance_payload.py @@ -22,7 +22,7 @@ from typing_extensions import Self from stackit.postgresflex.models.acl import ACL -from stackit.postgresflex.models.storage import Storage +from stackit.postgresflex.models.storage_update import StorageUpdate class UpdateInstancePayload(BaseModel): @@ -37,7 +37,7 @@ class UpdateInstancePayload(BaseModel): name: Optional[StrictStr] = None options: Optional[Dict[str, StrictStr]] = None replicas: Optional[StrictInt] = None - storage: Optional[Storage] = None + storage: Optional[StorageUpdate] = None version: Optional[StrictStr] = None __properties: ClassVar[List[str]] = [ "acl", @@ -114,7 +114,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "options": obj.get("options"), "replicas": obj.get("replicas"), - "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None, + "storage": StorageUpdate.from_dict(obj["storage"]) if obj.get("storage") is not None else None, "version": obj.get("version"), } )