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

�
�Udac@`sSddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZytdd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
ridd
lmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ d e!fd!��YZ"d"e!fd#��YZ#d$e!fd%��YZ$d&�Z%e&d'krOe%�nd(S()i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_service_policy
short_description: Manages service policies on a BIG-IP.
description:
  - Service policies allow you to configure timers and port misuse rules,
    if enabled, on a per rule or per context basis.
version_added: 2.6
options:
  name:
    description:
      - Name of the service policy.
    required: True
    type: str
  description:
    description:
      - Description of the service policy.
    type: str
  timer_policy:
    description:
      - The timer policy to attach to the service policy.
    type: str
  port_misuse_policy:
    description:
      - The port misuse policy to attach to the service policy.
      - Requires that C(afm) be provisioned to use. If C(afm) is not provisioned, this parameter
        will be ignored.
    type: str
  state:
    description:
      - Whether the resource should exist or not.
    type: str
    choices:
      - present
      - absent
    default: present
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
sC
- name: Create a service policy
  bigip_service_policy:
    name: foo
    timer_policy: timer1
    port_misuse_policy: misuse1
    timer_policy_enabled: yes
    port_misuse_policy_enabled: yes
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
s�
timer_policy:
  description: The new timer policy attached to the resource.
  returned: changed
  type: str
  sample: /Common/timer1
port_misuse_policy:
  description: The new port misuse policy attached to the resource.
  returned: changed
  type: str
  sample: /Common/misuse1
description:
  description: New description of the resource.
  returned: changed
  type: str
  sample: My service policy description
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tfq_name(ttransform_name(tmodule_provisionedt
ParameterscB`sIeZidd6dd6ZdddgZdddgZdddgZRS(tport_misuse_policytportMisusePolicyttimer_policyttimerPolicytdescription(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRus
		t
ApiParameterscB`seZRS((RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR�stModuleParameterscB`s&eZed��Zed��ZRS(cC`sE|jddkrdS|jddkr.dSt|j|jd�S(NRt(t_valuestNoneRt	partition(tself((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR�s
cC`sE|jddkrdS|jddkr.dSt|j|jd�S(NRR(R R!RR"(R#((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR�s
(RRtpropertyRR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(R#tresultt
returnable((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyt	to_return�s
(RRR+(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR%�st
UsableChangescB`seZRS((RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR,�stReportableChangescB`seZRS((RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR-�st
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R#R/R0((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R&tAttributeErrort_Difference__default(R#tparamR)((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R&R/R0R2(R#R4tattr1tattr2((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyt	__default�s
N(RRR!R1R5R3(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.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�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR!R:R
R;tclientRR/RR0R,tchanges(R#targstkwargs((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR1�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR;(RRR&R/R!R,R>(R#tchangedtkey((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_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(NR;(R.R/R0RRtdictR5R!t
isinstancetupdateR,R>tTruetFalse(R#tdiffRRAtktchange((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RLRGRH(R#R)((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentR;RA(RHRDR/tstateRNROR-R>R+RFt_announce_deprecations(R#RAR)RPt
reportableR>((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pytexec_module�s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR=R:t	deprecate(R#R)twarningstwarning((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRQs


cC`s$|j�r|j�S|j�SdS(N(texistsRFtcreate(R#((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRNs
cC`s|j�r|j�StS(N(R[tremoveRH(R#((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyROs
cC`sm|j�|_|j�stS|jjrOt|jd�sOtd��qOn|j	j
r_tS|j�tS(NtafmsCTo configure a 'port_misuse_policy', you must have AFM provisioned.(
tread_current_from_deviceR0RMRHR/RRR=RR:t
check_modeRGtupdate_on_device(R#((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRFs
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(R:R`RGtremove_from_deviceR[R(R#((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR](s
cC`sX|j�|jjr:t|jd�s:td��q:n|jjrJtS|j	�tS(NR^sCTo configure a 'port_misuse_policy', you must have AFM provisioned.(
RCR/RRR=RR:R`RGtcreate_on_device(R#((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR\0s

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/service-policy/{2}tservertserver_porti�tcode(tformatR=tproviderRR/R"tnametapiR<tjsont
ValueErrorRHRRG(R#turitresptresponse((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.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��ndS(NRiR"s+https://{0}:{1}/mgmt/tm/net/service-policy/RdReRkRfi�i�tmessage(i�i�(R>t
api_paramsR/RiR"RgR=RhRjtpostRkRlRtstrtcontent(R#R;RmRnRotex((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRcKs
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/service-policy/{2}RdReRkRfi�Rp(R>RqRgR=RhRR/R"RiRjtpatchRkRlRRsRt(R#R;RmRnRoRu((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRa_s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns.https://{0}:{1}/mgmt/tm/net/service-policy/{2}RdRei�(
RgR=RhRR/R"RiRjtdeleteRRGRRt(R#RmRo((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRbrs

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/service-policy/{2}RdReRfi�RpR;(RgR=RhRR/R"RiRjR<RkRlRRsRtR(R#RmRnRoRu((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR_}s

(RRR1RCRLRMRSRQRNRORFR]R\R[RcRaRbR_(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR9�s 															tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdt�dt�dt�dt�dtdddd	dg�d
tdddtd
gf��}i|_|jjt�|jj|�dS(NRiRRRRPtdefaultRNtchoicesROR"tCommontfallbacktF5_PARTITION(RGtsupports_check_modeRDR	t
argument_specRFR
(R#R((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyR1�s						(RRR1(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyRx�scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NRR~R:RU(
RxRRR~R9RSt	exit_jsonRt	fail_jsonRs(tspecR:tmmtresultsRu((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pytmain�s		t__main__N('t
__future__RRRttypet
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRt(library.module_utils.network.f5.icontrolRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRRRR%R,R-tobjectR.R9RxR�R(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_service_policy.pyt<module>sJ


/
�	

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