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

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZyTdd
l
mZddlmZddlmZddlmZddlmZWnaek
r)dd
lmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd efd!��YZd"efd#��YZ d$�Z!e"d%kre!�nd&S('i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bysE
---
module: bigip_firewall_rule_list
short_description: Manage AFM security firewall policies on a BIG-IP
description:
  - Manages AFM security firewall policies on a BIG-IP.
version_added: 2.7
options:
  name:
    description:
      - The name of the policy to create.
    type: str
    required: True
  description:
    description:
      - The description to attach to the policy.
      - This parameter is only supported on versions of BIG-IP >= 12.1.0. On earlier
        versions it will simply be ignored.
    type: str
  state:
    description:
      - When C(state) is C(present), ensures that the rule list exists.
      - When C(state) is C(absent), ensures that the rule list is removed.
    type: str
    choices:
      - present
      - absent
    default: present
  rules:
    description:
      - Specifies a list of rules that you want associated with this policy.
        The order of this list is the order they will be evaluated by BIG-IP.
        If the specified rules do not exist (for example when creating a new
        policy) then they will be created.
      - Rules specified here, if they do not exist, will be created with "default deny"
        behavior. It is expected that you follow-up this module with the actual
        configuration for these rules.
      - The C(bigip_firewall_rule) module can be used to also create, as well as
        edit, existing and new rules.
    type: list
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s
- name: Create a basic policy with some rule stubs
  bigip_firewall_rule_list:
    name: foo
    rules:
      - rule1
      - rule2
      - rule3
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s"
description:
  description: The new description of the policy.
  returned: changed
  type: str
  sample: My firewall policy
rules:
  description: The list of rules, in the order that they are evaluated, on the device.
  returned: changed
  type: list
  sample: ['rule1', 'rule2', 'rule3']
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttransform_namet
ParameterscB`s?eZidd6ZdgZddgZddgZd�ZRS(trulestrulesReferencetdescriptioncC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(treturnablestgetattrt_filter_paramst	Exception(tselftresultt
returnable((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt	to_return�s
(t__name__t
__module__tapi_maptapi_attributesRt
updatablesR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRns
			tModuleParameterscB`seZed��ZRS(cC`sA|jddkrdSg|jdD]}t|�^q%}|S(NR(t_valuestNonetstr(RtxR((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR�s&(RRtpropertyR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR �st
ApiParameterscB`seZed��ZRS(cC`s�g}|jddks,d|jdkr0gSxEt|jdd�D],\}}|jtd|dd|��qHWgt|dd��D]}|d^q�}|S(NRtitemstitemtfullPathtordertkeycS`s|dS(NR*((tk((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt<lambda>�s(R!R"t	enumeratetappendtdicttsorted(RRtidxR(R$((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR�s&$$,(RRR%R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR&�stChangescB`seZRS((RR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR3�st
UsableChangescB`seZRS((RR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR4�stReportableChangescB`seZRS((RR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR5�st
DifferencecB`s5eZdd�Zd�Zd�Zed��ZRS(cC`s||_||_dS(N(twantthave(RR7R8((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RtAttributeErrort_Difference__default(RtparamR((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RR7R8R:(RR<tattr1tattr2((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt	__default�s
cC`sd|jjdkrdS|jjdkr2|jjSt|jj�t|jj�kr`|jjSdS(N(R7RR"R8tset(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR�s
$N(RRR"R9R=R;R%R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR6�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�Zd�Zd�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR"RCR
RDtclientR R7R&R8R4tchanges(Rtargstkwargs((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR9�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRD(RRRR7R"R3RG(RtchangedR+((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.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(NRD(R6R7R8RRR0R=R"t
isinstancetupdateR3RGtTruetFalse(RtdiffRRJR,tchange((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RRRNRO(RR((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}n|jj�}|j|�|jtd|��|j	|�|S(NtpresenttabsentRJ(
ROR0R7tstateRTRURGRRMt_announce_deprecations(RRJRRVRG((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytexec_module�s	

cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRCt	deprecate(RRtwarningstwarning((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRWs


cC`s$|j�r|j�S|j�SdS(N(texistsRMtcreate(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRT
s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns7https://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}tservertserver_porti�tcode(tformatRFtproviderRR7t	partitiontnametapiREtjsont
ValueErrorRORRN(Rturitresptresponse((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR`s


+cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR8RSRORCt
check_modeRNtupdate_on_device(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRM"s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RCRpRNtremove_from_deviceR`R(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytremove+s
cC`s(|j�|jjrtS|j�tS(N(RKRCRpRNtcreate_on_device(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRa3s


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|jjr|j�n|dS(
NRhRgs4https://{0}:{1}/mgmt/tm/security/firewall/rule-list/RbRcRjRdi�i�tmessagetselfLink(i�i�(RGt
api_paramsR7RhRgReRFRfRitpostRjRkRR#tcontentRt_upsert_policy_rules_on_device(RRDRlRmRntex((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRt:s$

cC`s|jj�}dj|jjd|jjdt|jj|jj��}|r�|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��n|dS|jjdk	r|j�ndS(	Ns7https://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}RbRcRjRdi�RuRv(RGRwReRFRfRR7RgRhRitpatchRjRkRR#RyRR"Rz(RRDRlRmRnR{((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRqQs$

cC`s|j�r|j�StS(N(R`RsRO(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRUhs
cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns7https://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}RbRci�(
ReRFRfRR7RgRhRitdeleteRRNRRy(RRlRm((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRrms

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(NsRhttps://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}/?expandSubcollections=trueRbRcRdi�RuRD(ReRFRfRR7RgRhRiRERjRkRR#RyR&(RRlRmRnR{((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRoxs

cC`s�dj|jjd|jjdt|jj|jj�|jdd��}|jjj	|�}y|j
�}Wntk
r�tSX|j
dks�d|kr�|ddkr�tStS(NsAhttps://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}/rules/{3}RbRct/t_i�Rd(ReRFRfRR7RgRhtreplaceRiRERjRkRORRN(RtruleRlRmRn((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytrule_exists�s


+cC`s
td|jdd�dddd�}dj|jjd	|jjd
t|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr|ddkrd|kr�t
|d��qt
|j��n|dS(NRhR~Rtactiontrejectt
placeAftertlasts>https://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}/rules/RbRcRjRdi�i�RuRv(i�i�(R0R�ReRFRfRR7RgRhRiRxRjRkRR#Ry(RR�RDRlRmRnR{((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytcreate_default_rule_on_device�s$	

cC`s�dj|jjd|jjdt|jj|jj�|jdd��}|jjj	|�}|j
dkr�t|j��ndS(	NsAhttps://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}/rules/{3}RbRcR~Ri�i�(i�i�(
ReRFRfRR7RgRhR�RiR}RRRy(RR�RlRm((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytremove_rule_from_device�s

cC`stdd�}dj|jjd|jjdt|jj|jj�|jdd��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd	|kr�|d	dkr�d|kr�t
|d��q�t
|j��n|d
S(NR�R�sAhttps://{0}:{1}/mgmt/tm/security/firewall/rule-list/{2}/rules/{3}RbRcR~RRjRdi�i�RuRv(i�i�(R0ReRFRfRR7RgRhR�RiR|RjRkRR#Ry(RR�RDRlRmRnR{((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytmove_rule_to_front�s"	

cC`s�|jj}|dkr!g}n|j|�x9t|�D]+\}}|j|�s;|j|�q;q;Wx't|�D]\}}|j|�qwWdS(N(RGRR"t_remove_rule_differenceR.R�R�R�(RRR2R�((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRz�s	
cC`sq|dks|jjdkr"dSt|jj�}t|�}|j|�}x|D]}|j|�qVWdS(N(R"R8RRAt
differenceR�(RRt
have_rulest
want_rulest	removableRs((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR��s
(RRR9RKRRRSRXRWRTR`RMRsRaRtRqRURrRoR�R�R�R�RzR�(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyRB�s,																						tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dtdd�dtdd	d
tdgf�dtdd
dd
dg��}i|_|jjt�|jj|�dS(NRhtrequiredRRttypetlistRgtdefaulttCommontfallbacktF5_PARTITIONRVRTtchoicesRU(RNtsupports_check_modeR0R	t
argument_specRMR
(RR�((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR9�s			(RRR9(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RCRZ(
R�RR�R�RBRXt	exit_jsonRt	fail_jsonR#(tspecRCtmmtresultsR{((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pytmains		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
RtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRR R&R3R4R5tobjectR6RBR�R�R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_rule_list.pyt<module>sD


2


�"	

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