From 3e0eae645a142b6beb7d23074d5230dd5bf86b02 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 11 May 2026 14:56:31 +0000 Subject: [PATCH] Generate auditlog --- services/auditlog/oas_commit | 2 +- .../src/stackit/auditlog/api_client.py | 32 +++++++++---------- .../audit_log_entry_context_response.py | 7 ++-- .../audit_log_entry_initiator_response.py | 7 ++-- .../audit_log_entry_request_response.py | 7 ++-- .../models/audit_log_entry_response.py | 7 ++-- ...ervice_account_delegation_info_response.py | 7 ++-- .../stackit/auditlog/models/error_response.py | 7 ++-- .../auditlog/models/gateway_error_response.py | 7 ++-- .../models/list_audit_log_entries_response.py | 7 ++-- ...ount_delegation_info_principal_response.py | 7 ++-- 11 files changed, 52 insertions(+), 45 deletions(-) diff --git a/services/auditlog/oas_commit b/services/auditlog/oas_commit index e3713dde3..72dcff29c 100644 --- a/services/auditlog/oas_commit +++ b/services/auditlog/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +0867dbbb09a8032415dc6debe18bc392bd58ba42 diff --git a/services/auditlog/src/stackit/auditlog/api_client.py b/services/auditlog/src/stackit/auditlog/api_client.py index b03ac46d2..db6d78f35 100644 --- a/services/auditlog/src/stackit/auditlog/api_client.py +++ b/services/auditlog/src/stackit/auditlog/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/auditlog/src/stackit/auditlog/models/audit_log_entry_context_response.py b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_context_response.py index 809fd9e22..193b78d0b 100644 --- a/services/auditlog/src/stackit/auditlog/models/audit_log_entry_context_response.py +++ b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_context_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 Annotated, Self @@ -38,7 +39,8 @@ class AuditLogEntryContextResponse(BaseModel): __properties: ClassVar[List[str]] = ["folderId", "organizationId", "projectId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,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/auditlog/src/stackit/auditlog/models/audit_log_entry_initiator_response.py b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_initiator_response.py index 87d04d31e..b025dae5d 100644 --- a/services/auditlog/src/stackit/auditlog/models/audit_log_entry_initiator_response.py +++ b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_initiator_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 Annotated, Self @@ -33,7 +34,8 @@ class AuditLogEntryInitiatorResponse(BaseModel): __properties: ClassVar[List[str]] = ["email", "id"] 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/auditlog/src/stackit/auditlog/models/audit_log_entry_request_response.py b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_request_response.py index 3b65270ef..5b8804b67 100644 --- a/services/auditlog/src/stackit/auditlog/models/audit_log_entry_request_response.py +++ b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_request_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 Annotated, Self @@ -38,7 +39,8 @@ class AuditLogEntryRequestResponse(BaseModel): __properties: ClassVar[List[str]] = ["body", "endpoint", "headers", "parameters"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,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/auditlog/src/stackit/auditlog/models/audit_log_entry_response.py b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_response.py index d9c42a9ba..18867c818 100644 --- a/services/auditlog/src/stackit/auditlog/models/audit_log_entry_response.py +++ b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_response.py @@ -20,6 +20,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 Annotated, Self from stackit.auditlog.models.audit_log_entry_context_response import ( @@ -167,7 +168,8 @@ def visibility_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=(), ) @@ -178,8 +180,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/auditlog/src/stackit/auditlog/models/audit_log_entry_service_account_delegation_info_response.py b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_service_account_delegation_info_response.py index b4e12323d..0a95f98a3 100644 --- a/services/auditlog/src/stackit/auditlog/models/audit_log_entry_service_account_delegation_info_response.py +++ b/services/auditlog/src/stackit/auditlog/models/audit_log_entry_service_account_delegation_info_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.auditlog.models.service_account_delegation_info_principal_response import ( @@ -36,7 +37,8 @@ class AuditLogEntryServiceAccountDelegationInfoResponse(BaseModel): __properties: ClassVar[List[str]] = ["principals"] 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/auditlog/src/stackit/auditlog/models/error_response.py b/services/auditlog/src/stackit/auditlog/models/error_response.py index bc90c9d28..793284c45 100644 --- a/services/auditlog/src/stackit/auditlog/models/error_response.py +++ b/services/auditlog/src/stackit/auditlog/models/error_response.py @@ -28,6 +28,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -56,7 +57,8 @@ def timestamp_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -67,8 +69,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/auditlog/src/stackit/auditlog/models/gateway_error_response.py b/services/auditlog/src/stackit/auditlog/models/gateway_error_response.py index 27fa6136c..510cade62 100644 --- a/services/auditlog/src/stackit/auditlog/models/gateway_error_response.py +++ b/services/auditlog/src/stackit/auditlog/models/gateway_error_response.py @@ -25,6 +25,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -38,7 +39,8 @@ class GatewayErrorResponse(BaseModel): __properties: ClassVar[List[str]] = ["message", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,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/auditlog/src/stackit/auditlog/models/list_audit_log_entries_response.py b/services/auditlog/src/stackit/auditlog/models/list_audit_log_entries_response.py index 02cc150d4..4ccbb88b1 100644 --- a/services/auditlog/src/stackit/auditlog/models/list_audit_log_entries_response.py +++ b/services/auditlog/src/stackit/auditlog/models/list_audit_log_entries_response.py @@ -25,6 +25,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.auditlog.models.audit_log_entry_response import AuditLogEntryResponse @@ -43,7 +44,8 @@ class ListAuditLogEntriesResponse(BaseModel): __properties: ClassVar[List[str]] = ["cursor", "items", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,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/auditlog/src/stackit/auditlog/models/service_account_delegation_info_principal_response.py b/services/auditlog/src/stackit/auditlog/models/service_account_delegation_info_principal_response.py index 06843040a..20f9f75dc 100644 --- a/services/auditlog/src/stackit/auditlog/models/service_account_delegation_info_principal_response.py +++ b/services/auditlog/src/stackit/auditlog/models/service_account_delegation_info_principal_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 Annotated, Self @@ -33,7 +34,8 @@ class ServiceAccountDelegationInfoPrincipalResponse(BaseModel): __properties: ClassVar[List[str]] = ["email", "id"] 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]: