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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
lm
Z
ddlmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZ de fd��YZ!de fd��YZ"de fd��YZ#d e#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_apm_policy_import
short_description: Manage BIG-IP APM policy or APM access profile imports
description:
   - Manage BIG-IP APM policy or APM access profile imports.
version_added: 2.8
options:
  name:
    description:
      - The name of the APM policy or APM access profile to create or override.
    type: str
    required: True
  type:
    description:
      - Specifies the type of item to export from device.
    type: str
    choices:
      - profile_access
      - access_policy
    default: profile_access
  source:
    description:
      - Full path to a file to be imported into the BIG-IP APM.
    type: path
  force:
    description:
      - When set to C(yes) any existing policy with the same name will be overwritten by the new import.
      - If policy does not exist this setting is ignored.
    default: no
    type: bool
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
notes:
  - Due to ID685681 it is not possible to execute ng_* tools via REST api on v12.x and 13.x, once this is fixed
    this restriction will be removed.
  - Requires BIG-IP >= 14.0.0
extends_documentation_fragment: f5
author:
  - Wojciech Wypior (@wojtek0806)
s�
- name: Import APM profile
  bigip_apm_policy_import:
    name: new_apm_profile
    source: /root/apm_profile.tar.gz
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Import APM policy
  bigip_apm_policy_import:
    name: new_apm_policy
    source: /root/apm_policy.tar.gz
    type: access_policy
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Override existing APM policy
  bigip_asm_policy:
    name: new_apm_policy
    source: /root/apm_policy.tar.gz
    force: yes
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
s
source:
  description: Local path to APM policy file.
  returned: changed
  type: str
  sample: /root/some_policy.tar.gz
name:
  description: Name of the APM policy or APM access profile to be created/overwritten.
  returned: changed
  type: str
  sample: APM_policy_global
type:
  description: Set to specify type of item to export.
  returned: changed
  type: str
  sample: access_policy
force:
  description: Set when overwriting an existing policy or profile.
  returned: changed
  type: bool
  sample: yes
N(t
AnsibleModule(tenv_fallback(tLooseVersion(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(ttransform_name(tf5_argument_spec(tupload_file(ttmos_version(tmodule_provisionedt
ParameterscB`s)eZiZgZdddgZgZRS(tnametsourcettype(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR�s	t
ApiParameterscB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR�stModuleParameterscB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(tselftresultt
returnable((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyt	to_return�s
(RRR'(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR �st
UsableChangescB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR(�stReportableChangescB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR)�st
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R$R+R,((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R!tAttributeErrort_Difference__default(R$tparamR%((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R!R+R,R.(R$R0tattr1tattr2((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyt	__default�s
N(RRtNoneR-R1R/(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR*�s	t
ModuleManagercB`sbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cO`sR|jdd�|_t|jj�|_td|jj�|_t�|_	dS(Ntmoduletparams(
tgetR5R7RR8tclientRR+R(tchanges(R$targstkwargs((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR-�scC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR8(RRR!R+R5R(R;(R$tchangedtkey((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyt_set_changed_options�scC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR:R7t	deprecate(R$R%twarningstwarning((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyt_announce_deprecations�s


cC`s�t|jd�s!td��n|j�r<td��nt�}|j�}td|jj��}|j�}|j	|�|j	td|��|j
|�|S(Ntapms+APM must be provisioned to use this module.sTDue to bug ID685681 it is not possible to use this module on TMOS version below 14.xR8R>(RR:Rtversion_less_than_14tdictt
policy_importR)R;R'tupdateRH(R$R%R>t
reportableR;((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pytexec_module�s	

cC`s/t|j�}t|�td�kr+tStS(Ns14.0.0(RR:R
tTruetFalse(R$RC((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyRJscC`sW|j�|jjrtS|j�r?|jjtkr?tSn|j�|j	�tS(N(
R@R7t
check_modeRPtexistsR+tforceRQtimport_file_to_devicetremove_temp_file_from_device(R$((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyRLs


cC`s�|jjdkrSdj|jjd|jjdt|jj|jj��}n>dj|jjd|jjdt|jj|jj��}|jjj	|�}y|j
�}Wntk
r�tSX|j
dks�d|kr�|ddkr�tStS(Nt
access_policys4https://{0}:{1}/mgmt/tm/apm/policy/access-policy/{2}tservertserver_ports.https://{0}:{1}/mgmt/tm/apm/profile/access/{2}i�tcode(R+RtformatR:tproviderRt	partitionRtapiR9tjsont
ValueErrorRQRRP(R$turitresptresponse((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyRSs"

!


+cC`sddj|jjd|jjd�}yt|j|||�Wntk
r_td��nXdS(Ns1https://{0}:{1}/mgmt/shared/file-transfer/uploadsRXRYsFailed to upload the file.(R[R:R\RR(R$tcontentRturl((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pytupload_file_to_device*s

cC`sZtjj|jj�d}|j|jj|�dj||jj|jj�}dj|j	j
d|j	j
d�}tdddd	j|��}|j	jj
|d
|�}y/|j�}d|kr�t|d��nWn%tk
r}tt|���nXd|krV|dd
krVd|krDt|d��qVt|j��ntS(Nis6ng_import -s /var/config/rest/downloads/{0} {1} -p {2}s"https://{0}:{1}/mgmt/tm/util/bash/RXRYtcommandtruntutilCmdArgss-c "{0}"R_t
commandResultRZi�tmessage(tostpathtsplitR+RRfR[RR]R:R\RKR^tpostR_RR`tstrRdRP(R$RtcmdRaR<RbRctex((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyRU6s*!
cC`s
tjj|jj�d}dj|�}dj|jjd|jjd�}tddd|�}|jj	j
|d	|�}y|j�}Wn%tk
r�}t
t|���nXd
|kr|d
dkrd|kr�t
|d��qt
|j��ndS(
Nis/var/config/rest/downloads/{0}s%https://{0}:{1}/mgmt/tm/util/unix-rm/RXRYRgRhRiR_RZi�Rk(RlRmRnR+RR[R:R\RKR^RoR_R`RRpRd(R$Rt
tpath_nameRaR<RbRcRr((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyRVTs"
	(RRR-R@RHRORJRLRSRfRURV(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR6�s									tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdd�dtdddd	�dtdd
dd
dg�d
tdddtdgf��}i|_|jjt�|jj|�dS(NRtrequiredRRRmRTtbooltdefaulttnotprofile_accesstchoicesRWR]tCommontfallbacktF5_PARTITION(RPtsupports_check_modeRKR	t
argument_specRMR(R$R((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyR-ls"				(RRR-(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyRtkscC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NRR~R7RB(
RtRRR~R6ROt	exit_jsonRt	fail_jsonRp(tspecR7tmmtresultsRr((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pytmain�s		t__main__(,t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRltansible.module_utils.basicRR	tdistutils.versionR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
RRRt(library.module_utils.network.f5.icontrolRRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRRRR R(R)tobjectR*R6RtR�R(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_apm_policy_import.pyt<module>sV


-"
�	

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