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_monitor_tcp_echo.pyo

�
�Udac@`s_ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
lm
Z
ytddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
ruddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZ defd��YZ!de!fd��YZ"de!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_versiontpreviewtstatust	certifiedtsupported_bys\

---
module: bigip_monitor_tcp_echo
short_description: Manages F5 BIG-IP LTM tcp echo monitors
description: Manages F5 BIG-IP LTM tcp echo monitors.
version_added: 2.4
options:
  name:
    description:
      - Monitor name.
    type: str
    required: True
  parent:
    description:
      - The parent template of this monitor template. Once this value has
        been set, it cannot be changed. By default, this value is the C(tcp_echo)
        parent on the C(Common) partition.
    type: str
    default: /Common/tcp_echo
  description:
    description:
      - The description of the monitor.
    type: str
    version_added: 2.7
  ip:
    description:
      - IP address part of the IP/port definition. If this parameter is not
        provided when creating a new monitor, then the default value will be
        '*'.
    type: str
  interval:
    description:
      - The interval specifying how frequently the monitor instance of this
        template will run. If this parameter is not provided when creating
        a new monitor, then the default value will be 5. This value B(must)
        be less than the C(timeout) value.
    type: int
  timeout:
    description:
      - The number of seconds in which the node or service must respond to
        the monitor request. If the target responds within the set time
        period, it is considered up. If the target does not respond within
        the set time period, it is considered down. You can change this
        number to any number you want, however, it should be 3 times the
        interval number of seconds plus 1 second. If this parameter is not
        provided when creating a new monitor, then the default value will be 16.
    type: int
  time_until_up:
    description:
      - Specifies the amount of time in seconds after the first successful
        response before a node will be marked up. A value of 0 will cause a
        node to be marked up immediately after a valid response is received
        from the node. If this parameter is not provided when creating
        a new monitor, then the default value will be 0.
    type: int
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
    version_added: 2.5
  state:
    description:
      - When C(present), ensures that the monitor exists.
      - When C(absent), ensures the monitor is removed.
    type: str
    choices:
      - present
      - absent
    default: present
    version_added: 2.5
notes:
  - Requires BIG-IP software version >= 12
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s�
- name: Create TCP Echo Monitor
  bigip_monitor_tcp_echo:
    state: present
    ip: 10.10.10.10
    name: my_tcp_monitor
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Remove TCP Echo Monitor
  bigip_monitor_tcp_echo:
    state: absent
    name: my_tcp_monitor
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
s�
parent:
  description: New parent template of the monitor.
  returned: changed
  type: str
  sample: tcp
ip:
  description: The new IP of IP/port definition.
  returned: changed
  type: str
  sample: 10.12.13.14
description:
  description: The description of the monitor.
  returned: changed
  type: str
  sample: Important Monitor
interval:
  description: The new interval in which to run the monitor check.
  returned: changed
  type: int
  sample: 2
timeout:
  description: The new timeout in which the remote system must respond to the monitor.
  returned: changed
  type: int
  sample: 10
time_until_up:
  description: The new time in which to mark a system as up after first successful response.
  returned: changed
  type: int
  sample: 2
N(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttransform_name(tis_valid_ip(tcmp_str_with_nonet
ParameterscB`s�eZidd6dd6ZddddddgZddddddgZdddddgZed	��Zed
��Zed��Z	ed��Z
e
jd
��Z
ed��Zed��Z
ed��ZRS(t
time_until_upttimeUntilUptparenttdefaultsFromtintervalttimeouttdestinationtdescriptiontipcC`s`|jddkrdSdt|jd�ko;dknrOtd��nt|jd�S(NRii�Qs*Interval value must be between 1 and 86400(t_valuestNonetintR(tself((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�s)cC`s(|jddkrdSt|jd�S(NR(RRR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�scC`s\|jddkrdS|jddkr.dSt|jd�rL|jdStd��dS(NRt*s0.0.0.0s1The provided 'ip' parameter is not an IP address.(Rs0.0.0.0(RRRR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�scC`s|jS(N(R(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�scC`s||jd<dS(NR(R(Rtvalue((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�scC`s(|jddkrdSt|jd�S(NR(RRR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�scC`s~|jddkrdS|jdjd�r^tjj|jd�}dj|j|�}ndj|j|jd�}|S(NRt/s/{0}/{1}(RRt
startswithtostpathtbasenametformatt	partition(RRtresult((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�scC`sdS(Nttcp_echo((R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyttypes(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablestpropertyRRRRtsetterRRR*(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�s8
			

t
ApiParameterscB`seZed��ZRS(cC`s"|jddkrdS|jdS(NRtnone(NR4(RR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR	s(R+R,R1R(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR3stModuleParameterscB`seZed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NRR4t(snoneR6(RR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRs
(R+R,R1R(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR5stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R/tgetattrt_filter_paramst	Exception(RR(t
returnable((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt	to_returns
(R+R,R<(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR7st
UsableChangescB`seZRS((R+R,(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR=&stReportableChangescB`seZRS((R+R,(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR>*st
DifferencecB`sbeZdd�Zd�Zed��Zed��Zed��Zd�Z	ed��Z
RS(cC`s||_||_dS(N(twantthave(RR@RA((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt__init__/s	cC`s?yt||�}|SWn!tk
r:|j|�}|SXdS(N(R8tAttributeErrort_Difference__default(RtparamR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pytcompare3s
cC`s+|jj|jjkr'td��ndS(Ns$The parent monitor cannot be changed(R@RRAR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR;scC`s<|jjdkrdS|jj|jjkr8|jjSdS(N(R@RRRRA(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRBscC`s�|jjdk	rN|jjdk	rN|jj|jjkr�td��q�nx|jjdk	r�|jj|jjkr�td��q�n<|jjdk	r�|jj|jjkr�td��q�n|jj|jjkr�|jjSdS(Ns1Parameter 'interval' must be less than 'timeout'.(R@RRRRRA(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRIs$cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R8R@RARC(RREtattr1tattr2((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt	__default]s
cC`st|jj|jj�S(N(RR@RRA(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRfsN(R+R,RRBRFR1RRRRDR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR?.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�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetRRKR
RLtclientR5R@R3RAR=tchanges(Rtargstkwargs((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRBls
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRL(RR/R8R@RR=RO(Rtchangedtkey((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt_set_changed_optionsss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(NRL(R?R@RARR0tdictRFRt
isinstancetupdateR=ROtTruetFalse(RtdiffR0RRtktchange((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt_update_changed_options{s		
cC`s|j�}|rtStS(N(R]RXRY(RR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRLRR(RYRUR@tstateR_R`R>ROR<RWt_announce_deprecations(RRRR(Rat
reportableRO((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRNRKt	deprecate(RR(twarningstwarning((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRb�s


cC`s$|j�r|j�S|j�SdS(N(texistsRWtcreate(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR_�s
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/monitor/tcp-echo/{2}tservertserver_porti�tcode(R&RNtproviderRR@R'tnametapiRMtjsont
ValueErrorRYRRX(Rturitresptresponse((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRl�s


+cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRAR^RYRKt
check_modeRXtupdate_on_device(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRW�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RKRzRXtremove_from_deviceRlR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pytremove�s
cC`s2|j�|j�|jjr$tS|j�tS(N(RTt_set_default_creation_valuesRKRzRXtcreate_on_device(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRm�s


cC`s�|jjdkr,|jjidd6�n|jjdkrX|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�ndS(	NiRiRiRRR(R@RRRWRRR(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR~�scC`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��ndS(NRrR's-https://{0}:{1}/mgmt/tm/ltm/monitor/tcp-echo/RnRoRtRpi�i�tmessage(i�i�(ROt
api_paramsR@RrR'R&RNRqRstpostRtRuRtstrtcontent(RRLRvRwRxtex((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.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/monitor/tcp-echo/{2}RnRoRtRpi�R�(ROR�R&RNRqRR@R'RrRstpatchRtRuRR�R�(RRLRvRwRxR�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR{�s

cC`s|j�r|j�StS(N(RlR}RY(R((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR`s
cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns0https://{0}:{1}/mgmt/tm/ltm/monitor/tcp-echo/{2}RnRoi�(R&RNRqRR@R'RrRstdeleteRRX(RRvRw((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.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/monitor/tcp-echo/{2}RnRoRpi�R�RL(R&RNRqRR@R'RrRsRMRtRuRR�R�R3(RRvRwRxR�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRys

(R+R,RBRTR]R^RdRbR_RlRWR}RmR~RR{R`R|Ry(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRJks"													
				
tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdd�dt�dt�dtd	d
�dtd	d
�dtd	d
�d
tdddddg�dtdddtdgf��	}i|_|jjt�|jj|�dS(NRrtrequiredRtdefaults/Common/tcp_echoRRRR*RRRRaR_tchoicesR`R'tCommontfallbacktF5_PARTITION(RXtsupports_check_modeRUR	t
argument_specRWR
(RR�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyRB/s$				(R+R,RB(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyR�.scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RKRf(
R�RR�R�RJRdt	exit_jsonRt	fail_jsonR�(tspecRKtmmtresultsR�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pytmainGs		t__main__(*t
__future__RRRR*t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR#tansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
Rt)library.module_utils.network.f5.ipaddressRt'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.compareRR3R5R7R=R>tobjectR?RJR�R�R+(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_tcp_echo.pyt<module>sL


O!
[
=�	

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