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/netapp_e_snapshot_volume.pyc

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	idd6dd
6Z
ddlZddlm
Z
ddlmZddlmZddlmZdddeeddedddeed�
Zdefd��YZd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys#	
---
module: netapp_e_snapshot_volume
short_description: NetApp E-Series manage snapshot volumes.
description:
    - Create, update, remove snapshot volumes for NetApp E/EF-Series storage arrays.
version_added: '2.2'
author: Kevin Hulquest (@hulquest)
notes:
  - Only I(full_threshold) is supported for update operations. If the snapshot volume already exists and the threshold matches, then an C(ok) status
    will be returned, no other changes can be made to a pre-existing snapshot volume.
options:
    api_username:
        required: true
        description:
        - The username to authenticate with the SANtricity WebServices Proxy or embedded REST API.
    api_password:
        required: true
        description:
        - The password to authenticate with the SANtricity WebServices Proxy or embedded REST API.
    api_url:
        required: true
        description:
        - The url to the SANtricity WebServices Proxy or embedded REST API.
    validate_certs:
        required: false
        default: true
        description:
        - Should https certificates be validated?
        type: bool
    ssid:
      description:
          - storage array ID
      required: True
    snapshot_image_id:
      required: True
      description:
          - The identifier of the snapshot image used to create the new snapshot volume.
          - "Note: You'll likely want to use the M(netapp_e_facts) module to find the ID of the image you want."
    full_threshold:
      description:
          - The repository utilization warning threshold percentage
      default: 85
    name:
      required: True
      description:
          - The name you wish to give the snapshot volume
    view_mode:
      required: True
      description:
          - The snapshot volume access mode
      choices:
          - modeUnknown
          - readWrite
          - readOnly
          - __UNDEFINED
    repo_percentage:
      description:
          - The size of the view in relation to the size of the base volume
      default: 20
    storage_pool_name:
      description:
          - Name of the storage pool on which to allocate the repository volume.
      required: True
    state:
      description:
          - Whether to create or remove the snapshot volume
      required: True
      choices:
          - absent
          - present
s�
    - name: Snapshot volume
      netapp_e_snapshot_volume:
        ssid: "{{ ssid }}"
        api_url: "{{ netapp_api_url }}/"
        api_username: "{{ netapp_api_username }}"
        api_password: "{{ netapp_api_password }}"
        state: present
        storage_pool_name: "{{ snapshot_volume_storage_pool_name }}"
        snapshot_image_id: "{{ snapshot_volume_image_id }}"
        name: "{{ snapshot_volume_name }}"
s�
msg:
    description: Success message
    returned: success
    type: str
    sample: Json facts for the volume that was created.
sapplication/jsonsContent-TypetAcceptN(tbasic_auth_argument_spec(t
AnsibleModule(topen_url(t	HTTPErrortGETi
cC`sy[td|d|d|d|d|d|d|d|d	|d
|	d|
d|d
|�
}Wntk
ry}|j}nXy.|j�}|r�tj|�}nd}Wn&tk
r�|
r�q�t|��nX|j�}|dkr|
rt||��n
||fSdS(Nturltdatatheaderstmethodt	use_proxytforcet
last_mod_timettimeouttvalidate_certsturl_usernameturl_passwordt
http_agenttforce_basic_authi�(	RRtfptreadtjsontloadstNonet	Exceptiontgetcode(RRRRRRRRRRRRRt
ignore_errorstrterrtraw_datat	resp_code((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pytrequestws($



tSnapshotVolumecB`sbeZd�Zed��Zed��Zed��Zd�Zd�Zd�Z	d�Z
RS(cC`st�}|jtdtdddt�dtdddtdt�dtdddt�dtdddt�d	tdddt�d
tdddd
�dtdddt�dtdddddddddg�dtdddd�dtdddt�dtdddtdddg���td|�|_|jj}|d|_|d|_|d	|_	|d
|_
|d|_|d|_|d|_
|d|_|d|_|d|_|d|_|d|_|jjd�s|jd7_ndS(Ntapi_usernamettypetstrtrequiredtapi_passwordtno_logtapi_urltssidtsnapshot_image_idtfull_thresholdtinttdefaultiUtnamet	view_modetreadOnlytchoicest	readWritetmodeUnknownt__Undefinedtrepo_percentageitstorage_pool_nametstatetabsenttpresentt
argument_specRt/(R	tupdatetdicttTrueR
tmoduletparamsR>R0R1R2R5R6R<R=Rtusertpwdtcertstendswith(tselfRAtargs((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyt__init__�s<	%











c
C`s�d|j}|j|}t|dtd|jd|jd|j�\}}x2|D]*}|d|jkrT||_|dSqTW|j	j
dd	|j�dS(
Ns storage-systems/%s/storage-poolsRRRRR5tidtmsgs-No storage pool with the name: '%s' was found(R0RR'tHEADERSRHRIRJR=t	pool_dataRFt	fail_jsonR5(RLtpoolsRtrcRtpool((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pytpool_id�s

!
	c
C`s�t|jd|jdtd|jd|jd|j�\}}|r{x5|D]&}|d|jkrN||_t	SqNWnt
St
S(Ns#storage-systems/%s/snapshot-volumesRRRRR5(R'RR0RQRHRIRJR5tss_volREtFalse(RLRUtss_volsRX((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyt
ss_vol_exists�s$
	cC`s"|jd|jkrtStSdS(NtfullWarnThreshold(RXR2RERY(RL((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pytss_vol_needs_update�scC`s�td|jd|jd|jd|jd|jd|j�}t|jd|j	dt
j|�d	td
|j
d|jd|jd
d�\}}||_|jr�|j�n|jjdt|�dS(NtsnapshotImageIdt
fullThresholdR5tviewModetrepositoryPercentagetrepositoryPoolIds#storage-systems/%s/snapshot-volumesRRRRRRtPOSTtchanged(RDR1R2R5R6R<RWR'RR0RtdumpsRQRHRIRJRXR]t
update_ss_volRFt	exit_jsonRE(RLt	post_dataRUtcreate_resp((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyt
create_ss_vol�s					!		
cC`s�td|j�}t|jd|j|jdfdtj|�dtd|j	d|j
dd	d
|j�\}}|jj
dt|�dS(NR_s&storage-systems/%s/snapshot-volumes/%sRORRRRRRcRRd(RDR2R'RR0RXRReRQRHRIRJRFRgRE(RLRhRUtresp((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyRf�s$'cC`sqt|jd|j|jdfdtd|jd|jd|jdd�\}}|jj	d	t
d
d�dS(Ns&storage-systems/%s/snapshot-volumes/%sRORRRRRtDELETERdRPsVolume successfully deleted(R'RR0RXRQRHRIRJRFRgRE(RLRURk((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyt
remove_ss_vol�s$!cC`s�|jdkrW|jrJ|jr.|j�qT|jjdt|j�q�|j�n/|jrm|j	�n|jjdtdd�dS(NR@RdRPsVolume already absent(
R>R[R]RfRFRgRYRXRjRm(RL((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pytapplys		

	
(t__name__t
__module__RNtpropertyRWR[R]RjRfRmRn(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyR(�s	#			cC`st�}|j�dS(N(R(Rn(tsv((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pytmains	t__main__(t
__future__RRRR*t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRQRtansible.module_utils.apiR	tansible.module_utils.basicR
tansible.module_utils.urlsRt+ansible.module_utils.six.moves.urllib.errorRRRERYR'tobjectR(RsRo(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_snapshot_volume.pyt<module>s,


J
}	

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