# coding: utf-8

"""
    Zadara Provisioning Portal API

     # Overview  This document outlines the methods available for creation and high-level administration of Zadara Storage VPSAs via a Zadara Storage Provisioning Portal. This API supports form-encoded requests, and can return either JSON or XML responses.  ## Endpoint  The base URL for the requests is the Provisioning Portal URL you created your VPSA through - for example: https://manage.zadarastorage.com/, and all APIs will be prefixed with /api as noted in the documentation below.  ## Authentication  To use this API, an authentication token is required. The API for retrieving this token can be found below in the Authentication section. You may pass this token in requests either via the the X-Token header or via basic authentication (base64 encoded) in Authorization header.  ## Questions  If you have any questions or need support involving the REST API, please contact for assistance.   # noqa: E501

    OpenAPI spec version: 23.03-sp1
    Contact: support@zadarastorage.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from ProvisioningPortal.api_client import ApiClient


class AuthenticationApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

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

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

        Retrieve your authentication token without resetting it.  # 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_authentication_token(get_authentication_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param GetAuthenticationToken get_authentication_token: (required)
        :return: InlineResponse200
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_authentication_token_with_http_info(get_authentication_token, **kwargs)  # noqa: E501
        else:
            (data) = self.get_authentication_token_with_http_info(get_authentication_token, **kwargs)  # noqa: E501
            return data

    def get_authentication_token_with_http_info(self, get_authentication_token, **kwargs):  # noqa: E501
        """get_authentication_token  # noqa: E501

        Retrieve your authentication token without resetting it.  # 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_authentication_token_with_http_info(get_authentication_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param GetAuthenticationToken get_authentication_token: (required)
        :return: InlineResponse200
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['get_authentication_token']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_authentication_token" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'get_authentication_token' is set
        if self.api_client.client_side_validation and ('get_authentication_token' not in params or
                                                       params['get_authentication_token'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `get_authentication_token` when calling `get_authentication_token`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'get_authentication_token' in params:
            body_params = params['get_authentication_token']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/token.json', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse200',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

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

        Reset and retrieve your API token.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.reset_authentication_token(reset_authentication_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ResetAuthenticationToken reset_authentication_token: (required)
        :return: InlineResponse200
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.reset_authentication_token_with_http_info(reset_authentication_token, **kwargs)  # noqa: E501
        else:
            (data) = self.reset_authentication_token_with_http_info(reset_authentication_token, **kwargs)  # noqa: E501
            return data

    def reset_authentication_token_with_http_info(self, reset_authentication_token, **kwargs):  # noqa: E501
        """reset_authentication_token  # noqa: E501

        Reset and retrieve your API token.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.reset_authentication_token_with_http_info(reset_authentication_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ResetAuthenticationToken reset_authentication_token: (required)
        :return: InlineResponse200
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['reset_authentication_token']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method reset_authentication_token" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'reset_authentication_token' is set
        if self.api_client.client_side_validation and ('reset_authentication_token' not in params or
                                                       params['reset_authentication_token'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `reset_authentication_token` when calling `reset_authentication_token`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'reset_authentication_token' in params:
            body_params = params['reset_authentication_token']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/token/reset.json', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse200',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
