Skip to content

Generator: Update SDK /services/runcommand #1388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 63 additions & 25 deletions services/runcommand/src/stackit/runcommand/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,75 @@
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",
"CommandDetails",
"CommandTemplate",
"CommandTemplateResponse",
"CommandTemplateSchema",
"Commands",
"CreateCommandPayload",
"ErrorResponse",
"GetCommandsResponse",
"ModelField",
"NewCommandResponse",
"ParametersSchema",
"Properties",
]

# import apis into sdk package
from stackit.runcommand.api.default_api import DefaultApi
from stackit.runcommand.api_client import ApiClient
from stackit.runcommand.api.default_api import DefaultApi as DefaultApi
from stackit.runcommand.api_client import ApiClient as ApiClient

# import ApiClient
from stackit.runcommand.api_response import ApiResponse
from stackit.runcommand.configuration import HostConfiguration
from stackit.runcommand.exceptions import (
ApiAttributeError,
ApiException,
ApiKeyError,
ApiTypeError,
ApiValueError,
OpenApiException,
)
from stackit.runcommand.api_response import ApiResponse as ApiResponse
from stackit.runcommand.configuration import HostConfiguration as HostConfiguration
from stackit.runcommand.exceptions import ApiAttributeError as ApiAttributeError
from stackit.runcommand.exceptions import ApiException as ApiException
from stackit.runcommand.exceptions import ApiKeyError as ApiKeyError
from stackit.runcommand.exceptions import ApiTypeError as ApiTypeError
from stackit.runcommand.exceptions import ApiValueError as ApiValueError
from stackit.runcommand.exceptions import OpenApiException as OpenApiException

# import models into sdk package
from stackit.runcommand.models.command_details import CommandDetails
from stackit.runcommand.models.command_template import CommandTemplate
from stackit.runcommand.models.command_template_response import CommandTemplateResponse
from stackit.runcommand.models.command_template_schema import CommandTemplateSchema
from stackit.runcommand.models.commands import Commands
from stackit.runcommand.models.create_command_payload import CreateCommandPayload
from stackit.runcommand.models.error_response import ErrorResponse
from stackit.runcommand.models.get_commands_response import GetCommandsResponse
from stackit.runcommand.models.model_field import ModelField
from stackit.runcommand.models.new_command_response import NewCommandResponse
from stackit.runcommand.models.parameters_schema import ParametersSchema
from stackit.runcommand.models.properties import Properties
from stackit.runcommand.models.command_details import CommandDetails as CommandDetails
from stackit.runcommand.models.command_template import (
CommandTemplate as CommandTemplate,
)
from stackit.runcommand.models.command_template_response import (
CommandTemplateResponse as CommandTemplateResponse,
)
from stackit.runcommand.models.command_template_schema import (
CommandTemplateSchema as CommandTemplateSchema,
)
from stackit.runcommand.models.commands import Commands as Commands
from stackit.runcommand.models.create_command_payload import (
CreateCommandPayload as CreateCommandPayload,
)
from stackit.runcommand.models.error_response import ErrorResponse as ErrorResponse
from stackit.runcommand.models.get_commands_response import (
GetCommandsResponse as GetCommandsResponse,
)
from stackit.runcommand.models.model_field import ModelField as ModelField
from stackit.runcommand.models.new_command_response import (
NewCommandResponse as NewCommandResponse,
)
from stackit.runcommand.models.parameters_schema import (
ParametersSchema as ParametersSchema,
)
from stackit.runcommand.models.properties import Properties as Properties
42 changes: 21 additions & 21 deletions services/runcommand/src/stackit/runcommand/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

from typing import Any, Dict, List, Optional, Tuple, Union

Expand Down Expand Up @@ -91,7 +91,7 @@ def create_command(
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_command_serialize(
project_id=project_id,
Expand Down Expand Up @@ -166,7 +166,7 @@ def create_command_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_command_serialize(
project_id=project_id,
Expand Down Expand Up @@ -241,7 +241,7 @@ def create_command_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_command_serialize(
project_id=project_id,
Expand Down Expand Up @@ -283,7 +283,7 @@ def _create_command_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
Expand Down Expand Up @@ -379,7 +379,7 @@ def get_command(
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_command_serialize(
project_id=project_id,
Expand Down Expand Up @@ -454,7 +454,7 @@ def get_command_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_command_serialize(
project_id=project_id,
Expand Down Expand Up @@ -529,7 +529,7 @@ def get_command_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_command_serialize(
project_id=project_id,
Expand Down Expand Up @@ -571,7 +571,7 @@ def _get_command_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
Expand Down Expand Up @@ -659,7 +659,7 @@ def get_command_template(
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_command_template_serialize(
project_id=project_id,
Expand Down Expand Up @@ -734,7 +734,7 @@ def get_command_template_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_command_template_serialize(
project_id=project_id,
Expand Down Expand Up @@ -809,7 +809,7 @@ def get_command_template_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_command_template_serialize(
project_id=project_id,
Expand Down Expand Up @@ -851,7 +851,7 @@ def _get_command_template_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
Expand Down Expand Up @@ -935,7 +935,7 @@ def list_command_templates(
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_command_templates_serialize(
os_type=os_type,
Expand Down Expand Up @@ -1002,7 +1002,7 @@ def list_command_templates_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_command_templates_serialize(
os_type=os_type,
Expand Down Expand Up @@ -1069,7 +1069,7 @@ def list_command_templates_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_command_templates_serialize(
os_type=os_type,
Expand Down Expand Up @@ -1104,7 +1104,7 @@ def _list_command_templates_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
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def list_commands(
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_commands_serialize(
project_id=project_id,
Expand Down Expand Up @@ -1256,7 +1256,7 @@ def list_commands_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_commands_serialize(
project_id=project_id,
Expand Down Expand Up @@ -1327,7 +1327,7 @@ def list_commands_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_commands_serialize(
project_id=project_id,
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def _list_commands_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
Expand Down
23 changes: 18 additions & 5 deletions services/runcommand/src/stackit/runcommand/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 datetime
import json
Expand Down Expand Up @@ -332,6 +332,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]):
Expand All @@ -351,12 +355,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))
Expand Down Expand Up @@ -458,7 +462,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 = " "
Expand All @@ -474,7 +478,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.
Expand All @@ -489,6 +496,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"
Expand Down
Loading
Loading