Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl mZnXdefd��YZ!de!fd��YZ"de!fd��YZ#de!fd��YZ$de$fd ��YZ%d!e$fd"��YZ&d#e'fd$��YZ(d%e'fd&��YZ)d'e'fd(��YZ*d)�Z+e,d*kr�e+�ndS(+i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	certifiedtsupported_bys�
---
module: bigip_snat_pool
short_description: Manage SNAT pools on a BIG-IP
description:
  - Manage SNAT pools on a BIG-IP.
version_added: 2.3
options:
  members:
    description:
      - List of members to put in the SNAT pool. When a C(state) of present is
        provided, this parameter is required. Otherwise, it is optional.
      - The members can be either IP addresses, or names of the SNAT translation objects.
    type: list
    aliases:
      - member
  description:
    description:
      - A general description of the SNAT pool, provided by the user for their
        benefit. It is optional.
    type: str
    version_added: 2.9
  name:
    description:
      - The name of the SNAT pool.
    type: str
    required: True
  state:
    description:
      - Whether the SNAT pool should exist or not.
    type: str
    choices:
      - present
      - absent
    default: present
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
    version_added: 2.5
notes:
  - When C(bigip_snat_pool) object is removed it also removes any associated C(bigip_snat_translation) objects.
  - This is a BIG-IP behavior not module behavior and it only occurs when the C(bigip_snat_translation) objects
    are also not referenced by another C(bigip_snat_pool).
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s
- name: Add the SNAT pool 'my-snat-pool'
  bigip_snat_pool:
    name: my-snat-pool
    state: present
    members:
      - 10.10.10.10
      - 20.20.20.20
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Change the SNAT pool's members to a single member
  bigip_snat_pool:
    name: my-snat-pool
    state: present
    member: 30.30.30.30
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Remove the SNAT pool 'my-snat-pool'
  bigip_snat_pool:
    name: johnd
    state: absent
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Add the SNAT pool 'my-snat-pool' with a description
  bigip_snat_pool:
    name: my-snat-pool
    state: present
    members:
      - 10.10.10.10
      - 20.20.20.20
    description: A SNAT pool description
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
s�
members:
  description:
    - List of members that are part of the SNAT pool.
  returned: changed and success
  type: list
  sample: "['10.10.10.10']"
N(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tis_valid_ip(tcompress_address(tcmp_str_with_nonet
ParameterscB`s2eZiZddgZddgZddgZRS(tmemberstdescription(t__name__t
__module__tapi_mapt
updatablestreturnablestapi_attributes(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR�s		t
ApiParameterscB`seZRS((RR(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR�stModuleParameterscB`s8eZd�Zd�Zed��Zed��ZRS(cC`stjj|�}|S(N(tostpathtbasename(tselftmembertresult((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt_clear_member_prefix�scC`s�t|jd��dkra|jd�\}}t|�r�dj|jt|�|�}|Snbt|�r�dj|j|�}|Stjdtj�}|j	|�r�dj|j|�}|St
dj|���dS(Nt%is/{0}/{1}%{2}s/{0}/{1}s(?!-)[A-Z-].*(?<!-)$sSThe provided member address: {0} is not a valid IP address or snat translation name(tlentsplitRtformatt	partitionRtretcompilet
IGNORECASEtmatchR(R!R"taddresstrdR#tpattern((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt_format_member_address�scC`sp|jddkrdSt�}xC|jdD]4}|j|�}|j|�}|j|g�q.Wt|�S(NR(t_valuestNonetsetR$R1tupdatetlist(R!R#R"R.((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR�s	cC`s9|jddkrdS|jddkr.dS|jdS(NRtnonet(R7R8(R2R3(R!((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR�s
(RRR$R1tpropertyRR(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR�s		tChangescB`seZd�ZRS(cC`sXi}xK|jD]@}yt||�||<Wntk
r@nX|j|�}qW|S(N(Rtgetattrt	Exceptiont_filter_params(R!R#t
returnable((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt	to_return�s
(RRR?(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR:�st
UsableChangescB`seZRS((RR(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR@�stReportableChangescB`seZRS((RR(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRA�st
DifferencecB`sDeZdd�Zd�Zd�Zed��Zed��ZRS(cC`s||_||_dS(N(twantthave(R!RCRD((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R;tAttributeErrort_Difference__default(R!tparamR#((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R;RCRDRF(R!RHtattr1tattr2((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt	__default�s
cC`sZ|jjdkrdSt|jj�t|jj�kr>dStt|jj��}|S(N(RCRR3R4RDR6(R!R#((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRs$cC`st|jj|jj�}|S(N(RRCRRD(R!R#((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRsN(	RRR3RERIRGR9RR(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRB�s
				t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR3RNR
ROtclientRRCRRDR@tchanges(R!targstkwargs((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyREs
cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRNt	deprecate(R!R#twarningstwarning((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt_announce_deprecationss


cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRO(RRR;RCR3R@RR(R!tchangedtkey((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt_set_changed_options&scC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRO(RBRCRDRRtdictRIR3t
isinstanceR5R@RRtTruetFalse(R!tdiffRR]tktchange((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt_update_changed_options.s		
cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j
jr�|jr�|j
�|d<n|j	td|��|j|�|S(NtpresenttabsentRORdR](RcR`RCtstateRhRiRARRR?R5RNt_diffRDt	make_diffR\(R!R]R#Rjt
reportableRR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pytexec_module@s	

cC`sRt�}tj}x9|D]1}t||�dk	rt||�||<qqW|S(N(R`RRR;R3(R!titemR#RRe((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt
_grab_attrVs		
cC`s1td|j|j�d|j|j��}|S(Ntbeforetafter(R`RpRDRC(R!R#((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRl^s-cC`s$|j�r|j�S|j�SdS(N(texistsR5tcreate(R!((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRhbs
cC`s%t}|j�r!|j�}n|S(N(RcRstremove(R!R]((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRihscC`s|j�}|rtStS(N(RgRbRc(R!R#((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt
should_updatenscC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRDRvRcRNt
check_modeRbtupdate_on_device(R!((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR5ts
cC`sC|j�|jjrtS|j�|j�s?td��ntS(NsFailed to create the SNAT pool(R_RNRxRbtcreate_on_deviceRsR(R!((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRt}s

cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the SNAT pool(RNRxRbtremove_from_deviceRsR(R!((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRu�s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns(https://{0}:{1}/mgmt/tm/ltm/snatpool/{2}tservertserver_porti�tcode(R(RQtproviderRRCR)tnametapiRPtjsont
ValueErrorRcRRb(R!turitresptresponse((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRs�s


+cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��n|dS(
NR�R)s%https://{0}:{1}/mgmt/tm/ltm/snatpool/R|R}R�R~i�i�tmessagetselfLink(i�i�(RRt
api_paramsRCR�R)R(RQRR�tpostR�R�Rtstrtcontent(R!ROR�R�R�tex((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRz�s 
cC`s�|jj�}dj|jjd|jjdt|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��ndS(Ns(https://{0}:{1}/mgmt/tm/ltm/snatpool/{2}R|R}R�R~i�R�(RRR�R(RQRRRCR)R�R�tpatchR�R�RR�R�(R!ROR�R�R�R�((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRy�s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns(https://{0}:{1}/mgmt/tm/ltm/snatpool/{2}R|R}i�(
R(RQRRRCR)R�R�tdeleteRRbRR�(R!R�R�((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR{�s

cC`s�dj|jjd|jjdt|jj|jj��}d}|jjj||�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(	Ns(https://{0}:{1}/mgmt/tm/ltm/snatpool/{2}R|R}s?expandSubcollections=trueR~i�R�RO(R(RQRRRCR)R�R�RPR�R�RR�R�R(R!R�tqueryR�R�R�((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRw�s

(RRRER\R_RgRnRpRlRhRiRvR5RtRuRsRzRyR{Rw(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRMs$																			tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtddddg�dt�d	td
ddd
dg�dtd
ddtdgf��}i|_|jjt�|jj|�d	ddggg|_dS(NR�trequiredRttypeR6taliasesR"RRjtdefaultRhtchoicesRiR)tCommontfallbacktF5_PARTITION(Rbtsupports_check_modeR`R	t
argument_specR5Rtrequired_if(R!R�((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyRE�s"			(RRRE(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyR��scC`s�t�}td|jd|jd|j�}y,td|�}|j�}|j|�Wn)tk
r�}|j	dt
|��nXdS(NR�R�R�RNRV(R�RR�R�R�RMRnt	exit_jsonRt	fail_jsonR�(tspecRNtmmtresultsR�((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pytmains			t__main__(-t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR*Rtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRt)library.module_utils.network.f5.ipaddressRRt'library.module_utils.network.f5.compareRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddresst'ansible.module_utils.network.f5.compareRRRR:R@RAtobjectRBRMR�R�R(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_pool.pyt<module>sV


32	
.$�	

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