IBM-StorageSystem
view release on metacpan or search on metacpan
lib/IBM/StorageSystem/Task.pm view on Meta::CPAN
package IBM::StorageSystem::Task;
use strict;
use warnings;
use Carp qw(croak);
our $VERSION = '0.01';
our @ATTR = qw(Name Description Status Last_run Runs_on Type Scheduled Second
Minute Hour DayOfMonth Month DayOfWeek Parameter);
foreach my $attr ( map lc, @ATTR ) {
{
no strict 'refs';
*{ __PACKAGE__ .'::'. $attr } = sub {
my( $self, $val ) = @_;
$self->{$attr} = $val if $val;
return $self->{$attr}
}
}
}
sub new {
my( $class, $ibm, %args ) = @_;
my $self = bless {}, $class;
defined $args{'Name'} or croak __PACKAGE__
. ' constructor failed: mandatory Name argument not supplied';
foreach my $attr ( @ATTR ) { $self->{lc $attr} = $args{$attr} }
return $self
}
1;
__END__
=pod
=head1 NAME
IBM::StorageSystem::Task - Class for operations with IBM StorageSystem tasks
=head1 VERSION
Version 0.01
=head1 SYNOPSIS
IBM::StorageSystem::Task - Class for operations with IBM StorageSystem tasks
use IBM::StorageSystem;
my $ibm = IBM::StorageSystem->new( user => 'admin',
host => 'my-v7000',
key_path => '/path/to/my/.ssh/private_key'
) or die "Couldn't create object! $!\n";
# Print the status of the SNAPSHOTS task
my $snapshots = $ibm->task(SNAPSHOTS);
print "Status: " . $snapshots->status . "\n";
# Alternately
print "Status: " . $ibm->task(SNAPSHOTS)->status . "\n";
# Print the array status of all arrays in our system
map { print "Array ", $_->mdisk_id, " status ", $_->status, "\n" } $ibm->get_arrays;
=head1 METHODS
=head3 name
Returns the task name.
=head3 description
Returns the task description.
=head3 status
Returns the task last run status.
=head3 last_run
Returns the time at which the task was last run.
=head3 runs_on
Returns the node on which the task runs.
=head3 type
Returns the task type, either B<CRON> or B<GUI>.
=head3 scheduled
Returns teh scheduled status of the task.
=head3 second
Returns the second at which the second at which the task is run - used in conjunction with
the B<minute>, B<hour>, B<dayofmonth>, B<dayofweek> and B<month> methods.
=head3 minute
Returns the minute at which the second at which the task is run - used in conjunction with
the B<second>, B<hour>, B<dayofmonth>, B<dayofweek> and B<month> methods.
=head3 hour
Returns the hour at which the second at which the task is run - used in conjunction with
the B<second>, B<minute>, B<dayofmonth>, B<dayofweek> and B<month> methods.
=head3 dayofmonth
Returns the day of the month at which the second at which the task is run - used in conjunction with
( run in 0.548 second using v1.01-cache-2.11-cpan-39bf76dae61 )