API-PureStorage

 view release on metacpan or  search on metacpan

lib/API/PureStorage.pm  view on Meta::CPAN

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
sub new {
    my $class = shift @_;
    my $self = {
        cookie_file => '/tmp/cookies.txt',
        host => $_[0],
        token => $_[1]
    };
    bless $self, $class;
 
    my $client = REST::Client->new( follow => 1 );
    $client->setHost('https://'.$self->{host});
 
    $client->addHeader('Content-Type', 'application/json');
 
    $client->getUseragent()->cookie_jar({ file => $self->{cookie_file} });
    $client->getUseragent()->ssl_opts(verify_hostname => 0);
 
    $self->{client} = $client;
 
    # Check API compatibility

lib/API/PureStorage.pm  view on Meta::CPAN

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  my $vol_info = $pure->volume_info();
  for my $vol (sort { lc($a->{name}) cmp lc($b->{name}) } @$vol_info) {
    my $detail = $pure->volume_detail($vol->{name});
    print join("\t", $detail->{name}, $detail->{serial}, $detail->{created}), "\n";
  }
 
=head1 DESCRIPTION
 
This module is a wrapper around the Pure Storage API for their devices.
 
It currently supports API v1.4 and earlier. It supports a limited set of
the available API commands: basic reading of volume and array information.
 
=head1 METHODS
 
=head2 array_info()
 
    my %volume_info = $pure->volume_info()
    my $volume_info_ref = $pure->volume_info()
 
Returns a hash or hasref (depending on requested context) of general array



( run in 0.648 second using v1.01-cache-2.11-cpan-95122f20152 )