# coding: utf-8

"""
    Karbon Platform Services API reference.

    OpenAPI documentation for public facing Karbon Platform Services API  This API documentation is generated from source code using go-swagger. Do not edit the generated kps_api.json directly!  # noqa: E501

    OpenAPI spec version: 1.0
    Contact: karbon-platform-services-api@nutanix.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 kps_api.api_client import ApiClient


class HelmApi(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 helm_application_create(self, chart, values, application, url, authorization, **kwargs):  # noqa: E501
        """Create Helm Application.  # noqa: E501

        Create a Helm Chart based Application.  Use Application APIs to list or delete the application created by using this API  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.helm_application_create(chart, values, application, url, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param file chart: (required)
        :param file values: (required)
        :param str application: (required)
        :param str url: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: CreateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.helm_application_create_with_http_info(chart, values, application, url, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.helm_application_create_with_http_info(chart, values, application, url, authorization, **kwargs)  # noqa: E501
            return data

    def helm_application_create_with_http_info(self, chart, values, application, url, authorization, **kwargs):  # noqa: E501
        """Create Helm Application.  # noqa: E501

        Create a Helm Chart based Application.  Use Application APIs to list or delete the application created by using this API  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.helm_application_create_with_http_info(chart, values, application, url, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param file chart: (required)
        :param file values: (required)
        :param str application: (required)
        :param str url: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: CreateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['chart', 'values', 'application', 'url', 'authorization']  # 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 helm_application_create" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'chart' is set
        if ('chart' not in params or
                params['chart'] is None):
            raise ValueError("Missing the required parameter `chart` when calling `helm_application_create`")  # noqa: E501
        # verify the required parameter 'values' is set
        if ('values' not in params or
                params['values'] is None):
            raise ValueError("Missing the required parameter `values` when calling `helm_application_create`")  # noqa: E501
        # verify the required parameter 'application' is set
        if ('application' not in params or
                params['application'] is None):
            raise ValueError("Missing the required parameter `application` when calling `helm_application_create`")  # noqa: E501
        # verify the required parameter 'url' is set
        if ('url' not in params or
                params['url'] is None):
            raise ValueError("Missing the required parameter `url` when calling `helm_application_create`")  # noqa: E501
        # verify the required parameter 'authorization' is set
        if ('authorization' not in params or
                params['authorization'] is None):
            raise ValueError("Missing the required parameter `authorization` when calling `helm_application_create`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}
        if 'chart' in params:
            local_var_files['chart'] = params['chart']  # noqa: E501
        if 'values' in params:
            local_var_files['values'] = params['values']  # noqa: E501
        if 'application' in params:
            form_params.append(('application', params['application']))  # noqa: E501
        if 'url' in params:
            form_params.append(('url', params['url']))  # noqa: E501

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['multipart/form-data'])  # noqa: E501

        # Authentication setting
        auth_settings = ['BearerToken']  # noqa: E501

        return self.api_client.call_api(
            '/v1.0/helm/apps', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CreateDocumentResponseV2',  # 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 helm_application_update(self, chart, values, application, url, authorization, id, **kwargs):  # noqa: E501
        """Update Helm Application.  # noqa: E501

        Update a Helm Chart based Application.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.helm_application_update(chart, values, application, url, authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param file chart: (required)
        :param file values: (required)
        :param str application: (required)
        :param str url: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: UpdateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.helm_application_update_with_http_info(chart, values, application, url, authorization, id, **kwargs)  # noqa: E501
        else:
            (data) = self.helm_application_update_with_http_info(chart, values, application, url, authorization, id, **kwargs)  # noqa: E501
            return data

    def helm_application_update_with_http_info(self, chart, values, application, url, authorization, id, **kwargs):  # noqa: E501
        """Update Helm Application.  # noqa: E501

        Update a Helm Chart based Application.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.helm_application_update_with_http_info(chart, values, application, url, authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param file chart: (required)
        :param file values: (required)
        :param str application: (required)
        :param str url: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: UpdateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['chart', 'values', 'application', 'url', 'authorization', 'id']  # 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 helm_application_update" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'chart' is set
        if ('chart' not in params or
                params['chart'] is None):
            raise ValueError("Missing the required parameter `chart` when calling `helm_application_update`")  # noqa: E501
        # verify the required parameter 'values' is set
        if ('values' not in params or
                params['values'] is None):
            raise ValueError("Missing the required parameter `values` when calling `helm_application_update`")  # noqa: E501
        # verify the required parameter 'application' is set
        if ('application' not in params or
                params['application'] is None):
            raise ValueError("Missing the required parameter `application` when calling `helm_application_update`")  # noqa: E501
        # verify the required parameter 'url' is set
        if ('url' not in params or
                params['url'] is None):
            raise ValueError("Missing the required parameter `url` when calling `helm_application_update`")  # noqa: E501
        # verify the required parameter 'authorization' is set
        if ('authorization' not in params or
                params['authorization'] is None):
            raise ValueError("Missing the required parameter `authorization` when calling `helm_application_update`")  # noqa: E501
        # verify the required parameter 'id' is set
        if ('id' not in params or
                params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `helm_application_update`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}
        if 'chart' in params:
            local_var_files['chart'] = params['chart']  # noqa: E501
        if 'values' in params:
            local_var_files['values'] = params['values']  # noqa: E501
        if 'application' in params:
            form_params.append(('application', params['application']))  # noqa: E501
        if 'url' in params:
            form_params.append(('url', params['url']))  # noqa: E501

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['multipart/form-data'])  # noqa: E501

        # Authentication setting
        auth_settings = ['BearerToken']  # noqa: E501

        return self.api_client.call_api(
            '/v1.0/helm/apps/{id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UpdateDocumentResponseV2',  # 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 helm_template(self, chart, values, release, namespace, url, authorization, **kwargs):  # noqa: E501
        """Run Helm Template.  # noqa: E501

        Run Helm Template to render Helm Chart.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.helm_template(chart, values, release, namespace, url, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param file chart: (required)
        :param file values: (required)
        :param str release: (required)
        :param str namespace: (required)
        :param str url: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: HelmTemplateResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.helm_template_with_http_info(chart, values, release, namespace, url, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.helm_template_with_http_info(chart, values, release, namespace, url, authorization, **kwargs)  # noqa: E501
            return data

    def helm_template_with_http_info(self, chart, values, release, namespace, url, authorization, **kwargs):  # noqa: E501
        """Run Helm Template.  # noqa: E501

        Run Helm Template to render Helm Chart.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.helm_template_with_http_info(chart, values, release, namespace, url, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param file chart: (required)
        :param file values: (required)
        :param str release: (required)
        :param str namespace: (required)
        :param str url: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: HelmTemplateResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['chart', 'values', 'release', 'namespace', 'url', 'authorization']  # 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 helm_template" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'chart' is set
        if ('chart' not in params or
                params['chart'] is None):
            raise ValueError("Missing the required parameter `chart` when calling `helm_template`")  # noqa: E501
        # verify the required parameter 'values' is set
        if ('values' not in params or
                params['values'] is None):
            raise ValueError("Missing the required parameter `values` when calling `helm_template`")  # noqa: E501
        # verify the required parameter 'release' is set
        if ('release' not in params or
                params['release'] is None):
            raise ValueError("Missing the required parameter `release` when calling `helm_template`")  # noqa: E501
        # verify the required parameter 'namespace' is set
        if ('namespace' not in params or
                params['namespace'] is None):
            raise ValueError("Missing the required parameter `namespace` when calling `helm_template`")  # noqa: E501
        # verify the required parameter 'url' is set
        if ('url' not in params or
                params['url'] is None):
            raise ValueError("Missing the required parameter `url` when calling `helm_template`")  # noqa: E501
        # verify the required parameter 'authorization' is set
        if ('authorization' not in params or
                params['authorization'] is None):
            raise ValueError("Missing the required parameter `authorization` when calling `helm_template`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}
        if 'chart' in params:
            local_var_files['chart'] = params['chart']  # noqa: E501
        if 'values' in params:
            local_var_files['values'] = params['values']  # noqa: E501
        if 'release' in params:
            form_params.append(('release', params['release']))  # noqa: E501
        if 'namespace' in params:
            form_params.append(('namespace', params['namespace']))  # noqa: E501
        if 'url' in params:
            form_params.append(('url', params['url']))  # noqa: E501

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['multipart/form-data'])  # noqa: E501

        # Authentication setting
        auth_settings = ['BearerToken']  # noqa: E501

        return self.api_client.call_api(
            '/v1.0/helm/template', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='HelmTemplateResponse',  # 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)
