# # Copyright (c) 2001-2011 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary StorageArray ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::StorageArray =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP StorageArray. A related class is L, which represents access to an ONTAP StorageArray. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the StorageArray element are the attributes of the StorageArray ComponentState. =over =item C<< "options" >> =item C<< "uid_decode_type" >> =item C<< "serial_number" >> =item C<< "model" >> =item C<< "name" >> =item C<< "port_count" >> =item C<< "firmware" >> =item C<< "failover_type" >> =item C<< "id" >> =item C<< "ip_address" >> =item C<< "vendor" >> =item C<< "prefix" >> =item C<< max_queue_depth >> Filled in for CMode CLI. =item C<< affinity >> Filled in for CMode CLI. =item C<< optimization_policy >> Filled in for CMode CLI. =item C<< lun_queue_depth >> Filled in for CMode CLI. =item C<< upgrade_pending >> Filled in for CMode CLI. =item C<< is_upgrade_pending >> Filled in for CMode CLI. =item C<< error_text >> Filled in for CMode CLI. Note that for array fields, the accessor method can be invoked in either scalar or list context. my $error_text = $obj->error_text(); # $error_text contains a reference to the array of values my @error_text = $obj->error_text(); # @error_text contains the array of values Filled in for CMode CLI. =item C<< error_type >> Filled in for CMode CLI. =item C<< error_id >> Filled in for CMode CLI. =item C<< upgrade_pending_status >> Filled in for CMode CLI. =item C<< storage_device_type >> Storage Device Type possible value(s) are, default , array_lun , fcsas_bridge , sts_bridge , tape_mc , virtual_disk , unknown Filled in for CMode CLI. =item C<< cluster_uuid >> Cluster UUID Filled in for CMode CLI. =item C<< next_avail_offset >> Next offset for naming Filled in for CMode CLI. =back =cut package NACL::CS::StorageArray; use strict; use warnings; use Params::Validate qw(validate); 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 Class::MethodMaker [ scalar => 'options', scalar => 'uid_decode_type', scalar => 'serial_number', scalar => 'model', scalar => 'name', scalar => 'port_count', scalar => 'firmware', scalar => 'failover_type', scalar => 'id', scalar => 'ip_address', scalar => 'vendor', scalar => 'prefix', scalar => 'node', scalar => 'max_queue_depth', scalar => 'affinity', scalar => 'optimization_policy', scalar => 'lun_queue_depth', scalar => 'upgrade_pending', scalar => 'is_upgrade_pending', array => 'error_text', scalar => 'error_type', scalar => 'error_id', scalar => 'upgrade_pending_status', scalar => 'storage_device_type', scalar => 'cluster_uuid', scalar => 'next_avail_offset', ]; =head1 METHODS =head2 fetch my $StorageArray_state = NACL::CS::StorageArray->fetch(command_interface => $ci, ...); my @StorageArray_states = NACL::CS::StorageArray->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. =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 = shift; my @state_objs = $pkg->SUPER::fetch( @_, show_cmd => 'storage array show', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_fetch_7mode_cli', interface => 'CLI', set => '7Mode', }, ], exception_text => 'No matching storage array(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_array_show'); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _fetch_7mode_cli { $Log->enter() if $may_enter; my $pkg = shift; my %opts = validate @_, $pkg->_fetch_backend_validate_spec(); my $apiset = delete $opts{apiset}; my @state_objs; my %copy_filter = %{$opts{filter}}; my @copy_requested_fields = @{$opts{requested_fields}}; my $deleted_filter = $pkg->_remove_relational_regex_filters( filter => \%copy_filter, requested_fields => \@copy_requested_fields ); my $filter = \%copy_filter; my $requested_fields = \@copy_requested_fields; my $response = $apiset->storage_array_show(); my $output = $response->get_parsed_output(); my $row_modified; foreach my $row (@$output) { my $obj = $pkg->new(); $row_modified = $pkg->_hash_copy( source => $row, copy => [qw( name vendor prefix model options )], ); $row_modified->{'node'} = $opts{'command_interface'}->name(); $row_modified->{'command_interface'} = $opts{'command_interface'}; $obj->_set_fields(row => $row_modified); push @state_objs, $obj; } ## end foreach my $row (@$output) $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_7mode_cli 1;