"""
    Volatile Blob API v1

    The `volatile-blob` service supports the upload and retrieval of volatile data from the storage of a catalog. Each discrete chunk of data is stored as a blob (Binary Large Object). Each blob has its own unique id (data handle) which is stored as partition metadata. To get a partition's data, you first use `metadata` service to retrieve the partition's metadata (data handle) with the addresses of the relevant blobs. You then use those addresses to pull the data using the `volatile-blob` service. Unlike the `blob` service, data handles can be overwritten. Hence the volatile aspect.  # noqa: E501

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


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

from here_data_volatile_blob_v1_client.api_client import ApiClient, Endpoint as _Endpoint
from here_data_volatile_blob_v1_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from here_data_volatile_blob_v1_client.model.authentication_message import AuthenticationMessage
from here_data_volatile_blob_v1_client.model.authorization_message import AuthorizationMessage


class VolatileBlobApi(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 __check_handle_exists(
            self,
            layer_id,
            data_handle,
            **kwargs
        ):
            """Checks if a data handle exists  # noqa: E501

            Checks if a volatile blob exists for the requested data handle.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.check_handle_exists(layer_id, data_handle, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the layer that the volatile blob belongs to.
                data_handle (str): The data handle identifies a specific volatile blob so that you can get that blob's contents.

            Keyword Args:
                billing_tag (str): Billing Tag is an optional free-form tag which is used for grouping billing records together. If supplied, it must be between 4 - 16 characters, contain only alpha/numeric ASCII characters  [A-Za-z0-9]. Grouping billing records by billing tag will be available in future releases.. [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 (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:
                str
                    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['layer_id'] = \
                layer_id
            kwargs['data_handle'] = \
                data_handle
            return self.call_with_http_info(**kwargs)

        self.check_handle_exists = _Endpoint(
            settings={
                'response_type': (str,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/data/{dataHandle}',
                'operation_id': 'check_handle_exists',
                'http_method': 'HEAD',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'data_handle',
                    'billing_tag',
                ],
                'required': [
                    'layer_id',
                    'data_handle',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'data_handle':
                        (str,),
                    'billing_tag':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'data_handle': 'dataHandle',
                    'billing_tag': 'billingTag',
                },
                'location_map': {
                    'layer_id': 'path',
                    'data_handle': 'path',
                    'billing_tag': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/octet-stream',
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__check_handle_exists
        )

        def __delete_volatile_blob(
            self,
            layer_id,
            data_handle,
            **kwargs
        ):
            """Deletes a volatile data blob  # noqa: E501

            Deletes a volatile data blob from the underlying storage mechanism (volume).  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.delete_volatile_blob(layer_id, data_handle, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the layer that the volatile data blob belongs to.
                data_handle (str): The data handle (ID) represents an identifier for the volatile data blob which contents will be deleted.

            Keyword Args:
                x_replicate (str): If set to true, it indicates the request is a replication call. It is not required for user to set it manually. [optional]
                billing_tag (str): Billing Tag is an optional free-form tag which is used for grouping billing records together. If supplied, it must be between 4 - 16 characters, contain only alpha/numeric ASCII characters  [A-Za-z0-9]. Grouping billing records by billing tag will be available in future releases.. [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 (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:
                None
                    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['layer_id'] = \
                layer_id
            kwargs['data_handle'] = \
                data_handle
            return self.call_with_http_info(**kwargs)

        self.delete_volatile_blob = _Endpoint(
            settings={
                'response_type': None,
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/data/{dataHandle}',
                'operation_id': 'delete_volatile_blob',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'data_handle',
                    'x_replicate',
                    'billing_tag',
                ],
                'required': [
                    'layer_id',
                    'data_handle',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'data_handle':
                        (str,),
                    'x_replicate':
                        (str,),
                    'billing_tag':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'data_handle': 'dataHandle',
                    'x_replicate': 'X-Replicate',
                    'billing_tag': 'billingTag',
                },
                'location_map': {
                    'layer_id': 'path',
                    'data_handle': 'path',
                    'x_replicate': 'header',
                    'billing_tag': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__delete_volatile_blob
        )

        def __get_volatile_blob(
            self,
            layer_id,
            data_handle,
            **kwargs
        ):
            """Gets a volatile blob  # noqa: E501

            Retrieves a volatile data blob from storage.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.get_volatile_blob(layer_id, data_handle, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the parent layer for this volatile data blob.
                data_handle (str): The data handle identifies a specific volatile data blob so that you can get that blob's contents.

            Keyword Args:
                billing_tag (str): Billing Tag is an optional free-form tag which is used for grouping billing records together. If supplied, it must be between 4 - 16 characters, contain only alpha/numeric ASCII characters [A-Za-z0-9]. Grouping billing records by billing tag will be available in future releases.. [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 (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:
                file_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['layer_id'] = \
                layer_id
            kwargs['data_handle'] = \
                data_handle
            return self.call_with_http_info(**kwargs)

        self.get_volatile_blob = _Endpoint(
            settings={
                'response_type': (file_type,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/data/{dataHandle}',
                'operation_id': 'get_volatile_blob',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'data_handle',
                    'billing_tag',
                ],
                'required': [
                    'layer_id',
                    'data_handle',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'data_handle':
                        (str,),
                    'billing_tag':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'data_handle': 'dataHandle',
                    'billing_tag': 'billingTag',
                },
                'location_map': {
                    'layer_id': 'path',
                    'data_handle': 'path',
                    'billing_tag': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/octet-stream',
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__get_volatile_blob
        )

        def __put_volatile_blob(
            self,
            layer_id,
            data_handle,
            body,
            **kwargs
        ):
            """Publishes a volatile data blob  # noqa: E501

            Persists the volatile data blob in the underlying storage mechanism (volume).  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.put_volatile_blob(layer_id, data_handle, body, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the layer that the volatile data blob belongs to.
                data_handle (str): The data handle (ID) represents an identifier for the volatile data blob.
                body (file_type): The data to upload as part of the blob. Size limit: 2 MB

            Keyword Args:
                x_replicate (str): If set to true, it indicates the request is a replication call. It is not required for user to set it manually. [optional]
                billing_tag (str): Billing Tag is an optional free-form tag which is used for grouping billing records together. If supplied, it must be between 4 - 16 characters, contain only alpha/numeric ASCII characters  [A-Za-z0-9]. Grouping billing records by billing tag will be available in future releases.. [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 (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:
                None
                    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['layer_id'] = \
                layer_id
            kwargs['data_handle'] = \
                data_handle
            kwargs['body'] = \
                body
            return self.call_with_http_info(**kwargs)

        self.put_volatile_blob = _Endpoint(
            settings={
                'response_type': None,
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/data/{dataHandle}',
                'operation_id': 'put_volatile_blob',
                'http_method': 'PUT',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'data_handle',
                    'body',
                    'x_replicate',
                    'billing_tag',
                ],
                'required': [
                    'layer_id',
                    'data_handle',
                    'body',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'data_handle':
                        (str,),
                    'body':
                        (file_type,),
                    'x_replicate':
                        (str,),
                    'billing_tag':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'data_handle': 'dataHandle',
                    'x_replicate': 'X-Replicate',
                    'billing_tag': 'billingTag',
                },
                'location_map': {
                    'layer_id': 'path',
                    'data_handle': 'path',
                    'body': 'body',
                    'x_replicate': 'header',
                    'billing_tag': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__put_volatile_blob
        )
