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_elementsw_account.pyo

�
�Udac@`s�dZddlmZmZmZeZidd6dgd6dd6Zd	Zd
Z	dZ
ddlZdd
lm
Z
ddlmZddljjZddlmZej�Zdefd��YZd�Zedkr�e�ndS(s"
Element Software Account Manager
i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bysn

module: na_elementsw_account

short_description: NetApp Element Software Manage Accounts
extends_documentation_fragment:
    - netapp.solidfire
version_added: '2.7'
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Create, destroy, or update accounts on Element SW

options:

    state:
        description:
        - Whether the specified account should exist or not.
        required: true
        choices: ['present', 'absent']

    element_username:
        description:
        - Unique username for this account. (May be 1 to 64 characters in length).
        required: true
        aliases:
        - account_id

    from_name:
        description:
        - ID or Name of the account to rename.
        - Required to create an account called 'element_username' by renaming 'from_name'.
        version_added: '2.8'

    initiator_secret:
        description:
        - CHAP secret to use for the initiator. Should be 12-16 characters long and impenetrable.
        - The CHAP initiator secrets must be unique and cannot be the same as the target CHAP secret.
        - If not specified, a random secret is created.

    target_secret:
        description:
        - CHAP secret to use for the target (mutual CHAP authentication).
        - Should be 12-16 characters long and impenetrable.
        - The CHAP target secrets must be unique and cannot be the same as the initiator CHAP secret.
        - If not specified, a random secret is created.

    attributes:
        description: List of Name/Value pairs in JSON object format.

    status:
        description:
        - Status of the account.

s�
- name: Create Account
  na_elementsw_account:
    hostname: "{{ elementsw_hostname }}"
    username: "{{ elementsw_username }}"
    password: "{{ elementsw_password }}"
    state: present
    element_username: TenantA

- name: Modify Account
  na_elementsw_account:
    hostname: "{{ elementsw_hostname }}"
    username: "{{ elementsw_username }}"
    password: "{{ elementsw_password }}"
    state: present
    status: locked
    element_username: TenantA

- name: Rename Account
  na_elementsw_account:
    hostname: "{{ elementsw_hostname }}"
    username: "{{ elementsw_username }}"
    password: "{{ elementsw_password }}"
    state: present
    element_username: TenantA_Renamed
    from_name: TenantA

- name: Rename and modify Account
  na_elementsw_account:
    hostname: "{{ elementsw_hostname }}"
    username: "{{ elementsw_username }}"
    password: "{{ elementsw_password }}"
    state: present
    status: locked
    element_username: TenantA_Renamed
    from_name: TenantA

- name: Delete Account
  na_elementsw_account:
    hostname: "{{ elementsw_hostname }}"
    username: "{{ elementsw_username }}"
    password: "{{ elementsw_password }}"
    state: absent
    element_username: TenantA_Renamed
s

N(t
AnsibleModule(t	to_native(tNaElementSWModuletElementSWAccountcB`sMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s
    Element SW Account
    cC`stj�|_|jjtdtdtdddg�dtdtddgd	d
�dtdtdd�d
tdtd	d
dt�dtdtd	d
dt�dtdtd	d�dtdtd	d
���td|jdt�|_	|j	j
}|jd�|_|jd�|_
|jd�|_|jd
�|_|jd�|_|jd�|_|jd�|_ttkr�|j	jdd�ntjd|j	�|_t|j�|_|jdk	r�|jj|jjdd��n|jjdd�|_dS(Ntstatetrequiredtchoicestpresenttabsenttelement_usernametaliasest
account_idttypetstrt	from_nametdefaulttinitiator_secrettno_logt
target_secrett
attributestdictRt
argument_spectsupports_check_modetmsgs*Unable to import the Element SW Python SDKtmoduletsourcetna_elementsw_account(tnetapp_utilstontap_sf_host_argument_specRtupdateRtTruetFalsetNoneRR tparamstgetRRRRRRRt
HAS_SF_SDKt	fail_jsontcreate_sf_connectiontsfeR
telementsw_helpertset_element_attributes(tselfR)((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pyt__init__�s6	"cC`sS|jj�}x=|jD]2}t|j�|kr8|S|j|kr|SqWdS(s�
        Get Account
            :description: Get Account object from account id or name

            :return: Details about the account. None if not found.
            :rtype: object (Account object)
        N(R.t
list_accountstaccountsRRtusernameR((R1R5taccount_listtaccount((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytget_account�s	c	C`s�y5|jjd|jd|jd|jd|j�WnEtk
r|}|jjdd|jt	|�fdt
j��nXdS(	s$
        Create the Account
        R5RRRRsError creating account %s: %st	exceptionN(R.tadd_accountRRRRt	ExceptionR R,R	t	tracebackt
format_exc(R1te((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytcreate_account�s		%cC`sfy|jjd|j�WnEtk
ra}|jjdd|jt|�fdtj��nXdS(s$
        Delete the Account
        RRsError deleting account %s: %sR9N(	R.tremove_accountRR;R R,R	R<R=(R1R>((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytdelete_account�s
%c
C`s�yG|jjd|jd|jd|jd|jd|jd|j�WnEtk
r�}|j	j
dd|jt|�fd	tj
��nXd
S(s$
        Rename the Account
        RR5RRRRRsError renaming account %s: %sR9N(R.tmodify_accountRRRRRRR;R R,R	R<R=(R1R>((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytrename_account�s				%cC`s�y>|jjd|jd|jd|jd|jd|j�WnEtk
r�}|jj	dd|jt
|�fdtj��nXd	S(
s>
        Update the Account if account already exists
        RRRRRRsError updating account %s: %sR9N(
R.RBRRRRRR;R R,R	R<R=(R1R>((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytupdate_account�s			%cC`s�t}t}|j|j�}|dkrB|jdkrBt}nn|dk	r�|j|_|jdkrrt}q�|jdk	r�|jdk	r�|j|jkr�t}t}q�|jdk	r�|jdk	r�|j|jkr�t}t}q�|j	dk	r/|j	dk	r/|j	|j	kr/t}t}q�|j
dk	rn|j
dk	rn|j
|j
krnt}t}q�|jdk	r�|jdk	r�|j|jkr�t}t}q�n|rv|jj
r�qv|jdkrW|r�|j�qs|jdk	rJ|j|j�}|dk	r-|j|_|j�qT|jjdd|j�qs|j�qv|jdkrv|j�qvn|jjd|�dS(sI
        Process the account operation on the Element OS Cluster
        RRRsResource does not exist : %stchangedN(R'R8RR(RR&RR5RRRRR t
check_modeRDRRCR,R?RAt	exit_json(R1RERDtaccount_detailtaccount_exists((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytapply�sZ						


(
t__name__t
__module__t__doc__R2R8R?RARCRDRJ(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pyR�s	)		
			cC`st�}|j�dS(s
    Main function
    N(RRJ(R"((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pytmainDs	t__main__(RMt
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR<tansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappR#t,ansible.module_utils.netapp_elementsw_moduleR
t
has_sf_sdkR+tobjectRRNRK(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_account.pyt<module>s$


8.�	

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