# coding: utf-8

"""
    herd

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    OpenAPI spec version: 0.178.0-SNAPSHOT
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from herdsdk.api_client import ApiClient


class SecurityRoleToFunctionMappingApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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

    def security_role_to_function_mapping_create_security_role_function(self, security_role_function_create_request, **kwargs):  # noqa: E501
        """createSecurityRoleFunction  # noqa: E501

        Creates a new security role to function mapping that is identified by security role name and security function name.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_create_security_role_function(security_role_function_create_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SecurityRoleFunctionCreateRequest security_role_function_create_request: the information needed to create a security role to function mapping (required)
        :return: SecurityRoleFunction
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.security_role_to_function_mapping_create_security_role_function_with_http_info(security_role_function_create_request, **kwargs)  # noqa: E501
        else:
            (data) = self.security_role_to_function_mapping_create_security_role_function_with_http_info(security_role_function_create_request, **kwargs)  # noqa: E501
            return data

    def security_role_to_function_mapping_create_security_role_function_with_http_info(self, security_role_function_create_request, **kwargs):  # noqa: E501
        """createSecurityRoleFunction  # noqa: E501

        Creates a new security role to function mapping that is identified by security role name and security function name.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_create_security_role_function_with_http_info(security_role_function_create_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SecurityRoleFunctionCreateRequest security_role_function_create_request: the information needed to create a security role to function mapping (required)
        :return: SecurityRoleFunction
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

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

    def security_role_to_function_mapping_delete_security_role_function(self, security_role_name, security_function_name, **kwargs):  # noqa: E501
        """deleteSecurityRoleFunction  # noqa: E501

        Deletes an existing security role to function mapping based on the specified parameters.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_delete_security_role_function(security_role_name, security_function_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_role_name: the security role name (required)
        :param str security_function_name: the security function name (required)
        :return: SecurityRoleFunction
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.security_role_to_function_mapping_delete_security_role_function_with_http_info(security_role_name, security_function_name, **kwargs)  # noqa: E501
        else:
            (data) = self.security_role_to_function_mapping_delete_security_role_function_with_http_info(security_role_name, security_function_name, **kwargs)  # noqa: E501
            return data

    def security_role_to_function_mapping_delete_security_role_function_with_http_info(self, security_role_name, security_function_name, **kwargs):  # noqa: E501
        """deleteSecurityRoleFunction  # noqa: E501

        Deletes an existing security role to function mapping based on the specified parameters.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_delete_security_role_function_with_http_info(security_role_name, security_function_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_role_name: the security role name (required)
        :param str security_function_name: the security function name (required)
        :return: SecurityRoleFunction
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'security_role_name' in local_var_params:
            path_params['securityRoleName'] = local_var_params['security_role_name']  # noqa: E501
        if 'security_function_name' in local_var_params:
            path_params['securityFunctionName'] = local_var_params['security_function_name']  # 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 = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/securityRoleFunctions/securityRoleNames/{securityRoleName}/securityFunctionNames/{securityFunctionName}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SecurityRoleFunction',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def security_role_to_function_mapping_get_security_role_function(self, security_role_name, security_function_name, **kwargs):  # noqa: E501
        """getSecurityRoleFunction  # noqa: E501

        Retrieves an existing security role to function mapping based on the specified parameters.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_function(security_role_name, security_function_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_role_name: the security role name (required)
        :param str security_function_name: the security function name (required)
        :return: SecurityRoleFunction
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.security_role_to_function_mapping_get_security_role_function_with_http_info(security_role_name, security_function_name, **kwargs)  # noqa: E501
        else:
            (data) = self.security_role_to_function_mapping_get_security_role_function_with_http_info(security_role_name, security_function_name, **kwargs)  # noqa: E501
            return data

    def security_role_to_function_mapping_get_security_role_function_with_http_info(self, security_role_name, security_function_name, **kwargs):  # noqa: E501
        """getSecurityRoleFunction  # noqa: E501

        Retrieves an existing security role to function mapping based on the specified parameters.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_function_with_http_info(security_role_name, security_function_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_role_name: the security role name (required)
        :param str security_function_name: the security function name (required)
        :return: SecurityRoleFunction
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'security_role_name' in local_var_params:
            path_params['securityRoleName'] = local_var_params['security_role_name']  # noqa: E501
        if 'security_function_name' in local_var_params:
            path_params['securityFunctionName'] = local_var_params['security_function_name']  # 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 = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/securityRoleFunctions/securityRoleNames/{securityRoleName}/securityFunctionNames/{securityFunctionName}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SecurityRoleFunction',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

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

        Retrieves a list of security role to function mapping keys for all security role to function mappings registered in the system. The result list is sorted by security role name and security function name in ascending order.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_functions(async_req=True)
        >>> result = thread.get()

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

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

        Retrieves a list of security role to function mapping keys for all security role to function mappings registered in the system. The result list is sorted by security role name and security function name in ascending order.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_functions_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: SecurityRoleFunctionKeys
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method security_role_to_function_mapping_get_security_role_functions" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        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 = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/securityRoleFunctions', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SecurityRoleFunctionKeys',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def security_role_to_function_mapping_get_security_role_functions_by_security_function(self, security_function_name, **kwargs):  # noqa: E501
        """getSecurityRoleFunctionsBySecurityFunction  # noqa: E501

        Retrieves a list of security role to function mapping keys for the specified security function. The result list is sorted by security role name in ascending order.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_functions_by_security_function(security_function_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_function_name: the security function name (required)
        :return: SecurityRoleFunctionKeys
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.security_role_to_function_mapping_get_security_role_functions_by_security_function_with_http_info(security_function_name, **kwargs)  # noqa: E501
        else:
            (data) = self.security_role_to_function_mapping_get_security_role_functions_by_security_function_with_http_info(security_function_name, **kwargs)  # noqa: E501
            return data

    def security_role_to_function_mapping_get_security_role_functions_by_security_function_with_http_info(self, security_function_name, **kwargs):  # noqa: E501
        """getSecurityRoleFunctionsBySecurityFunction  # noqa: E501

        Retrieves a list of security role to function mapping keys for the specified security function. The result list is sorted by security role name in ascending order.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_functions_by_security_function_with_http_info(security_function_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_function_name: the security function name (required)
        :return: SecurityRoleFunctionKeys
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'security_function_name' in local_var_params:
            path_params['securityFunctionName'] = local_var_params['security_function_name']  # 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 = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/securityRoleFunctions/securityFunctionNames/{securityFunctionName}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SecurityRoleFunctionKeys',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def security_role_to_function_mapping_get_security_role_functions_by_security_role(self, security_role_name, **kwargs):  # noqa: E501
        """getSecurityRoleFunctionsBySecurityRole  # noqa: E501

        Retrieves a list of security role to function mapping keys for the specified security role. The result list is sorted by security function name in ascending order.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_functions_by_security_role(security_role_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_role_name: the security role name (required)
        :return: SecurityRoleFunctionKeys
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.security_role_to_function_mapping_get_security_role_functions_by_security_role_with_http_info(security_role_name, **kwargs)  # noqa: E501
        else:
            (data) = self.security_role_to_function_mapping_get_security_role_functions_by_security_role_with_http_info(security_role_name, **kwargs)  # noqa: E501
            return data

    def security_role_to_function_mapping_get_security_role_functions_by_security_role_with_http_info(self, security_role_name, **kwargs):  # noqa: E501
        """getSecurityRoleFunctionsBySecurityRole  # noqa: E501

        Retrieves a list of security role to function mapping keys for the specified security role. The result list is sorted by security function name in ascending order.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.security_role_to_function_mapping_get_security_role_functions_by_security_role_with_http_info(security_role_name, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str security_role_name: the security role name (required)
        :return: SecurityRoleFunctionKeys
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'security_role_name' in local_var_params:
            path_params['securityRoleName'] = local_var_params['security_role_name']  # 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 = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/securityRoleFunctions/securityRoleNames/{securityRoleName}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SecurityRoleFunctionKeys',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
