Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyo

�
�Udac@`s-ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZddlmZmZddlmZyddlmZmZWn'ek
r�ddlmZmZnXdefd��YZd�Zedkr)e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys
---
module: netapp_e_auditlog
short_description: NetApp E-Series manage audit-log configuration
description:
    - This module allows an e-series storage system owner to set audit-log configuration parameters.
version_added: '2.7'
author: Nathan Swartz (@ndswartz)
extends_documentation_fragment:
    - netapp.eseries
options:
    max_records:
        description:
            - The maximum number log messages audit-log will retain.
            - Max records must be between and including 100 and 50000.
        default: 50000
    log_level:
        description: Filters the log messages according to the specified log level selection.
        choices:
            - all
            - writeOnly
        default: writeOnly
    full_policy:
        description: Specifies what audit-log should do once the number of entries approach the record limit.
        choices:
            - overWrite
            - preventSystemAccess
        default: overWrite
    threshold:
        description:
            - This is the memory full percent threshold that audit-log will start issuing warning messages.
            - Percent range must be between and including 60 and 90.
        default: 90
    force:
        description:
            - Forces the audit-log configuration to delete log history when log messages fullness cause immediate
              warning or full condition.
            - Warning! This will cause any existing audit-log messages to be deleted.
            - This is only applicable for I(full_policy=preventSystemAccess).
        type: bool
        default: no
    log_path:
        description: A local path to a file to be used for debug logging.
        required: no
notes:
    - Check mode is supported.
    - This module is currently only supported with the Embedded Web Services API v3.0 and higher.
s�
- name: Define audit-log to prevent system access if records exceed 50000 with warnings occurring at 60% capacity.
  netapp_e_auditlog:
     api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
     api_username: "{{ netapp_e_api_username }}"
     api_password: "{{ netapp_e_api_password }}"
     ssid: "{{ netapp_e_ssid }}"
     validate_certs: no
     max_records: 50000
     log_level: all
     full_policy: preventSystemAccess
     threshold: 60
     log_path: /path/to/log_file.log
- name: Define audit-log utilize the default values.
  netapp_e_auditlog:
     api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
     api_username: "{{ netapp_e_api_username }}"
     api_password: "{{ netapp_e_api_password }}"
     ssid: "{{ netapp_e_ssid }}"
- name: Force audit-log configuration when full or warning conditions occur while enacting preventSystemAccess policy.
  netapp_e_auditlog:
     api_url: "https://{{ netapp_e_api_host }}/devmgr/v2"
     api_username: "{{ netapp_e_api_username }}"
     api_password: "{{ netapp_e_api_password }}"
     ssid: "{{ netapp_e_ssid }}"
     max_records: 5000
     log_level: all
     full_policy: preventSystemAccess
     threshold: 60
     force: yes
sz
msg:
    description: Success message
    returned: on success
    type: str
    sample: The settings have been updated.
N(tpformat(t
AnsibleModule(trequestteseries_host_argument_spec(t	to_native(turlparset
urlunparsetAuditLogcB`syeZdZdZidd6dd6Zd�Zd�Zd�Zd�Zd	�Z	d
d
ed
�Zd�Z
d�ZRS(s%Audit-log module configuration class.iP�sapplication/jsonsContent-TypetAcceptcC`szt�}|jtdtdddd�dtddddd	d
dg�dtddddd	dd
g�dtdddd�dtdddt�dtdddt���td|dt�|_|jj}|d|_|jdks|j|j	kr|jj
dd|j�n|d|_|jdksI|jdkrf|jj
dd|j�n|d|_|d|_
|d|_|d|_|d|_|jjd�s�|jd7_ntd|dd |d d!|d"�|_|d}tj|jj�|_|rEtjd#tjd$|d%d&d'd(�n|j�|_|jj|j�|jj|_dS()Ntmax_recordsttypetinttdefaultiP�t	log_leveltstrt	writeOnlytchoicestalltfull_policyt	overWritetpreventSystemAccesst	thresholdiZtforcetbooltlog_pathtrequiredt
argument_spectsupports_check_modeidtmsgs?Audit-log max_records count must be between 100 and 50000: [%s]i<s;Audit-log percent threshold must be between 60 and 90: [%s]tssidtapi_urlt/turl_passwordtapi_passwordtvalidate_certsturl_usernametapi_usernametleveltfilenametfilemodetwtformatsS%(relativeCreated)dms %(levelname)s %(module)s.%(funcName)s:%(lineno)d
 %(message)s(RtupdatetdicttFalseR	tTruetmoduletparamsRtMAX_RECORDSt	fail_jsonRRRRR%turltendswithtcredstloggingt	getLoggert	__class__t__name__t_loggertbasicConfigtDEBUGtis_proxyt
proxy_usedtinfot
check_mode(tselfR"targsR ((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyt__init__{sH	!!
!







	
cC`s�y^tt|j��}d|d<t|�}t|ddd|j|j�\}}|dSWn9tk
r�}|jj	dd|j
t|�f�nXd	S(
s/Determine whether the API is embedded or proxy.sdevmgr/utils/aboutittimeouti,theaderstrunningAsProxyR$sPFailed to retrieve the webservices about information! Array Id [%s]. Error [%s].N(tlistR
R:RR
tHEADERSR<t	ExceptionR6R9R%R(RHt	about_urltrctdataterr((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyRD�s
'cC`s�yw|jr=t|jdddd|j|j�\}}n5t|jd|jddd|j|j�\}}|SWn9tk
r�}|jjdd|jt	|�f�nXdS(	s�Retrieve the existing audit-log configurations.

        :returns: dictionary containing current audit-log configuration
        saudit-log/configRKi,RLs#storage-systems/%s/audit-log/configR$sJFailed to retrieve the audit-log configuration! Array Id [%s]. Error [%s].N(
RER
R:ROR<R%RPR6R9R(RHRRRSRT((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pytget_configuration�s	1c
C`s�|j�}td|dd|dd|dd|d�}td|jd|jd|jd|j�}||k}|jjt|��|jjt|��||fS(s�Build audit-log expected configuration.

        :returns: Tuple containing update boolean value and dictionary of audit-log configuration
        tauditLogMaxRecordst
auditLogLeveltauditLogFullPolicytauditLogWarningThresholdPct(	RUR3RRRRRARFR(RHtconfigtcurrenttbodyR2((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pytbuild_configuration�s


		c	C`s�|jjd�y|jrSt|jdddddd|j|j�\}}n;t|jd|jddddd|j|j�\}}Wn9tk
r�}|j	j
d	d
|jt|�f�nXdS(sDelete all audit-log messages.sDeleting audit-log messages...saudit-log?clearAll=TrueRKi,tmethodtDELETERLs*storage-systems/%s/audit-log?clearAll=TrueR$s?Failed to delete audit-log messages! Array Id [%s]. Error [%s].N(RARFRER
R:ROR<R%RPR6R9R(RHRRtresultRT((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pytdelete_log_messages�s	!"cC`s�|d
ks|d
kr-|j�\}}n|r�|jr�y|jr�t|jddddtj|�ddd|jdt	|j
�\}}nPt|jd	|jdddtj|�ddd|jdt	|j
�\}}|d
krN|jr"|r"|j
�|j||t�}qN|jjdd|jt||�f�nWq�tk
r�}|jjdd|jt|�f�q�Xn|S(sUpdate audit-log configuration.s storage-systems/audit-log/configRKi,RSR^tPOSTRLt
ignore_errorss#storage-systems/%s/audit-log/configi�R$sDFailed to update audit-log configuration! Array Id [%s]. Error [%s].N(tNoneR]RGRER
R:tjsontdumpsROR5R<R%RRatupdate_configurationR4R6R9RRP(RHR2R\tattempt_recoveryRRR`terror((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyRg�s*	
!cC`s)|j�}|jjddd|�dS(s#Update the audit-log configuration.R$sAudit-log update completetchangedN(RgR6t	exit_json(RHR2((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyR2
scC`s|j�dS(N(R2(RH((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyt__call__sN(R@t
__module__t__doc__R8RORJRDRUR]RaRdR5RgR2Rl(((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyRus

	,					cC`st�}|�dS(N(R(tauditlog((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pytmains	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNReR=tpprintRtansible.module_utils.basicR	tansible.module_utils.netappR
Rtansible.module_utils._textRR
RRPturllib.parsetobjectRRpR@(((sT/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_auditlog.pyt<module>s*


1 
�	

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