# 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 ServiceBindingApi(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 service_binding_create(self, body, authorization, **kwargs):  # noqa: E501
        """Create a Service Binding.  # noqa: E501

        Create a Service Binding  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_create(body, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ServiceBindingParam body: (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.service_binding_create_with_http_info(body, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.service_binding_create_with_http_info(body, authorization, **kwargs)  # noqa: E501
            return data

    def service_binding_create_with_http_info(self, body, authorization, **kwargs):  # noqa: E501
        """Create a Service Binding.  # noqa: E501

        Create a Service Binding  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_create_with_http_info(body, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ServiceBindingParam body: (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 = ['body', '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 service_binding_create" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `service_binding_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 `service_binding_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 = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # 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
            ['application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1.0/servicebindings', '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 service_binding_delete(self, svc_binding_id, authorization, **kwargs):  # noqa: E501
        """Delete a Service Binding.  # noqa: E501

        Delete a Service Binding  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_delete(svc_binding_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str svc_binding_id: Service Binding ID (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: DeleteDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.service_binding_delete_with_http_info(svc_binding_id, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.service_binding_delete_with_http_info(svc_binding_id, authorization, **kwargs)  # noqa: E501
            return data

    def service_binding_delete_with_http_info(self, svc_binding_id, authorization, **kwargs):  # noqa: E501
        """Delete a Service Binding.  # noqa: E501

        Delete a Service Binding  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_delete_with_http_info(svc_binding_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str svc_binding_id: Service Binding ID (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: DeleteDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

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

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/v1.0/servicebindings/{svcBindingId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeleteDocumentResponseV2',  # 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 service_binding_get(self, svc_binding_id, authorization, **kwargs):  # noqa: E501
        """Get a Service Binding.  # noqa: E501

        Get a Service Binding  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_get(svc_binding_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str svc_binding_id: Service Binding ID (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: ServiceBinding
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.service_binding_get_with_http_info(svc_binding_id, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.service_binding_get_with_http_info(svc_binding_id, authorization, **kwargs)  # noqa: E501
            return data

    def service_binding_get_with_http_info(self, svc_binding_id, authorization, **kwargs):  # noqa: E501
        """Get a Service Binding.  # noqa: E501

        Get a Service Binding  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_get_with_http_info(svc_binding_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str svc_binding_id: Service Binding ID (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: ServiceBinding
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

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

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/v1.0/servicebindings/{svcBindingId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServiceBinding',  # 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 service_binding_list(self, authorization, **kwargs):  # noqa: E501
        """List Service Bindings.  # noqa: E501

        List Service Bindings  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_list(authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :param str svc_class_id: Service Class ID
        :param str bind_resource_type: Bind resource type
        :param str bind_resource_id: Bind resource ID
        :return: ServiceBindingListPayload
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.service_binding_list_with_http_info(authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.service_binding_list_with_http_info(authorization, **kwargs)  # noqa: E501
            return data

    def service_binding_list_with_http_info(self, authorization, **kwargs):  # noqa: E501
        """List Service Bindings.  # noqa: E501

        List Service Bindings  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_list_with_http_info(authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :param str svc_class_id: Service Class ID
        :param str bind_resource_type: Bind resource type
        :param str bind_resource_id: Bind resource ID
        :return: ServiceBindingListPayload
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['authorization', 'page_index', 'page_size', 'order_by', 'filter', 'svc_class_id', 'bind_resource_type', 'bind_resource_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 service_binding_list" % key
                )
            params[key] = val
        del params['kwargs']
        # 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 `service_binding_list`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'page_index' in params:
            query_params.append(('pageIndex', params['page_index']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501
        if 'order_by' in params:
            query_params.append(('orderBy', params['order_by']))  # noqa: E501
            collection_formats['orderBy'] = 'csv'  # noqa: E501
        if 'filter' in params:
            query_params.append(('filter', params['filter']))  # noqa: E501
        if 'svc_class_id' in params:
            query_params.append(('svcClassId', params['svc_class_id']))  # noqa: E501
        if 'bind_resource_type' in params:
            query_params.append(('bindResourceType', params['bind_resource_type']))  # noqa: E501
        if 'bind_resource_id' in params:
            query_params.append(('bindResourceId', params['bind_resource_id']))  # noqa: E501

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

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/v1.0/servicebindings', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServiceBindingListPayload',  # 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 service_binding_status_list(self, svc_binding_id, authorization, **kwargs):  # noqa: E501
        """Get the status of Service Binding.  # noqa: E501

        Get the status of Service Binding on Service Domains  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_status_list(svc_binding_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str svc_binding_id: Service Binding ID (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :param str svc_domain_id: Service Domain ID
        :param str svc_instance_id: Service Instance ID
        :return: ServiceBindingStatusListPayload
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.service_binding_status_list_with_http_info(svc_binding_id, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.service_binding_status_list_with_http_info(svc_binding_id, authorization, **kwargs)  # noqa: E501
            return data

    def service_binding_status_list_with_http_info(self, svc_binding_id, authorization, **kwargs):  # noqa: E501
        """Get the status of Service Binding.  # noqa: E501

        Get the status of Service Binding on Service Domains  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.service_binding_status_list_with_http_info(svc_binding_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str svc_binding_id: Service Binding ID (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :param str svc_domain_id: Service Domain ID
        :param str svc_instance_id: Service Instance ID
        :return: ServiceBindingStatusListPayload
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['svc_binding_id', 'authorization', 'page_index', 'page_size', 'order_by', 'filter', 'svc_domain_id', 'svc_instance_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 service_binding_status_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'svc_binding_id' is set
        if ('svc_binding_id' not in params or
                params['svc_binding_id'] is None):
            raise ValueError("Missing the required parameter `svc_binding_id` when calling `service_binding_status_list`")  # 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 `service_binding_status_list`")  # noqa: E501

        collection_formats = {}

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

        query_params = []
        if 'page_index' in params:
            query_params.append(('pageIndex', params['page_index']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501
        if 'order_by' in params:
            query_params.append(('orderBy', params['order_by']))  # noqa: E501
            collection_formats['orderBy'] = 'csv'  # noqa: E501
        if 'filter' in params:
            query_params.append(('filter', params['filter']))  # noqa: E501
        if 'svc_domain_id' in params:
            query_params.append(('svcDomainId', params['svc_domain_id']))  # noqa: E501
        if 'svc_instance_id' in params:
            query_params.append(('svcInstanceId', params['svc_instance_id']))  # noqa: E501

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

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/v1.0/servicebindings/{svcBindingId}/status', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServiceBindingStatusListPayload',  # 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)
