# coding: utf-8

"""
    Kestra EE

    All API operations, except for Superadmin-only endpoints, require a tenant identifier in the HTTP path.<br/> Endpoints designated as Superadmin-only are not tenant-scoped.

    The version of the OpenAPI document: v1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from datetime import datetime
from pydantic import Field, StrictBytes, StrictInt, StrictStr
from typing import Any, List, Optional, Tuple, Union
from typing_extensions import Annotated
from kestrapy.models.event_log_entry import EventLogEntry
from kestrapy.models.log_entry import LogEntry
from kestrapy.models.paged_results_log_entry import PagedResultsLogEntry
from kestrapy.models.query_filter import QueryFilter

from kestrapy.api_client import ApiClient, RequestSerialized
from kestrapy.api_response import ApiResponse
from kestrapy.rest import RESTResponseType


class LogsApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def delete_logs_from_execution(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> None:
        """Delete logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_logs_from_execution_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[None]:
        """Delete logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def delete_logs_from_execution_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Delete logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _delete_logs_from_execution_serialize(
        self,
        execution_id,
        tenant,
        min_level,
        task_run_id,
        task_id,
        attempt,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _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, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if min_level is not None:
            
            _query_params.append(('minLevel', min_level.value))
            
        if task_run_id is not None:
            
            _query_params.append(('taskRunId', task_run_id))
            
        if task_id is not None:
            
            _query_params.append(('taskId', task_id))
            
        if attempt is not None:
            
            _query_params.append(('attempt', attempt))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter




        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/{tenant}/logs/{executionId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def delete_logs_from_flow(
        self,
        namespace: Annotated[StrictStr, Field(description="The namespace")],
        flow_id: Annotated[StrictStr, Field(description="The flow identifier")],
        trigger_id: Annotated[StrictStr, Field(description="The trigger id")],
        tenant: StrictStr,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> None:
        """Delete logs for a specific execution, taskrun or task


        :param namespace: The namespace (required)
        :type namespace: str
        :param flow_id: The flow identifier (required)
        :type flow_id: str
        :param trigger_id: The trigger id (required)
        :type trigger_id: str
        :param tenant: (required)
        :type tenant: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_logs_from_flow_serialize(
            namespace=namespace,
            flow_id=flow_id,
            trigger_id=trigger_id,
            tenant=tenant,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_logs_from_flow_with_http_info(
        self,
        namespace: Annotated[StrictStr, Field(description="The namespace")],
        flow_id: Annotated[StrictStr, Field(description="The flow identifier")],
        trigger_id: Annotated[StrictStr, Field(description="The trigger id")],
        tenant: StrictStr,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[None]:
        """Delete logs for a specific execution, taskrun or task


        :param namespace: The namespace (required)
        :type namespace: str
        :param flow_id: The flow identifier (required)
        :type flow_id: str
        :param trigger_id: The trigger id (required)
        :type trigger_id: str
        :param tenant: (required)
        :type tenant: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_logs_from_flow_serialize(
            namespace=namespace,
            flow_id=flow_id,
            trigger_id=trigger_id,
            tenant=tenant,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def delete_logs_from_flow_without_preload_content(
        self,
        namespace: Annotated[StrictStr, Field(description="The namespace")],
        flow_id: Annotated[StrictStr, Field(description="The flow identifier")],
        trigger_id: Annotated[StrictStr, Field(description="The trigger id")],
        tenant: StrictStr,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Delete logs for a specific execution, taskrun or task


        :param namespace: The namespace (required)
        :type namespace: str
        :param flow_id: The flow identifier (required)
        :type flow_id: str
        :param trigger_id: The trigger id (required)
        :type trigger_id: str
        :param tenant: (required)
        :type tenant: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_logs_from_flow_serialize(
            namespace=namespace,
            flow_id=flow_id,
            trigger_id=trigger_id,
            tenant=tenant,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _delete_logs_from_flow_serialize(
        self,
        namespace,
        flow_id,
        trigger_id,
        tenant,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _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, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if namespace is not None:
            _path_params['namespace'] = namespace
        if flow_id is not None:
            _path_params['flowId'] = flow_id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if trigger_id is not None:
            
            _query_params.append(('triggerId', trigger_id))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter




        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v1/{tenant}/logs/{namespace}/{flowId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def download_logs_from_execution(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> bytearray:
        """Download logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._download_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "bytearray",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def download_logs_from_execution_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[bytearray]:
        """Download logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._download_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "bytearray",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def download_logs_from_execution_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Download logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._download_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "bytearray",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _download_logs_from_execution_serialize(
        self,
        execution_id,
        tenant,
        min_level,
        task_run_id,
        task_id,
        attempt,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _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, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if min_level is not None:
            
            _query_params.append(('minLevel', min_level.value))
            
        if task_run_id is not None:
            
            _query_params.append(('taskRunId', task_run_id))
            
        if task_id is not None:
            
            _query_params.append(('taskId', task_id))
            
        if attempt is not None:
            
            _query_params.append(('attempt', attempt))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'text/plain'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/{tenant}/logs/{executionId}/download',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def follow_logs_from_execution(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> EventLogEntry:
        """Follow logs for a specific execution


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._follow_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "EventLogEntry",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def follow_logs_from_execution_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[EventLogEntry]:
        """Follow logs for a specific execution


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._follow_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "EventLogEntry",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def follow_logs_from_execution_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Follow logs for a specific execution


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._follow_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "EventLogEntry",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _follow_logs_from_execution_serialize(
        self,
        execution_id,
        tenant,
        min_level,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _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, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if min_level is not None:
            
            _query_params.append(('minLevel', min_level.value))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'text/event-stream'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/{tenant}/logs/{executionId}/follow',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def list_logs_from_execution(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> List[LogEntry]:
        """Get logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[LogEntry]",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_logs_from_execution_with_http_info(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[List[LogEntry]]:
        """Get logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[LogEntry]",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def list_logs_from_execution_without_preload_content(
        self,
        execution_id: Annotated[StrictStr, Field(description="The execution id")],
        tenant: StrictStr,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        task_run_id: Annotated[Optional[StrictStr], Field(description="The taskrun id")] = None,
        task_id: Annotated[Optional[StrictStr], Field(description="The task id")] = None,
        attempt: Annotated[Optional[StrictInt], Field(description="The attempt number")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get logs for a specific execution, taskrun or task


        :param execution_id: The execution id (required)
        :type execution_id: str
        :param tenant: (required)
        :type tenant: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param task_run_id: The taskrun id
        :type task_run_id: str
        :param task_id: The task id
        :type task_id: str
        :param attempt: The attempt number
        :type attempt: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_logs_from_execution_serialize(
            execution_id=execution_id,
            tenant=tenant,
            min_level=min_level,
            task_run_id=task_run_id,
            task_id=task_id,
            attempt=attempt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[LogEntry]",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _list_logs_from_execution_serialize(
        self,
        execution_id,
        tenant,
        min_level,
        task_run_id,
        task_id,
        attempt,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _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, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if execution_id is not None:
            _path_params['executionId'] = execution_id
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if min_level is not None:
            
            _query_params.append(('minLevel', min_level.value))
            
        if task_run_id is not None:
            
            _query_params.append(('taskRunId', task_run_id))
            
        if task_id is not None:
            
            _query_params.append(('taskId', task_id))
            
        if attempt is not None:
            
            _query_params.append(('attempt', attempt))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/{tenant}/logs/{executionId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def search_logs(
        self,
        page: Annotated[int, Field(strict=True, ge=1, description="The current page")],
        size: Annotated[int, Field(strict=True, ge=1, description="The current page size")],
        tenant: StrictStr,
        sort: Annotated[Optional[List[StrictStr]], Field(description="The sort of current page")] = None,
        filters: Annotated[Optional[List[QueryFilter]], Field(description="Filters")] = None,
        q: Annotated[Optional[StrictStr], Field(description="A string filter")] = None,
        namespace: Annotated[Optional[StrictStr], Field(description="A namespace filter prefix")] = None,
        flow_id: Annotated[Optional[StrictStr], Field(description="A flow id filter")] = None,
        trigger_id: Annotated[Optional[StrictStr], Field(description="A trigger id filter")] = None,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        start_date: Annotated[Optional[datetime], Field(description="The start datetime")] = None,
        end_date: Annotated[Optional[datetime], Field(description="The end datetime")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PagedResultsLogEntry:
        """Search for logs


        :param page: The current page (required)
        :type page: int
        :param size: The current page size (required)
        :type size: int
        :param tenant: (required)
        :type tenant: str
        :param sort: The sort of current page
        :type sort: List[str]
        :param filters: Filters
        :type filters: List[QueryFilter]
        :param q: A string filter
        :type q: str
        :param namespace: A namespace filter prefix
        :type namespace: str
        :param flow_id: A flow id filter
        :type flow_id: str
        :param trigger_id: A trigger id filter
        :type trigger_id: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param start_date: The start datetime
        :type start_date: datetime
        :param end_date: The end datetime
        :type end_date: datetime
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_logs_serialize(
            page=page,
            size=size,
            tenant=tenant,
            sort=sort,
            filters=filters,
            q=q,
            namespace=namespace,
            flow_id=flow_id,
            trigger_id=trigger_id,
            min_level=min_level,
            start_date=start_date,
            end_date=end_date,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsLogEntry",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def search_logs_with_http_info(
        self,
        page: Annotated[int, Field(strict=True, ge=1, description="The current page")],
        size: Annotated[int, Field(strict=True, ge=1, description="The current page size")],
        tenant: StrictStr,
        sort: Annotated[Optional[List[StrictStr]], Field(description="The sort of current page")] = None,
        filters: Annotated[Optional[List[QueryFilter]], Field(description="Filters")] = None,
        q: Annotated[Optional[StrictStr], Field(description="A string filter")] = None,
        namespace: Annotated[Optional[StrictStr], Field(description="A namespace filter prefix")] = None,
        flow_id: Annotated[Optional[StrictStr], Field(description="A flow id filter")] = None,
        trigger_id: Annotated[Optional[StrictStr], Field(description="A trigger id filter")] = None,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        start_date: Annotated[Optional[datetime], Field(description="The start datetime")] = None,
        end_date: Annotated[Optional[datetime], Field(description="The end datetime")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PagedResultsLogEntry]:
        """Search for logs


        :param page: The current page (required)
        :type page: int
        :param size: The current page size (required)
        :type size: int
        :param tenant: (required)
        :type tenant: str
        :param sort: The sort of current page
        :type sort: List[str]
        :param filters: Filters
        :type filters: List[QueryFilter]
        :param q: A string filter
        :type q: str
        :param namespace: A namespace filter prefix
        :type namespace: str
        :param flow_id: A flow id filter
        :type flow_id: str
        :param trigger_id: A trigger id filter
        :type trigger_id: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param start_date: The start datetime
        :type start_date: datetime
        :param end_date: The end datetime
        :type end_date: datetime
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_logs_serialize(
            page=page,
            size=size,
            tenant=tenant,
            sort=sort,
            filters=filters,
            q=q,
            namespace=namespace,
            flow_id=flow_id,
            trigger_id=trigger_id,
            min_level=min_level,
            start_date=start_date,
            end_date=end_date,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsLogEntry",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def search_logs_without_preload_content(
        self,
        page: Annotated[int, Field(strict=True, ge=1, description="The current page")],
        size: Annotated[int, Field(strict=True, ge=1, description="The current page size")],
        tenant: StrictStr,
        sort: Annotated[Optional[List[StrictStr]], Field(description="The sort of current page")] = None,
        filters: Annotated[Optional[List[QueryFilter]], Field(description="Filters")] = None,
        q: Annotated[Optional[StrictStr], Field(description="A string filter")] = None,
        namespace: Annotated[Optional[StrictStr], Field(description="A namespace filter prefix")] = None,
        flow_id: Annotated[Optional[StrictStr], Field(description="A flow id filter")] = None,
        trigger_id: Annotated[Optional[StrictStr], Field(description="A trigger id filter")] = None,
        min_level: Annotated[Optional[Any], Field(description="The min log level filter")] = None,
        start_date: Annotated[Optional[datetime], Field(description="The start datetime")] = None,
        end_date: Annotated[Optional[datetime], Field(description="The end datetime")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Search for logs


        :param page: The current page (required)
        :type page: int
        :param size: The current page size (required)
        :type size: int
        :param tenant: (required)
        :type tenant: str
        :param sort: The sort of current page
        :type sort: List[str]
        :param filters: Filters
        :type filters: List[QueryFilter]
        :param q: A string filter
        :type q: str
        :param namespace: A namespace filter prefix
        :type namespace: str
        :param flow_id: A flow id filter
        :type flow_id: str
        :param trigger_id: A trigger id filter
        :type trigger_id: str
        :param min_level: The min log level filter
        :type min_level: Level
        :param start_date: The start datetime
        :type start_date: datetime
        :param end_date: The end datetime
        :type end_date: datetime
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_logs_serialize(
            page=page,
            size=size,
            tenant=tenant,
            sort=sort,
            filters=filters,
            q=q,
            namespace=namespace,
            flow_id=flow_id,
            trigger_id=trigger_id,
            min_level=min_level,
            start_date=start_date,
            end_date=end_date,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PagedResultsLogEntry",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _search_logs_serialize(
        self,
        page,
        size,
        tenant,
        sort,
        filters,
        q,
        namespace,
        flow_id,
        trigger_id,
        min_level,
        start_date,
        end_date,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'sort': 'csv',
            'filters': 'csv',
        }

        _path_params: Dict[str, str] = {}
        _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, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if tenant is not None:
            _path_params['tenant'] = tenant
        # process the query parameters
        if page is not None:
            
            _query_params.append(('page', page))
            
        if size is not None:
            
            _query_params.append(('size', size))
            
        if sort is not None:
            
            _query_params.append(('sort', sort))
            
        if filters is not None:
            
            _query_params.append(('filters', filters))
            
        if q is not None:
            
            _query_params.append(('q', q))
            
        if namespace is not None:
            
            _query_params.append(('namespace', namespace))
            
        if flow_id is not None:
            
            _query_params.append(('flowId', flow_id))
            
        if trigger_id is not None:
            
            _query_params.append(('triggerId', trigger_id))
            
        if min_level is not None:
            
            _query_params.append(('minLevel', min_level.value))
            
        if start_date is not None:
            if isinstance(start_date, datetime):
                _query_params.append(
                    (
                        'startDate',
                        start_date.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('startDate', start_date))
            
        if end_date is not None:
            if isinstance(end_date, datetime):
                _query_params.append(
                    (
                        'endDate',
                        end_date.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('endDate', end_date))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'basicAuth', 
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v1/{tenant}/logs/search',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


