diff --git a/services/objectstorage/src/stackit/objectstorage/__init__.py b/services/objectstorage/src/stackit/objectstorage/__init__.py index 08a41a77..461f5a4c 100644 --- a/services/objectstorage/src/stackit/objectstorage/__init__.py +++ b/services/objectstorage/src/stackit/objectstorage/__init__.py @@ -11,63 +11,111 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 __version__ = "1.0.0" +# Define package exports +__all__ = [ + "DefaultApi", + "ApiResponse", + "ApiClient", + "HostConfiguration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "AccessKey", + "Bucket", + "CreateAccessKeyPayload", + "CreateAccessKeyResponse", + "CreateBucketResponse", + "CreateCredentialsGroupPayload", + "CreateCredentialsGroupResponse", + "CredentialsGroup", + "DeleteAccessKeyResponse", + "DeleteBucketResponse", + "DeleteCredentialsGroupResponse", + "DetailedError", + "ErrorMessage", + "GetBucketResponse", + "HTTPValidationError", + "ListAccessKeysResponse", + "ListBucketsResponse", + "ListCredentialsGroupsResponse", + "LocationInner", + "ProjectScope", + "ProjectStatus", + "ValidationError", +] + # import apis into sdk package -from stackit.objectstorage.api.default_api import DefaultApi -from stackit.objectstorage.api_client import ApiClient +from stackit.objectstorage.api.default_api import DefaultApi as DefaultApi +from stackit.objectstorage.api_client import ApiClient as ApiClient # import ApiClient -from stackit.objectstorage.api_response import ApiResponse -from stackit.objectstorage.configuration import HostConfiguration -from stackit.objectstorage.exceptions import ( - ApiAttributeError, - ApiException, - ApiKeyError, - ApiTypeError, - ApiValueError, - OpenApiException, -) +from stackit.objectstorage.api_response import ApiResponse as ApiResponse +from stackit.objectstorage.configuration import HostConfiguration as HostConfiguration +from stackit.objectstorage.exceptions import ApiAttributeError as ApiAttributeError +from stackit.objectstorage.exceptions import ApiException as ApiException +from stackit.objectstorage.exceptions import ApiKeyError as ApiKeyError +from stackit.objectstorage.exceptions import ApiTypeError as ApiTypeError +from stackit.objectstorage.exceptions import ApiValueError as ApiValueError +from stackit.objectstorage.exceptions import OpenApiException as OpenApiException # import models into sdk package -from stackit.objectstorage.models.access_key import AccessKey -from stackit.objectstorage.models.bucket import Bucket +from stackit.objectstorage.models.access_key import AccessKey as AccessKey +from stackit.objectstorage.models.bucket import Bucket as Bucket from stackit.objectstorage.models.create_access_key_payload import ( - CreateAccessKeyPayload, + CreateAccessKeyPayload as CreateAccessKeyPayload, ) from stackit.objectstorage.models.create_access_key_response import ( - CreateAccessKeyResponse, + CreateAccessKeyResponse as CreateAccessKeyResponse, +) +from stackit.objectstorage.models.create_bucket_response import ( + CreateBucketResponse as CreateBucketResponse, ) -from stackit.objectstorage.models.create_bucket_response import CreateBucketResponse from stackit.objectstorage.models.create_credentials_group_payload import ( - CreateCredentialsGroupPayload, + CreateCredentialsGroupPayload as CreateCredentialsGroupPayload, ) from stackit.objectstorage.models.create_credentials_group_response import ( - CreateCredentialsGroupResponse, + CreateCredentialsGroupResponse as CreateCredentialsGroupResponse, +) +from stackit.objectstorage.models.credentials_group import ( + CredentialsGroup as CredentialsGroup, ) -from stackit.objectstorage.models.credentials_group import CredentialsGroup from stackit.objectstorage.models.delete_access_key_response import ( - DeleteAccessKeyResponse, + DeleteAccessKeyResponse as DeleteAccessKeyResponse, +) +from stackit.objectstorage.models.delete_bucket_response import ( + DeleteBucketResponse as DeleteBucketResponse, ) -from stackit.objectstorage.models.delete_bucket_response import DeleteBucketResponse from stackit.objectstorage.models.delete_credentials_group_response import ( - DeleteCredentialsGroupResponse, + DeleteCredentialsGroupResponse as DeleteCredentialsGroupResponse, +) +from stackit.objectstorage.models.detailed_error import DetailedError as DetailedError +from stackit.objectstorage.models.error_message import ErrorMessage as ErrorMessage +from stackit.objectstorage.models.get_bucket_response import ( + GetBucketResponse as GetBucketResponse, +) +from stackit.objectstorage.models.http_validation_error import ( + HTTPValidationError as HTTPValidationError, ) -from stackit.objectstorage.models.detailed_error import DetailedError -from stackit.objectstorage.models.error_message import ErrorMessage -from stackit.objectstorage.models.get_bucket_response import GetBucketResponse -from stackit.objectstorage.models.http_validation_error import HTTPValidationError from stackit.objectstorage.models.list_access_keys_response import ( - ListAccessKeysResponse, + ListAccessKeysResponse as ListAccessKeysResponse, +) +from stackit.objectstorage.models.list_buckets_response import ( + ListBucketsResponse as ListBucketsResponse, ) -from stackit.objectstorage.models.list_buckets_response import ListBucketsResponse from stackit.objectstorage.models.list_credentials_groups_response import ( - ListCredentialsGroupsResponse, + ListCredentialsGroupsResponse as ListCredentialsGroupsResponse, +) +from stackit.objectstorage.models.location_inner import LocationInner as LocationInner +from stackit.objectstorage.models.project_scope import ProjectScope as ProjectScope +from stackit.objectstorage.models.project_status import ProjectStatus as ProjectStatus +from stackit.objectstorage.models.validation_error import ( + ValidationError as ValidationError, ) -from stackit.objectstorage.models.location_inner import LocationInner -from stackit.objectstorage.models.project_scope import ProjectScope -from stackit.objectstorage.models.project_status import ProjectStatus -from stackit.objectstorage.models.validation_error import ValidationError diff --git a/services/objectstorage/src/stackit/objectstorage/api/default_api.py b/services/objectstorage/src/stackit/objectstorage/api/default_api.py index 7fa7f0ff..5fa229b3 100644 --- a/services/objectstorage/src/stackit/objectstorage/api/default_api.py +++ b/services/objectstorage/src/stackit/objectstorage/api/default_api.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from typing import Any, Dict, List, Optional, Tuple, Union @@ -113,7 +113,7 @@ def create_access_key( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_access_key_serialize( project_id=project_id, @@ -190,7 +190,7 @@ def create_access_key_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_access_key_serialize( project_id=project_id, @@ -267,7 +267,7 @@ def create_access_key_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_access_key_serialize( project_id=project_id, @@ -311,7 +311,7 @@ def _create_access_key_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -408,7 +408,7 @@ def create_bucket( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_bucket_serialize( project_id=project_id, @@ -483,7 +483,7 @@ def create_bucket_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_bucket_serialize( project_id=project_id, @@ -558,7 +558,7 @@ def create_bucket_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_bucket_serialize( project_id=project_id, @@ -600,7 +600,7 @@ def _create_bucket_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -682,7 +682,7 @@ def create_credentials_group( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_credentials_group_serialize( project_id=project_id, @@ -755,7 +755,7 @@ def create_credentials_group_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_credentials_group_serialize( project_id=project_id, @@ -828,7 +828,7 @@ def create_credentials_group_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_credentials_group_serialize( project_id=project_id, @@ -871,7 +871,7 @@ def _create_credentials_group_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -965,7 +965,7 @@ def delete_access_key( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_access_key_serialize( project_id=project_id, @@ -1043,7 +1043,7 @@ def delete_access_key_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_access_key_serialize( project_id=project_id, @@ -1121,7 +1121,7 @@ def delete_access_key_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_access_key_serialize( project_id=project_id, @@ -1166,7 +1166,7 @@ def _delete_access_key_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1255,7 +1255,7 @@ def delete_bucket( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_bucket_serialize( project_id=project_id, @@ -1329,7 +1329,7 @@ def delete_bucket_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_bucket_serialize( project_id=project_id, @@ -1403,7 +1403,7 @@ def delete_bucket_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_bucket_serialize( project_id=project_id, @@ -1444,7 +1444,7 @@ def _delete_bucket_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1527,7 +1527,7 @@ def delete_credentials_group( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_credentials_group_serialize( project_id=project_id, @@ -1599,7 +1599,7 @@ def delete_credentials_group_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_credentials_group_serialize( project_id=project_id, @@ -1671,7 +1671,7 @@ def delete_credentials_group_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_credentials_group_serialize( project_id=project_id, @@ -1712,7 +1712,7 @@ def _delete_credentials_group_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1792,7 +1792,7 @@ def disable_service( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._disable_service_serialize( project_id=project_id, @@ -1862,7 +1862,7 @@ def disable_service_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._disable_service_serialize( project_id=project_id, @@ -1932,7 +1932,7 @@ def disable_service_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._disable_service_serialize( project_id=project_id, @@ -1973,7 +1973,7 @@ def _disable_service_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2051,7 +2051,7 @@ def enable_service( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._enable_service_serialize( project_id=project_id, @@ -2121,7 +2121,7 @@ def enable_service_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._enable_service_serialize( project_id=project_id, @@ -2191,7 +2191,7 @@ def enable_service_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._enable_service_serialize( project_id=project_id, @@ -2232,7 +2232,7 @@ def _enable_service_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2315,7 +2315,7 @@ def get_bucket( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_bucket_serialize( project_id=project_id, @@ -2390,7 +2390,7 @@ def get_bucket_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_bucket_serialize( project_id=project_id, @@ -2465,7 +2465,7 @@ def get_bucket_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_bucket_serialize( project_id=project_id, @@ -2507,7 +2507,7 @@ def _get_bucket_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2587,7 +2587,7 @@ def get_service_status( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_service_status_serialize( project_id=project_id, @@ -2656,7 +2656,7 @@ def get_service_status_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_service_status_serialize( project_id=project_id, @@ -2725,7 +2725,7 @@ def get_service_status_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_service_status_serialize( project_id=project_id, @@ -2765,7 +2765,7 @@ def _get_service_status_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2846,7 +2846,7 @@ def list_access_keys( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_access_keys_serialize( project_id=project_id, @@ -2919,7 +2919,7 @@ def list_access_keys_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_access_keys_serialize( project_id=project_id, @@ -2992,7 +2992,7 @@ def list_access_keys_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_access_keys_serialize( project_id=project_id, @@ -3034,7 +3034,7 @@ def _list_access_keys_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -3116,7 +3116,7 @@ def list_buckets( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_buckets_serialize( project_id=project_id, @@ -3185,7 +3185,7 @@ def list_buckets_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_buckets_serialize( project_id=project_id, @@ -3254,7 +3254,7 @@ def list_buckets_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_buckets_serialize( project_id=project_id, @@ -3294,7 +3294,7 @@ def _list_buckets_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -3372,7 +3372,7 @@ def list_credentials_groups( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_credentials_groups_serialize( project_id=project_id, @@ -3440,7 +3440,7 @@ def list_credentials_groups_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_credentials_groups_serialize( project_id=project_id, @@ -3508,7 +3508,7 @@ def list_credentials_groups_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_credentials_groups_serialize( project_id=project_id, @@ -3547,7 +3547,7 @@ def _list_credentials_groups_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/services/objectstorage/src/stackit/objectstorage/api_client.py b/services/objectstorage/src/stackit/objectstorage/api_client.py index cc681180..0cd22dc3 100644 --- a/services/objectstorage/src/stackit/objectstorage/api_client.py +++ b/services/objectstorage/src/stackit/objectstorage/api_client.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 import datetime import json @@ -331,6 +331,10 @@ def sanitize_for_serialization(self, obj): 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() + return self.sanitize_for_serialization(obj_dict) + return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): @@ -350,12 +354,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif content_type.startswith("application/json"): + elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): if response_text == "": data = "" else: data = json.loads(response_text) - elif content_type.startswith("text/plain"): + elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE): data = response_text else: raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type)) @@ -457,7 +461,7 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == "multi": - new_params.extend((k, str(value)) for value in v) + new_params.extend((k, quote(str(value))) for value in v) else: if collection_format == "ssv": delimiter = " " @@ -473,7 +477,10 @@ def parameters_to_url_query(self, params, collection_formats): return "&".join(["=".join(map(str, item)) for item in new_params]) - def files_parameters(self, files: Dict[str, Union[str, bytes]]): + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. :param files: File parameters. @@ -488,6 +495,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]): elif isinstance(v, bytes): filename = k filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue else: raise ValueError("Unsupported file value") mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" diff --git a/services/objectstorage/src/stackit/objectstorage/configuration.py b/services/objectstorage/src/stackit/objectstorage/configuration.py index 9ea21c6c..2b47b61e 100644 --- a/services/objectstorage/src/stackit/objectstorage/configuration.py +++ b/services/objectstorage/src/stackit/objectstorage/configuration.py @@ -1,10 +1,5 @@ # coding: utf-8 -import sys - -import os - - """ STACKIT Object Storage API @@ -14,7 +9,29 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 + +import sys +from typing import Dict, List, Optional, TypedDict + +from typing_extensions import NotRequired + +import os + + +ServerVariablesT = Dict[str, str] + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] class HostConfiguration: @@ -53,7 +70,7 @@ def __init__( """Ignore operation servers """ - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -71,7 +88,12 @@ def get_host_settings(self): } ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT] = None, + servers: Optional[List[HostSetting]] = None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -111,7 +133,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): and variables.get(variable_name) is not None ): raise ValueError( - "this API does not support setting a region in the the client configuration, " + "this API does not support setting a region in the client configuration, " "please check if the region can be specified as a function parameter" ) used_value = variables.get(variable_name, variable["default_value"]) @@ -130,12 +152,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/services/objectstorage/src/stackit/objectstorage/exceptions.py b/services/objectstorage/src/stackit/objectstorage/exceptions.py index 2c356c90..349a982a 100644 --- a/services/objectstorage/src/stackit/objectstorage/exceptions.py +++ b/services/objectstorage/src/stackit/objectstorage/exceptions.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from typing import Any, Optional @@ -127,7 +127,7 @@ def __init__( if self.body is None: try: self.body = http_resp.data.decode("utf-8") - except Exception: # noqa: S110 + except Exception: pass self.headers = http_resp.getheaders() @@ -151,6 +151,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -187,6 +194,18 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/services/objectstorage/src/stackit/objectstorage/models/__init__.py b/services/objectstorage/src/stackit/objectstorage/models/__init__.py index 3892bdb7..1aa77634 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/__init__.py +++ b/services/objectstorage/src/stackit/objectstorage/models/__init__.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 # import models into model package diff --git a/services/objectstorage/src/stackit/objectstorage/models/access_key.py b/services/objectstorage/src/stackit/objectstorage/models/access_key.py index 1a722311..495316bd 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/access_key.py +++ b/services/objectstorage/src/stackit/objectstorage/models/access_key.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class AccessKey(BaseModel): """ AccessKey - """ + """ # noqa: E501 display_name: StrictStr = Field(alias="displayName") expires: StrictStr diff --git a/services/objectstorage/src/stackit/objectstorage/models/bucket.py b/services/objectstorage/src/stackit/objectstorage/models/bucket.py index ccf7893c..93fa50f2 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/bucket.py +++ b/services/objectstorage/src/stackit/objectstorage/models/bucket.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class Bucket(BaseModel): """ Bucket - """ + """ # noqa: E501 name: StrictStr region: StrictStr diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py index cde98c97..2bbddfa1 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_payload.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -25,7 +25,7 @@ class CreateAccessKeyPayload(BaseModel): """ CreateAccessKeyPayload - """ + """ # noqa: E501 expires: Optional[datetime] = Field(default=None, description="Expiration date. Null means never expires.") __properties: ClassVar[List[str]] = ["expires"] diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py index 2954bbdb..97c9cb58 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_access_key_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class CreateAccessKeyResponse(BaseModel): """ CreateAccessKeyResponse - """ + """ # noqa: E501 access_key: StrictStr = Field(description="Access key", alias="accessKey") display_name: StrictStr = Field(description="Obfuscated access key", alias="displayName") diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py b/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py index 4eaefb2c..e2ffc02f 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_bucket_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class CreateBucketResponse(BaseModel): """ CreateBucketResponse - """ + """ # noqa: E501 bucket: StrictStr = Field(description="Name of the bucket") project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py index 9f3ce54c..0d106d56 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_payload.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class CreateCredentialsGroupPayload(BaseModel): """ CreateCredentialsGroupPayload - """ + """ # noqa: E501 display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field( description="Name of the group holding credentials", alias="displayName" diff --git a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py index 74104401..28357d6a 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/create_credentials_group_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class CreateCredentialsGroupResponse(BaseModel): """ CreateCredentialsGroupResponse - """ + """ # noqa: E501 credentials_group: CredentialsGroup = Field(alias="credentialsGroup") project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py b/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py index d5ed3388..31e0c698 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py +++ b/services/objectstorage/src/stackit/objectstorage/models/credentials_group.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class CredentialsGroup(BaseModel): """ CredentialsGroup - """ + """ # noqa: E501 credentials_group_id: StrictStr = Field(description="The ID of the credentials group", alias="credentialsGroupId") display_name: StrictStr = Field(description="Name of the group holding credentials", alias="displayName") diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py index 565a79b7..d99f2ee6 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_access_key_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class DeleteAccessKeyResponse(BaseModel): """ DeleteAccessKeyResponse - """ + """ # noqa: E501 key_id: StrictStr = Field( description="Identifies the pair of access key and secret access key for deletion", alias="keyId" diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py index eb13e28d..f0021c50 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_bucket_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class DeleteBucketResponse(BaseModel): """ DeleteBucketResponse - """ + """ # noqa: E501 bucket: StrictStr = Field(description="Name of the bucket") project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py b/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py index b42f67ad..9fe24e22 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/delete_credentials_group_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class DeleteCredentialsGroupResponse(BaseModel): """ DeleteCredentialsGroupResponse - """ + """ # noqa: E501 credentials_group_id: StrictStr = Field(description="The ID of the credentials group", alias="credentialsGroupId") project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py b/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py index 10f5db0b..41d71903 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py +++ b/services/objectstorage/src/stackit/objectstorage/models/detailed_error.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -24,7 +24,7 @@ class DetailedError(BaseModel): """ DetailedError - """ + """ # noqa: E501 key: StrictStr msg: StrictStr diff --git a/services/objectstorage/src/stackit/objectstorage/models/error_message.py b/services/objectstorage/src/stackit/objectstorage/models/error_message.py index f81c4244..5249c9fe 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/error_message.py +++ b/services/objectstorage/src/stackit/objectstorage/models/error_message.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class ErrorMessage(BaseModel): """ ErrorMessage - """ + """ # noqa: E501 detail: List[DetailedError] __properties: ClassVar[List[str]] = ["detail"] diff --git a/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py b/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py index c4193f36..7a8a47df 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/get_bucket_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class GetBucketResponse(BaseModel): """ GetBucketResponse - """ + """ # noqa: E501 bucket: Bucket project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py b/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py index 04e04e66..08cee2d8 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py +++ b/services/objectstorage/src/stackit/objectstorage/models/http_validation_error.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class HTTPValidationError(BaseModel): """ HTTPValidationError - """ + """ # noqa: E501 detail: Optional[List[ValidationError]] = None __properties: ClassVar[List[str]] = ["detail"] diff --git a/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py b/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py index 459b8e2f..53b76ff7 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/list_access_keys_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class ListAccessKeysResponse(BaseModel): """ ListAccessKeysResponse - """ + """ # noqa: E501 access_keys: List[AccessKey] = Field(alias="accessKeys") project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py b/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py index a43a7fbc..04edbeb3 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/list_buckets_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class ListBucketsResponse(BaseModel): """ ListBucketsResponse - """ + """ # noqa: E501 buckets: List[Bucket] project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py b/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py index 005d9c13..d9dbdef0 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py +++ b/services/objectstorage/src/stackit/objectstorage/models/list_credentials_groups_response.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class ListCredentialsGroupsResponse(BaseModel): """ ListCredentialsGroupsResponse - """ + """ # noqa: E501 credentials_groups: List[CredentialsGroup] = Field(alias="credentialsGroups") project: StrictStr = Field(description="Project ID") diff --git a/services/objectstorage/src/stackit/objectstorage/models/location_inner.py b/services/objectstorage/src/stackit/objectstorage/models/location_inner.py index 9479fd9f..de9ffcd2 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/location_inner.py +++ b/services/objectstorage/src/stackit/objectstorage/models/location_inner.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations diff --git a/services/objectstorage/src/stackit/objectstorage/models/project_scope.py b/services/objectstorage/src/stackit/objectstorage/models/project_scope.py index 3dc27380..bd4d7e97 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/project_scope.py +++ b/services/objectstorage/src/stackit/objectstorage/models/project_scope.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations diff --git a/services/objectstorage/src/stackit/objectstorage/models/project_status.py b/services/objectstorage/src/stackit/objectstorage/models/project_status.py index bac9df89..9570ba9f 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/project_status.py +++ b/services/objectstorage/src/stackit/objectstorage/models/project_status.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class ProjectStatus(BaseModel): """ ProjectStatus - """ + """ # noqa: E501 project: StrictStr = Field(description="Project ID") scope: ProjectScope = Field(description="Project Scope") diff --git a/services/objectstorage/src/stackit/objectstorage/models/validation_error.py b/services/objectstorage/src/stackit/objectstorage/models/validation_error.py index f38c2d59..57539695 100644 --- a/services/objectstorage/src/stackit/objectstorage/models/validation_error.py +++ b/services/objectstorage/src/stackit/objectstorage/models/validation_error.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,7 +26,7 @@ class ValidationError(BaseModel): """ ValidationError - """ + """ # noqa: E501 loc: List[LocationInner] msg: StrictStr diff --git a/services/objectstorage/src/stackit/objectstorage/rest.py b/services/objectstorage/src/stackit/objectstorage/rest.py index 79c73f45..17775e9d 100644 --- a/services/objectstorage/src/stackit/objectstorage/rest.py +++ b/services/objectstorage/src/stackit/objectstorage/rest.py @@ -9,7 +9,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 import io import json @@ -124,7 +124,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque data=body, headers=headers, ) - elif headers["Content-Type"] == "text/plain" and isinstance(body, bool): + elif headers["Content-Type"].startswith("text/") and isinstance(body, bool): request_body = "true" if body else "false" r = self.session.request(method, url, data=request_body, headers=headers) else: