API-PureStorage
view release on metacpan or search on metacpan
lib/API/PureStorage.pm view on Meta::CPAN
1819202122232425262728293031323334353637sub
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
150151152153154155156157158159160161162163164165166167168169170
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});
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 )