# # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary JobSchedule Component Module ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::JobSchedule =head1 DESCRIPTION C is a derived class of L. It represents access to an ONTAP JobSchedule. A related class is L, which represents the past state of an ONTAP JobSchedule. =head1 ATTRIBUTES =head2 command_interface See L =head2 name =cut package NACL::C::JobSchedule; use strict; use warnings; use NACL::CS::JobSchedule; use NACL::CS::JobScheduleShowJobs; use NACL::ComponentUtils qw (_optional_scalars); use base 'NACL::C::Component::ONTAP'; use Params::Validate qw(validate validate_with SCALAR ARRAYREF); 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; =head1 METHODS =head2 new my $JobSchedule = NACL::C::JobSchedule->new(command_interface=>$ci, name =>$name, ); Return a new JobSchedule component object with the given attributes. =cut use Class::MethodMaker [scalar => 'name',]; =head2 find my $JobSchedule = NACL::C::JobSchedule->find(command_interface => $ci, ...); my @JobSchedules = NACL::C::JobSchedule->find(command_interface => $ci, ...); Uses a CMode CLI or CMode ZAPI APISet. (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. =head2 state my $JobSchedule_state = $NACL::C::JobSchedule->state(); Uses a CMode CLI or CMode ZAPI APISet. (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::JobSchedule would return a NACL::CS::JobSchedule 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. =cut =head2 delete NACL::C::JobSchedule->delete( command_interface => $ci, name => $name, ...); or $JobSchedule_object->delete(...); (Class or instance method) This method is used to delete a schedule. 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<< "name" => $name >> (Required for class method, Not Applicable for instance method) Applicable for CMode CLI. =item C<< "extended_query" => $string >> (Optional) Applicable for CMode CLI =item C<< '*' >> This method takes all other options supported by "job schedule delete" command in ONTAP. 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 delete { $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, cli_cmd => 'job schedule delete', ); my $ret = $pkg_or_obj->call_on_apiset( %opts, choices => [ { method => '_delete_cmode_cli', interface => 'CLI', set => 'CMode', }, ], frontend => 'NACL::C::JobSchedule::delete', ); $Log->exit() if $may_exit; return $ret; } ## end sub delete sub _delete_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_base_backend_cmode_cli(@args, api => 'job_schedule_delete'); $Log->exit() if $may_exit; } ## end sub _delete_cmode_cli =head2 show_jobs my @jobscheduleshowjobs = NACL::C::JobSchedule->show_jobs(...); or my @jobscheduleshowjobs = $Jobschedule_obj->show_jobs(...); (Class or instance method) This method is used to display the list of jobs by schedule. It returns objects of type L. The options accepted are the same as those accepted by L. (requested_fields, filter, allow_empty) =cut sub show_jobs { $Log->enter() if $may_enter; my $pkg_or_obj = shift; $pkg_or_obj->_handle_obj_cs_like_calls(@_); my @state_objs = NACL::CS::JobScheduleShowJobs->fetch(@_); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub show_jobs __PACKAGE__->_load_event_class(); sub _primary_keys_validate_spec { return ('name' => {type => SCALAR},); } 1;