From d52a0d3222fd202ae2f87328901b0bc505111291 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 11 May 2026 10:18:23 +0000 Subject: [PATCH] Generate opensearch --- services/opensearch/oas_commit | 2 +- .../src/stackit/opensearch/api/default_api.py | 10 +++--- .../src/stackit/opensearch/api_client.py | 32 +++++++++---------- .../src/stackit/opensearch/models/backup.py | 7 ++-- .../models/create_backup_response_item.py | 7 ++-- .../models/create_instance_payload.py | 7 ++-- .../models/create_instance_response.py | 7 ++-- .../stackit/opensearch/models/credentials.py | 7 ++-- .../models/credentials_list_item.py | 7 ++-- .../opensearch/models/credentials_response.py | 7 ++-- .../src/stackit/opensearch/models/error.py | 7 ++-- .../opensearch/models/get_metrics_response.py | 7 ++-- .../src/stackit/opensearch/models/instance.py | 7 ++-- .../models/instance_last_operation.py | 7 ++-- .../opensearch/models/instance_parameters.py | 7 ++-- .../opensearch/models/instance_schema.py | 7 ++-- .../models/list_backups_response.py | 7 ++-- .../models/list_credentials_response.py | 7 ++-- .../models/list_instances_response.py | 7 ++-- .../models/list_offerings_response.py | 7 ++-- .../models/list_restores_response.py | 7 ++-- .../stackit/opensearch/models/model_schema.py | 7 ++-- .../src/stackit/opensearch/models/offering.py | 7 ++-- .../models/partial_update_instance_payload.py | 7 ++-- .../src/stackit/opensearch/models/plan.py | 7 ++-- .../opensearch/models/raw_credentials.py | 7 ++-- .../src/stackit/opensearch/models/restore.py | 7 ++-- .../models/trigger_restore_response.py | 7 ++-- .../models/update_backups_config_payload.py | 7 ++-- .../models/update_backups_config_response.py | 7 ++-- 30 files changed, 129 insertions(+), 104 deletions(-) diff --git a/services/opensearch/oas_commit b/services/opensearch/oas_commit index e3713dde3..b129c2291 100644 --- a/services/opensearch/oas_commit +++ b/services/opensearch/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +98c11e0ee4834ddaaa474eccc437d234e6276a70 diff --git a/services/opensearch/src/stackit/opensearch/api/default_api.py b/services/opensearch/src/stackit/opensearch/api/default_api.py index 8dabfd95d..da1e13f2d 100644 --- a/services/opensearch/src/stackit/opensearch/api/default_api.py +++ b/services/opensearch/src/stackit/opensearch/api/default_api.py @@ -1334,7 +1334,7 @@ def download_backup( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> bytearray: + ) -> bytes: """download backup @@ -1377,7 +1377,7 @@ def download_backup( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "bytearray", + "200": "bytes", "500": "Error", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -1402,7 +1402,7 @@ def download_backup_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[bytearray]: + ) -> ApiResponse[bytes]: """download backup @@ -1445,7 +1445,7 @@ def download_backup_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "bytearray", + "200": "bytes", "500": "Error", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -1513,7 +1513,7 @@ def download_backup_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "bytearray", + "200": "bytes", "500": "Error", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) diff --git a/services/opensearch/src/stackit/opensearch/api_client.py b/services/opensearch/src/stackit/opensearch/api_client.py index 4ee59f1ac..b1d71a32b 100644 --- a/services/opensearch/src/stackit/opensearch/api_client.py +++ b/services/opensearch/src/stackit/opensearch/api_client.py @@ -66,6 +66,7 @@ class ApiClient: "date": datetime.date, "datetime": datetime.datetime, "decimal": decimal.Decimal, + "UUID": uuid.UUID, "object": object, } _pool = None @@ -265,7 +266,7 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) @@ -326,25 +327,20 @@ def sanitize_for_serialization(self, obj): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return str(obj) - elif isinstance(obj, dict): - obj_dict = obj + return {key: self.sanitize_for_serialization(val) for key, val in obj.items()} + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009 - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ - - if isinstance(obj_dict, list): - # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501 - return self.sanitize_for_serialization(obj_dict) + obj_dict = obj.__dict__ - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + return self.sanitize_for_serialization(obj_dict) def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. @@ -417,6 +413,8 @@ def __deserialize(self, data, klass): return self.__deserialize_datetime(data) elif klass is decimal.Decimal: return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: diff --git a/services/opensearch/src/stackit/opensearch/models/backup.py b/services/opensearch/src/stackit/opensearch/models/backup.py index 0b5f4a7f1..77e65dcae 100644 --- a/services/opensearch/src/stackit/opensearch/models/backup.py +++ b/services/opensearch/src/stackit/opensearch/models/backup.py @@ -24,6 +24,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -41,7 +42,8 @@ class Backup(BaseModel): __properties: ClassVar[List[str]] = ["downloadable", "finished_at", "id", "size", "status", "triggered_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/create_backup_response_item.py b/services/opensearch/src/stackit/opensearch/models/create_backup_response_item.py index 1f60ae488..512512935 100644 --- a/services/opensearch/src/stackit/opensearch/models/create_backup_response_item.py +++ b/services/opensearch/src/stackit/opensearch/models/create_backup_response_item.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class CreateBackupResponseItem(BaseModel): __properties: ClassVar[List[str]] = ["id", "message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/create_instance_payload.py b/services/opensearch/src/stackit/opensearch/models/create_instance_payload.py index 6c235dcbc..06a59c746 100644 --- a/services/opensearch/src/stackit/opensearch/models/create_instance_payload.py +++ b/services/opensearch/src/stackit/opensearch/models/create_instance_payload.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.instance_parameters import InstanceParameters @@ -34,7 +35,8 @@ class CreateInstancePayload(BaseModel): __properties: ClassVar[List[str]] = ["instanceName", "parameters", "planId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/create_instance_response.py b/services/opensearch/src/stackit/opensearch/models/create_instance_response.py index 75abed57d..d68583221 100644 --- a/services/opensearch/src/stackit/opensearch/models/create_instance_response.py +++ b/services/opensearch/src/stackit/opensearch/models/create_instance_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -30,7 +31,8 @@ class CreateInstanceResponse(BaseModel): __properties: ClassVar[List[str]] = ["instanceId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -41,8 +43,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/credentials.py b/services/opensearch/src/stackit/opensearch/models/credentials.py index 6222f090e..2b7709161 100644 --- a/services/opensearch/src/stackit/opensearch/models/credentials.py +++ b/services/opensearch/src/stackit/opensearch/models/credentials.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -36,7 +37,8 @@ class Credentials(BaseModel): __properties: ClassVar[List[str]] = ["host", "hosts", "password", "port", "scheme", "uri", "username"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/credentials_list_item.py b/services/opensearch/src/stackit/opensearch/models/credentials_list_item.py index debc34f61..8c0e37b2e 100644 --- a/services/opensearch/src/stackit/opensearch/models/credentials_list_item.py +++ b/services/opensearch/src/stackit/opensearch/models/credentials_list_item.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -30,7 +31,8 @@ class CredentialsListItem(BaseModel): __properties: ClassVar[List[str]] = ["id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -41,8 +43,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/credentials_response.py b/services/opensearch/src/stackit/opensearch/models/credentials_response.py index 330334916..4869deaa1 100644 --- a/services/opensearch/src/stackit/opensearch/models/credentials_response.py +++ b/services/opensearch/src/stackit/opensearch/models/credentials_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.raw_credentials import RawCredentials @@ -34,7 +35,8 @@ class CredentialsResponse(BaseModel): __properties: ClassVar[List[str]] = ["id", "raw", "uri"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/error.py b/services/opensearch/src/stackit/opensearch/models/error.py index d8c463de3..5efd6f359 100644 --- a/services/opensearch/src/stackit/opensearch/models/error.py +++ b/services/opensearch/src/stackit/opensearch/models/error.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class Error(BaseModel): __properties: ClassVar[List[str]] = ["description", "error"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/get_metrics_response.py b/services/opensearch/src/stackit/opensearch/models/get_metrics_response.py index d11495f30..51391aaaa 100644 --- a/services/opensearch/src/stackit/opensearch/models/get_metrics_response.py +++ b/services/opensearch/src/stackit/opensearch/models/get_metrics_response.py @@ -25,6 +25,7 @@ StrictFloat, StrictInt, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -83,7 +84,8 @@ class GetMetricsResponse(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -94,8 +96,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/instance.py b/services/opensearch/src/stackit/opensearch/models/instance.py index 1a349a5d7..2fa1dc496 100644 --- a/services/opensearch/src/stackit/opensearch/models/instance.py +++ b/services/opensearch/src/stackit/opensearch/models/instance.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.instance_last_operation import InstanceLastOperation @@ -72,7 +73,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -83,8 +85,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/instance_last_operation.py b/services/opensearch/src/stackit/opensearch/models/instance_last_operation.py index d0b6a0d95..e291376a3 100644 --- a/services/opensearch/src/stackit/opensearch/models/instance_last_operation.py +++ b/services/opensearch/src/stackit/opensearch/models/instance_last_operation.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -46,7 +47,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/instance_parameters.py b/services/opensearch/src/stackit/opensearch/models/instance_parameters.py index 5a145f509..0c50f7906 100644 --- a/services/opensearch/src/stackit/opensearch/models/instance_parameters.py +++ b/services/opensearch/src/stackit/opensearch/models/instance_parameters.py @@ -26,6 +26,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -126,7 +127,8 @@ def tls_protocols_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -137,8 +139,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/instance_schema.py b/services/opensearch/src/stackit/opensearch/models/instance_schema.py index 9f59459ff..78b95801f 100644 --- a/services/opensearch/src/stackit/opensearch/models/instance_schema.py +++ b/services/opensearch/src/stackit/opensearch/models/instance_schema.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.model_schema import ModelSchema @@ -33,7 +34,8 @@ class InstanceSchema(BaseModel): __properties: ClassVar[List[str]] = ["create", "update"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/list_backups_response.py b/services/opensearch/src/stackit/opensearch/models/list_backups_response.py index 0b7d8e1a6..c3ccd226b 100644 --- a/services/opensearch/src/stackit/opensearch/models/list_backups_response.py +++ b/services/opensearch/src/stackit/opensearch/models/list_backups_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.backup import Backup @@ -32,7 +33,8 @@ class ListBackupsResponse(BaseModel): __properties: ClassVar[List[str]] = ["instanceBackups"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/list_credentials_response.py b/services/opensearch/src/stackit/opensearch/models/list_credentials_response.py index a7c2b5fc7..d1a84d9e7 100644 --- a/services/opensearch/src/stackit/opensearch/models/list_credentials_response.py +++ b/services/opensearch/src/stackit/opensearch/models/list_credentials_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.credentials_list_item import CredentialsListItem @@ -32,7 +33,8 @@ class ListCredentialsResponse(BaseModel): __properties: ClassVar[List[str]] = ["credentialsList"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/list_instances_response.py b/services/opensearch/src/stackit/opensearch/models/list_instances_response.py index fd3a42815..a96df12e7 100644 --- a/services/opensearch/src/stackit/opensearch/models/list_instances_response.py +++ b/services/opensearch/src/stackit/opensearch/models/list_instances_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.instance import Instance @@ -32,7 +33,8 @@ class ListInstancesResponse(BaseModel): __properties: ClassVar[List[str]] = ["instances"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/list_offerings_response.py b/services/opensearch/src/stackit/opensearch/models/list_offerings_response.py index f7bf401c4..ff3b9ec75 100644 --- a/services/opensearch/src/stackit/opensearch/models/list_offerings_response.py +++ b/services/opensearch/src/stackit/opensearch/models/list_offerings_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.offering import Offering @@ -32,7 +33,8 @@ class ListOfferingsResponse(BaseModel): __properties: ClassVar[List[str]] = ["offerings"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/list_restores_response.py b/services/opensearch/src/stackit/opensearch/models/list_restores_response.py index 48fb22ca6..0aa5435c8 100644 --- a/services/opensearch/src/stackit/opensearch/models/list_restores_response.py +++ b/services/opensearch/src/stackit/opensearch/models/list_restores_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.restore import Restore @@ -32,7 +33,8 @@ class ListRestoresResponse(BaseModel): __properties: ClassVar[List[str]] = ["instanceRestores"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/model_schema.py b/services/opensearch/src/stackit/opensearch/models/model_schema.py index 787ba9503..45963a740 100644 --- a/services/opensearch/src/stackit/opensearch/models/model_schema.py +++ b/services/opensearch/src/stackit/opensearch/models/model_schema.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -30,7 +31,8 @@ class ModelSchema(BaseModel): __properties: ClassVar[List[str]] = ["parameters"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -41,8 +43,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/offering.py b/services/opensearch/src/stackit/opensearch/models/offering.py index 5165bf9bc..ae538ea7f 100644 --- a/services/opensearch/src/stackit/opensearch/models/offering.py +++ b/services/opensearch/src/stackit/opensearch/models/offering.py @@ -25,6 +25,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.instance_schema import InstanceSchema @@ -60,7 +61,8 @@ class Offering(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -71,8 +73,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/partial_update_instance_payload.py b/services/opensearch/src/stackit/opensearch/models/partial_update_instance_payload.py index 25c2a7048..0d88e2d49 100644 --- a/services/opensearch/src/stackit/opensearch/models/partial_update_instance_payload.py +++ b/services/opensearch/src/stackit/opensearch/models/partial_update_instance_payload.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.instance_parameters import InstanceParameters @@ -34,7 +35,8 @@ class PartialUpdateInstancePayload(BaseModel): __properties: ClassVar[List[str]] = ["instanceName", "parameters", "planId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/plan.py b/services/opensearch/src/stackit/opensearch/models/plan.py index 080987cdd..f2d1be1fd 100644 --- a/services/opensearch/src/stackit/opensearch/models/plan.py +++ b/services/opensearch/src/stackit/opensearch/models/plan.py @@ -24,6 +24,7 @@ StrictBool, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -40,7 +41,8 @@ class Plan(BaseModel): __properties: ClassVar[List[str]] = ["description", "free", "id", "name", "skuName"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/raw_credentials.py b/services/opensearch/src/stackit/opensearch/models/raw_credentials.py index ed82169ce..ebf720076 100644 --- a/services/opensearch/src/stackit/opensearch/models/raw_credentials.py +++ b/services/opensearch/src/stackit/opensearch/models/raw_credentials.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.opensearch.models.credentials import Credentials @@ -32,7 +33,8 @@ class RawCredentials(BaseModel): __properties: ClassVar[List[str]] = ["credentials"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/restore.py b/services/opensearch/src/stackit/opensearch/models/restore.py index 37537ac43..d95f7e8f7 100644 --- a/services/opensearch/src/stackit/opensearch/models/restore.py +++ b/services/opensearch/src/stackit/opensearch/models/restore.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -34,7 +35,8 @@ class Restore(BaseModel): __properties: ClassVar[List[str]] = ["backup_id", "finished_at", "id", "status", "triggered_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/trigger_restore_response.py b/services/opensearch/src/stackit/opensearch/models/trigger_restore_response.py index 93cb5fd2b..8ba3dc239 100644 --- a/services/opensearch/src/stackit/opensearch/models/trigger_restore_response.py +++ b/services/opensearch/src/stackit/opensearch/models/trigger_restore_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -30,7 +31,8 @@ class TriggerRestoreResponse(BaseModel): __properties: ClassVar[List[str]] = ["id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -41,8 +43,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/update_backups_config_payload.py b/services/opensearch/src/stackit/opensearch/models/update_backups_config_payload.py index 7d5782d92..8466a30f4 100644 --- a/services/opensearch/src/stackit/opensearch/models/update_backups_config_payload.py +++ b/services/opensearch/src/stackit/opensearch/models/update_backups_config_payload.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -30,7 +31,8 @@ class UpdateBackupsConfigPayload(BaseModel): __properties: ClassVar[List[str]] = ["encryption_key"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -41,8 +43,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/opensearch/src/stackit/opensearch/models/update_backups_config_response.py b/services/opensearch/src/stackit/opensearch/models/update_backups_config_response.py index 57b3f7efa..0f59a893d 100644 --- a/services/opensearch/src/stackit/opensearch/models/update_backups_config_response.py +++ b/services/opensearch/src/stackit/opensearch/models/update_backups_config_response.py @@ -18,6 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -30,7 +31,8 @@ class UpdateBackupsConfigResponse(BaseModel): __properties: ClassVar[List[str]] = ["message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -41,8 +43,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: