# # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary AntivirusOnDemandCommand ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::AntivirusOnDemandCommand =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP AntivirusOnDemandCommand. A related class is L, which represents access to an ONTAP AntivirusOnDemandCommand. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the AntivirusOnDemandCommand element are the attributes of the AntivirusOnDemandCommand ComponentState. =over =item C<< "command_line" >> Filled in for CMode CLI. =item C<< "name" >> Filled in for CMode CLI. =item C<< scan_path >> Path Name Filled in for CMode CLI. =item C<< recursion >> Enable Subdirectory Recusion, possible value(s) are on,off Filled in for CMode CLI. =item C<< include_files >> Include or Exclude File-pattern, possible value(s) are include,exclude Filled in for CMode CLI. =item C<< vserver >> Vserver Filled in for CMode CLI. =item C<< force >> Force Creation Filled in for CMode CLI. =item C<< include_directories >> Include or Exclude Directory-pattern, possible value(s) are include,exclude Filled in for CMode CLI. =item C<< policy_owner >> Creator of On-demand Command Filled in for CMode CLI. =item C<< include_vservers >> Include or Exclude Vserver-pattern, possible value(s) are include,exclude Filled in for CMode CLI. =item C<< follow_junctions >> Enable Follow Junction, possible value(s) are on,off Filled in for CMode CLI. =item C<< vserver_pattern >> Regular Expression for Vservers Filled in for CMode CLI. =item C<< scan_type >> Object to be Scanned, possible value(s) are file,dir,vserver,cluster Filled in for CMode CLI. =item C<< file_pattern >> Regular Expression for Files Filled in for CMode CLI. =item C<< directory_pattern >> Regular Expression for Directories Filled in for CMode CLI. =back =cut package NACL::CS::AntivirusOnDemandCommand; use strict; use warnings; use Params::Validate qw(validate validate_with HASHREF ARRAYREF); use NACL::ComponentUtils qw(_dump_one); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use Data::Dumper; use NACL::Exceptions::NoElementsFound qw(:try); use base 'NACL::CS::ComponentState::ONTAP'; use NACL::C::_Mixins::AntivirusOnDemandCommand qw(:cmd_line); use Class::MethodMaker [ scalar => 'command_line', scalar => 'name', scalar => 'scan_path', scalar => 'recursion', scalar => 'include_files', scalar => 'vserver', scalar => 'force', scalar => 'include_directories', scalar => 'policy_owner', scalar => 'include_vservers', scalar => 'follow_junctions', scalar => 'vserver_pattern', scalar => 'scan_type', scalar => 'file_pattern', scalar => 'directory_pattern', ]; =head1 METHODS =head2 fetch my $AntivirusOnDemandCommand_state = NACL::CS::AntivirusOnDemandCommand->fetch(command_interface => $ci, ...); my @AntivirusOnDemandCommand_states = NACL::CS::AntivirusOnDemandCommand->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. Supports CMode CLI. =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 %opts = validate @args, $pkg->_fetch_validate_spec(); if ($opts{command_interface} ->has_uichange(uichange => 'antivirus-vserverization')) { if (exists $opts{filter}->{'command-line'}) { $pkg->_handle_full_cmd_line(opts => $opts{filter}); } if (grep {/^command-line$/} @{$opts{requested_fields}}) { $opts{requested_fields} = []; $Log->warn("The 'command-line' attribute no longer shows " . 'up in the output of antivirus on-demand command'); } } my @state_objs = $pkg->SUPER::fetch( %opts, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', }, ], exception_text => 'No matching antivirus on demand command(s) found', show_cmd => 'antivirus on-demand command show' ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub fetch sub _fetch_cmode_cli { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@_, api => 'antivirus_on_demand_command_show'); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _apply_filter { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate_with( params => \@args, spec => { state_objs => {type => ARRAYREF}, filter => {type => HASHREF}, }, allow_extra => 1 ); my $state_objs = $opts{state_objs}; if (@$state_objs) { my $ci = $state_objs->[0]->command_interface(); if ( $ci && $ci->has_uichange(uichange => 'antivirus-vserverization')) { if (exists $opts{filter}->{'command-line'}) { $pkg->_handle_full_cmd_line(opts => $opts{filter}); } } } $Log->exit() if $may_exit; return $pkg->SUPER::_apply_filter(%opts); } 1;