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

�
�Udac@`sCddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZyddd
l
mZddlmZddlmZddlmZddlmZddlmZWn�ek
rYdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��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_timer_policy
short_description: Manage timer policies on a BIG-IP
description:
  - Manage timer policies on a BIG-IP.
version_added: 2.6
options:
  name:
    description:
      - Specifies the name of the timer policy.
    type: str
    required: True
  description:
    description:
      - Specifies descriptive text that identifies the timer policy.
    type: str
  rules:
    description:
      - Rules that you want assigned to the timer policy
    suboptions:
      name:
        description:
          - The name of the rule.
        type: str
        required: True
      protocol:
        description:
          - Specifies the IP protocol entry for which the timer policy rule is being
            configured. This could be a layer-4 protocol (such as C(tcp), C(udp) or
            C(sctp).
          - Only flows matching the configured protocol will make use of this rule.
          - When C(all-other) is specified, if there are no specific ip-protocol rules
            that match the flow, the flow matches all the other ip-protocol rules.
          - When specifying rules, if this parameter is not specified, the default of
            C(all-other) will be used.
        type: str
        choices:
          - all-other
          - ah
          - bna
          - esp
          - etherip
          - gre
          - icmp
          - ipencap
          - ipv6
          - ipv6-auth
          - ipv6-crypt
          - ipv6-icmp
          - isp-ip
          - mux
          - ospf
          - sctp
          - tcp
          - udp
          - udplite
      destination_ports:
        description:
          - The list of destination ports to match the rule on.
          - Specify a port range by specifying start and end ports separated by a
            dash (-).
          - This field is only available if you have selected the C(sctp), C(tcp), or
            C(udp) protocol.
        type: list
      idle_timeout:
        description:
          - Specifies an idle timeout, in seconds, for protocol and port pairs that
            match the timer policy rule.
          - When C(infinite), specifies that the protocol and port pairs that match
            the timer policy rule have no idle timeout.
          - When specifying rules, if this parameter is not specified, the default of
            C(unspecified) will be used.
        type: str
    type: list
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s
- name: Create a timer policy
  bigip_timer_policy:
    name: timer1
    description: My timer policy
    rules:
      - name: rule1
        protocol: tcp
        idle_timeout: indefinite
        destination_ports:
          - 443
          - 80
      - name: rule2
        protocol: 200
      - name: rule3
        protocol: sctp
        idle_timeout: 200
        destination_ports:
          - 21
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Remove a timer policy and all its associated rules
  bigip_timer_policy:
    name: timer1
    description: My timer policy
    state: absent
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
su
description:
  description: The new description of the timer policy.
  returned: changed
  type: str
  sample: true
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttransform_name(tcompare_complex_list(tfq_namet
ParameterscB`s2eZiZddgZddgZddgZRS(tdescriptiontrules(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�s		t
ApiParameterscB`seZed��ZRS(cC`s|jddkrdSg}x�|jdD]�}t�}|d|d<d|krkt|d�|d<nd|kr�t|ddd�|d<nd	|kr�ttg|d	D]}t|d�^q���}|j�||d
<n|j|�t|dd��}q+W|S(
NRtnamet
ipProtocoltprotocolttimersitvaluetidle_timeouttdestinationPortstdestination_portstkeycS`s|dS(NR((tk((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt<lambda>�s(	t_valuestNonetdicttstrtlisttsettsorttappendtsorted(tselftresultstruletresulttxtports((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�s"	3


(RRtpropertyR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�stModuleParameterscB`s eZed��Zd�ZRS(cC`sz|jddkrdSt|jd�dkrK|jdddkrKdSg}x"|jdD]}t�}|d|d<d|kr�t|d�|d<n
d|d<d|kr�t|d�|d<n
d	|d<d
|krPttg|d
D]}t|�^q���}|j�g|D]}t|j|��^q"}||d
<n|j	|�t
|dd��}q_W|S(
NRiitRRs	all-otherR tunspecifiedR"R#cS`s|dS(NR((R$((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR%�s(R&R'tlenR(R)R*R+R,t_validate_port_entriesR-R.(R/R0R1R2R3R4((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�s,0	

/
(

cC`s	|dkrdSd|kr�|jd�}t|�dkrLtd��ny$t|d�}t|d�}Wn1tk
r�tdj|d|d���nX||kr�|S||kr�dj||�S|Sn.yt|�SWntk
rtd	��nXdS(
Ns	all-otherit-is[The correct format for a port range is X-Y, where X is the startport and Y is the end port.isBThe ports in a range must be numbers.You provided '{0}' and '{1}'.s{0}-{1}s/The specified destination port is not a number.(tsplitR9Rtintt
ValueErrortformat(R/tporttpartststarttend((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR:�s0

(RRR5RR:(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR6�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(R/R2t
returnable((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt	to_returns
(RRRI(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRDst
UsableChangescB`seZed��ZRS(cC`s�|jddkrdSg}x]|jdD]N}t�}|d|d<d|kre|d|d<nd|kr�|ddkr�td	��ng|dD]}tdt|��^q�}||d
<n
g|d
<d|krW|ddkr�|d}n<yt|d�|d}Wntk
r7td��nXtddd|�g|d<n|j|�t|dd��}q+W|S(NRRRRR"ttcptudptsctpsHOnly the 'tcp', 'udp', and 'sctp' protocols support 'destination_ports'.R!R t
indefinitet	immediateR8sVidle_timeout must be a number, or, one of 'indefinite', 'immediate', or 'unspecified'.sflow-idle-timeoutRRR#cS`s|dS(NR((R$((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR%Js(RKRLRM(RNROsunspecified(	R&R'R(RR)R=R>R-R.(R/R0R1R2R3R4ttimeout((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR&s8	,





(RRR5R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRJ%stReportableChangescB`seZRS((RR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRQNst
DifferencecB`s5eZdd�Zd�Zd�Zed��ZRS(cC`s||_||_dS(N(twantthave(R/RSRT((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt__init__Ss	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(REtAttributeErrort_Difference__default(R/tparamR2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pytcompareWs

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RERSRTRV(R/RXtattr1tattr2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt	__default^s
cC`sA|jjdkrdS|jjdkr>|jjdkr>dS|jjdk	rf|jjdkrfgS|jjdkr�|jjSg|jjD]'}d|kr�t|jd��^q�}g|jjD]'}d|kr�t|jd��^q�}t|�t|�kr|jjSt|jj|jj�r=|jjSdS(NR7R"(RSRR'RTttupletpopR+R(R/R3RSRT((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRgs$$
::
N(RRR'RURYRWR5R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRRRs			t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR'R`R
RatclientR6RSRRTRJtchanges(R/targstkwargs((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRU{s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRa(RRRERSR'RJRd(R/tchangedR#((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.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(NRa(RRRSRTRRR(RYR't
isinstancetupdateRJRdtTruetFalse(R/tdiffRRgR$tchange((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RoRkRl(R/R2((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRaRg(RlR(RStstateRqRrRQRdRIRjt_announce_deprecations(R/RgR2Rst
reportableRd((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(R^RcR`t	deprecate(R/R2twarningstwarning((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRt�s


cC`s$|j�r|j�S|j�SdS(N(texistsRjtcreate(R/((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRq�s
cC`s|j�r|j�StS(N(R}tremoveRl(R/((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRr�s
cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRTRpRlR`t
check_modeRktupdate_on_device(R/((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRj�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(R`R�Rktremove_from_deviceR}R(R/((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�s
cC`s(|j�|jjrtS|j�tS(N(RhR`R�Rktcreate_on_device(R/((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR~�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/net/timer-policy/{2}tservertserver_porti�tcode(R?RctproviderRRSt	partitionRtapiRbtjsonR>RlRRk(R/turitresptresponse((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR}�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(
NRR�s)https://{0}:{1}/mgmt/tm/net/timer-policy/R�R�R�R�i�i�tmessagetselfLink(i�i�(Rdt
api_paramsRSRR�R?RcR�R�tpostR�R>RR)tcontent(R/RaR�R�R�tex((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.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(Ns,https://{0}:{1}/mgmt/tm/net/timer-policy/{2}R�R�R�R�i�R�(RdR�R?RcR�RRSR�RR�tpatchR�R>RR)R�(R/RaR�R�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns,https://{0}:{1}/mgmt/tm/net/timer-policy/{2}R�R�i�(
R?RcR�RRSR�RR�tdeleteRRkRR�(R/R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.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(Ns,https://{0}:{1}/mgmt/tm/net/timer-policy/{2}R�R�R�i�R�Ra(R?RcR�RRSR�RR�RbR�R>RR)R�R(R/R�R�R�R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR� s

(RRRURhRoRpRvRtRqRrRjRR~R}R�R�R�R�(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR_zs 																tArgumentSpeccB`seZd�ZRS(c%C`s,t|_tdtdt�dt�dtdddtdtdt�dtd	d
dd
dd
ddddddddddddddddg�dt�dtd	d�d tdd���d!td	d"dd"d#g�d$td	d%d&td'gf��}i|_|jjt�|jj|�dS((NRtrequiredRRttypeR*t
suboptionsRtdefaults	all-othertchoicestahtbnatesptetheriptgreticmptipencaptipv6s	ipv6-auths
ipv6-crypts	ipv6-icmpsisp-iptmuxtospfRMRKRLtudpliteR R8R"RsRqRrR�tCommontfallbacktF5_PARTITION(Rktsupports_check_modeR(R	t
argument_specRjR
(R/R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyRU5sT				(RRRU(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyR�4scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�R`Rx(
R�RR�R�R_Rvt	exit_jsonRt	fail_jsonR)(tspecR`tmmR0R�((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pytmainks		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
Rt'library.module_utils.network.f5.compareRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRt'ansible.module_utils.network.f5.compareRRR6RDRJRQtobjectRRR_R�R�R(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_timer_policy.pyt<module>sH


^&
?)(�7	

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