"""
    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.required_kernel_image_resource import RequiredKernelImageResource
from h2o_notebook.gen.model.rpc_status import RpcStatus
from h2o_notebook.gen.model.v1_create_kernel_image_response import V1CreateKernelImageResponse
from h2o_notebook.gen.model.v1_get_kernel_image_response import V1GetKernelImageResponse
from h2o_notebook.gen.model.v1_kernel_image import V1KernelImage
from h2o_notebook.gen.model.v1_list_kernel_images_response import V1ListKernelImagesResponse
from h2o_notebook.gen.model.v1_update_kernel_image_response import V1UpdateKernelImageResponse


class KernelImageServiceApi(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_image_service_create_kernel_image_endpoint = _Endpoint(
            settings={
                'response_type': (V1CreateKernelImageResponse,),
                'auth': [],
                'endpoint_path': '/v1/kernelImages',
                'operation_id': 'kernel_image_service_create_kernel_image',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'kernel_image',
                    'kernel_image_id',
                ],
                'required': [
                    'kernel_image',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'kernel_image':
                        (V1KernelImage,),
                    'kernel_image_id':
                        (str,),
                },
                'attribute_map': {
                    'kernel_image_id': 'kernelImageId',
                },
                'location_map': {
                    'kernel_image': 'body',
                    'kernel_image_id': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.kernel_image_service_delete_kernel_image_endpoint = _Endpoint(
            settings={
                'response_type': (bool, date, datetime, dict, float, int, list, str, none_type,),
                'auth': [],
                'endpoint_path': '/v1/{name}',
                'operation_id': 'kernel_image_service_delete_kernel_image',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'name',
                    'allow_missing',
                    'validate_only',
                ],
                'required': [
                    'name',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'name',
                ]
            },
            root_map={
                'validations': {
                    ('name',): {

                        'regex': {
                            'pattern': r'kernelImages\/[^\/]+',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'name':
                        (str,),
                    'allow_missing':
                        (bool,),
                    'validate_only':
                        (bool,),
                },
                'attribute_map': {
                    'name': 'name',
                    'allow_missing': 'allowMissing',
                    'validate_only': 'validateOnly',
                },
                'location_map': {
                    'name': 'path',
                    'allow_missing': 'query',
                    'validate_only': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.kernel_image_service_get_kernel_image_endpoint = _Endpoint(
            settings={
                'response_type': (V1GetKernelImageResponse,),
                'auth': [],
                'endpoint_path': '/v1/{name}',
                'operation_id': 'kernel_image_service_get_kernel_image',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'name',
                ],
                'required': [
                    'name',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'name',
                ]
            },
            root_map={
                'validations': {
                    ('name',): {

                        'regex': {
                            'pattern': r'kernelImages\/[^\/]+',  # 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_image_service_list_kernel_images_endpoint = _Endpoint(
            settings={
                'response_type': (V1ListKernelImagesResponse,),
                'auth': [],
                'endpoint_path': '/v1/kernelImages',
                'operation_id': 'kernel_image_service_list_kernel_images',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'page_size',
                    'page_token',
                    'order_by',
                    'filter',
                ],
                'required': [],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'page_size':
                        (int,),
                    'page_token':
                        (str,),
                    'order_by':
                        (str,),
                    'filter':
                        (str,),
                },
                'attribute_map': {
                    'page_size': 'pageSize',
                    'page_token': 'pageToken',
                    'order_by': 'orderBy',
                    'filter': 'filter',
                },
                'location_map': {
                    'page_size': 'query',
                    'page_token': 'query',
                    'order_by': 'query',
                    'filter': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.kernel_image_service_update_kernel_image_endpoint = _Endpoint(
            settings={
                'response_type': (V1UpdateKernelImageResponse,),
                'auth': [],
                'endpoint_path': '/v1/{kernelImage.name}',
                'operation_id': 'kernel_image_service_update_kernel_image',
                'http_method': 'PATCH',
                'servers': None,
            },
            params_map={
                'all': [
                    'kernel_image_name',
                    'update_mask',
                    'kernel_image',
                    'allow_missing',
                    'validate_only',
                ],
                'required': [
                    'kernel_image_name',
                    'update_mask',
                    'kernel_image',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'kernel_image_name',
                ]
            },
            root_map={
                'validations': {
                    ('kernel_image_name',): {

                        'regex': {
                            'pattern': r'kernelImages\/[^\/]+',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'kernel_image_name':
                        (str,),
                    'update_mask':
                        (str,),
                    'kernel_image':
                        (RequiredKernelImageResource,),
                    'allow_missing':
                        (bool,),
                    'validate_only':
                        (bool,),
                },
                'attribute_map': {
                    'kernel_image_name': 'kernelImage.name',
                    'update_mask': 'updateMask',
                    'allow_missing': 'allowMissing',
                    'validate_only': 'validateOnly',
                },
                'location_map': {
                    'kernel_image_name': 'path',
                    'update_mask': 'query',
                    'kernel_image': 'body',
                    'allow_missing': 'query',
                    'validate_only': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )

    def kernel_image_service_create_kernel_image(
        self,
        kernel_image,
        **kwargs
    ):
        """Creates a new KernelImage.  # 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_image_service_create_kernel_image(kernel_image, async_req=True)
        >>> result = thread.get()

        Args:
            kernel_image (V1KernelImage): Required. The KernelImage resource to create.

        Keyword Args:
            kernel_image_id (str): Optional. Specify the KernelImage ID, which will become a part of the KernelImage resource name. If not specified, the server will generate one.  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])?$. [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:
            V1CreateKernelImageResponse
                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_image'] = \
            kernel_image
        return self.kernel_image_service_create_kernel_image_endpoint.call_with_http_info(**kwargs)

    def kernel_image_service_delete_kernel_image(
        self,
        name,
        **kwargs
    ):
        """Deletes a KernelImage.  # 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_image_service_delete_kernel_image(name, async_req=True)
        >>> result = thread.get()

        Args:
            name (str): Required. KernelImage resource name. Format: kernelImages/{kernel_image}

        Keyword Args:
            allow_missing (bool): Optional. When set and the KernelImage is not found, the request will succeed but no changes are made.. [optional]
            validate_only (bool): Optional. When set, request is validated but no changes are made.. [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:
            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_image_service_delete_kernel_image_endpoint.call_with_http_info(**kwargs)

    def kernel_image_service_get_kernel_image(
        self,
        name,
        **kwargs
    ):
        """Returns a specific KernelImage.  # 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_image_service_get_kernel_image(name, async_req=True)
        >>> result = thread.get()

        Args:
            name (str): Required. The name of the KernelImage to retrieve. Format: `kernelImages/{kernel_image}`

        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:
            V1GetKernelImageResponse
                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_image_service_get_kernel_image_endpoint.call_with_http_info(**kwargs)

    def kernel_image_service_list_kernel_images(
        self,
        **kwargs
    ):
        """Returns a collection of KernelImages.  # 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_image_service_list_kernel_images(async_req=True)
        >>> result = thread.get()


        Keyword Args:
            page_size (int): Optional. Maximum number of KernelImages to return in a response. If unspecified (or set to 0), at most 50 KernelImages will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.. [optional]
            page_token (str): Optional. Leave unset to receive the initial page. To list any subsequent pages use the value of 'next_page_token' returned from the ListKernelImagesResponse.. [optional]
            order_by (str): Optional. Used to specify the sorting order.  When unset, KernelImages are ordered by their time of creation in descending order. This is equivalent to \"create_time desc\".  When specified, the value must be a comma separated list of supported fields. The supported fields are: - TODO: name - TODO: image - TODO: create_time - TODO: update_time  The default sorting order is ascending. For example: \"name\" and \"name asc\" are equivalent values.  To specify descending order for a field, append a \" desc\" suffix. For example: \"name desc\".  Redundant space characters are insignificant. For example these values are all equal: - \"  name, cpu     desc\" - \"name, cpu desc\" - \"name   , cpu desc   \"  Undefined (empty) time is interpreted as a zero time (0s since epoch, i.e. 1970-01-01T00:00:00Z).  Undefined (empty) duration is interpreted as a zero duration (0 seconds).. [optional]
            filter (str): Optional. Used to filter KernelImages. When unset, no filtering is applied.  Filtering implements specification https://google.aip.dev/160.  Supported filter fields: - TODO: name - TODO: kernel_image_id - TODO: type - TODO: image - TODO: disabled - TODO: create_time - TODO: update_time  Examples: - TODO: Examples. [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:
            V1ListKernelImagesResponse
                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_image_service_list_kernel_images_endpoint.call_with_http_info(**kwargs)

    def kernel_image_service_update_kernel_image(
        self,
        kernel_image_name,
        update_mask,
        kernel_image,
        **kwargs
    ):
        """Updates a KernelImage.  # 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_image_service_update_kernel_image(kernel_image_name, update_mask, kernel_image, async_req=True)
        >>> result = thread.get()

        Args:
            kernel_image_name (str): Output only. Resource name.
            update_mask (str): Required. The list of paths referencing which fields to update. Update mask must be non-empty.  Allowed field paths are: {\"display_name\", \"type\", \"image\", \"disabled\"}. Paths are case sensitive (must match exactly).  To update all allowed fields, specify exactly one path with value \"*\".
            kernel_image (RequiredKernelImageResource): Required. KernelImage resource.

        Keyword Args:
            allow_missing (bool): Optional. When set and the KernelImage is not found, a new one is created. In this situation, `update_mask` is ignored, i.e. all fields are applied regardless of any provided update mask; but the update mask must be still present.. [optional]
            validate_only (bool): Optional. When set, request is validated but no changes are made.. [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:
            V1UpdateKernelImageResponse
                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_image_name'] = \
            kernel_image_name
        kwargs['update_mask'] = \
            update_mask
        kwargs['kernel_image'] = \
            kernel_image
        return self.kernel_image_service_update_kernel_image_endpoint.call_with_http_info(**kwargs)

