<gh_stars>1-10
# coding: utf-8

"""
    Eclipse Kapua REST API

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

    OpenAPI spec version: 1.0
    
    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 swagger_client.api_client import ApiClient


class CredentialsApi(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 credential_count(self, scope_id, body, **kwargs):  # noqa: E501
        """Counts the Credentials  # noqa: E501

        Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_count(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results (required)
        :param CredentialQuery body: The CredentialQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_count_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_count_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def credential_count_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Counts the Credentials  # noqa: E501

        Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_count_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results (required)
        :param CredentialQuery body: The CredentialQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/_count', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CountResult',  # 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 credential_create(self, scope_id, body, **kwargs):  # noqa: E501
        """Create a Credential  # noqa: E501

        Creates a new Credential based on the information provided in CredentialCreator parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_create(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to create the Credential (required)
        :param CredentialCreator body: Provides the information for the new Credential to be created (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_create_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_create_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def credential_create_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Create a Credential  # noqa: E501

        Creates a new Credential based on the information provided in CredentialCreator parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_create_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to create the Credential (required)
        :param CredentialCreator body: Provides the information for the new Credential to be created (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Credential',  # 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 credential_delete(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Delete a Credential  # noqa: E501

        Deletes the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_delete(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_delete_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_delete_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
            return data

    def credential_delete_with_http_info(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Delete a Credential  # noqa: E501

        Deletes the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_delete_with_http_info(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 credential_find(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Get a Credential  # noqa: E501

        Returns the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_find(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_find_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_find_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
            return data

    def credential_find_with_http_info(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Get a Credential  # noqa: E501

        Returns the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_find_with_http_info(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Credential',  # 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 credential_query(self, scope_id, body, **kwargs):  # noqa: E501
        """Queries the Credentials  # noqa: E501

        Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_query(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param CredentialQuery body: The CredentialQuery to use to filter results. (required)
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_query_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_query_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def credential_query_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Queries the Credentials  # noqa: E501

        Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_query_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param CredentialQuery body: The CredentialQuery to use to filter results. (required)
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/_query', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CredentialListResult',  # 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 credential_simple_query(self, scope_id, limit, **kwargs):  # noqa: E501
        """Gets the Credential list in the scope  # noqa: E501

        Returns the list of all the credentials associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_simple_query(scope_id, limit, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param int limit: The result set limit. (required)
        :param str user_id: The optional id to filter results.
        :param int offset: The result set offset.
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_simple_query_with_http_info(scope_id, limit, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_simple_query_with_http_info(scope_id, limit, **kwargs)  # noqa: E501
            return data

    def credential_simple_query_with_http_info(self, scope_id, limit, **kwargs):  # noqa: E501
        """Gets the Credential list in the scope  # noqa: E501

        Returns the list of all the credentials associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_simple_query_with_http_info(scope_id, limit, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param int limit: The result set limit. (required)
        :param str user_id: The optional id to filter results.
        :param int offset: The result set offset.
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'user_id' in params:
            query_params.append(('userId', params['user_id']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/{scopeId}/credentials', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CredentialListResult',  # 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 credential_unlock(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Unlock a Credential  # noqa: E501

        Unlocks a Credential that has been locked due to a lockout policy.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_unlock(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be unlocked (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_unlock_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_unlock_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
            return data

    def credential_unlock_with_http_info(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Unlock a Credential  # noqa: E501

        Unlocks a Credential that has been locked due to a lockout policy.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_unlock_with_http_info(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be unlocked (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}/unlock', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 credential_update(self, scope_id, credential_id, body, **kwargs):  # noqa: E501
        """Update an Credential  # noqa: E501

        Updates a new Credential based on the information provided in the Credential parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_update(scope_id, credential_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :param Credential body: The modified Credential whose attributed need to be updated (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_update_with_http_info(scope_id, credential_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_update_with_http_info(scope_id, credential_id, body, **kwargs)  # noqa: E501
            return data

    def credential_update_with_http_info(self, scope_id, credential_id, body, **kwargs):  # noqa: E501
        """Update an Credential  # noqa: E501

        Updates a new Credential based on the information provided in the Credential parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_update_with_http_info(scope_id, credential_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :param Credential body: The modified Credential whose attributed need to be updated (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Credential',  # 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)

# coding: utf-8

"""
    Eclipse Kapua REST API

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

    OpenAPI spec version: 1.0
    
    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 swagger_client.api_client import ApiClient


class CredentialsApi(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 credential_count(self, scope_id, body, **kwargs):  # noqa: E501
        """Counts the Credentials  # noqa: E501

        Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_count(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results (required)
        :param CredentialQuery body: The CredentialQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_count_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_count_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def credential_count_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Counts the Credentials  # noqa: E501

        Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_count_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results (required)
        :param CredentialQuery body: The CredentialQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/_count', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CountResult',  # 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 credential_create(self, scope_id, body, **kwargs):  # noqa: E501
        """Create a Credential  # noqa: E501

        Creates a new Credential based on the information provided in CredentialCreator parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_create(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to create the Credential (required)
        :param CredentialCreator body: Provides the information for the new Credential to be created (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_create_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_create_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def credential_create_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Create a Credential  # noqa: E501

        Creates a new Credential based on the information provided in CredentialCreator parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_create_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to create the Credential (required)
        :param CredentialCreator body: Provides the information for the new Credential to be created (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Credential',  # 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 credential_delete(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Delete a Credential  # noqa: E501

        Deletes the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_delete(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_delete_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_delete_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
            return data

    def credential_delete_with_http_info(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Delete a Credential  # noqa: E501

        Deletes the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_delete_with_http_info(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 credential_find(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Get a Credential  # noqa: E501

        Returns the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_find(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_find_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_find_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
            return data

    def credential_find_with_http_info(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Get a Credential  # noqa: E501

        Returns the Credential specified by the \"credentialId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_find_with_http_info(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Credential',  # 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 credential_query(self, scope_id, body, **kwargs):  # noqa: E501
        """Queries the Credentials  # noqa: E501

        Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_query(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param CredentialQuery body: The CredentialQuery to use to filter results. (required)
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_query_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_query_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def credential_query_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Queries the Credentials  # noqa: E501

        Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_query_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param CredentialQuery body: The CredentialQuery to use to filter results. (required)
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/_query', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CredentialListResult',  # 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 credential_simple_query(self, scope_id, limit, **kwargs):  # noqa: E501
        """Gets the Credential list in the scope  # noqa: E501

        Returns the list of all the credentials associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_simple_query(scope_id, limit, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param int limit: The result set limit. (required)
        :param str user_id: The optional id to filter results.
        :param int offset: The result set offset.
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_simple_query_with_http_info(scope_id, limit, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_simple_query_with_http_info(scope_id, limit, **kwargs)  # noqa: E501
            return data

    def credential_simple_query_with_http_info(self, scope_id, limit, **kwargs):  # noqa: E501
        """Gets the Credential list in the scope  # noqa: E501

        Returns the list of all the credentials associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_simple_query_with_http_info(scope_id, limit, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param int limit: The result set limit. (required)
        :param str user_id: The optional id to filter results.
        :param int offset: The result set offset.
        :return: CredentialListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'user_id' in params:
            query_params.append(('userId', params['user_id']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/{scopeId}/credentials', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CredentialListResult',  # 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 credential_unlock(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Unlock a Credential  # noqa: E501

        Unlocks a Credential that has been locked due to a lockout policy.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_unlock(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be unlocked (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_unlock_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_unlock_with_http_info(scope_id, credential_id, **kwargs)  # noqa: E501
            return data

    def credential_unlock_with_http_info(self, scope_id, credential_id, **kwargs):  # noqa: E501
        """Unlock a Credential  # noqa: E501

        Unlocks a Credential that has been locked due to a lockout policy.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_unlock_with_http_info(scope_id, credential_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Credential to delete. (required)
        :param str credential_id: The id of the Credential to be unlocked (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}/unlock', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 credential_update(self, scope_id, credential_id, body, **kwargs):  # noqa: E501
        """Update an Credential  # noqa: E501

        Updates a new Credential based on the information provided in the Credential parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_update(scope_id, credential_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :param Credential body: The modified Credential whose attributed need to be updated (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.credential_update_with_http_info(scope_id, credential_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.credential_update_with_http_info(scope_id, credential_id, body, **kwargs)  # noqa: E501
            return data

    def credential_update_with_http_info(self, scope_id, credential_id, body, **kwargs):  # noqa: E501
        """Update an Credential  # noqa: E501

        Updates a new Credential based on the information provided in the Credential parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.credential_update_with_http_info(scope_id, credential_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Credential. (required)
        :param str credential_id: The id of the requested Credential (required)
        :param Credential body: The modified Credential whose attributed need to be updated (required)
        :return: Credential
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'credential_id' in params:
            path_params['credentialId'] = params['credential_id']  # noqa: E501

        query_params = []

        header_params = {}

        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/xml', 'application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/xml', 'application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/{scopeId}/credentials/{credentialId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Credential',  # 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)
# coding: utf-8 Eclipse Kapua REST API      No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501      OpenAPI spec version: 1.0          Generated by: https://github.com/swagger-api/swagger-codegen.git # noqa: F401 # python 2 and python 3 compatibility library 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 # noqa: E501 Counts the Credentials  # noqa: E501          Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_count(scope_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to count results (required)         :param CredentialQuery body: The CredentialQuery to use to filter count results (required)         :return: CountResult                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Counts the Credentials  # noqa: E501          Counts the Credentials with the given CredentialQuery parameter returning the number of matching Credentials  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_count_with_http_info(scope_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to count results (required)         :param CredentialQuery body: The CredentialQuery to use to filter count results (required)         :return: CountResult                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'body' is set # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # HTTP header `Content-Type` # noqa: E501 # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Create a Credential  # noqa: E501          Creates a new Credential based on the information provided in CredentialCreator parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_create(scope_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to create the Credential (required)         :param CredentialCreator body: Provides the information for the new Credential to be created (required)         :return: Credential                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Create a Credential  # noqa: E501          Creates a new Credential based on the information provided in CredentialCreator parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_create_with_http_info(scope_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to create the Credential (required)         :param CredentialCreator body: Provides the information for the new Credential to be created (required)         :return: Credential                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'body' is set # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # HTTP header `Content-Type` # noqa: E501 # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Delete a Credential  # noqa: E501          Deletes the Credential specified by the \"credentialId\" path parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_delete(scope_id, credential_id, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the Credential to delete. (required)         :param str credential_id: The id of the Credential to be deleted (required)         :return: None                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Delete a Credential  # noqa: E501          Deletes the Credential specified by the \"credentialId\" path parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_delete_with_http_info(scope_id, credential_id, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the Credential to delete. (required)         :param str credential_id: The id of the Credential to be deleted (required)         :return: None                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'credential_id' is set # noqa: E501 # noqa: E501 # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Get a Credential  # noqa: E501          Returns the Credential specified by the \"credentialId\" path parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_find(scope_id, credential_id, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the requested Credential. (required)         :param str credential_id: The id of the requested Credential (required)         :return: Credential                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Get a Credential  # noqa: E501          Returns the Credential specified by the \"credentialId\" path parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_find_with_http_info(scope_id, credential_id, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the requested Credential. (required)         :param str credential_id: The id of the requested Credential (required)         :return: Credential                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'credential_id' is set # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Queries the Credentials  # noqa: E501          Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_query(scope_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to search results. (required)         :param CredentialQuery body: The CredentialQuery to use to filter results. (required)         :return: CredentialListResult                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Queries the Credentials  # noqa: E501          Queries the Credentials with the given CredentialQuery parameter returning all matching Credentials  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_query_with_http_info(scope_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to search results. (required)         :param CredentialQuery body: The CredentialQuery to use to filter results. (required)         :return: CredentialListResult                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'body' is set # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # HTTP header `Content-Type` # noqa: E501 # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Gets the Credential list in the scope  # noqa: E501          Returns the list of all the credentials associated to the current selected scope.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_simple_query(scope_id, limit, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to search results. (required)         :param int limit: The result set limit. (required)         :param str user_id: The optional id to filter results.         :param int offset: The result set offset.         :return: CredentialListResult                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Gets the Credential list in the scope  # noqa: E501          Returns the list of all the credentials associated to the current selected scope.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_simple_query_with_http_info(scope_id, limit, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId in which to search results. (required)         :param int limit: The result set limit. (required)         :param str user_id: The optional id to filter results.         :param int offset: The result set offset.         :return: CredentialListResult                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'limit' is set # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Unlock a Credential  # noqa: E501          Unlocks a Credential that has been locked due to a lockout policy.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_unlock(scope_id, credential_id, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the Credential to delete. (required)         :param str credential_id: The id of the Credential to be unlocked (required)         :return: None                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Unlock a Credential  # noqa: E501          Unlocks a Credential that has been locked due to a lockout policy.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_unlock_with_http_info(scope_id, credential_id, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the Credential to delete. (required)         :param str credential_id: The id of the Credential to be unlocked (required)         :return: None                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'credential_id' is set # noqa: E501 # noqa: E501 # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 Update an Credential  # noqa: E501          Updates a new Credential based on the information provided in the Credential parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_update(scope_id, credential_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the requested Credential. (required)         :param str credential_id: The id of the requested Credential (required)         :param Credential body: The modified Credential whose attributed need to be updated (required)         :return: Credential                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # noqa: E501 # noqa: E501 Update an Credential  # noqa: E501          Updates a new Credential based on the information provided in the Credential parameter.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True         >>> thread = api.credential_update_with_http_info(scope_id, credential_id, body, async_req=True)         >>> result = thread.get()          :param async_req bool         :param str scope_id: The ScopeId of the requested Credential. (required)         :param str credential_id: The id of the requested Credential (required)         :param Credential body: The modified Credential whose attributed need to be updated (required)         :return: Credential                  If the method is called asynchronously,                  returns the request thread. # noqa: E501 # verify the required parameter 'scope_id' is set # noqa: E501 # verify the required parameter 'credential_id' is set # noqa: E501 # verify the required parameter 'body' is set # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # HTTP header `Content-Type` # noqa: E501 # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501