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_access_group.pyc

�
�Udac@`sdZddlmZmZmZeZidd6dgd6dd6Zd	Zd
Z	dZ
ddlZdd
lm
Z
ddlmZddljjZddlmZej�ZyddlZWnek
r�eZnXdefd��YZd�Zedkre�ndS(s'
Element Software Access Group Manager
i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�

module: na_elementsw_access_group

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

options:

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

    from_name:
        description:
        - ID or Name of the access group to rename.
        - Required to create a new access group called 'name' by renaming 'from_name'.
        version_added: '2.8'

    name:
        description:
        - Name for the access group for create, modify and delete operations.
        required: True
        aliases:
        - src_access_group_id

    initiators:
        description:
        - List of initiators to include in the access group. If unspecified, the access group will start out without configured initiators.

    volumes:
        description:
        - List of volumes to initially include in the volume access group. If unspecified, the access group will start without any volumes.
        - It accepts either volume_name or volume_id

    account_id:
        description:
        - Account ID for the owner of this volume.
        - It accepts either account_name or account_id
        - if account_id is digit, it will consider as account_id
        - If account_id is string, it will consider as account_name
        version_added: '2.8'

    virtual_network_id:
        description:
        - The ID of the Element SW Software Cluster Virtual Network ID to associate the access group with.

    virtual_network_tags:
        description:
        - The ID of the VLAN Virtual Network Tag to associate the access group with.

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

s�
   - name: Create Access Group
     na_elementsw_access_group:
       hostname: "{{ elementsw_hostname }}"
       username: "{{ elementsw_username }}"
       password: "{{ elementsw_password }}"
       state: present
       name: AnsibleAccessGroup
       volumes: [7,8]
       account_id: 1

   - name: Modify Access Group
     na_elementsw_access_group:
       hostname: "{{ elementsw_hostname }}"
       username: "{{ elementsw_username }}"
       password: "{{ elementsw_password }}"
       state: present
       name: AnsibleAccessGroup-Renamed
       account_id: 1
       attributes: {"volumes": [1,2,3], "virtual_network_id": 12345}

   - name: Rename Access Group
     na_elementsw_access_group:
       hostname: "{{ elementsw_hostname }}"
       username: "{{ elementsw_username }}"
       password: "{{ elementsw_password }}"
       state: present
       from_name: AnsibleAccessGroup
       name: AnsibleAccessGroup-Renamed

   - name: Delete Access Group
     na_elementsw_access_group:
       hostname: "{{ elementsw_hostname }}"
       username: "{{ elementsw_username }}"
       password: "{{ elementsw_password }}"
       state: absent
       name: 1
sM

msg:
    description: Success message
    returned: success
    type: str

N(t
AnsibleModule(t	to_native(tNaElementSWModuletElementSWAccessGroupcB`s_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s.
    Element Software Volume Access Group
    cC`s8tj�|_|jjtdtdtdddg�dtdtdd�d	tdtd
dgdd�dtdtdd
�dtdtdd
�dtdtdd�dtdtdd
�dtdtdd
�dtdtdd��	�td|jddddgfgdt�|_|jj	}|d|_
|d|_|d	|_|d|_
|d|_|d|_|d|_|d|_|d|_ttkr�|jjdd�ntjd|j�|_t|j�|_|jdk	r|jj|jjdd��n|jjdd�|_dS(Ntstatetrequiredtchoicestpresenttabsentt	from_namettypetstrtnametaliasestsrc_access_group_idt
initiatorstlisttvolumest
account_idtvirtual_network_idtvirtual_network_tagst
attributestdictt
argument_spectrequired_iftsupports_check_modetmsgs)Unable to import the SolidFire Python SDKtmoduletsourcetna_elementsw_access_group(tnetapp_utilstontap_sf_host_argument_specRtupdateRtTruetFalseRR#tparamsRRtaccess_group_nameRRRRRRt
HAS_SF_SDKt	fail_jsontcreate_sf_connectiontsfeR
telementsw_helpertNonetset_element_attributes(tselftinput_params((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pyt__init__�s@	








"cC`sc|jj�}d}xG|jD]<}t|j�|krC|}q|j|kr|}qqW|S(s�
        Get Access Group
            :description: Get Access Group object for a given name

            :return: object (Group object)
            :rtype: object (Group object)
        N(R0tlist_volume_access_groupsR2tvolume_access_groupsRtvolume_access_group_idR(R4Rtaccess_groups_listt	group_objtgroup((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytget_access_group�s	
cC`s<y|jj|j�}|SWntjjk
r7dSXdS(N(R1taccount_existsRt	solidfiretcommontApiServerErrorR2(R4R((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytget_account_id�s
cC`scg}xV|jD]K}|jj||j�}|rD|j|�q|jjdd|�qW|S(NR"s"Specified volume %s does not exist(RR1t
volume_existsRtappendR#R.(R4t
volume_idstvolumet	volume_id((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pyt
get_volume_id�sc
C`s�yG|jjd|jd|jd|jd|jd|jd|j�WnEtk
r�}|j	j
dd|jt|�fd	tj
��nXd
S(s)
        Create the Access Group
        RRRRRRR"s)Error creating volume access group %s: %st	exceptionN(R0tcreate_volume_access_groupR,RRRRRt	ExceptionR#R.R	t	tracebackt
format_exc(R4te((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytcreate_access_group�s				cC`sfy|jjd|j�WnEtk
ra}|jjdd|jt|�fdtj	��nXdS(s)
        Delete the Access Group
        R9R"s)Error deleting volume access group %s: %sRIN(
R0tdelete_volume_access_grouptgroup_idRKR#R.R,R	RLRM(R4RN((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytdelete_access_group�sc
C`s�yG|jjd|jd|jd|jd|jd|jd|j�WnEtk
r�}|j	j
dd|jt|�fd	t
j��nXd
S(sL
        Update the Access Group if the access_group already exists
        R9RRRRRR"s)Error updating volume access group %s: %sRIN(R0tmodify_volume_access_groupRQRRRRRRKR#R.R,R	RLRM(R4RN((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytupdate_access_groups				cC`s�yP|jjd|jd|jd|jd|jd|jd|jd|j�WnEt	k
r�}|j
jdd	|jt
|�fd
tj��nXdS(s9
        Rename the Access Group to the new name
        R9RRRRRRR"s)Error updating volume access group %s: %sRIN(R0RSt
from_group_idRRR,RRRRKR#R.RR	RLRM(R4RN((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytrename_access_groups					cC`sqt}t}|j}|jdk	r6|j�|_n|jdkr�|jdk	r�|jro|j�|_q�|jjddt	|��n|j
|j�}|dk	r�|j|_
|jdkr�|j�t}qZ|jdk	rMt|j�dkrM|jst}t}q�x�|jD]%}||jkr!t}t}Pq!q!Wn]|jdk	r}|j|jkr}t}t}n-|jdk	s�|jdk	r�t}t}n|rZ|j�qZn�|jdkr8|jdk	r8|j
|j�}|dk	r|j|_|j�t}qZ|jjdd|j�n"|jdkrZ|j�t}n|jjd|�dS(	sT
        Process the access group operation on the Element Software Cluster
        RR"s0Error: Specified account id "%s" does not exist.RisResource does not exist : %stchangedN(R*RR2RBRRRHR#R.RR=R,R9RQRRR)tlenRRRRTRRURVROt	exit_json(R4RWtupdate_grouptinput_account_idtgroup_detailtvolumeID((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytapply*sV		 
	$		!		
	
	(t__name__t
__module__t__doc__R6R=RBRHRORRRTRVR^(((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pyR�s	1								cC`st�}|j�dS(s
    Main function
    N(RR^(R%((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pytmainqs	t__main__( Rat
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRLtansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappR&t,ansible.module_utils.netapp_elementsw_moduleR
t
has_sf_sdkR-tsolidfire.commonR?tImportErrorR*tobjectRRbR_(((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_elementsw_access_group.pyt<module>	s,


@'


�	

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