# $Id$ # # Copyright (c) 2001-2014 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverAudit ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VserverAudit =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP VserverAudit. A related class is L, which represents access to an ONTAP VserverAudit. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the VserverAudit element are the attributes of the VserverAudit ComponentState. Additionally, the command_interface used to obtain the ComponentState object is also an attribute of the object. This makes it easier to obtain the component object corresponding to the CS object, using L. =over =item command_interface The command_interface with which the CS object was obtained. (Available in all CS objects regardless of requested_fields and the mode/interface) =item C<< rotate_schedule_minute >> Log Rotation Schedule: Minute (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $rotate_schedule_minute = $obj->rotate_schedule_minute(); # $rotate_schedule_minute contains a reference to the array of values my @rotate_schedule_minute = $obj->rotate_schedule_minute(); # @rotate_schedule_minute contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { rotate_schedule_minute = [ value1, value2...] } Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< vserver >> Vserver Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< destination >> Log Destination Path Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_schedule_dayofweek >> Log Rotation Schedule: Day of Week (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $rotate_schedule_dayofweek = $obj->rotate_schedule_dayofweek(); # $rotate_schedule_dayofweek contains a reference to the array of values my @rotate_schedule_dayofweek = $obj->rotate_schedule_dayofweek(); # @rotate_schedule_dayofweek contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { rotate_schedule_dayofweek = [ value1, value2...] } Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_schedule_day >> Log Rotation Schedule: Day (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $rotate_schedule_day = $obj->rotate_schedule_day(); # $rotate_schedule_day contains a reference to the array of values my @rotate_schedule_day = $obj->rotate_schedule_day(); # @rotate_schedule_day contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { rotate_schedule_day = [ value1, value2...] } Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< audit_guarantee >> Strict Guarantee of Auditing possible value(s) are, true,false Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_size >> Log File Size Limit Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_schedule_description >> Rotation Schedules Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< state >> Auditing State possible value(s) are, true,false Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< format >> Log Format possible value(s) are, xml,evtx Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< events >> Categories of Events to Audit possible value(s) are, file-ops,cifs-logon-logoff,cap-staging (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $events = $obj->events(); # $events contains a reference to the array of values my @events = $obj->events(); # @events contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { events = [ value1, value2...] } Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_schedule_month >> Log Rotation Schedule: Month (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $rotate_schedule_month = $obj->rotate_schedule_month(); # $rotate_schedule_month contains a reference to the array of values my @rotate_schedule_month = $obj->rotate_schedule_month(); # @rotate_schedule_month contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { rotate_schedule_month = [ value1, value2...] } Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_limit >> Log Files Rotation Limit Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< rotate_schedule_hour >> Log Rotation Schedule: Hour (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $rotate_schedule_hour = $obj->rotate_schedule_hour(); # $rotate_schedule_hour contains a reference to the array of values my @rotate_schedule_hour = $obj->rotate_schedule_hour(); # @rotate_schedule_hour contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { rotate_schedule_hour = [ value1, value2...] } Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =back =cut package NACL::CS::VserverAudit; use strict; use warnings; use Params::Validate qw(validate); use NATE::Log qw(log_global); use NACL::Exceptions::NoElementsFound qw(:try); use NACL::CS::ComponentState::ZapiSkip qw(make_zapi_skip); use NACL::CS::ComponentState::ZapiArray qw(make_zapi_array); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ array => 'rotate_schedule_minute', scalar => 'vserver', scalar => 'destination', array => 'rotate_schedule_dayofweek', array => 'rotate_schedule_day', scalar => 'audit_guarantee', scalar => 'rotate_size', scalar => 'rotate_schedule_description', scalar => 'state', scalar => 'format', array => 'events', array => 'rotate_schedule_month', scalar => 'rotate_limit', array => 'rotate_schedule_hour', ]; my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); =head1 METHODS =head2 fetch my $VserverAudit_state = NACL::CS::VserverAudit->fetch(command_interface => $ci, ...); my @VserverAudit_states = NACL::CS::VserverAudit->fetch(command_interface => $ci, ...); (Class method) Discovers which elements are present and returns their state in ComponentState objects. Called in scalar context it returns only one state object, in list context it returns all state objects. See L for a more detailed description along with a complete explanation of the options it accepts. Uses CMode CLI/ZAPI. Invokes fileservice-audit-config-get-iter API for CMode ZAPI iter. =over =item Exceptions =over =item C When there are no elements matching the query specified or elements of that type doesn't exist, then this exception will be thrown. =back =back =cut sub fetch { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::fetch( @args, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', zapi_type => 'none', }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', zapi_type => 'iter' }, ], show_cmd => 'vserver audit show', exception_text => 'No matching VserverAudit(s) found', frontend => 'NACL::CS::VserverAudit::fetch', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _update_state_objs_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->SUPER::_update_state_objs_cmode_zapi( @args, zapi_field_translations => { integer_cron_time => [ qw(rotate-schedule-minute rotate-schedule-dayofweek rotate-schedule-day rotate-schedule-month rotate-schedule-hour) ], hyphenate_value => [qw(format events)], }, ); $Log->exit() if $may_exit; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@args, api => 'vserver_audit_show',); $Log->exit() if $may_exit; return @state_objs; } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( @args, copy => [ qw(audit-guarantee destination vserver rotate-size format rotate-limit ) ], map => { 'rotate-schedule-minute' => [ make_zapi_array('rotate-schedule-minute'), make_zapi_skip('cron-minute'), ], 'rotate-schedule-day' => [ make_zapi_array('rotate-schedule-day'), make_zapi_skip('cron-day-of-month'), ], 'rotate-schedule-dayofweek' => [ make_zapi_array('rotate-schedule-dayofweek'), make_zapi_skip('cron-day-of-week'), ], 'rotate-schedule-description' => 'rotation-schedule-description', 'state' => 'is-enabled', 'events' => [make_zapi_array('events'), make_zapi_skip('audit-events'),], 'rotate-schedule-month' => [ make_zapi_array('rotate-schedule-month'), make_zapi_skip('cron-month'), ], 'rotate-schedule-hour' => [ make_zapi_array('rotate-schedule-hour'), make_zapi_skip('cron-hour'), ], }, api => "fileservice-audit-config-get-iter", ); $Log->exit() if $may_exit; return @state_objs; } 1;