Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pyo

�
�Udac@`s�dZddlmZmZmZeZidd6dgd6dd6Zd	Zd
Z	dZ
ddlZddlj
jZdd
lmZddlmZddlmZej�Zdefd��YZd�Zedkr�e�ndS(sw
(c) 2018-2019, NetApp, Inc
GNU General Public License v3.0+
(see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�

module: na_ontap_ldap_client

short_description: NetApp ONTAP LDAP client
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.9'
author: Milan Zink (@zeten30) <[email protected]>/<[email protected]>

description:
- Create, modify or delete LDAP client on NetApp ONTAP

options:

  state:
    description:
    - Whether the specified LDAP client configuration exist or not.
    choices: ['present', 'absent']
    default: 'present'
    type: str

  vserver:
    description:
    - vserver/svm that holds LDAP client configuration
    required: true
    type: str

  name:
    description:
    - The name of LDAP client configuration
    required: true
    type: str

  ldap_servers:
    description:
    - Comma separated list of LDAP servers. FQDN's or IP addresses
    - Required if I(state=present).
    type: list

  schema:
    description:
    - LDAP schema
    - Required if I(state=present).
    choices: ['AD-IDMU', 'AD-SFU', 'MS-AD-BIS', 'RFC-2307']
    type: str

  base_dn:
    description:
    - LDAP base DN
    type: str

  base_scope:
    description:
    - LDAP search scope
    choices: ['subtree', 'onelevel', 'base']
    type: str

  port:
    description:
    - LDAP server port
    type: int

  query_timeout:
    description:
    - LDAP server query timeout
    type: int

  min_bind_level:
    description:
    - Minimal LDAP server bind level.
    choices: ['anonymous', 'simple', 'sasl']
    type: str

  bind_dn:
    description:
    - LDAP bind user DN
    type: str

  bind_password:
    description:
    - LDAP bind user password
    type: str

  use_start_tls:
    description:
    - Start TLS on LDAP connection
    choices: ['true', 'false']
    type: str

  referral_enabled:
    description:
    - LDAP Referral Chasing
    choices: ['true', 'false']
    type: str

  session_security:
    description:
    - Client Session Security
    choices: ['true', 'false']
    type: str
s�

    - name: Create LDAP client
      na_ontap_ldap_client:
        state:         present
        name:          'example_ldap'
        vserver:       'vserver1'
        ldap_servers:  'ldap1.example.company.com,ldap2.example.company.com'
        base_dn:       'dc=example,dc=company,dc=com'
        hostname:      "{{ netapp_hostname }}"
        username:      "{{ netapp_username }}"
        password:      "{{ netapp_password }}"

t
N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppOntapLDAPClientcB`sJeZdZd�Zddd�Zd�Zd�Zd�Zd�Z	RS(s&
    LDAP Client definition class
    c%C`s�tj�|_|jjtdtdtdd�dtdtddddd	d
g�dtdtdddd�dtdddtddd
t�dtdtdd�dtdddggdd�dtdtddddddg�dtdtdddd�dtdtdddd�dtdtdddddg�dtdddggddddddd d!d"g�d#tdtdddddg�dtdtddd$gdd�d%tdtdddddg�d&tdtdd���td'|jd(tdddddgfg�|_	t
�|_|jj|j	j
�|_ttkro|j	jd)d*�n%tjd+|j	d&|jd&�|_ddddddddd#d%g
|_dS(,Ntbase_dntrequiredttypetstrt
base_scopetdefaulttchoicestsubtreetoneleveltbasetbind_dnt
bind_passwordtno_logtnametldap_serverstrequired_iftstatetpresenttlisttmin_bind_levelt	anonymoustsimpletsasltporttintt
query_timeouttreferral_enabledttruetfalsetschemasAD-IDMUsAD-SFUs	MS-AD-BISsRFC-2307tsession_securitytabsentt
use_start_tlstvservert
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specR/tupdatetdicttFalsetNonetTrueR	R2Rt	na_helpertset_parameterstparamst
parameterstHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitservertsimple_attributes(tself((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pyt__init__�sJ$!$!6!!!	
%c
C`s?tjjd�}|d"kr.|jd}n|d"krCd}ntjjjdi|d6|d6�}tjjd�}|j|�|j|�|jj|dt	�}d"}|j
d	�r;t|jd	��d
kr;|j
d�}|j
d�}t
�}	|j
d�}
|
d"k	rR|
j�}x$|D]}|	j|j��q2Wni|jd�d6|jd�d
6|jd�d6|jd�d6|jd�d6|jd�d6|jd�d6|jd�d6|jd�d6|jd�d6|jd�d6|jd�d6|jd �d!6|jd�d6}n|S(#s�
        Checks if LDAP client config exists.

        :return:
            ldap client config object if found
            None if not found
        :rtype: object/None
        sldap-client-get-iterRt*sldap-clientsldap-client-configR.tquerytenable_tunnelingsnum-recordsisattributes-listsldap-serversRsbase-dnR
s
base-scopeRsbind-dnRs
bind-passwordRsmin-bind-levelR R$s
query-timeoutR&sreferral-enabledR'R*ssession-securityR+s
use-start-tlsR-N(R3tzapit	NaElementR8R=tcreate_node_with_childrentadd_child_elemRAtinvoke_successfullyR7tget_child_by_nameR%tget_child_contentRtget_childrentappendtget_content(
RCtclient_config_nametvserver_nametclient_config_infot
query_detailsRFtresulttclient_config_detailstattributes_listtldap_server_listtget_listRtldap_server((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pytget_ldap_client�sH
	

*	
cC`sCtjjd�}x%|jdD]}|jd|�q Wi|jdd6|jdd6}xO|jD]D}|jj|�dk	rf|j||t|�j	dd�<qfqfWtjjj
d	|�}|j|�y|jj
|d
t�WnOtjjk
r>}|jjdd|jdt|�fd
tj��nXdS(s2
        Create LDAP client configuration
        sldap-serversRtstringRsldap-client-configR*t_t-sldap-client-createRGR1s!Error creating LDAP client %s: %st	exceptionN(R3RHRIR=t
add_new_childRBtgetR8RtreplaceRJRKRARLR9t
NaApiErrorR2R?R
t	tracebackt
format_exc(RCtldap_servers_elementtldap_server_nametoptionst	attributetldap_client_createterrcatch((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pytcreate_ldap_clients *
)cC`s�tjjjdi|jdd6�}y|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fdtj
��nXdS(	s2
        Delete LDAP client configuration
        sldap-client-deleteRsldap-client-configRGR1s/Error deleting LDAP client configuration %s: %sR`N(R3RHRIRJR=RARLR9RdR2R?R
ReRf(RCtldap_client_deleteRl((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pytdelete_ldap_client scC`s;tjjd�}|jd|jd�x�|D]�}|dkr�tjjd�}x%|jdD]}|jd|�qbW|j|�n||jkr0|jt|�jdd�|j|�q0q0Wy|j	j
|d	t�WnOtjjk
r6}|j
jd
d|jdt|�fdtj��nXd
S(sU
        Modify LDAP client
        :param modify: list of modify attributes
        sldap-client-modifysldap-client-configRRsldap-serversR]R^R_RGR1s"Error modifying LDAP client %s: %sR`N(R3RHRIRaR=RKRBRRcRARLR9RdR2R?R
ReRf(RCtmodifytldap_client_modifyRjRgRhRl((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pytmodify_ldap_client-s
0)cC`s�|j�}|jj||j�}|jj||j�}tjd|j�|jjr�|j	j
rjq�|dkr�|j�q�|dkr�|j�q�|r�|j
|�q�n|j	jd|jj�dS(s%Call create/modify/delete operations.tna_ontap_ldap_clienttcreatetdeletetchangedN(R\R:t
get_cd_actionR=tget_modified_attributesR3t
ems_log_eventRARvR2t
check_modeRmRoRrt	exit_json(RCtcurrentt	cd_actionRp((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pytapplyHs

N(
t__name__t
__module__t__doc__RDR8R\RmRoRrR~(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pyR�s	/;	 	
	cC`st�}|j�dS(sONTAP LDAP client configurationN(RR~(t
ldapclient((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pytmain`s	t__main__(R�t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRetansible.module_utils.netapptmodule_utilstnetappR3tansible.module_utils.basicR	tansible.module_utils._textR
t"ansible.module_utils.netapp_moduleRthas_netapp_libR>tobjectRR�R(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_ldap_client.pyt<module>s$


g�	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]