# $Id : //depot/prod/test/nacldev/lib/NACL/CS/StorageFailoverShowGiveback.pm#6 $ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary ComponentState Module for the method NACL::C::StorageFailover->show_giveback() (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::StorageFailoverShowGiveback =head1 DESCRIPTION C is a derived class of L. Object(s) of this type are returned when NACL::C::StorageFailover->show_giveback() is invoked. ((This module does not represent the state of any element, but is an object repesentation of the output obtained when NACL::C::StorageFailover->show_giveback() is invoked.) =head1 ATTRIBUTES The fields of the output are fields of the ComponentState object. =over =item C<< giveback_status >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $giveback_status = $obj->giveback_status(); # $giveback_status contains a reference to the array of values my @giveback_status = $obj->giveback_status(); # @giveback_status contains the array of values Filled in for CMode CLI. =item C<< aggr_index >> Filled in for CMode CLI. =item C<< destination >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< aggregate >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< node >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< state >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< error >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< module >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =back =cut package NACL::CS::StorageFailoverShowGiveback; use strict; use warnings; use Params::Validate qw(validate); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use NACL::Exceptions::NoElementsFound qw(:try); use NACL::Exceptions::InvalidChoice; use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ array => 'giveback_status', scalar => 'aggr_index', scalar => 'destination', scalar => 'aggregate', scalar => 'node', scalar => 'state', scalar => 'error', scalar => 'module', ]; =head1 METHODS =head2 fetch my $StorageFailoverShowGiveback_state = NACL::CS::StorageFailoverShowGiveback->fetch(command_interface => $ci, ...); my @StorageFailoverShowGiveback_states = NACL::CS::StorageFailoverShowGiveback->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/ZAPI. Invokes "cf-aggregate-giveback-status" API for CMode ZAPI. =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' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', check => '_cmode_zapi_check', } ], show_cmd => 'storage failover show-giveback', exception_text => 'No matching storage failover show giveback(s) found' ); $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 => 'storage_failover_show_giveback',); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _cmode_zapi_check { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; if (exists $opts{filter}->{'giveback-status'} || grep {$_ eq 'giveback-status'} @{$opts{requested_fields}}) { my $msg = 'Could not use the ZAPI implementation of ' . __PACKAGE__ . "because the field 'giveback-status' " . 'was provided in requested_fields or filter, but the ZAPI ' . 'does not return this value.'; $Log->comment($msg); $Log->exit() if $may_exit; NACL::Exceptions::InvalidChoice->throw($msg); } $Log->exit() if $may_exit; } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( @args, api => 'cf_aggregate_giveback_status', copy => [qw ( node aggregate)], map => { 'error' => 'aggr-giveback-error', 'module' => 'aggr-giveback-module', 'state' => 'aggr-giveback-state', 'destination' => 'destination-node', }, 'max_records' => '100', ); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi 1;