#!/usr/bin/env python
# coding: utf-8

"""
LDAPApi.py

  The Clear BSD License

  Copyright (c) – 2016, NetApp, Inc. All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  * Neither the name of NetApp, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

  NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
from __future__ import absolute_import

import sys
import os

# python 2 and python 3 compatibility library
from six import iteritems

from ....santricity.configuration import Configuration
from ....santricity.api_client import ApiClient


class LDAPApi(object):

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient(context_path='/devmgr/v2')
            self.api_client = config.api_client
    
    
    def get_ldap_configuration(self, system_id, **kwargs):
            """
            Retrieve the LDAP configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.get_ldap_configuration(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `get_ldap_configuration`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'GET',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def get_ldap_domain(self, system_id, id, **kwargs):
            """
            Retrieve a specific LDAP domain configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.get_ldap_domain(system_id, id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param str id:  (required)
    
            :return: LdapDomain
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `get_ldap_domain`")
    
    
    
            # verify the required parameter 'id' is set
            if ('id' not in params) or (params['id'] is None):
                raise ValueError("Missing the required parameter `id` when calling `get_ldap_domain`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap/{id}'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    
            if 'id' in params:
                path_params['id'] = params['id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'GET',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapDomain',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def get_role_permissions(self, system_id, **kwargs):
            """
            Get the user's current roles and list of role permissions.
            Mode: Both Embedded and Proxy.

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.get_role_permissions(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param bool all_users: 
    
            :return: RolesResponse
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'all_users']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `get_role_permissions`")
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap/roles'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            query_params = {}
    
            if 'all_users' in params:
                query_params['allUsers'] = params['all_users']
    

            header_params = {}
    

            form_params = []
            local_var_files = {}
    

            body_params = None
    

            # HTTP header `Accept`
            header_params['Accept'] = self.api_client.\
                select_header_accept(['application/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'GET',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='RolesResponse',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def new_ldap_domain(self, system_id, **kwargs):
            """
            Adds an LDAP domain to the existing configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.new_ldap_domain(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param LdapDomain body: 
    
            :param bool skip_test: 
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'body', 'skip_test']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `new_ldap_domain`")
    
    
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap/addDomain'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            query_params = {}
    
            if 'skip_test' in params:
                query_params['skipTest'] = params['skip_test']
    

            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/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def remove_ldap_domain(self, system_id, id, **kwargs):
            """
            Deletes the specified domain from the LDAP configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.remove_ldap_domain(system_id, id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param str id:  (required)
    
            :return: None
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `remove_ldap_domain`")
    
    
    
            # verify the required parameter 'id' is set
            if ('id' not in params) or (params['id'] is None):
                raise ValueError("Missing the required parameter `id` when calling `remove_ldap_domain`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap/{id}'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    
            if 'id' in params:
                path_params['id'] = params['id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'DELETE',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type=None,
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def set_ldap_configuration(self, system_id, **kwargs):
            """
            Sets the LDAP configuration for a single or multiple domains. Warning: This will remove previous configurations
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.set_ldap_configuration(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param LdapConfiguration body: 
    
            :param bool skip_test: 
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'body', 'skip_test']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `set_ldap_configuration`")
    
    
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            query_params = {}
    
            if 'skip_test' in params:
                query_params['skipTest'] = params['skip_test']
    

            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/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def test_ldap(self, system_id, **kwargs):
            """
            Tests current LDAP configuration. If no bind user is defined only a communication test will be performed
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.test_ldap(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :return: list[LdapDomainTestResponse]
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `test_ldap`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap/test'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='list[LdapDomainTestResponse]',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def update_ldap_domain(self, system_id, domain_id, **kwargs):
            """
            Updates LDAP configuration for a single domain
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.update_ldap_domain(system_id, domain_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param str domain_id: The id of the LDAP domain to be updated (required)
    
            :param LdapDomain body: 
    
            :param bool skip_test: 
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'domain_id', 'body', 'skip_test']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `update_ldap_domain`")
    
    
    
            # verify the required parameter 'domain_id' is set
            if ('domain_id' not in params) or (params['domain_id'] is None):
                raise ValueError("Missing the required parameter `domain_id` when calling `update_ldap_domain`")
    
    
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap/{domain-id}'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    
            if 'domain_id' in params:
                path_params['domain-id'] = params['domain_id']
    

            query_params = {}
    
            if 'skip_test' in params:
                query_params['skipTest'] = params['skip_test']
    

            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/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    










#!/usr/bin/env python
# coding: utf-8

"""
LDAPApi.py

  The Clear BSD License

  Copyright (c) – 2016, NetApp, Inc. All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  * Neither the name of NetApp, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

  NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
from __future__ import absolute_import

import sys
import os

# python 2 and python 3 compatibility library
from six import iteritems

from ....santricity.configuration import Configuration
from ....santricity.api_client import ApiClient


class LDAPApi(object):

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient(context_path='/devmgr/v2')
            self.api_client = config.api_client
    
    
    def get_ldap_configuration(self, system_id, **kwargs):
            """
            Retrieve the LDAP configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.get_ldap_configuration(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `get_ldap_configuration`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'GET',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def get_ldap_domain(self, system_id, id, **kwargs):
            """
            Retrieve a specific LDAP domain configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.get_ldap_domain(system_id, id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param str id:  (required)
    
            :return: LdapDomain
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `get_ldap_domain`")
    
    
    
            # verify the required parameter 'id' is set
            if ('id' not in params) or (params['id'] is None):
                raise ValueError("Missing the required parameter `id` when calling `get_ldap_domain`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap/{id}'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    
            if 'id' in params:
                path_params['id'] = params['id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'GET',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapDomain',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def get_role_permissions(self, system_id, **kwargs):
            """
            Get the user's current roles and list of role permissions.
            Mode: Both Embedded and Proxy.

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.get_role_permissions(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param bool all_users: 
    
            :return: RolesResponse
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'all_users']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `get_role_permissions`")
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap/roles'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            query_params = {}
    
            if 'all_users' in params:
                query_params['allUsers'] = params['all_users']
    

            header_params = {}
    

            form_params = []
            local_var_files = {}
    

            body_params = None
    

            # HTTP header `Accept`
            header_params['Accept'] = self.api_client.\
                select_header_accept(['application/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'GET',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='RolesResponse',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def new_ldap_domain(self, system_id, **kwargs):
            """
            Adds an LDAP domain to the existing configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.new_ldap_domain(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param LdapDomain body: 
    
            :param bool skip_test: 
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'body', 'skip_test']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `new_ldap_domain`")
    
    
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap/addDomain'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            query_params = {}
    
            if 'skip_test' in params:
                query_params['skipTest'] = params['skip_test']
    

            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/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def remove_ldap_domain(self, system_id, id, **kwargs):
            """
            Deletes the specified domain from the LDAP configuration
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.remove_ldap_domain(system_id, id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param str id:  (required)
    
            :return: None
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `remove_ldap_domain`")
    
    
    
            # verify the required parameter 'id' is set
            if ('id' not in params) or (params['id'] is None):
                raise ValueError("Missing the required parameter `id` when calling `remove_ldap_domain`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap/{id}'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    
            if 'id' in params:
                path_params['id'] = params['id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'DELETE',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type=None,
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def set_ldap_configuration(self, system_id, **kwargs):
            """
            Sets the LDAP configuration for a single or multiple domains. Warning: This will remove previous configurations
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.set_ldap_configuration(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param LdapConfiguration body: 
    
            :param bool skip_test: 
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'body', 'skip_test']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `set_ldap_configuration`")
    
    
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            query_params = {}
    
            if 'skip_test' in params:
                query_params['skipTest'] = params['skip_test']
    

            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/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def test_ldap(self, system_id, **kwargs):
            """
            Tests current LDAP configuration. If no bind user is defined only a communication test will be performed
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.test_ldap(system_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :return: list[LdapDomainTestResponse]
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `test_ldap`")
    
    

            resource_path = '/storage-systems/{system-id}/ldap/test'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    

            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'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='list[LdapDomainTestResponse]',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    
    def update_ldap_domain(self, system_id, domain_id, **kwargs):
            """
            Updates LDAP configuration for a single domain
            Mode: Embedded Only. 

            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please define a `callback` function
            to be invoked when receiving the response.
            >>> def callback_function(response):
            >>>     pprint(response)
            >>>
    
            >>> thread = api.update_ldap_domain(system_id, domain_id, callback=callback_function)
    
    

            :param callback function: The callback function
                for asynchronous request. (optional)
    
            :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)
    
            :param str domain_id: The id of the LDAP domain to be updated (required)
    
            :param LdapDomain body: 
    
            :param bool skip_test: 
    
            :return: LdapConfiguration
                     If the method is called asynchronously,
                     returns the request thread.
            :raises: ValueError
                       If the required params are not provided or if the response data format is unknown.
                     TypeError:
                        When the data type of response data is different from what we are expecting
                     ApiException:
                        Occurs when we get a HTTP error code (422 and above).

            """

            all_params = ['system_id', 'domain_id', 'body', 'skip_test']
            all_params.append('callback')

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

    
    
            # verify the required parameter 'system_id' is set
            if ('system_id' not in params) or (params['system_id'] is None):
                raise ValueError("Missing the required parameter `system_id` when calling `update_ldap_domain`")
    
    
    
            # verify the required parameter 'domain_id' is set
            if ('domain_id' not in params) or (params['domain_id'] is None):
                raise ValueError("Missing the required parameter `domain_id` when calling `update_ldap_domain`")
    
    
    
    
    
    

            resource_path = '/storage-systems/{system-id}/ldap/{domain-id}'.replace('{format}', 'json')
            path_params = {}
    
            if 'system_id' in params:
                path_params['system-id'] = params['system_id']
    
            if 'domain_id' in params:
                path_params['domain-id'] = params['domain_id']
    

            query_params = {}
    
            if 'skip_test' in params:
                query_params['skipTest'] = params['skip_test']
    

            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/json'])
            if not header_params['Accept']:
                del header_params['Accept']

            # HTTP header `Content-Type`
            header_params['Content-Type'] = self.api_client.\
                select_header_content_type(['application/json'])

            # Authentication setting
            auth_settings = ['basicAuth']

            response = self.api_client.call_api(resource_path, 'POST',
                                                path_params,
                                                query_params,
                                                header_params,
                                                body=body_params,
                                                post_params=form_params,
                                                files=local_var_files,
                                                response_type='LdapConfiguration',
                                                auth_settings=auth_settings,
                                                callback=params.get('callback'))
            return response
    










#!/usr/bin/env python # coding: utf-8 LDAPApi.py    The Clear BSD License    Copyright (c) – 2016, NetApp, Inc. All rights reserved.    Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.    * Neither the name of NetApp, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.    NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # python 2 and python 3 compatibility library Retrieve the LDAP configuration             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.get_ldap_configuration(system_id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :return: LdapConfiguration                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Retrieve a specific LDAP domain configuration             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.get_ldap_domain(system_id, id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :param str id:  (required)                  :return: LdapDomain                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # verify the required parameter 'id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Get the user's current roles and list of role permissions.             Mode: Both Embedded and Proxy.              This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.get_role_permissions(system_id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :param bool all_users:                   :return: RolesResponse                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Adds an LDAP domain to the existing configuration             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.new_ldap_domain(system_id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :param LdapDomain body:                   :param bool skip_test:                   :return: LdapConfiguration                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Deletes the specified domain from the LDAP configuration             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.remove_ldap_domain(system_id, id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :param str id:  (required)                  :return: None                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # verify the required parameter 'id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Sets the LDAP configuration for a single or multiple domains. Warning: This will remove previous configurations             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.set_ldap_configuration(system_id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :param LdapConfiguration body:                   :param bool skip_test:                   :return: LdapConfiguration                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Tests current LDAP configuration. If no bind user is defined only a communication test will be performed             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.test_ldap(system_id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :return: list[LdapDomainTestResponse]                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting Updates LDAP configuration for a single domain             Mode: Embedded Only.               This method makes a synchronous HTTP request by default. To make an             asynchronous HTTP request, please define a `callback` function             to be invoked when receiving the response.             >>> def callback_function(response):             >>>     pprint(response)             >>>                  >>> thread = api.update_ldap_domain(system_id, domain_id, callback=callback_function)                        :param callback function: The callback function                 for asynchronous request. (optional)                  :param str system_id: The unique identifier of the storage-system. This may be the id or the WWN. (required)                  :param str domain_id: The id of the LDAP domain to be updated (required)                  :param LdapDomain body:                   :param bool skip_test:                   :return: LdapConfiguration                      If the method is called asynchronously,                      returns the request thread.             :raises: ValueError                        If the required params are not provided or if the response data format is unknown.                      TypeError:                         When the data type of response data is different from what we are expecting                      ApiException:                         Occurs when we get a HTTP error code (422 and above). # verify the required parameter 'system_id' is set # verify the required parameter 'domain_id' is set # HTTP header `Accept` # HTTP header `Content-Type` # Authentication setting