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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZ defd��YZ!de!fd��YZ"d e!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_firewall_schedule
short_description: Manage BIG-IP AFM schedule configurations
description:
  - Manage BIG-IP AFM schedule configurations.
version_added: 2.9
options:
  name:
    description:
      - Specifies the name of the AFM schedule configuration.
    type: str
    required: True
  description:
    description:
      - Specifies the user defined description text.
    type: str
  daily_hour_end:
    description:
      - Specifies the time of day the rule will stop being used.
      - When not defined, the default of C(24:00) is used when creating a new schedule.
      - The time zone is always assumed to be UTC and values must be provided as C(HH:MM) using 24hour clock format.
    type: str
  daily_hour_start:
    description:
      - Specifies the time of day the rule will start to be in use.
      - The value must be a time before C(daily_hour_end).
      - When not defined, the default of C(0:00) is used when creating a new schedule.
      - When the value is set to C(all-day) both C(daily_hour_end) and C(daily_hour_start) are reset to their respective
        defaults.
      - The time zone is always assumed to be UTC and values must be provided as C(HH:MM) using 24hour clock format.
    type: str
  date_valid_end:
    description:
      - Specifies the end date/time this schedule will apply to the rule.
      - The date must be after C(date_valid_start)
      - When not defined the default of C(indefinite) is used when creating a new schedule.
      - The time zone is always assumed to be UTC.
      - The datetime format should always be the following C(YYYY-MM-DD:HH:MM:SS) format.
    type: str
  date_valid_start:
    description:
      - Specifies the start date/time this schedule will apply to the rule.
      - When not defined the default of C(epoch) is used when creating a new schedule.
      - The time zone is always assumed to be UTC.
      - The datetime format should always be the following C(YYYY-MM-DD:HH:MM:SS) format.
    type: str
  days_of_week:
    description:
      - Specifies which days of the week the rule will be applied.
      - When not defined the default value of C(all) is used when creating a new schedule.
      - The C(all) value is mutually exclusive with other choices.
    type: list
    choices:
      - sunday
      - monday
      - tuesday
      - wednesday
      - thursday
      - friday
      - saturday
      - all
  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
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
extends_documentation_fragment: f5
author:
  - Wojciech Wypior (@wojtek0806)
s�
- name: Create a 6 hour two day schedule, no start/end date
  bigip_firewall_schedule:
    name: barfoo
    daily_hour_start: 13:00
    daily_hour_end: 19:00
    days_of_week:
      - monday
      - tuesday
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Create a seven day schedule with start/end date
  bigip_firewall_schedule:
    name: foobar
    date_valid_start: "{{ lookup('pipe','date +%Y-%m-%d:%H:%M:%S') }}"
    date_valid_end: "{{ lookup('pipe','date -d \"now + 7 days\" +%Y-%m-%d:%H:%M:%S') }}"
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Modify created schedule to all-day
  bigip_firewall_schedule:
    name: barfoo
    daily_hour_start: all-day
    days_of_week:
      - monday
      - tuesday
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Modify a schedule to have no end date
  bigip_firewall_schedule:
    name: foobar
    date_valid_start: "{{ lookup('pipe','date +%Y-%m-%d:%H:%M:%S') }}"
    date_valid_end: "indefinite"
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Remove created schedule
  bigip_firewall_schedule:
    name: foobar
    state: absent
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s*
daily_hour_start:
  description: The time of day the rule will start to be in use.
  returned: changed
  type: str
  sample: '13:00'
daily_hour_end:
  description: The time of day the rule will stop being used.
  returned: changed
  type: str
  sample: '18:00'
date_valid_start:
  description: The start date/time schedule will apply to the rule.
  returned: changed
  type: str
  sample: 2019-03-01:15:30:00
date_valid_end:
  description: The end date/time schedule will apply to the rule.
  returned: changed
  type: str
  sample: 2019-03-11:15:30:00
days_of_week:
  description: The days of the week the rule will be applied.
  returned: changed
  type: list
  sample: ["monday","tuesday"]
description:
  description: The user defined description text.
  returned: changed
  type: str
  sample: Foo is bar
N(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(ttransform_name(tf5_argument_spec(tcmp_str_with_none(tcmp_simple_listt
ParameterscB`syeZidd6dd6dd6dd6dd	6Zddddd	d
gZdddddd
gZdddddd
gZRS(tdaily_hour_endtdailyHourEndtdaily_hour_starttdailyHourStarttdate_valid_endtdateValidEndtdate_valid_starttdateValidStarttdays_of_weekt
daysOfWeektdescription(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�s0
		t
ApiParameterscB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR$�stModuleParameterscB`sqeZd�Zd�Zed�Zed��Zed��Zed��Z	ed��Z
ed��ZRS(cC`sYd}tj||�}|rIdj|jdddddd��}|Std	��dS(
Ns8(\d{4})-(\d{1,2})-(\d{1,2})[:, T](\d{2}):(\d{2}):(\d{2})s{0}-{1}-{2}T{3}:{4}:{5}ZiiiiiisInvalid datetime provided.(tretmatchtformattgroupR(tselftvaluetpR'tdate((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt_convert_datetimes'cC`s�d}tj||�}|r�t|jd��t|jd��f}ytj|�Wq�tk
r�}tt|���q�XndS(Ns(\d{2}):(\d{2})ii(	R&R'tintR)tdatetimettimet
ValueErrorRtstr(R*R+R,R'R1tex((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt_validate_times*c	
C`sy|r�d}tj||�}tj||�}|ru|rutd�|jdd�D��}td�|jdd�D��}tj|�tj|�kr�td��q�qun�d}tj||�}tj||�}|ru|rutd�|jddd	d
dd�D��}td
�|jddd	d
dd�D��}tj|�tj|�krutd��qundS(Ns(\d{2}):(\d{2})cs`s|]}t|�VqdS(N(R/(t.0ti((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pys	<genexpr>siics`s|]}t|�VqdS(N(R/(R6R7((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pys	<genexpr>ss'End time must be later than start time.s8(\d{4})-(\d{1,2})-(\d{1,2})[:, T](\d{2}):(\d{2}):(\d{2})cs`s|]}t|�VqdS(N(R/(R6R7((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pys	<genexpr>&siiiics`s|]}t|�VqdS(N(R/(R6R7((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pys	<genexpr>'ss'End date must be later than start date.(R&R'ttupleR)R0R1R(	R*tvalue1tvalue2R1tp1tm1tm2tstarttend((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt_compare_date_times&""..cC`s�|jddkrdS|jddkr.dS|j|jd�|jddk	r�|jdkr�|j|jd|jdt�n|jdS(NRsall-days0:00Rs24:00R1(t_valuestNoneR5RR@tTrue(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR-s"#cC`sc|jddkrdS|jddkr.dS|jddksX|j|jd�n|jdS(NRRsall-days24:00(RARBR5(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR8scC`sH|jddkrdS|jddkr.dS|j|jd�}|S(NRs2038-1-18:19:14:07t
indefinite(s2038-1-18:19:14:07RD(RARBR.(R*tresult((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRBscC`s�|jddkrdS|jddkr.dS|j|jd�}|jdr}|jddkr}|j||j�q}n|S(	NRs1970-1-1:00:00:00tepochRs2038-1-18:19:14:07RD(s1970-1-1:00:00:00RF(s2038-1-18:19:14:07s
indefinite(RARBR.R@R(R*RE((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRKs
cC`s�|jddkrdSd|jdkr�t|jd�dkre|jdtkretd��nddddd	d
dg}|S|jdS(NRtallis9The 'all' value must not be specified with other choices.tsundaytmondayttuesdayt	wednesdaytthursdaytfridaytsaturday(RARBtlentlistR(R*tweek((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRWs,(RRR.R5tFalseR@tpropertyRRRRR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR%s	
	

	tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R"tgetattrt_filter_paramst	Exception(R*REt
returnable((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt	to_returnfs
(RRRY(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRTest
UsableChangescB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRZqstReportableChangescB`s>eZd�Zed��Zed��Zed��ZRS(cC`s]|dkrdSd}tj||�}|rYdj|jdddddd��}|SdS(	Ns8(\d{4})-(\d{1,2})-(\d{1,2})[:, T](\d{2}):(\d{2}):(\d{2})s{0}-{1}-{2}:{3}:{4}:{5}iiiiii(RBR&R'R(R)(R*R+R,R'R-((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR.vs'cC`s|j|jd�}|S(NR(R.RA(R*RE((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRscC`s|j|jd�}|S(NR(R.RA(R*RE((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�scC`s8|jddkrdSt|jd�dkr4dSdS(NRiRG(RARBRO(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�s(RRR.RSRRR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR[us		t
DifferencecB`sDeZdd�Zd�Zd�Zed��Zed��ZRS(cC`s||_||_dS(N(twantthave(R*R]R^((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RUtAttributeErrort_Difference__default(R*tparamRE((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RUR]R^R`(R*Rbtattr1tattr2((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt	__default�s
cC`st|jj|jj�S(N(RR]RR^(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�scC`st|jj|jj�S(N(RR]RR^(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�sN(	RRRBR_RcRaRSRR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.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(tgetRBRhR
RitclientR%R]R$R^RZtchanges(R*targstkwargs((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR_�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRi(RR"RUR]RBRZRl(R*tchangedtkey((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.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(NRi(R\R]R^RR#tdictRcRBt
isinstancetupdateRZRlRCRR(R*tdiffR#Rotktchange((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt_update_changed_options�s		
cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRkRht	deprecate(R*REtwarningstwarning((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt_announce_deprecations�s


cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRiRo(RRRrR]tstateR�R�R[RlRYRtR�(R*RoRER�t
reportableRl((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pytexec_module�s	

cC`s$|j�r|j�S|j�SdS(N(texistsRttcreate(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR��s
cC`s|j�r|j�StS(N(R�tremoveRR(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR��s
cC`s|j�}|rtStS(N(RxRCRR(R*RE((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt
should_update�scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR^R�RRRht
check_modeRCtupdate_on_device(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRt�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RhR�RCtremove_from_deviceR�R(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�s
cC`s(|j�|jjrtS|j�tS(N(RqRhR�RCtcreate_on_device(R*((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�s


cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns6https://{0}:{1}/mgmt/tm/security/firewall/schedule/{2}tservertserver_porti�tcode(R(RktproviderRR]t	partitiontnametapiRjtjsonR2RRRRC(R*turitresptresponse((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.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��ntS(NR�R�s3https://{0}:{1}/mgmt/tm/security/firewall/schedule/R�R�R�R�i�i�tmessage(i�i�(Rlt
api_paramsR]R�R�R(RkR�R�tpostR�R2RR3tcontentRC(R*RiR�R�R�R4((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.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(Ns6https://{0}:{1}/mgmt/tm/security/firewall/schedule/{2}R�R�R�R�i�R�(RlR�R(RkR�RR]R�R�R�tpatchR�R2RR3R�(R*RiR�R�R�R4((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�7s

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns6https://{0}:{1}/mgmt/tm/security/firewall/schedule/{2}R�R�i�(
R(RkR�RR]R�R�R�tdeleteRRCRR�(R*R�R�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�Js

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(Ns6https://{0}:{1}/mgmt/tm/security/firewall/schedule/{2}R�R�R�i�R�Ri(R(RkR�RR]R�R�R�RjR�R2RR3R�R$(R*R�R�R�R4((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�Us

(RRR_RqRxR�R�R�R�R�RtR�R�R�R�R�R�R�(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyRg�s 																tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dt�dt�dt�dt�dtd	d
ddd
ddddddg�dtdddddg�dtdddtdgf��	}i|_|jjt�|jj|�dS(NR�trequiredRRRRRRttypeRPtchoicesRHRIRJRKRLRMRNRGR�tdefaultR�R�R�tCommontfallbacktF5_PARTITION(RCtsupports_check_modeRrR	t
argument_specRtR(R*R�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR_js4								(RRR_(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyR�iscC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RhRz(
R�RR�R�RgR�t	exit_jsonRt	fail_jsonR3(tspecRhtmmtresultsR4((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pytmain�s		t__main__(*t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR&R0tansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRt'library.module_utils.network.f5.compareRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont'ansible.module_utils.network.f5.compareRR$R%RTRZR[tobjectR\RgR�R�R(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_firewall_schedule.pyt<module>sR


Q=!
%e�$	

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