line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/bin/false |
2
|
|
|
|
|
|
|
# vim: softtabstop=2 tabstop=2 shiftwidth=2 ft=perl expandtab smarttab |
3
|
|
|
|
|
|
|
# PODNAME: Net::Proxmox::VE::Pools |
4
|
|
|
|
|
|
|
# ABSTRACT: Presents a pool object |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Net::Proxmox::VE::Pools; |
10
|
|
|
|
|
|
|
$Net::Proxmox::VE::Pools::VERSION = '0.38'; |
11
|
1
|
|
|
1
|
|
5
|
use parent 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
51
|
use Carp qw( croak ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
487
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT = qw( pools get_pool create_pool delete_pool update_pool ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $base = '/pools'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub pools { |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return $self->get($base); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_pool { |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
my $a = shift or croak 'No poolid for get_pool()'; |
35
|
0
|
0
|
|
|
|
|
croak 'poolid must be a scalar for get_pool()' if ref $a; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self->get( $base, $a ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub create_pool { |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
45
|
0
|
|
|
|
|
|
my @p = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
croak 'No arguments for create_pool()' unless @p; |
48
|
0
|
|
|
|
|
|
my %args; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
if ( @p == 1 ) { |
51
|
0
|
0
|
|
|
|
|
croak 'Single argument not a hash for create_pool()' |
52
|
|
|
|
|
|
|
unless ref $a eq 'HASH'; |
53
|
0
|
|
|
|
|
|
%args = %{ $p[0] }; |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else { |
56
|
0
|
0
|
|
|
|
|
croak 'Odd number of arguments for create_pool()' |
57
|
|
|
|
|
|
|
if ( scalar @p % 2 != 0 ); |
58
|
0
|
|
|
|
|
|
%args = @p; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $self->post( $base, \%args ) |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub delete_pool { |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
69
|
0
|
0
|
|
|
|
|
my $a = shift or croak 'No argument given for delete_pool()'; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $self->delete( $base, $a ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub update_pool { |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
79
|
0
|
0
|
|
|
|
|
my $poolid = shift or croak 'No poolid provided for update_pool()'; |
80
|
0
|
0
|
|
|
|
|
croak 'poolid must be a scalar for update_pool()' if ref $poolid; |
81
|
0
|
|
|
|
|
|
my @p = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
croak 'No arguments for update_pool()' unless @p; |
84
|
0
|
|
|
|
|
|
my %args; |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
if ( @p == 1 ) { |
87
|
0
|
0
|
|
|
|
|
croak 'Single argument not a hash for update_pool()' |
88
|
|
|
|
|
|
|
unless ref $p[0] eq 'HASH'; |
89
|
0
|
|
|
|
|
|
%args = %{ $p[0] }; |
|
0
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else { |
92
|
0
|
0
|
|
|
|
|
croak 'Odd number of arguments for update_pool()' |
93
|
|
|
|
|
|
|
if ( scalar @p % 2 != 0 ); |
94
|
0
|
|
|
|
|
|
%args = @p; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return $self->put( $base, $poolid, \%args ) |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |