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

�
�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_firewall_port_list
short_description: Manage port lists on BIG-IP AFM
description:
  - Manages the AFM port lists on a BIG-IP. This module can be used to add
    and remove port list entries.
version_added: 2.5
options:
  name:
    description:
      - Specifies the name of the port list.
    type: str
    required: True
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  description:
    description:
      - Description of the port list
    type: str
  ports:
    description:
      - Simple list of port values to add to the list
    type: list
  port_ranges:
    description:
      - A list of port ranges where the range starts with a port number, is followed
        by a dash (-) and then a second number.
      - If the first number is greater than the second number, the numbers will be
        reversed so-as to be properly formatted. ie, 90-78 would become 78-90.
    type: list
  port_lists:
    description:
      - Simple list of existing port lists to add to this list. Port lists can be
        specified in either their fully qualified name (/Common/foo) or their short
        name (foo). If a short name is used, the C(partition) argument will automatically
        be prepended to the short name.
    type: list
  state:
    description:
      - When C(present), ensures that the address list and entries exists.
      - When C(absent), ensures the address list is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
sR
- name: Create a simple port list
  bigip_firewall_port_list:
    name: foo
    ports:
      - 80
      - 443
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Override the above list of ports with a new list
  bigip_firewall_port_list:
    name: foo
    ports:
      - 3389
      - 8080
      - 25
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Create port list with series of ranges
  bigip_firewall_port_list:
    name: foo
    port_ranges:
      - 25-30
      - 80-500
      - 50-78
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Use multiple types of port arguments
  bigip_firewall_port_list:
    name: foo
    port_ranges:
      - 25-30
      - 80-500
      - 50-78
    ports:
      - 8080
      - 443
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Remove port list
  bigip_firewall_port_list:
    name: foo
    state: absent
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Create port list from a file with one port per line
  bigip_firewall_port_list:
    name: lot-of-ports
    ports: "{{ lookup('file', 'my-large-port-list.txt').split('\n') }}"
    state: present
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s$
description:
  description: The new description of the port list.
  returned: changed
  type: str
  sample: My port list
ports:
  description: The new list of ports applied to the port list.
  returned: changed
  type: list
  sample: [80, 443]
port_ranges:
  description: The new list of port ranges applied to the port list.
  returned: changed
  type: list
  sample: [80-100, 200-8080]
port_lists:
  description: The new list of port list names applied to the port list.
  returned: changed
  type: list
  sample: [/Common/list1, /Common/list2]
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tmodule_provisionedt
ParameterscB`sHeZidd6ZdddgZddddgZddddgZRS(t
port_listst	portListstportstdescriptiontport_ranges(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s

t
ApiParameterscB`s5eZed��Zed��Zed��ZRS(cC`s�|jddkrdSg}x�|jdD]�}d|dkrGq+n|djd�\}}t|j��}t|j��}||kr�||}}ndj||�}|j|�q+W|S(NRt-tnames{0}-{1}(t_valuestNonetsplittinttstriptformattappend(tselftresultt
port_rangetstarttstoptitem((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�scC`s`|jddkrdSg}x<|jdD]-}dj|d|d�}|j|�q+W|S(NRs/{0}/{1}t	partitionR(R R!R%R&(R'R(txR,((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�scC`sU|jddkrdSg|jdD]&}d|dkr%t|d�^q%}|S(NRRR(R R!R#(R'R.R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s:(RRtpropertyRRR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s
tModuleParameterscB`s5eZed��Zed��Zed��ZRS(cC`s�|jddkrdStd�|jdD��rCtd��ntd�|jdD��rotd��ng|jdD]}t|�^q}}|S(NRcs`s'|]}dt|�kr|VqdS(RN(tstr(t.0R.((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pys	<genexpr>�ss0Ports must be whole numbers between 0 and 65,535cs`s7|]-}dt|�ko&dknr|VqdS(ii��N(R#(R2R.((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pys	<genexpr>s(R R!tanyRR#(R'R.R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s&cC`s|jddkrdSg}x�|jdD]�}d|krCq+n|jd�\}}t|j��}t|j��}||kr�||}}nd|ko�dkns�d|ko�dknr�td��ndj||�}|j|�q+W|S(NRRii��s0Ports must be whole numbers between 0 and 65,535s{0}-{1}(R R!R"R#R$RR%R&(R'R(R)R*R+R,((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR
s"8cC`sX|jddkrdSg}x4|jdD]%}t|j|�}|j|�q+W|S(NR(R R!R
R-R&(R'R(R.R,((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRs(RRR/RRR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR0�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(R'R(t
returnable((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyt	to_return+s
(RRR9(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR4*stReportableChangescB`s&eZed��Zed��ZRS(cC`sIg}x<|jdD]-}d|dkr0qn|j|d�qW|S(NRRR(R R&(R'R(R,((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR7scC`sIg}x<|jdD]-}d|dkr0qn|j|d�qW|S(NRRR(R R&(R'R(R,((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR@s(RRR/RR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR:6s	t
UsableChangescB`s&eZed��Zed��ZRS(cC`s�|jddkr*|jddkr*dSg}|jdrs|g|jdD]}tdt|��^qN7}n|jdr�|g|jdD]}tdt|��^q�7}n|S(NRRR(R R!tdictR1(R'R(R.((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRKs&
6
6cC`sn|jddkrdSg}xJ|jdD];}|jd�d\}}|jtd|d|��q+W|S(NRt/iRR-(R R!R"R&R<(R'R(R.R-R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR_s(RRR/RR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR;Jst
DifferencecB`sSeZdd�Zd�Zd�Zed��Zed��Zed��Z	RS(cC`s||_||_dS(N(twantthave(R'R?R@((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyt__init__ns	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R5tAttributeErrort_Difference__default(R'tparamR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pytcomparers

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R5R?R@RB(R'RDtattr1tattr2((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyt	__defaultys
cC`sd|jjdkrdS|jjdkr2|jjSt|jj�t|jj�kr`|jjSdS(N(R?RR!R@tsorted(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s
$cC`sd|jjdkrdS|jjdkr2|jjSt|jj�t|jj�kr`|jjSdS(N(R?RR!R@RI(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s
$cC`sd|jjdkrdS|jjdkr2|jjSt|jj�t|jj�kr`|jjSdS(N(R?RR!R@RI(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR�s
$N(
RRR!RARERCR/RRR(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR>ms					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!RKR
RLtclientR0R?RR@R;tchanges(R'targstkwargs((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRA�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRL(RRR5R?R!R;RO(R'tchangedtkey((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_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(NRL(R>R?R@RRR<RER!t
isinstancetupdateR;ROtTruetFalse(R'tdiffRRRtktchange((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(R\RWRX(R'R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyt
should_update�scC`s�t|jd�s!td��nt}t�}|jj}|dkrW|j�}n|dkrr|j�}nt	d|j
j��}|j�}|j|�|jtd|��|j
|�|S(Ntafms+AFM must be provisioned to use this module.tpresenttabsentRLRR(RRNRRXR<R?tstateR_R`R:ROR9RVt_announce_deprecations(R'RRR(Rat
reportableRO((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pytexec_module�s 	

cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRKt	deprecate(R'R(twarningstwarning((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRb�s


cC`s$|j�r|j�S|j�SdS(N(texistsRVtcreate(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR_�s
cC`s|j�r|j�StS(N(RltremoveRX(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyR`�s
cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR@R]RXRKt
check_modeRWtupdate_on_device(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRV�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RKRpRWtremove_from_deviceRlR(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRn�s
cC`s(|j�|jjrtS|j�tS(N(RTRKRpRWtcreate_on_device(R'((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRm�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/port-list/{2}tservertserver_porti�tcode(R%RNtproviderRR?R-RtapiRMtjsont
ValueErrorRXRRW(R'turitresptresponse((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRls


+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(Ns7https://{0}:{1}/mgmt/tm/security/firewall/port-list/{2}RtRuRyRvi�tmessage(ROt
api_paramsR%RNRwRR?R-RRxtpatchRyRzRR1tcontent(R'RLR{R|R}tex((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRqs

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(Ns7https://{0}:{1}/mgmt/tm/security/firewall/port-list/{2}RtRuRvi�R~RL(R%RNRwRR?R-RRxRMRyRzRR1R�R(R'R{R|R}R�((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRo(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-s4https://{0}:{1}/mgmt/tm/security/firewall/port-list/RtRuRyRvi�i�R~tselfLink(i�i�(RORR?RR-R%RNRwRxtpostRyRzRR1R�(R'RLR{R|R}R�((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRs<s 
cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns7https://{0}:{1}/mgmt/tm/security/firewall/port-list/{2}RtRui�(
R%RNRwRR?R-RRxtdeleteRRWRR�(R'R{R}((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRrQs

(RRRARTR\R]RdRbR_R`RVRnRmRlRqRoRsRr(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRJ�s 																tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dtdd�dtdd�dtdd�d	td
ddtd
gf�dtd
ddddg��}i|_|jjt�|jj|�dS(NRtrequiredRRttypetlistRRR-tdefaulttCommontfallbacktF5_PARTITIONRaR_tchoicesR`(RWtsupports_check_modeR<R	t
argument_specRVR(R'R�((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyRA^s 			(RRRA(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.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_jsonR1(tspecRKtmmtresultsR�((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pytmaints		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
RRt(library.module_utils.network.f5.icontrolRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRRR0R4R:R;tobjectR>RJR�R�R(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_port_list.pyt<module>sJ


8Q
$0#1�	

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