"""
    ai/h2o/notebook/v1/kernel.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 h2o_notebook.gen.api_client import ApiClient, Endpoint as _Endpoint
from h2o_notebook.gen.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from h2o_notebook.gen.model.kernel_resource import KernelResource
from h2o_notebook.gen.model.rpc_status import RpcStatus
from h2o_notebook.gen.model.v1_create_kernel_response import V1CreateKernelResponse
from h2o_notebook.gen.model.v1_get_kernel_response import V1GetKernelResponse
from h2o_notebook.gen.model.v1_kernel import V1Kernel
from h2o_notebook.gen.model.v1_list_kernels_response import V1ListKernelsResponse
from h2o_notebook.gen.model.v1_update_kernel_response import V1UpdateKernelResponse


class KernelServiceApi(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
        self.kernel_service_create_kernel_endpoint = _Endpoint(
            settings={
                'response_type': (V1CreateKernelResponse,),
                'auth': [],
                'endpoint_path': '/v1/kernels',
                'operation_id': 'kernel_service_create_kernel',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'kernel_id',
                    'kernel',
                ],
                'required': [
                    'kernel_id',
                    'kernel',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'kernel_id':
                        (str,),
                    'kernel':
                        (V1Kernel,),
                },
                'attribute_map': {
                    'kernel_id': 'kernelId',
                },
                'location_map': {
                    'kernel_id': 'query',
                    'kernel': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.kernel_service_delete_kernel_endpoint = _Endpoint(
            settings={
                'response_type': (bool, date, datetime, dict, float, int, list, str, none_type,),
                'auth': [],
                'endpoint_path': '/v1/{name}',
                'operation_id': 'kernel_service_delete_kernel',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'name',
                ],
                'required': [
                    'name',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'name',
                ]
            },
            root_map={
                'validations': {
                    ('name',): {

                        'regex': {
                            'pattern': r'kernels\/[^\/]+',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'name':
                        (str,),
                },
                'attribute_map': {
                    'name': 'name',
                },
                'location_map': {
                    'name': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.kernel_service_get_kernel_endpoint = _Endpoint(
            settings={
                'response_type': (V1GetKernelResponse,),
                'auth': [],
                'endpoint_path': '/v1/{name}',
                'operation_id': 'kernel_service_get_kernel',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'name',
                ],
                'required': [
                    'name',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'name',
                ]
            },
            root_map={
                'validations': {
                    ('name',): {

                        'regex': {
                            'pattern': r'kernels\/[^\/]+',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'name':
                        (str,),
                },
                'attribute_map': {
                    'name': 'name',
                },
                'location_map': {
                    'name': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.kernel_service_list_kernels_endpoint = _Endpoint(
            settings={
                'response_type': (V1ListKernelsResponse,),
                'auth': [],
                'endpoint_path': '/v1/kernels',
                'operation_id': 'kernel_service_list_kernels',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'page_size',
                    'page_token',
                ],
                'required': [],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'page_size':
                        (int,),
                    'page_token':
                        (str,),
                },
                'attribute_map': {
                    'page_size': 'pageSize',
                    'page_token': 'pageToken',
                },
                'location_map': {
                    'page_size': 'query',
                    'page_token': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.kernel_service_update_kernel_endpoint = _Endpoint(
            settings={
                'response_type': (V1UpdateKernelResponse,),
                'auth': [],
                'endpoint_path': '/v1/{kernel.name}',
                'operation_id': 'kernel_service_update_kernel',
                'http_method': 'PATCH',
                'servers': None,
            },
            params_map={
                'all': [
                    'kernel_name',
                    'update_mask',
                    'kernel',
                ],
                'required': [
                    'kernel_name',
                    'update_mask',
                    'kernel',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'kernel_name',
                ]
            },
            root_map={
                'validations': {
                    ('kernel_name',): {

                        'regex': {
                            'pattern': r'kernels\/[^\/]+',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'kernel_name':
                        (str,),
                    'update_mask':
                        (str,),
                    'kernel':
                        (KernelResource,),
                },
                'attribute_map': {
                    'kernel_name': 'kernel.name',
                    'update_mask': 'updateMask',
                },
                'location_map': {
                    'kernel_name': 'path',
                    'update_mask': 'query',
                    'kernel': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )

    def kernel_service_create_kernel(
        self,
        kernel_id,
        kernel,
        **kwargs
    ):
        """Create a new Kernel. (-- api-linter: core::0133::http-uri-parent=disabled     aip.dev/not-precedent: Kernel has no parent (it's a top-level resource) --) (-- api-linter: core::0133::method-signature=disabled     aip.dev/not-precedent: Kernel has no parent (it's a top-level resource) --)  # noqa: E501

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

        >>> thread = api.kernel_service_create_kernel(kernel_id, kernel, async_req=True)
        >>> result = thread.get()

        Args:
            kernel_id (str): Specify the Kernel resource ID, which will become a part of the Kernel resource name.  It must: - contain 1-63 characters - contain only lowercase alphanumeric characters or hyphen ('-') - start with an alphabetic character - end with an alphanumeric character  This matches a regular expression: ^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$  (-- api-linter: core::0133::request-required-fields=disabled     aip.dev/not-precedent: Google API linter bug (kernel_id is a valid field in Create request...) --)
            kernel (V1Kernel): The Kernel resource to create. (-- api-linter: core::0133::request-required-fields=disabled     aip.dev/not-precedent: Google API linter bug (kernel is a valid field in Create request...) --)

        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.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            V1CreateKernelResponse
                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['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['kernel_id'] = \
            kernel_id
        kwargs['kernel'] = \
            kernel
        return self.kernel_service_create_kernel_endpoint.call_with_http_info(**kwargs)

    def kernel_service_delete_kernel(
        self,
        name,
        **kwargs
    ):
        """Delete a Kernel.  # noqa: E501

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

        >>> thread = api.kernel_service_delete_kernel(name, async_req=True)
        >>> result = thread.get()

        Args:
            name (str): Kernel resource name.

        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.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            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['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['name'] = \
            name
        return self.kernel_service_delete_kernel_endpoint.call_with_http_info(**kwargs)

    def kernel_service_get_kernel(
        self,
        name,
        **kwargs
    ):
        """Return a specific Kernel.  # noqa: E501

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

        >>> thread = api.kernel_service_get_kernel(name, async_req=True)
        >>> result = thread.get()

        Args:
            name (str): Kernel resource name.

        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.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            V1GetKernelResponse
                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['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['name'] = \
            name
        return self.kernel_service_get_kernel_endpoint.call_with_http_info(**kwargs)

    def kernel_service_list_kernels(
        self,
        **kwargs
    ):
        """Return a collection of Kernels.  # noqa: E501

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

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


        Keyword Args:
            page_size (int): Maximum number of Kernels to return in a response. If unspecified (or set to 0), at most 50 Kernels will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.. [optional]
            page_token (str): Leave unset to receive the initial page. To list any subsequent pages use the value of 'next_page_token' returned from the ListKernelsResponse.. [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.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            V1ListKernelsResponse
                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['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        return self.kernel_service_list_kernels_endpoint.call_with_http_info(**kwargs)

    def kernel_service_update_kernel(
        self,
        kernel_name,
        update_mask,
        kernel,
        **kwargs
    ):
        """Update a Kernel.  # noqa: E501

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

        >>> thread = api.kernel_service_update_kernel(kernel_name, update_mask, kernel, async_req=True)
        >>> result = thread.get()

        Args:
            kernel_name (str): Resource name.
            update_mask (str): The list of paths referencing which fields to update. Update mask must be non-empty.  Allowed field paths are: {display_name, type, image, cpu_request, cpu_limit, gpu_resource_name, gpu_request, gpu_limit, memory_bytes_request, memory_bytes_limit, yaml_pod_template_spec}.  To update all allowed fields, specify exactly one path with value \"*\".
            kernel (KernelResource): Kernel resource.

        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.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            _request_auths (list): set to override the auth_settings for an a single
                request; this effectively ignores the authentication
                in the spec for a single request.
                Default is None
            async_req (bool): execute request asynchronously

        Returns:
            V1UpdateKernelResponse
                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['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['_request_auths'] = kwargs.get('_request_auths', None)
        kwargs['kernel_name'] = \
            kernel_name
        kwargs['update_mask'] = \
            update_mask
        kwargs['kernel'] = \
            kernel
        return self.kernel_service_update_kernel_endpoint.call_with_http_info(**kwargs)

