# # Copyright (c) 2011-2015 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary StatisticsBase ComponentState Module ## @author lmurthy@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::_StatisticsBase =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP statistics object. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the StatisticsBase element are the attributes of the Statistics Object 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 C<< "timestamp" >> Filled in for CMode CLI. =item C<< "statistics" >> Filled in for CMode CLI. =item C<< "iteration" >> Filled in for CMode CLI. =item C<< "scope" >> Filled in for CMode CLI. =item C<< "sort_key" >> Filled in for CMode CLI. =back =cut package NACL::CS::_StatisticsBase; use strict; use warnings; use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use base qw(NACL::CS::ComponentState::ONTAP); use Class::MethodMaker [ scalar => 'timestamp', array => 'statistics', scalar => 'iteration', scalar => 'scope', scalar => 'sort_key', ]; sub _extra_filter_fields { $Log->enter() if $may_enter; $Log->exit() if $may_exit; return [qw(interval iterations max)]; } sub _build_fetch_methods { $Log->enter() if $may_enter; my ($pkg, $show_cmd) = @_; no strict 'refs'; *{"${pkg}::fetch"} = sub { $Log->enter() if $may_enter; my ($pkg, @opts) = @_; my @state_objs = $pkg->SUPER::fetch( @opts, show_cmd => $show_cmd, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', }, ], exception_text => "No matching $show_cmd(s) found", ); $Log->exit() if $may_exit; return wantarray ? @state_objs: $state_objs[0]; }; # Convert show_cmd to api by replacing spaces and hyphens with underscores. my $api = $show_cmd; $api =~ s/\s/_/g; $api =~ s/-/_/g; *{"${pkg}::_fetch_cmode_cli"} = sub { $Log->enter() if $may_enter; my ($pkg, @opts) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@opts, api => $api); $Log->exit() if $may_exit; return @state_objs; }; use strict 'refs'; $Log->exit() if $may_exit; } 1;