IBM-SONAS

 view release on metacpan or  search on metacpan

lib/IBM/SONAS.pm  view on Meta::CPAN

	{
		no strict 'refs';
		my $get_method	= "get_$method";
		my $get_methods	= "get_${method}s";
	
		*{ __PACKAGE__ ."::$method" } = sub {
			my $self = shift;
			$self->{ss}->$method(@_)
		};

		*{ __PACKAGE__ ."::$get_method" } = sub {
			my $self = shift;
			$self->{ss}->$get_method(@_)
		};

		*{ __PACKAGE__ ."::$get_methods" } = sub {
			my $self = shift;
			$self->{ss}->$get_methods(@_)
		}
	}
}

foreach my $attr ( @ATTRS ) {
        {
                no strict 'refs';
                *{ __PACKAGE__ ."::$attr" } = sub {
                        my $self = shift;
                        $self->{ss}->$attr(@_)
                }
        }
}

sub new {
        my ( $class, %args ) = @_;

        my $self = bless {} , $class;
        $self->{ss} = IBM::StorageSystem->new( %args, no_stats => 1 );

        return $self
}

1;

__END__

=head1 NAME

IBM::SONAS - Perl API to IBM SONAS CLI

=head1 SYNOPSIS

IBM::SONAS is a Perl API to IBM SONAS CLI.

	use IBM::SONAS;

	# Create an IBM::SONAS object

	my $ibm = IBM::SONAS->new(
				user     => 'admin',
				host     => 'my-sonas.company.com',
				key_path => '/path/to/my/.ssh/private_key'
		) or die "Couldn't create object! $!\n";

=head1 METHODS

=head3 new ( %ARGS )

	my $ibm = IBM::SONAS->new(      
				user     => 'admin',
				host     => 'my-sonas.company.com',
				key_path => '/path/to/my/.ssh/private_key'
		) or die "Couldn't create object! $!\n";

Constructor - creates a new IBM::SONAS object.  This method accepts three 
mandatory parameters and one optional parameter, the three mandatory 
parameters are:

=over 3

=item user

The username of the user with which to connect to the device.

=item host

The hostname or IP address of the device to which we are connecting.

=item key_path

Either a relative or fully qualified path to the private ssh key valid for the
user name and device to which we are connecting.  Please note that the 
executing user must have read permission to this key.

=back

=head3 disk ( $id ) 

        # Get the disk named "system_vol_00" as an 
	# IBM::StorageSystem::Disk object

        my $disk = $ibm->disk(system_vol_00);
        
        # Print the disk status

        print $disk->status;

        # Alternately

        print $ibm->disk(system_vol_00)->status;

Returns a L<IBM::StorageSystem::Disk> object representing the disk specified 
by the value of the id parameter, which should be a valid disk name in the 
target system.

B<Note> that this is a caching method and that a previously retrieved 
L<IBM::StorageSystem::Array> object will be returned if one has been cached 
from previous invocations.

=head3 get_disk( $id )

This is a functionally equivalent non-caching implementation of the B<disk> 
method.

=head3 get_disks

        # Print a listing of all disks in the target system including their 
	# name, the assigned pool and status

        printf( "%-20s%-20s%-20s\n", 
		"Name", 
		"Pool", 



( run in 0.724 second using v1.01-cache-2.11-cpan-13bb782fe5a )