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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZy�dd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�dd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZ defd��YZ!defd��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)�nd+S(,i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_snat_translation
short_description:  Manage SNAT Translations on a BIG-IP
description:
  - Manage SNAT Translations on a BIG-IP.
version_added: 2.9
options:
  address:
    description:
      - Specifies the IP address of the SNAT translation. When a C(state) of present, enabled, or disabled is
        provided, this parameter is required.
      - This parameter cannot be updated after it is set.
    type: str
    aliases:
      - ip
  arp:
    description:
      - If C(yes), specifies that the NAT sends ARP requests.
    type: bool
  connection_limit:
    description:
      - Specifies a limit on the number of connections a translation address must reach before it no longer
        initiates a connection. The default value of 0 indicates that the setting is disabled.
      - The accepted value range is C(0 - 65535).
    type: int
  description:
    description:
      - Description of snat-translation. C(none or '') will set to default description of null.
    type: str
  ip_idle_timeout:
    description:
      - Specifies the amount of time that connections to an IP address initiated using a SNAT address are
        allowed to remain idle before being automatically disconnected. C(indefinite) prevents the connection
        from timing out.
      - The accepted value range is C(0 - 4294967295) seconds, specifying C(indefinite) will
        set it to the maximum value.
    type: str
  name:
    description:
      - The name of SNAT translation.
    type: str
    required: True
  partition:
    description:
      - Device partition to manage resources on.
      - Required with state C(absent) when partition other than Common used.
    type: str
  state:
    description:
      - The SNAT translation state. If C(absent), delete the SNAT translation
        if it exists. C(present) creates the SNAT translation and enable it.
        If C(enabled), enable the SNAT translation if it exists. If C(disabled),
        create the SNAT translation if needed, and set state to C(disabled).
    type: str
    choices:
      - present
      - absent
      - enabled
      - disabled
    default: present
  tcp_idle_timeout:
    description:
      - Specifies the amount of time that TCP connections initiated using a SNAT address are allowed
        to remain idle before being automatically disconnected. C(indefinite) Prevents the
        connection from timing out.
      - The accepted value range is C(0 - 4294967295) seconds, specifying C(indefinite) will
        set it to the maximum value.
    type: str
  traffic_group:
    description:
      - The traffic group for the snat-translation address. When creating a new address,
        if this value is not specified, the default of C(/Common/traffic-group-1)
        will be used.
    type: str
  udp_idle_timeout:
    description:
      - Specifies the amount of time that UDP connections initiated using a SNAT address are allowed
        to remain idle before being automatically disconnected. C(indefinite) Prevents the connection
        from timing out.
      - The accepted value range is C(0 - 4294967295) seconds, specifying C(indefinite) will
        set it to the maximum value.
    type: str
extends_documentation_fragment: f5
author:
  - Greg Crosby (@crosbygw)
  - Wojciech Wypior (@wojtek0806)
s*	
- name: Create a SNAT translation 'my-snat-translation'
  bigip_snat_translation:
    name: my-snat-pool
    state: present
    address: 10.10.10.10
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Modify a SNAT translation 'my-snat-translation'
  bigip_snat_translation:
    name: my-snat-pool
    state: present
    address: 10.10.10.10
    arp: no
    connection_limit: 300
    ip_idle_timeout: 1800
    tcp_idle_timeout: 1800
    udp_idle_timeout: 1800
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Disable a SNAT translation 'my-snat-translation'
  bigip_snat_translation:
    name: my-snat-pool
    state: disabled
    address: 10.10.10.10
    arp: no
    connection_limit: 300
    ip_idle_timeout: 1800
    tcp_idle_timeout: 1800
    udp_idle_timeout: 1800
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Enable a SNAT translation 'my-snat-translation'
  bigip_snat_translation:
    name: my-snat-pool
    state: enabled
    address: 10.10.10.10
    arp: no
    connection_limit: 300
    ip_idle_timeout: 1800
    tcp_idle_timeout: 1800
    udp_idle_timeout: 1800
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Create using partition other then /Common on a SNAT translation 'my-new-snat-translation'
  bigip_snat_translation:
    name: my-new-snat-pool
    state: enabled
    address: 10.10.10.10
    arp: no
    connection_limit: 300
    ip_idle_timeout: 1800
    partition: ansible
    tcp_idle_timeout: 1800
    udp_idle_timeout: 1800
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Modify using traffic group other then /Common/traffic-group-1 on a SNAT translation 'my-new-snat-translation'
  bigip_snat_translation:
    name: my-new-snat-pool
    state: enabled
    address: 10.10.10.10
    arp: no
    connection_limit: 300
    ip_idle_timeout: 1800
    partition: ansible
    tcp_idle_timeout: 1800
    traffic_group: /Common/ansible
    udp_idle_timeout: 1800
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

sZ
address:
  description:
    - ip address used for SNAT translation.
  returned: changed and success
  type: str
  sample: "10.10.10.10"
arp:
  description: Whether snat-translation send arp requests.
  returned: changed
  type: bool
  sample: yes
connection_limit:
  description: The new connection limit of the virtual address.
  returned: changed
  type: int
  sample: 1000
description:
  description: Description of the snat-translaiton.
  returned: changed
  type: str
  sample: My snat-translation
ip_idle_timeout:
  description: IP idle timeout value for snat-translation.
  returned: changed
  type: str
  sample: 300
state:
  description: The new state of the snat-translation.
  returned: changed
  type: str
  sample: disabled
tcp_idle_timeout:
  description: TCP idle timeout value for snat-translation.
  returned: changed
  type: str
  sample: 1800
traffic_group:
  description: Assigned traffic group.
  returned: changed
  type: str
  sample: /Common/traffic-group-1
udp_idle_timeout:
  description: UDP idle timeout value for snat-translation.
  returned: changed
  type: str
  sample: indifinite
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tflatten_boolean(tf5_argument_spec(ttransform_name(tis_valid_ip(tcompress_address(tcmp_str_with_nonet
ParameterscB`s�eZidd6dd6dd6dd6dd	6Zd
dddd
ddddd	g
Zd
dddd
ddddddgZdddd
dddddg	ZRS(tconnection_limittconnectionLimittip_idle_timeoutt
ipIdleTimeoutttcp_idle_timeoutttcpIdleTimeoutt
traffic_groupttrafficGrouptudp_idle_timeouttudpIdleTimeouttaddresstarptdescriptiontdisabledtenabledtstate(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRsH
		t
ApiParameterscB`s5eZed��Zed��Zed��ZRS(cC`s(|jddkrdSt|jd�S(NR(t_valuestNonetint(tself((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRHscC`sd|jkrtStS(NR#(R,tTruetFalse(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR#NscC`sd|jkrtStS(NR"(R,R0R1(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR"Ts(R%R&tpropertyRR#R"(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR+GstModuleParameterscB`s�eZd�Zd�Zed��Zed��Zed��Zed��Zed��Z	ed��Z
ed��Zed	��Zed
��Z
ed��Zed��ZRS(
cC`s\|dkrdS|dkr dSdt|�ko=dknrLt|�Std��dS(Nt
indefinitet
4294967295iI����sEValid 'maximum_age' must be in range 0 - 4294967295, or 'indefinite'.(R4R5(R-R.tstrR(R/tlimit((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt_validate_timeout_limit]s"
cC`sL|dkrdSdt|�ko-dknr<t|�Std��dS(Nii��s4Valid 'connection_limit' must be in range 0 - 65535.(R-R.R(R/R7((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt_validate_conn_limiths"
cC`s�|jddkrdSt|jdjd��dkr�|jdjd�\}}t|�r�djt|�|�}|Snt|jd�r�|jdStdj|jd���dS(NRt%is{0}%{1}s3The provided address: {0} is not a valid IP address(R,R-tlentsplitRtformatRR(R/Rtrdtresult((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRqs"cC`s7t|jd�}|dkr#dS|dkr3dSdS(NR tyesR#R"(RR,R-(R/R?((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR �scC`s1|jddkrdSt|j|jd��S(NR(R,R-R.R9(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�scC`s9|jddkrdS|jddkr.dS|jdS(NR!ttnone(RARB(R,R-(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR!�s
cC`s|jddkrtSdS(NR$R"(R,R0(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR"�scC`s|jddkrtSdS(NR$R#tpresent(senabledspresent(R,R0(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR#�scC`s|j|jd�S(NR(R8R,(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�scC`sH|jtkr&|jddkr&dS|jtkr9dS|jdSdS(NR$RCR#R"(R#R0R,R"(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR$�s
"cC`s|j|jd�S(NR(R8R,(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�scC`s.|jddkrdSt|j|jd�S(NR(R,R-R
t	partition(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�scC`s|j|jd�S(NR(R8R,(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�s(R%R&R8R9R2RR RR!R"R#RR$RRR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR3[s					tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R)tgetattrt_filter_paramst	Exception(R/R?t
returnable((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt	to_return�s
(R%R&RJ(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRE�st
UsableChangescB`seZRS((R%R&(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRK�stReportableChangescB`sMeZd�Zed��Zed��Zed��Zed��ZRS(cC`s|dkrdS|SdS(NI����R4((R/tvalue((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt_change_limit_value�scC`st|jd�S(NR (RR,(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR �scC`s+|jddkrdS|j|jd�S(NR(R,R-RN(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�scC`s+|jddkrdS|j|jd�S(NR(R,R-RN(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�scC`s+|jddkrdS|j|jd�S(NR(R,R-RN(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR�s(R%R&RNR2R RRR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRL�s
	t
DifferencecB`s5eZdd�Zd�Zd�Zed��ZRS(cC`s||_||_dS(N(twantthave(R/RPRQ((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RFtAttributeErrort_Difference__default(R/tparamR?((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RFRPRQRS(R/RUtattr1tattr2((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt	__default�s
cC`st|jj|jj�S(N(RRPR!RQ(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR!sN(R%R&R-RRRVRTR2R!(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRO�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(tgetR-R[R
R\tclientR3RPR+RQRKtchanges(R/targstkwargs((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRRs
cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR[t	deprecate(R/R?twarningstwarning((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt_announce_deprecationss


cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR\(RR)RFRPR-RKR_(R/tchangedtkey((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt_set_changed_optionss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(NR\(RORPRQRR*tdictRVR-t
isinstancetupdateRKR_R0R1(R/tdiffR*Rjtktchange((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt_update_changed_optionss		
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(	NRCR#R"tabsentR\RpRj(spresentsenabledsdisabled(R1RmRPR$RCRtRLR_RJRoR[t_diffRQt	make_diffRi(R/RjR?R$t
reportableR_((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pytexec_module0s	

cC`sRt�}tj}x9|D]1}t||�dk	rt||�||<qqW|S(N(RmRR*RFR-(R/titemR?R*Rq((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt
_grab_attrFs		
cC`s1td|j|j�d|j|j��}|S(Ntbeforetafter(RmRzRQRP(R/R?((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRvNs-cC`s$|j�r|j�S|j�SdS(N(texistsRotcreate(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRCRs
cC`s%t}|j�r!|j�}n|S(N(R1R}tremove(R/Rj((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRtXscC`s|j�}|rtStS(N(RsR0R1(R/R?((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt
should_update^scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRQR�R1R[t
check_modeR0tupdate_on_device(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRods
cC`sC|j�|jjrtS|j�|j�s?td��ntS(NsFailed to create the SNAT pool(RlR[R�R0tcreate_on_deviceR}R(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR~ms

cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the SNAT pool(R[R�R0tremove_from_deviceR}R(R/((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRvs
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns0https://{0}:{1}/mgmt/tm/ltm/snat-translation/{2}tservertserver_porti�tcode(R=R^tproviderRRPRDtnametapiR]tjsont
ValueErrorR1RR0(R/turitresptresponse((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR}~s


+cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��ntS(NR�RDs-https://{0}:{1}/mgmt/tm/ltm/snat-translation/R�R�R�R�i�i�tmessage(i�i�(R_t
api_paramsRPR�RDR=R^R�R�tpostR�R�RR6tcontentR0(R/R\R�R�R�tex((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR��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(Ns0https://{0}:{1}/mgmt/tm/ltm/snat-translation/{2}R�R�R�R�i�R�(R_R�R=R^R�RRPRDR�R�tpatchR�R�RR6R�(R/R\R�R�R�R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR��s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns0https://{0}:{1}/mgmt/tm/ltm/snat-translation/{2}R�R�i�(
R=R^R�RRPRDR�R�tdeleteRR0RR�(R/R�R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR��s

cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(Ns0https://{0}:{1}/mgmt/tm/ltm/snat-translation/{2}R�R�R�i�R�R\(R=R^R�RRPRDR�R�R]R�R�RR6R�R+(R/R�R�R�R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR��s

(R%R&RRRiRlRsRxRzRvRCRtR�RoR~RR}R�R�R�R�(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRZs$																			tArgumentSpeccB`seZd�ZRS(cC`s#t|_tdtddg�dtdd�dtdd�d	t�d
t�dtdt�d
tdtdgf�dtdddddddg�dt�dt�dt��}i|_|jjt�|jj|�ddddggddddggddddggg|_dS(NRtaliasestipR ttypetboolRR.R!RR�trequiredRDtfallbacktF5_PARTITIONR$tdefaultRCtchoicesRtR#R"RRR(R0tsupports_check_modeRmR	t
argument_specRoRtrequired_if(R/R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyRR�s2								(R%R&RR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyR��scC`s�t�}td|jd|jd|j�}y,td|�}|j�}|j|�Wn)tk
r�}|j	dt
|��nXdS(NR�R�R�R[Rc(R�RR�R�R�RZRxt	exit_jsonRt	fail_jsonR6(tspecR[tmmtresultsR�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pytmain�s			t__main__N(+t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRRt)library.module_utils.network.f5.ipaddressRRt'ansible.module_utils.network.f5.compareRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddressRR+R3RERKRLtobjectRORZR�R�R%(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_snat_translation.pyt<module>sV


Ya1
1c�%	

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