# $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 EventConfig ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::EventConfig =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP EventConfig. A related class is L, which represents access to an ONTAP EventConfig. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the EventConfig element are the attributes of the EventConfig 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<< mailserver >> Mail Server (SMTP) Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: mail-server =item C<< console >> Console Logging possible value(s) are, on,off Filled in for CMode CLI/ZAPI, non-iter. =item C<< maxtargeteventbytes >> Target Maximum Bytes Per Event Per Week ranges from 10 to 134217728 Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: max-target-event-bytes =item C<< mailfrom >> Mail From Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: mail-from =item C<< suppression >> Event Throttling/Suppression possible value(s) are, on,off Filled in for CMode CLI/ZAPI, non-iter. =item C<< maxlogshowsize >> Maximum Number of Events Displayed ranges from 1 to 10000 Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: max-log-show-size =item C<< maxtargetlogsize >> Target Maximum Log Size per Week ranges from 1048576 to 134217728 Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: max-target-log-size =item C<< consoleloglevel >> Console Logging Level possible value(s) are, NODE_FAULT,SVC_FAULT,NODE_ERROR,SVC_ERROR,WARNING,NOTICE,INFO,DEBUG,VAR Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: console-log-level =item C<< tracelogsize >> Maximum Number of Events Displayed in Tracelog ranges from 1 to 10000 Filled in for CMode CLI/ZAPI, non-iter. Mapping for CMode ZAPI non-iter: trace-log-size =back =cut package NACL::CS::EventConfig; 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 [ scalar => 'mailserver', scalar => 'console', scalar => 'maxtargeteventbytes', scalar => 'mailfrom', scalar => 'suppression', scalar => 'maxlogshowsize', scalar => 'maxtargetlogsize', scalar => 'consoleloglevel', scalar => 'tracelogsize', ]; my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); =head1 METHODS =head2 fetch my $EventConfig_state = NACL::CS::EventConfig->fetch(command_interface => $ci, ...); (Class method) Discovers which elements are present and returns their state in ComponentState objects. This being a "singleton" table (i.e. one which can only have one row) is callable only in scalar context. See L for a more detailed description along with a complete explanation of the options it accepts. Uses CMode CLI/ZAPI. Invokes ems-config-get API for CMode ZAPI non-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_non_iter', interface => 'ZAPI', set => 'CMode', zapi_type => 'non-iter', }, ], show_cmd => 'event config show', exception_text => 'No matching event config(s) found', frontend => 'NACL::CS::EventConfig::fetch', is_singleton => 1 ); $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 => { on_off_boolean => [qw(console suppression)], uc => [qw(consoleloglevel)], }, ); $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 => 'event_config_show', is_singleton => 1, ); $Log->exit() if $may_exit; return @state_objs; } sub _fetch_cmode_zapi_non_iter { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi_non_iter( @args, copy => [ qw(console suppression ) ], map => { 'mailserver' => 'mail-server', 'maxtargeteventbytes' => 'max-target-event-bytes', 'mailfrom' => 'mail-from', 'maxlogshowsize' => 'max-log-show-size', 'maxtargetlogsize' => 'max-target-log-size', 'consoleloglevel' => 'console-log-level', 'tracelogsize' => 'trace-log-size', }, api => "ems-config-get", primary_keys => [qw( )], ); $Log->exit() if $may_exit; return @state_objs; } 1;