"""
    external/v1/external_session_service.proto

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: version not set
    Generated by: https://openapi-generator.tech
"""

import re  # noqa: F401
import sys  # noqa: F401

from grid.openapi.api_client import ApiClient
from grid.openapi.api_client import Endpoint as _Endpoint
from grid.openapi.model.externalv1_create_session_request import Externalv1CreateSessionRequest
from grid.openapi.model.externalv1_create_session_response import Externalv1CreateSessionResponse
from grid.openapi.model.externalv1_get_session_response import Externalv1GetSessionResponse
from grid.openapi.model.externalv1_list_sessions_response import Externalv1ListSessionsResponse
from grid.openapi.model.externalv1_update_session_response import Externalv1UpdateSessionResponse
from grid.openapi.model.inline_object1 import InlineObject1
from grid.openapi.model.rpc_status import RpcStatus
from grid.openapi.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types,
)


class SessionServiceApi(object):
    """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):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

        def __session_service_create_session(self, body, **kwargs):
            """session_service_create_session  # noqa: E501

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.session_service_create_session(body, async_req=True)
            >>> result = thread.get()

            Args:
                body (Externalv1CreateSessionRequest):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (int/float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                Externalv1CreateSessionResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get('async_req', False)
            kwargs['_return_http_data_only'] = kwargs.get('_return_http_data_only', True)
            kwargs['_preload_content'] = kwargs.get('_preload_content', True)
            kwargs['_request_timeout'] = kwargs.get('_request_timeout', None)
            kwargs['_check_input_type'] = kwargs.get('_check_input_type', True)
            kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['body'] = \
                body
            return self.call_with_http_info(**kwargs)

        self.session_service_create_session = _Endpoint(
            settings={
                'response_type': (Externalv1CreateSessionResponse, ),
                'auth': [],
                'endpoint_path': '/v1/core/sessions',
                'operation_id': 'session_service_create_session',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'body',
                ],
                'required': [
                    'body',
                ],
                'nullable': [],
                'enum': [],
                'validation': []
            },
            root_map={
                'validations': {},
                'allowed_values': {},
                'openapi_types': {
                    'body': (Externalv1CreateSessionRequest, ),
                },
                'attribute_map': {},
                'location_map': {
                    'body': 'body',
                },
                'collection_format_map': {}
            },
            headers_map={
                'accept': ['application/json'],
                'content_type': ['application/json']
            },
            api_client=api_client,
            callable=__session_service_create_session
        )

        def __session_service_delete_session(self, id, **kwargs):
            """session_service_delete_session  # noqa: E501

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.session_service_delete_session(id, async_req=True)
            >>> result = thread.get()

            Args:
                id (str):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (int/float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                bool, date, datetime, dict, float, int, list, str, none_type
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get('async_req', False)
            kwargs['_return_http_data_only'] = kwargs.get('_return_http_data_only', True)
            kwargs['_preload_content'] = kwargs.get('_preload_content', True)
            kwargs['_request_timeout'] = kwargs.get('_request_timeout', None)
            kwargs['_check_input_type'] = kwargs.get('_check_input_type', True)
            kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['id'] = \
                id
            return self.call_with_http_info(**kwargs)

        self.session_service_delete_session = _Endpoint(
            settings={
                'response_type': (
                    bool,
                    date,
                    datetime,
                    dict,
                    float,
                    int,
                    list,
                    str,
                    none_type,
                ),
                'auth': [],
                'endpoint_path': '/v1/core/sessions/{id}',
                'operation_id': 'session_service_delete_session',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                ],
                'required': [
                    'id',
                ],
                'nullable': [],
                'enum': [],
                'validation': []
            },
            root_map={
                'validations': {},
                'allowed_values': {},
                'openapi_types': {
                    'id': (str, ),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                },
                'collection_format_map': {}
            },
            headers_map={
                'accept': ['application/json'],
                'content_type': [],
            },
            api_client=api_client,
            callable=__session_service_delete_session
        )

        def __session_service_get_session(self, id, **kwargs):
            """session_service_get_session  # noqa: E501

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.session_service_get_session(id, async_req=True)
            >>> result = thread.get()

            Args:
                id (str):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (int/float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                Externalv1GetSessionResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get('async_req', False)
            kwargs['_return_http_data_only'] = kwargs.get('_return_http_data_only', True)
            kwargs['_preload_content'] = kwargs.get('_preload_content', True)
            kwargs['_request_timeout'] = kwargs.get('_request_timeout', None)
            kwargs['_check_input_type'] = kwargs.get('_check_input_type', True)
            kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['id'] = \
                id
            return self.call_with_http_info(**kwargs)

        self.session_service_get_session = _Endpoint(
            settings={
                'response_type': (Externalv1GetSessionResponse, ),
                'auth': [],
                'endpoint_path': '/v1/core/sessions/{id}',
                'operation_id': 'session_service_get_session',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                ],
                'required': [
                    'id',
                ],
                'nullable': [],
                'enum': [],
                'validation': []
            },
            root_map={
                'validations': {},
                'allowed_values': {},
                'openapi_types': {
                    'id': (str, ),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                },
                'collection_format_map': {}
            },
            headers_map={
                'accept': ['application/json'],
                'content_type': [],
            },
            api_client=api_client,
            callable=__session_service_get_session
        )

        def __session_service_list_sessions(self, **kwargs):
            """session_service_list_sessions  # noqa: E501

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.session_service_list_sessions(async_req=True)
            >>> result = thread.get()


            Keyword Args:
                page_token (str): [optional]
                limit (str): [optional]
                user_id (str): [optional]
                cluster_id (str): [optional]
                phase_in ([str]): [optional]
                phase_not_in ([str]): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (int/float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                Externalv1ListSessionsResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get('async_req', False)
            kwargs['_return_http_data_only'] = kwargs.get('_return_http_data_only', True)
            kwargs['_preload_content'] = kwargs.get('_preload_content', True)
            kwargs['_request_timeout'] = kwargs.get('_request_timeout', None)
            kwargs['_check_input_type'] = kwargs.get('_check_input_type', True)
            kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
            kwargs['_host_index'] = kwargs.get('_host_index')
            return self.call_with_http_info(**kwargs)

        self.session_service_list_sessions = _Endpoint(
            settings={
                'response_type': (Externalv1ListSessionsResponse, ),
                'auth': [],
                'endpoint_path': '/v1/core/sessions',
                'operation_id': 'session_service_list_sessions',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'page_token',
                    'limit',
                    'user_id',
                    'cluster_id',
                    'phase_in',
                    'phase_not_in',
                ],
                'required': [],
                'nullable': [],
                'enum': [
                    'phase_in',
                    'phase_not_in',
                ],
                'validation': []
            },
            root_map={
                'validations': {},
                'allowed_values': {
                    ('phase_in', ): {
                        "UNSPECIFIED": "SESSION_STATE_UNSPECIFIED",
                        "PENDING": "SESSION_STATE_PENDING",
                        "RUNNING": "SESSION_STATE_RUNNING",
                        "PAUSED": "SESSION_STATE_PAUSED",
                        "DELETED": "SESSION_STATE_DELETED"
                    },
                    ('phase_not_in', ): {
                        "UNSPECIFIED": "SESSION_STATE_UNSPECIFIED",
                        "PENDING": "SESSION_STATE_PENDING",
                        "RUNNING": "SESSION_STATE_RUNNING",
                        "PAUSED": "SESSION_STATE_PAUSED",
                        "DELETED": "SESSION_STATE_DELETED"
                    },
                },
                'openapi_types': {
                    'page_token': (str, ),
                    'limit': (str, ),
                    'user_id': (str, ),
                    'cluster_id': (str, ),
                    'phase_in': ([str], ),
                    'phase_not_in': ([str], ),
                },
                'attribute_map': {
                    'page_token': 'pageToken',
                    'limit': 'limit',
                    'user_id': 'userId',
                    'cluster_id': 'clusterId',
                    'phase_in': 'phaseIn',
                    'phase_not_in': 'phaseNotIn',
                },
                'location_map': {
                    'page_token': 'query',
                    'limit': 'query',
                    'user_id': 'query',
                    'cluster_id': 'query',
                    'phase_in': 'query',
                    'phase_not_in': 'query',
                },
                'collection_format_map': {
                    'phase_in': 'multi',
                    'phase_not_in': 'multi',
                }
            },
            headers_map={
                'accept': ['application/json'],
                'content_type': [],
            },
            api_client=api_client,
            callable=__session_service_list_sessions
        )

        def __session_service_update_session(self, id, body, **kwargs):
            """session_service_update_session  # noqa: E501

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.session_service_update_session(id, body, async_req=True)
            >>> result = thread.get()

            Args:
                id (str):
                body (InlineObject1):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (int/float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                Externalv1UpdateSessionResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get('async_req', False)
            kwargs['_return_http_data_only'] = kwargs.get('_return_http_data_only', True)
            kwargs['_preload_content'] = kwargs.get('_preload_content', True)
            kwargs['_request_timeout'] = kwargs.get('_request_timeout', None)
            kwargs['_check_input_type'] = kwargs.get('_check_input_type', True)
            kwargs['_check_return_type'] = kwargs.get('_check_return_type', True)
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['id'] = \
                id
            kwargs['body'] = \
                body
            return self.call_with_http_info(**kwargs)

        self.session_service_update_session = _Endpoint(
            settings={
                'response_type': (Externalv1UpdateSessionResponse, ),
                'auth': [],
                'endpoint_path': '/v1/core/sessions/{id}',
                'operation_id': 'session_service_update_session',
                'http_method': 'PUT',
                'servers': None,
            },
            params_map={
                'all': [
                    'id',
                    'body',
                ],
                'required': [
                    'id',
                    'body',
                ],
                'nullable': [],
                'enum': [],
                'validation': []
            },
            root_map={
                'validations': {},
                'allowed_values': {},
                'openapi_types': {
                    'id': (str, ),
                    'body': (InlineObject1, ),
                },
                'attribute_map': {
                    'id': 'id',
                },
                'location_map': {
                    'id': 'path',
                    'body': 'body',
                },
                'collection_format_map': {}
            },
            headers_map={
                'accept': ['application/json'],
                'content_type': ['application/json']
            },
            api_client=api_client,
            callable=__session_service_update_session
        )
