API-PureStorage

 view release on metacpan or  search on metacpan

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

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    if ( $num != 200 ) {
        die "API returned code $num for URL '$url'\n";
    }
    print 'DEBUG: GET ', $url, ' -> ', $num, ":\n", Dumper(from_json($con)), "\n" if $debug;
    return from_json($con);
}
 
sub _api_post {
    my $self = shift @_;
    my $url = shift @_;
    my $data = shift @_;
    my $ret = $self->{client}->POST($url, to_json($data));
    my $num = $ret->responseCode();
    my $con = $ret->responseContent();
    if ( $num == 500 ) {
        die "API returned error 500 for '$url' - $con\n";
    }
    if ( $num != 200 ) {
        die "API returned code $num for URL '$url'\n";
    }
    print 'DEBUG: POST ', $url, ' -> ', $num, ":\n", Dumper(from_json($con)), "\n" if $debug;
    return from_json($con);

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

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
=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
information, including space usage.
 
=head3 Hash data reference:
 
* hostname - the configured hostname of the system
 
* total_reduction - The current overall data reduction multiple of the array. IE: A "2" here means "2:1" reduction.
 
* data_reduction - The reduction multiple of just data partitions.
 
Array-wide space usage info:
 
* volumes - bytes in use by active volume data
 
* shared_space - bytes recognized in use between multiple copies, volumes, snapshots, etc
 
* snapshots - bytes in use by snapshots
 
* system - bytes in use by system overhead. This can include recently allocated bytes
that have yet to be accounted for in other categories. IE: a recently deleted volume
that has yet to garbage collect.
 
* total - a byte count of all data on the system.
 
* capacity - the total capacity of the array in bytes
 
* thin_provisioning - ?
 
NB: To calculate the percentage usage of whole array, divide total by capacity.
 
=head2 volume_info()
 
    my @volume_info = $pure->volume_info();
    my $volume_info_ref = $pure->volume_info();
 
Returns an array or arrayref of general information about volumes include space
usage.
 
Each element of the array is a hash reference, representing a single volume.
 
=head3 Hash data reference:
 
* name - the name of this volume
 
* data_reduction - Reduction multiple of the data on this volume
 
* total_reduction - overall reduction multiple of this volume
 
Volume space usage info:
 
* shared_space - bytes recognized in use between multiple copies, snapshots, etc
 
* snapshots - bytes in use by snapshots
 
* system - bytes in use by system overhead
 
* total - a byte count of all data used by the the volume
 
* size - the max size of the volume
 
* thin_provisioning - ?
 
NB: To calculate the percentage usage of the volume, divide total by size.
 
=head2 volume_detail($volume_name)
 
    my %volume_detail = $pure->volume_detail($volume_name);
    my $volume_detail_ref = $pure->volume_detail($volume_name);
 
Returns a hash or hasref (depending on requested context) of additional
information on the volumes now shown in the vol_info() summary.
 
=head3 Hash data reference:
 
* created - A time stamp from when the volume was created
* name - the name of the volume
* serial - the serial number of the volume
* size - Size of the volume in bytes
* source - the source of this volume if it was cloned from a snapshot or other volume
 
=head2 version()
 
    my @versions = $pure->version();



( run in 0.966 second using v1.01-cache-2.11-cpan-49f99fa48dc )