# # Copyright (c) 2001-2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary SystemNodeCoredumpSegmentConfig ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com, pkj@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::SystemNodeCoredumpSegmentConfig =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP SystemNodeCoredumpSegmentConfig. A related class is L, which represents access to an ONTAP SystemNodeCoredumpSegmentConfig. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the SystemNodeCoredumpSegmentConfig element are the attributes of the SystemNodeCoredumpSegmentConfig 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<< auto_segment >> Filled in for 7Mode ZAPI or CMode CLI/ZAPI Maps to: 7M ZAPI: is-auto-segment 7M CLI: auto-segment CM ZAPI: $value =item C<< auto_delete >> Filled in for 7Mode ZAPI or CMode CLI/ZAPI Maps to: 7M ZAPI: is-auto-delete 7M CLI: auto-delete CM ZAPI: $value =item C<< node >> Filled in for 7Mode ZAPI or CMode CLI/ZAPI Maps to: 7M ZAPI: node 7M CLI: node =item C<< "extended_query" => $string >> (Optional) Applicable only for CMode CLI =back =cut package NACL::CS::SystemNodeCoredumpSegmentConfig; use strict; use warnings; use Params::Validate qw(validate validate_pos HASHREF); 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 => 'auto_segment', scalar => 'auto_delete', scalar => 'node', ]; =head1 METHODS =head2 fetch my $SystemNodeCoredumpSegmentConfig_state = NACL::CS::SystemNodeCoredumpSegmentConfig->fetch(command_interface => $ci, ...); my @SystemNodeCoredumpSegmentConfig_states = NACL::CS::SystemNodeCoredumpSegmentConfig->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. Uses a CMode CLI/ZAPI, 7Mode CLI/ZAPI APISet. This method executes "core-segment-config-get" for 7mode or 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 = shift; my @state_objs = $pkg->SUPER::fetch( @_, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode' }, { method => '_fetch_7mode_cli', interface => 'CLI', set => '7Mode' }, { method => '_fetch_c_7mode_zapi', interface => 'ZAPI', }, ], exception_text => 'No matching system node coredump segment config(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 => 'system_node_coredump_segment_config_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, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my $apiset = $opts{apiset}; my $command_interface = $opts{command_interface}; my %filter = %{$opts{filter}}; my $delete_cmode_only_options = sub { # Not applicable for 7Mode my ($hashref) = validate_pos(@_, {type => HASHREF}); delete $hashref->{node}; delete $hashref->{'owner-node'}; }; $delete_cmode_only_options->(\%filter); my %api_args; while (my ($key, $value) = each %filter) { $api_args{$key} = $value; } my %requested_fields; map { $requested_fields{$_} = 1 } @{$opts{requested_fields}}; $delete_cmode_only_options->(\%requested_fields); my @final_req_field = keys %requested_fields; if (@final_req_field) { $api_args{fields} = join ',', @final_req_field; } my @state_objs; my ($response, $caught_exception); try { $response = $apiset->coredump_segment_config_show(%api_args); } catch NACL::APISet::Exceptions::NoMatchingEntriesException with { $caught_exception = 1; }; if ($caught_exception) { $Log->exit() if $may_exit; return; } my $output = $response->get_parsed_output(); foreach my $list_output (@$output) { my $target = $pkg->_hash_copy( source => $list_output, copy => [qw(node auto_segment auto_delete )], ); my $obj = $pkg->new(command_interface => $command_interface); $obj->_set_fields(row => $target); push @state_objs, $obj; } ## end foreach my $list_output (@$output) $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_7mode_cli sub _fetch_c_7mode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my @state_objs; my $apiset = delete $opts{apiset}; my $command_interface = delete $opts{command_interface}; my $filter = $opts{filter}; my $node = $filter->{'node'}; my $response = $apiset->core_segment_config_get('node' => $node); my $output = $response->get_parsed_output(); foreach my $list_output (@$output) { my $target = $pkg->_hash_copy( source => $list_output->{'attributes'}->[0] ->{'core-segment-config-info'}->[0], copy => [qw( node )], map => { 'is-auto-segment' => 'auto-segment', 'is-auto-delete' => 'auto-delete', }, ); my $obj = $pkg->new(command_interface => $command_interface,); $obj->_set_fields(row => $target); push @state_objs, $obj; } ## end foreach my $list_output (@$output) $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_c_7mode_zapi sub _fetch_cmode_zapi{ $Log->enter() if $may_enter; my ($pkg,@args) = @_; my %opts = validate @args,$pkg->_fetch_backend_validate_spec(); my @state_objs =$pkg->SUPER::_fetch_cmode_zapi_non_iter( %opts, api => 'core-segment-config-get', copy =>[qw( node )], map =>{ 'auto-delete' => 'is-auto-delete', 'auto-segment' => 'is-auto-segment', }, primary_keys => [qw(node)], ); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi_new 1;