# $Id$ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary DebugKenv Component Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::DebugKenv =head1 DESCRIPTION C is a derived class of L. It represents access to an ONTAP DebugKenv. A related class is L, which represents the past state of an ONTAP DebugKenv. =head1 ATTRIBUTES =head2 command_interface See L =head2 variable =head2 node =cut package NACL::C::DebugKenv; use strict; use warnings; use NACL::CS::DebugKenv; use NACL::ComponentUtils qw (_optional_scalars Dumper); use base 'NACL::C::Component::ONTAP'; use Params::Validate qw(validate_with SCALAR ARRAYREF SCALARREF); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); =head1 METHODS =head2 new my $DebugKenv = NACL::C::DebugKenv->new( command_interface => $ci, 'variable' => $variable, 'node' => $node, ); Return a new DebugKenv component object with the given attributes. =cut use Class::MethodMaker [ scalar => 'variable', scalar => 'node', ]; =head2 find my $DebugKenv_obj = NACL::C::DebugKenv->find(command_interface => $ci, ...); my @DebugKenv_objs = NACL::C::DebugKenv->find(command_interface => $ci, ...); (Class method) A constructor of sorts, which discovers which elements are present (by interacting with the given command interface). In an array context it creates a component object for each present element and returns them. In a scalar context it creates a component object for just one element. This method is generally not implemented in individual components. The base class (L provides an implementation. See for a more detailed description along with explanation of all the options accepted. Uses a CMode CLI APISet. =head2 state my DebugKenv_state = $DebugKenv_obj->state(); (Instance method) Fetch the current state of the element associated with this component, and return a Component State object corresponding to this component (calling this on NACL::C::DebugKenv would return a NACL::CS::DebugKenv object) This method is generally not implemented in individual components. The base class (L provides an implementation. See for a more detailed description along with explanation of all the options accepted. Uses a CMode CLI APISet. =cut =head2 modify NACL::C::DebugKenv->modify( command_interface => $ci, 'variable' => $variable, 'node' => $node, ...); or $DebugKenv_obj->modify(...); (Class or instance method) This method is used to modify a kernel environment variable. Uses a CMode CLI APIset. =over =item Options =over =item C<< command_interface => $command_interface >> (Required for class method, Not Applicable for instance method) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< 'variable' => $variable >> (Required for class method, Not Applicable for instance method) Variable possible value(s) are, text Applicable for CMode CLI. =item C<< 'node' => $node >> (Required for class method, Not Applicable for instance method) Node Name possible value(s) are, ,local Applicable for CMode CLI. =item C<< 'value' => $string >> Value possible value(s) are, text Applicable for CMode CLI. =item C<< 'persist' => $string >> Persistence possible value(s) are, true,false Applicable for CMode CLI. =item C<< 'cmd_execution_time' => \$scalar >> (Optional) Scalar reference , it will be updated with the command execution time returned by the apiset response object =item C<< 'method-timeout' => $time_in_seconds >> (Optional) The default NATE timeout is 60 seconds. If the command might take more time to complete, this option can be used to specify a larger timeout value. The value should be provided in seconds. =item C<< "extended_query" => $string >> (Optional) Applicable for CMode CLI =back =back =over =item Exceptions =over =item C In general, Component methods propagate the exceptions thrown from underlying API layer and the details of those exceptions are described in the L of user guide. =back =back =cut sub modify { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_frontend_log_debug_opts(@args); my %opts = $pkg_or_obj->_common_validate_with( params => \@args, additional_spec => { 'cmd_execution_time' => {type => SCALARREF, optional => 1}, _optional_scalars( qw( value persist ) ), }, ); $pkg_or_obj->call_on_apiset( %opts, choices => [ { method => '_modify_cmode_cli', interface => 'CLI', set => 'CMode', }, ], frontend => 'NACL::C::DebugKenv::modify', ); $Log->exit() if $may_exit; } sub _modify_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; my %opts = $pkg_or_obj->_validate_backend_opts(@opts); my $apiset = $opts{apiset}; my $execution_time = $opts{cmd_execution_time}; my $allowed_cmode_options = [ qw( variable value node persist extended_query ) ]; my %cmode_args; $pkg_or_obj->_hash_copy( source => \%opts, copy => $allowed_cmode_options, target => \%cmode_args, ); my $response = $apiset->debug_kenv_modify(%cmode_args); if (defined $execution_time) { $$execution_time = $response->get_execution_time(); } $Log->exit() if $may_exit; } __PACKAGE__->_load_event_class(); sub _primary_keys_validate_spec { return ( 'variable' => {type => SCALAR}, 'node' => {type => SCALAR}, ); } 1;