line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package API::Plesk::Webspace; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
9466
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
5
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1422
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
20
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
203
|
|
8
|
2
|
|
|
2
|
|
32
|
use Data::Dumper; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
185
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
15
|
use base 'API::Plesk::Component'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
3173
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @gen_setup_fields = qw( |
13
|
|
|
|
|
|
|
name |
14
|
|
|
|
|
|
|
owner-id |
15
|
|
|
|
|
|
|
owner-login |
16
|
|
|
|
|
|
|
owner-guid |
17
|
|
|
|
|
|
|
owner-external-id |
18
|
|
|
|
|
|
|
htype |
19
|
|
|
|
|
|
|
ip_address |
20
|
|
|
|
|
|
|
status |
21
|
|
|
|
|
|
|
external-id |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my @main_fields = qw( |
25
|
|
|
|
|
|
|
gen_setup |
26
|
|
|
|
|
|
|
hosting |
27
|
|
|
|
|
|
|
limits |
28
|
|
|
|
|
|
|
prefs |
29
|
|
|
|
|
|
|
performance |
30
|
|
|
|
|
|
|
permissions |
31
|
|
|
|
|
|
|
plan-id |
32
|
|
|
|
|
|
|
plan-name |
33
|
|
|
|
|
|
|
plan-guid |
34
|
|
|
|
|
|
|
plan-external-id |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub add { |
38
|
1
|
|
|
1
|
1
|
7
|
my ( $self, %params ) = @_; |
39
|
1
|
|
|
|
|
4
|
my $bulk_send = delete $params{bulk_send}; |
40
|
1
|
|
33
|
|
|
6
|
my $gen_setup = $params{gen_setup} || confess "Required gen_setup parameter!"; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
24
|
$self->check_hosting(\%params); |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
6
|
$self->check_required_params(\%params, [qw(plan-id plan-name plan-guid plan-external-id)]); |
45
|
1
|
|
|
|
|
5
|
$self->check_required_params($gen_setup, qw(name ip_address)); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
10
|
$params{gen_setup} = $self->sort_params($gen_setup, @gen_setup_fields); |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
6
|
my $data = $self->sort_params(\%params, @main_fields); |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
47
|
return $bulk_send ? $data : |
52
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'add', $data); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub get { |
56
|
0
|
|
|
0
|
1
|
0
|
my ($self, %filter) = @_; |
57
|
0
|
|
|
|
|
0
|
my $bulk_send = delete $filter{bulk_send}; |
58
|
0
|
|
|
|
|
0
|
my $dataset = {gen_info => ''}; |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
0
|
if ( my $add = delete $filter{dataset} ) { |
61
|
0
|
0
|
|
|
|
0
|
$dataset = { map { ( $_ => '' ) } ref $add ? @$add : ($add) }; |
|
0
|
|
|
|
|
0
|
|
62
|
0
|
|
|
|
|
0
|
$dataset->{gen_info} = ''; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
my $data = { |
66
|
|
|
|
|
|
|
filter => @_ > 2 ? \%filter : '', |
67
|
|
|
|
|
|
|
dataset => $dataset, |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
0
|
return $bulk_send ? $data : |
71
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'get', $data); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub set { |
75
|
1
|
|
|
1
|
1
|
7
|
my ( $self, %params ) = @_; |
76
|
1
|
|
|
|
|
4
|
my $bulk_send = delete $params{bulk_send}; |
77
|
1
|
|
50
|
|
|
16
|
my $filter = delete $params{filter} || ''; |
78
|
1
|
|
|
|
|
4
|
my $gen_setup = $params{gen_setup}; |
79
|
|
|
|
|
|
|
|
80
|
1
|
50
|
|
|
|
7
|
$params{gen_setup} = $self->sort_params($gen_setup, @gen_setup_fields) if $gen_setup; |
81
|
1
|
|
|
|
|
6
|
$self->check_hosting(\%params); |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
5
|
my $data = [ |
84
|
|
|
|
|
|
|
{ filter => $filter }, |
85
|
|
|
|
|
|
|
{ values => $self->sort_params(\%params, @main_fields) }, |
86
|
|
|
|
|
|
|
]; |
87
|
|
|
|
|
|
|
|
88
|
1
|
50
|
|
|
|
26
|
return $bulk_send ? $data : |
89
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'set', $data); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub del { |
93
|
0
|
|
|
0
|
1
|
0
|
my ($self, %filter) = @_; |
94
|
0
|
|
|
|
|
0
|
my $bulk_send = delete $filter{bulk_send}; |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
0
|
my $data = { |
97
|
|
|
|
|
|
|
filter => @_ > 2 ? \%filter : '' |
98
|
|
|
|
|
|
|
}; |
99
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
0
|
return $bulk_send ? $data : |
101
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'del', $data); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub add_plan_item { |
105
|
0
|
|
|
0
|
1
|
0
|
my ( $self, %params ) = @_; |
106
|
0
|
|
|
|
|
0
|
my $bulk_send = delete $params{bulk_send}; |
107
|
0
|
|
0
|
|
|
0
|
my $filter = delete $params{filter} || ''; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
0
|
|
|
0
|
my $name = $params{name} || confess "Required name field!"; |
110
|
0
|
|
|
|
|
0
|
my $data = { |
111
|
|
|
|
|
|
|
filter => $filter, |
112
|
|
|
|
|
|
|
'plan-item' => { name => $name }, |
113
|
|
|
|
|
|
|
}; |
114
|
|
|
|
|
|
|
|
115
|
0
|
0
|
|
|
|
0
|
return $bulk_send ? $data : |
116
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'add-plan-item', $data); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub add_subscription { |
120
|
1
|
|
|
1
|
1
|
6
|
my ($self, %params) = @_; |
121
|
1
|
|
|
|
|
4
|
my $bulk_send = delete $params{bulk_send}; |
122
|
|
|
|
|
|
|
|
123
|
1
|
|
|
|
|
7
|
$self->check_required_params(\%params, [qw(plan-guid plan-external-id)]); |
124
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
8
|
my $data = $self->sort_params(\%params, 'filter', [qw(plan-guid plan-external-id)]); |
126
|
|
|
|
|
|
|
|
127
|
1
|
50
|
|
|
|
9
|
return $bulk_send ? $data : |
128
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'add-subscription', $data); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub remove_subscription { |
132
|
1
|
|
|
1
|
1
|
5
|
my ($self, %params) = @_; |
133
|
1
|
|
|
|
|
3
|
my $bulk_send = delete $params{bulk_send}; |
134
|
|
|
|
|
|
|
|
135
|
1
|
|
50
|
|
|
5
|
$params{filter} ||= ''; |
136
|
|
|
|
|
|
|
|
137
|
1
|
|
|
|
|
7
|
$self->check_required_params(\%params, [qw(plan-guid plan-external-id)]); |
138
|
|
|
|
|
|
|
|
139
|
1
|
|
|
|
|
6
|
my $data = $self->sort_params(\%params, 'filter', [qw(plan-guid plan-external-id)]); |
140
|
|
|
|
|
|
|
|
141
|
1
|
50
|
|
|
|
19
|
return $bulk_send ? $data : |
142
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'remove-subscription', $data); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub switch_subscription { |
146
|
1
|
|
|
1
|
1
|
5
|
my ($self, %params) = @_; |
147
|
1
|
|
|
|
|
3
|
my $bulk_send = delete $params{bulk_send}; |
148
|
|
|
|
|
|
|
|
149
|
1
|
|
50
|
|
|
6
|
$params{filter} ||= ''; |
150
|
|
|
|
|
|
|
|
151
|
1
|
|
|
|
|
7
|
$self->check_required_params(\%params, [qw(plan-guid plan-external-id no-plan)]); |
152
|
|
|
|
|
|
|
|
153
|
1
|
|
|
|
|
7
|
my $data = $self->sort_params(\%params, 'filter', [qw(plan-guid plan-external-id no-plan)]); |
154
|
|
|
|
|
|
|
|
155
|
1
|
50
|
|
|
|
12
|
return $bulk_send ? $data : |
156
|
|
|
|
|
|
|
$self->plesk->send('webspace', 'switch-subscription', $data); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
__END__ |