line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Fortinet::FortiManager; |
2
|
|
|
|
|
|
|
$Net::Fortinet::FortiManager::VERSION = '0.003000'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Fortinet FortiManager REST API client library |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
168062
|
use 5.024; |
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
985
|
use Moo; |
|
1
|
|
|
|
|
5119
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
1052
|
use feature 'signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
8
|
1
|
|
|
1
|
|
431
|
use Types::Standard qw( ArrayRef HashRef InstanceOf Str ); |
|
1
|
|
|
|
|
71618
|
|
|
1
|
|
|
|
|
9
|
|
9
|
1
|
|
|
1
|
|
1234
|
use Types::Common::Numeric qw( PositiveInt ); |
|
1
|
|
|
|
|
15251
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
355
|
use Carp qw( croak ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
11
|
1
|
|
|
1
|
|
4
|
use List::Util qw( all any none ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
no warnings "experimental::signatures"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3003
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'user' => ( |
17
|
|
|
|
|
|
|
isa => Str, |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
predicate => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'passwd' => ( |
23
|
|
|
|
|
|
|
isa => Str, |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
predicate => 1, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has '_sessionid' => ( |
29
|
|
|
|
|
|
|
isa => Str, |
30
|
|
|
|
|
|
|
is => 'rw', |
31
|
|
|
|
|
|
|
predicate => 1, |
32
|
|
|
|
|
|
|
clearer => 1, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has '_last_transaction_id' => ( |
36
|
|
|
|
|
|
|
isa => PositiveInt, |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
predicate => 1, |
39
|
|
|
|
|
|
|
clearer => 1, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
|
|
sub _get_transaction_id ($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $id; |
44
|
0
|
0
|
|
|
|
|
if ($self->_has_last_transaction_id) { |
45
|
0
|
|
|
|
|
|
$id = $self->_last_transaction_id; |
46
|
0
|
|
|
|
|
|
$id++; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
0
|
|
|
|
|
|
$id = 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$self->_last_transaction_id($id); |
53
|
0
|
|
|
|
|
|
return $id; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has 'adoms' => ( |
58
|
|
|
|
|
|
|
is => 'rwp', |
59
|
|
|
|
|
|
|
isa => ArrayRef[Str], |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has 'adom' => ( |
64
|
|
|
|
|
|
|
is => 'rw', |
65
|
|
|
|
|
|
|
isa => Str, |
66
|
|
|
|
|
|
|
default => sub { 'root' }, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
with 'Role::REST::Client'; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# around 'do_request' => sub($orig, $self, $method, $uri, $opts) { |
72
|
|
|
|
|
|
|
# warn 'request: ' . np($method, $uri, $opts); |
73
|
|
|
|
|
|
|
# my $response = $orig->($self, $method, $uri, $opts); |
74
|
|
|
|
|
|
|
# warn 'response: ' . np($response); |
75
|
|
|
|
|
|
|
# return $response; |
76
|
|
|
|
|
|
|
# }; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
0
|
|
|
sub _http_error_handler ($self, $res) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
croak('http error (' . $res->code . '): ' . $res->response->decoded_content) |
80
|
|
|
|
|
|
|
unless $res->code == 200; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
0
|
|
|
sub _rpc_error_handler ($self, $res, $number_of_expected_results) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
84
|
0
|
0
|
0
|
|
|
|
if (ref $res->data eq 'HASH' |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
85
|
|
|
|
|
|
|
&& exists $res->data->{result} |
86
|
|
|
|
|
|
|
&& ref $res->data->{result} eq 'ARRAY' |
87
|
|
|
|
|
|
|
&& scalar $res->data->{result}->@* == $number_of_expected_results |
88
|
0
|
|
|
0
|
|
|
&& all { ref $_ eq 'HASH' } $res->data->{result}->@* ) { |
89
|
0
|
0
|
|
|
|
|
if ($number_of_expected_results == 1) { |
90
|
0
|
|
|
|
|
|
my $code = $res->data->{result}->[0]->{status}->{code}; |
91
|
0
|
|
|
|
|
|
my $message = $res->data->{result}->[0]->{status}->{message}; |
92
|
0
|
0
|
|
|
|
|
if ($code != 0) { |
93
|
0
|
|
|
|
|
|
croak("jsonrpc error ($code): $message"); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
else { |
97
|
|
|
|
|
|
|
my @failed_calls = grep { |
98
|
0
|
|
|
|
|
|
$_->{status}->{code} != 0 |
99
|
0
|
|
|
|
|
|
} $res->data->{result}->@*; |
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
if (@failed_calls) { |
102
|
|
|
|
|
|
|
croak("jsonrpc errors: " . join(', ', map { |
103
|
0
|
|
|
|
|
|
$_->{url} . ': (' . $_->{status}->{code} . ') ' . |
104
|
|
|
|
|
|
|
$_->{status}->{message} |
105
|
0
|
|
|
|
|
|
} @failed_calls)); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
else { |
110
|
0
|
|
|
|
|
|
croak "jsonrpc error: response not in expected format: " . |
111
|
|
|
|
|
|
|
$res->response->decoded_content; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
0
|
|
|
sub _exec_method ($self, $method, $params = undef) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
116
|
0
|
0
|
0
|
|
|
|
croak 'params needs to be an arrayref' |
117
|
|
|
|
|
|
|
if defined $params && ref $params ne 'ARRAY'; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $body = { |
120
|
|
|
|
|
|
|
id => $self->_get_transaction_id, |
121
|
|
|
|
|
|
|
method => $method, |
122
|
|
|
|
|
|
|
params => $params, |
123
|
|
|
|
|
|
|
verbose => 1, |
124
|
|
|
|
|
|
|
}; |
125
|
0
|
0
|
|
|
|
|
$body->{session} = $self->_sessionid |
126
|
|
|
|
|
|
|
if $self->_has_sessionid; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# p $body; |
129
|
0
|
|
|
|
|
|
my $res = $self->post('/jsonrpc', $body); |
130
|
|
|
|
|
|
|
# p $res; |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
$self->_http_error_handler($res); |
133
|
|
|
|
|
|
|
|
134
|
0
|
0
|
|
|
|
|
$self->_rpc_error_handler($res, defined $params ? scalar $params->@* : 1); |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
return $res; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
0
|
1
|
|
sub exec_method ($self, $method, $url, $params = undef) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
141
|
0
|
0
|
0
|
|
|
|
croak 'params needs to be a hashref' |
142
|
|
|
|
|
|
|
if defined $params && ref $params ne 'HASH'; |
143
|
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
|
my %full_params = defined $params |
145
|
|
|
|
|
|
|
? $params->%* |
146
|
|
|
|
|
|
|
: (); |
147
|
0
|
|
|
|
|
|
$full_params{url} = $url; |
148
|
0
|
|
|
|
|
|
my $rv = $self->_exec_method($method, [\%full_params])->data; |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# the existance of {result}[0] is already verified by _rpc_error_handler |
151
|
|
|
|
|
|
|
# called in _exec_method |
152
|
0
|
0
|
|
|
|
|
if (exists $rv->{result}[0]->{data}) { |
153
|
0
|
|
|
|
|
|
return $rv->{result}[0]->{data}; |
154
|
|
|
|
|
|
|
} |
155
|
0
|
|
|
|
|
|
return 1; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
0
|
1
|
|
sub exec_method_multi ($self, $method, $params) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
160
|
0
|
0
|
|
|
|
|
croak 'params needs to be an arrayref' |
161
|
|
|
|
|
|
|
unless ref $params eq 'ARRAY'; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
croak 'each parameter needs to be a hashref' |
164
|
0
|
0
|
|
0
|
|
|
unless any { ref $_ eq 'HASH' } $params->@*; |
|
0
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
my $rv = $self->_exec_method($method, $params)->data; |
167
|
|
|
|
|
|
|
|
168
|
0
|
0
|
|
|
|
|
if (exists $rv->{result}) { |
169
|
0
|
|
|
|
|
|
return $rv->{result}; |
170
|
|
|
|
|
|
|
} |
171
|
0
|
|
|
|
|
|
return 1; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
0
|
1
|
|
sub login ($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
176
|
0
|
0
|
0
|
|
|
|
die "user and password required\n" |
177
|
|
|
|
|
|
|
unless $self->has_user && $self->has_passwd; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
|
my $res = $self->_exec_method('exec', [{ |
180
|
|
|
|
|
|
|
url => "/sys/login/user", |
181
|
|
|
|
|
|
|
data => { |
182
|
|
|
|
|
|
|
user => $self->user, |
183
|
|
|
|
|
|
|
passwd => $self->passwd, |
184
|
|
|
|
|
|
|
}, |
185
|
|
|
|
|
|
|
}]); |
186
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
$self->_sessionid($res->data->{session}); |
188
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
$self->_set_adoms($self->list_adoms_by_name); |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
# switch to first ADOM if the currently set ADOM isn't available |
192
|
0
|
0
|
|
0
|
|
|
if (none { $_ eq $self->adom } $self->adoms->@*) { |
|
0
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
$self->adom($self->adoms->[0]); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
|
return 1; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
0
|
1
|
|
sub logout ($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
$self->exec_method('exec', '/sys/logout'); |
202
|
0
|
|
|
|
|
|
$self->_clear_sessionid; |
203
|
0
|
|
|
|
|
|
$self->_clear_last_transaction_id; |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
return 1; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
0
|
|
|
0
|
1
|
|
sub get_sys_status ($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
return $self->exec_method('get', '/sys/status'); |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
0
|
|
|
0
|
1
|
|
sub list_adoms ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
$self->exec_method('get', '/dvmdb/adom', $params); |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
0
|
1
|
|
sub list_adoms_by_name ($self) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my @adoms = |
221
|
|
|
|
|
|
|
sort |
222
|
|
|
|
|
|
|
map { |
223
|
0
|
|
|
|
|
|
$_->{name} |
224
|
0
|
|
|
|
|
|
} $self->list_adoms({ |
225
|
|
|
|
|
|
|
fields => [qw( name )], |
226
|
|
|
|
|
|
|
})->@*; |
227
|
0
|
|
|
|
|
|
return \@adoms; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
231
|
0
|
|
|
0
|
1
|
|
sub list_firewall_addresses ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
233
|
|
|
|
|
|
|
'/obj/firewall/address', $params); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
0
|
1
|
|
sub get_firewall_address ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
239
|
|
|
|
|
|
|
'/obj/firewall/address/'. $name, $params); |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
0
|
1
|
|
sub create_firewall_address ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
|
my $params = { |
245
|
|
|
|
|
|
|
data => [{ |
246
|
|
|
|
|
|
|
$data->%*, |
247
|
|
|
|
|
|
|
name => $name, |
248
|
|
|
|
|
|
|
}], |
249
|
|
|
|
|
|
|
}; |
250
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
251
|
|
|
|
|
|
|
'/obj/firewall/address', $params); |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
|
255
|
0
|
|
|
0
|
1
|
|
sub update_firewall_address ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
256
|
0
|
|
|
|
|
|
my $params = { |
257
|
|
|
|
|
|
|
data => { |
258
|
|
|
|
|
|
|
$data->%*, |
259
|
|
|
|
|
|
|
}, |
260
|
|
|
|
|
|
|
}; |
261
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
262
|
|
|
|
|
|
|
'/obj/firewall/address/' . $name, $params); |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_address ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
268
|
|
|
|
|
|
|
'/obj/firewall/address/' . $name); |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
0
|
1
|
|
sub list_firewall_address_groups ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
274
|
|
|
|
|
|
|
'/obj/firewall/addrgrp', $params); |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
0
|
1
|
|
sub get_firewall_address_group ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
280
|
|
|
|
|
|
|
'/obj/firewall/addrgrp/'. $name, $params); |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
284
|
0
|
|
|
0
|
1
|
|
sub create_firewall_address_group ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
my $params = { |
286
|
|
|
|
|
|
|
data => [{ |
287
|
|
|
|
|
|
|
$data->%*, |
288
|
|
|
|
|
|
|
name => $name, |
289
|
|
|
|
|
|
|
}], |
290
|
|
|
|
|
|
|
}; |
291
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
292
|
|
|
|
|
|
|
'/obj/firewall/addrgrp', $params); |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
0
|
1
|
|
sub update_firewall_address_group ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
my $params = { |
298
|
|
|
|
|
|
|
data => { |
299
|
|
|
|
|
|
|
$data->%*, |
300
|
|
|
|
|
|
|
}, |
301
|
|
|
|
|
|
|
}; |
302
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
303
|
|
|
|
|
|
|
'/obj/firewall/addrgrp/' . $name, $params); |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
|
307
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_address_group ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
309
|
|
|
|
|
|
|
'/obj/firewall/addrgrp/' . $name); |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
|
313
|
0
|
|
|
0
|
1
|
|
sub list_firewall_ipv6_addresses ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
315
|
|
|
|
|
|
|
'/obj/firewall/address6', $params); |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
0
|
|
|
0
|
1
|
|
sub get_firewall_ipv6_address ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
321
|
|
|
|
|
|
|
'/obj/firewall/address6/'. $name, $params); |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
0
|
|
|
0
|
1
|
|
sub create_firewall_ipv6_address ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
|
my $params = { |
327
|
|
|
|
|
|
|
data => [{ |
328
|
|
|
|
|
|
|
$data->%*, |
329
|
|
|
|
|
|
|
name => $name, |
330
|
|
|
|
|
|
|
}], |
331
|
|
|
|
|
|
|
}; |
332
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
333
|
|
|
|
|
|
|
'/obj/firewall/address6', $params); |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
|
337
|
0
|
|
|
0
|
1
|
|
sub update_firewall_ipv6_address ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
my $params = { |
339
|
|
|
|
|
|
|
data => { |
340
|
|
|
|
|
|
|
$data->%*, |
341
|
|
|
|
|
|
|
}, |
342
|
|
|
|
|
|
|
}; |
343
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
344
|
|
|
|
|
|
|
'/obj/firewall/address6/' . $name, $params); |
345
|
|
|
|
|
|
|
} |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
|
348
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_ipv6_address ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
350
|
|
|
|
|
|
|
'/obj/firewall/address6/' . $name); |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
|
354
|
0
|
|
|
0
|
1
|
|
sub list_firewall_ipv6_address_groups ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
355
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
356
|
|
|
|
|
|
|
'/obj/firewall/addrgrp6', $params); |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
|
360
|
0
|
|
|
0
|
1
|
|
sub get_firewall_ipv6_address_group ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
362
|
|
|
|
|
|
|
'/obj/firewall/addrgrp6/'. $name, $params); |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
|
366
|
0
|
|
|
0
|
1
|
|
sub create_firewall_ipv6_address_group ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
my $params = { |
368
|
|
|
|
|
|
|
data => [{ |
369
|
|
|
|
|
|
|
$data->%*, |
370
|
|
|
|
|
|
|
name => $name, |
371
|
|
|
|
|
|
|
}], |
372
|
|
|
|
|
|
|
}; |
373
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
374
|
|
|
|
|
|
|
'/obj/firewall/addrgrp6', $params); |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
|
378
|
0
|
|
|
0
|
1
|
|
sub update_firewall_ipv6_address_group ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
379
|
0
|
|
|
|
|
|
my $params = { |
380
|
|
|
|
|
|
|
data => { |
381
|
|
|
|
|
|
|
$data->%*, |
382
|
|
|
|
|
|
|
}, |
383
|
|
|
|
|
|
|
}; |
384
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
385
|
|
|
|
|
|
|
'/obj/firewall/addrgrp6/' . $name, $params); |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
|
389
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_ipv6_address_group ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
390
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
391
|
|
|
|
|
|
|
'/obj/firewall/addrgrp6/' . $name); |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
0
|
1
|
|
sub list_firewall_services ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
396
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
397
|
|
|
|
|
|
|
'/obj/firewall/service/custom', $params); |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
401
|
0
|
|
|
0
|
1
|
|
sub get_firewall_service ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
403
|
|
|
|
|
|
|
'/obj/firewall/service/custom/'. $name, $params); |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
|
407
|
0
|
|
|
0
|
1
|
|
sub create_firewall_service ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
408
|
0
|
|
|
|
|
|
my $params = { |
409
|
|
|
|
|
|
|
data => [{ |
410
|
|
|
|
|
|
|
$data->%*, |
411
|
|
|
|
|
|
|
name => $name, |
412
|
|
|
|
|
|
|
}], |
413
|
|
|
|
|
|
|
}; |
414
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
415
|
|
|
|
|
|
|
'/obj/firewall/service/custom', $params); |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
|
419
|
0
|
|
|
0
|
1
|
|
sub update_firewall_service ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
420
|
0
|
|
|
|
|
|
my $params = { |
421
|
|
|
|
|
|
|
data => { |
422
|
|
|
|
|
|
|
$data->%*, |
423
|
|
|
|
|
|
|
}, |
424
|
|
|
|
|
|
|
}; |
425
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
426
|
|
|
|
|
|
|
'/obj/firewall/service/custom/' . $name, $params); |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
|
430
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_service ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
432
|
|
|
|
|
|
|
'/obj/firewall/service/custom/' . $name); |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
|
436
|
0
|
|
|
0
|
1
|
|
sub list_firewall_service_groups ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
437
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
438
|
|
|
|
|
|
|
'/obj/firewall/service/group', $params); |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
|
442
|
0
|
|
|
0
|
1
|
|
sub get_firewall_service_group ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
443
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
444
|
|
|
|
|
|
|
'/obj/firewall/service/group/'. $name, $params); |
445
|
|
|
|
|
|
|
} |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
448
|
0
|
|
|
0
|
1
|
|
sub create_firewall_service_group ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
|
my $params = { |
450
|
|
|
|
|
|
|
data => [{ |
451
|
|
|
|
|
|
|
$data->%*, |
452
|
|
|
|
|
|
|
name => $name, |
453
|
|
|
|
|
|
|
}], |
454
|
|
|
|
|
|
|
}; |
455
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
456
|
|
|
|
|
|
|
'/obj/firewall/service/group', $params); |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
|
460
|
0
|
|
|
0
|
1
|
|
sub update_firewall_service_group ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
461
|
0
|
|
|
|
|
|
my $params = { |
462
|
|
|
|
|
|
|
data => { |
463
|
|
|
|
|
|
|
$data->%*, |
464
|
|
|
|
|
|
|
}, |
465
|
|
|
|
|
|
|
}; |
466
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
467
|
|
|
|
|
|
|
'/obj/firewall/service/group/' . $name, $params); |
468
|
|
|
|
|
|
|
} |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
|
471
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_service_group ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
472
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
473
|
|
|
|
|
|
|
'/obj/firewall/service/group/' . $name); |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
|
477
|
0
|
|
|
0
|
1
|
|
sub list_policy_packages ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/pkg/adom/' . $self->adom, $params); |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
|
482
|
0
|
|
|
0
|
1
|
|
sub get_policy_package ($self, $name, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
483
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/pkg/adom/' . $self->adom . '/'. $name, |
484
|
|
|
|
|
|
|
$params); |
485
|
|
|
|
|
|
|
} |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
|
488
|
0
|
|
|
0
|
1
|
|
sub create_policy_package ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
489
|
0
|
|
|
|
|
|
my $params = { |
490
|
|
|
|
|
|
|
data => [{ |
491
|
|
|
|
|
|
|
$data->%*, |
492
|
|
|
|
|
|
|
name => $name, |
493
|
|
|
|
|
|
|
}], |
494
|
|
|
|
|
|
|
}; |
495
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/pkg/adom/' . $self->adom, $params); |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
|
499
|
0
|
|
|
0
|
1
|
|
sub update_policy_package ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
500
|
0
|
|
|
|
|
|
my $params = { |
501
|
|
|
|
|
|
|
data => { |
502
|
|
|
|
|
|
|
$data->%*, |
503
|
|
|
|
|
|
|
}, |
504
|
|
|
|
|
|
|
}; |
505
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/pkg/adom/' . $self->adom . '/' . $name, |
506
|
|
|
|
|
|
|
$params); |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
|
510
|
0
|
|
|
0
|
1
|
|
sub delete_policy_package ($self, $name) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
511
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/pkg/adom/' . $self->adom . '/' . $name); |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
|
515
|
0
|
|
|
0
|
1
|
|
sub install_policy_package ($self, $name, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
516
|
0
|
|
|
|
|
|
my $params = { |
517
|
|
|
|
|
|
|
data => { |
518
|
|
|
|
|
|
|
$data->%*, |
519
|
|
|
|
|
|
|
adom => $self->adom, |
520
|
|
|
|
|
|
|
pkg => $name, |
521
|
|
|
|
|
|
|
}, |
522
|
|
|
|
|
|
|
}; |
523
|
0
|
|
|
|
|
|
$self->exec_method('exec', '/securityconsole/install/package', |
524
|
|
|
|
|
|
|
$params); |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
528
|
0
|
|
|
0
|
1
|
|
sub list_tasks ($self, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
529
|
0
|
|
|
|
|
|
$self->exec_method('get', '/task/task', $params); |
530
|
|
|
|
|
|
|
} |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
|
533
|
0
|
|
|
0
|
1
|
|
sub get_task ($self, $id, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
534
|
0
|
|
|
|
|
|
$self->exec_method('get', '/task/task/' . $id, $params); |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
|
538
|
0
|
|
|
0
|
1
|
|
sub list_firewall_policies ($self, $pkg, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
540
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/policy', $params); |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
|
544
|
0
|
|
|
0
|
1
|
|
sub get_firewall_policy ($self, $pkg, $id, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
545
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
546
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/policy/' . $id, $params); |
547
|
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
|
550
|
0
|
|
|
0
|
1
|
|
sub create_firewall_policy ($self, $pkg, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
551
|
0
|
|
|
|
|
|
my $params = { |
552
|
|
|
|
|
|
|
data => [{ |
553
|
|
|
|
|
|
|
$data->%*, |
554
|
|
|
|
|
|
|
}], |
555
|
|
|
|
|
|
|
}; |
556
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
557
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/policy', $params); |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
|
561
|
0
|
|
|
0
|
1
|
|
sub update_firewall_policy ($self, $pkg, $id, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
562
|
0
|
|
|
|
|
|
my $params = { |
563
|
|
|
|
|
|
|
data => { |
564
|
|
|
|
|
|
|
$data->%*, |
565
|
|
|
|
|
|
|
}, |
566
|
|
|
|
|
|
|
}; |
567
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
568
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/policy/' . $id , $params); |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
|
572
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_policy ($self, $pkg, $id) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
573
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
574
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/policy/' . $id); |
575
|
|
|
|
|
|
|
} |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
|
578
|
0
|
|
|
0
|
1
|
|
sub list_firewall_security_policies ($self, $pkg, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
579
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
580
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/security-policy', $params); |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
|
584
|
0
|
|
|
0
|
1
|
|
sub get_firewall_security_policy ($self, $pkg, $id, $params = {}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
$self->exec_method('get', '/pm/config/adom/' . $self->adom . |
586
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/security-policy/' . $id, $params); |
587
|
|
|
|
|
|
|
} |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
|
591
|
0
|
|
|
0
|
1
|
|
sub create_firewall_security_policy ($self, $pkg, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
592
|
0
|
|
|
|
|
|
my $params = { |
593
|
|
|
|
|
|
|
data => [{ |
594
|
|
|
|
|
|
|
$data->%*, |
595
|
|
|
|
|
|
|
}], |
596
|
|
|
|
|
|
|
}; |
597
|
0
|
|
|
|
|
|
$self->exec_method('add', '/pm/config/adom/' . $self->adom . |
598
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/security-policy', $params); |
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
|
602
|
0
|
|
|
0
|
1
|
|
sub update_firewall_security_policy ($self, $pkg, $id, $data) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
603
|
0
|
|
|
|
|
|
my $params = { |
604
|
|
|
|
|
|
|
data => { |
605
|
|
|
|
|
|
|
$data->%*, |
606
|
|
|
|
|
|
|
}, |
607
|
|
|
|
|
|
|
}; |
608
|
0
|
|
|
|
|
|
$self->exec_method('update', '/pm/config/adom/' . $self->adom . |
609
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/security-policy/' . $id , $params); |
610
|
|
|
|
|
|
|
} |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
|
613
|
0
|
|
|
0
|
1
|
|
sub delete_firewall_security_policy ($self, $pkg, $id) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
614
|
0
|
|
|
|
|
|
$self->exec_method('delete', '/pm/config/adom/' . $self->adom . |
615
|
|
|
|
|
|
|
'/pkg/' . $pkg . '/firewall/security-policy/' . $id); |
616
|
|
|
|
|
|
|
} |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
1; |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
__END__ |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=pod |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
=encoding UTF-8 |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
=head1 NAME |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
Net::Fortinet::FortiManager - Fortinet FortiManager REST API client library |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=head1 VERSION |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
version 0.003000 |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=head1 SYNOPSIS |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
use strict; |
638
|
|
|
|
|
|
|
use warnings; |
639
|
|
|
|
|
|
|
use Net::Fortinet::FortiManager; |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
my $fortimanager = Net::Fortinet::FortiManager->new( |
642
|
|
|
|
|
|
|
server => 'https://fortimanager.example.com', |
643
|
|
|
|
|
|
|
user => 'username', |
644
|
|
|
|
|
|
|
passwd => '$password', |
645
|
|
|
|
|
|
|
clientattrs => { |
646
|
|
|
|
|
|
|
timeout => 10, |
647
|
|
|
|
|
|
|
}, |
648
|
|
|
|
|
|
|
); |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
$fortimanager->login; |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
$fortimanager->adom('adomname'); |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=head1 DESCRIPTION |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
This module is a client library for the Fortigate FortiManager JSONRPC-like |
657
|
|
|
|
|
|
|
API. |
658
|
|
|
|
|
|
|
Currently it is developed and tested against version 6.4.6. |
659
|
|
|
|
|
|
|
All requests have the verbose parameter set to 1 to ensure that enums return |
660
|
|
|
|
|
|
|
their strings instead of undocumented ids. |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=head2 adoms |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
Returns a list of hashrefs containing name and uuid of all ADOMs which gets |
667
|
|
|
|
|
|
|
populated by L</login>. |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=head2 adom |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
The name of the ADOM which is used by all methods. |
672
|
|
|
|
|
|
|
Defaults to 'root'. |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
=head1 METHODS |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=head2 exec_method |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
Executes a method with the specified parameters. |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
Returns its response. |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
This is the lowest level method which can be used to execute every API action |
683
|
|
|
|
|
|
|
that's available. |
684
|
|
|
|
|
|
|
It does the http and JSONRPC error handling and extraction of the result |
685
|
|
|
|
|
|
|
from the JSONRPC response. |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=head2 exec_method_multi |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
Executes a method with multiple specified parameters. |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
Returns its responses. |
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
This is also a low level method which can be used to execute multiple API |
694
|
|
|
|
|
|
|
actions in a single JSONRPC call. |
695
|
|
|
|
|
|
|
The only restriction of the JSONRPC API is that all actions need to use the |
696
|
|
|
|
|
|
|
same method. |
697
|
|
|
|
|
|
|
It does the http and JSONRPC error handling and extraction of the results |
698
|
|
|
|
|
|
|
from the JSONRPC response. |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
=head2 login |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
Logs into the Fortinet FortiManager and switches to the first available ADOM |
703
|
|
|
|
|
|
|
if the currently set L<adom> isn't available, for example because the user |
704
|
|
|
|
|
|
|
is limited to one or more ADOMs. |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=head2 logout |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
Logs out of the Fortinet FortiManager. |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=head2 get_sys_status |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
Returns /sys/status. |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
=head2 list_adoms |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
Takes an optional parameter hashref. |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
Returns an arrayref of ADOMs. |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=head2 list_adoms_by_name |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
Returns an arrayref of ADOMs sorted by name. |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=head2 list_firewall_addresses |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
Returns an arrayref of firewall addresses. |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=head2 get_firewall_address |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
Takes a firewall address name and an optional parameter hashref. |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
Returns its data as a hashref. |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=head2 create_firewall_address |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
Takes a firewall address name and a hashref of address config. |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
Returns true on success. |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
Throws an exception on error. |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=head2 update_firewall_address |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
Takes a firewall address name and a hashref of address config. |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
Returns true on success. |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
Throws an exception on error. |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=head2 delete_firewall_address |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
Takes a firewall address name. |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
Returns true on success. |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
Throws an exception on error. |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=head2 list_firewall_address_groups |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
Returns an arrayref of firewall address groups. |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=head2 get_firewall_address_group |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
Takes a firewall address group name and an optional parameter hashref. |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
Returns its data as a hashref. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=head2 create_firewall_address_group |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
Takes a firewall address group name and a hashref of address group config. |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
Returns true on success. |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Throws an exception on error. |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=head2 update_firewall_address_group |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
Takes a firewall address group name and a hashref of address group config. |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
Returns true on success. |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
Throws an exception on error. |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=head2 delete_firewall_address_group |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
Takes a firewall address group name. |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
Returns true on success. |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
Throws an exception on error. |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
=head2 list_firewall_ipv6_addresses |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
Returns an arrayref of firewall IPv6 addresses. |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
=head2 get_firewall_ipv6_address |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
Takes a firewall IPv6 address name and an optional parameter hashref. |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
Returns its data as a hashref. |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=head2 create_firewall_ipv6_address |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
Takes a firewall IPv6 address name and a hashref of address config. |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
Returns true on success. |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
Throws an exception on error. |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
=head2 update_firewall_ipv6_address |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
Takes a firewall IPv6 address name and a hashref of address config. |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
Returns true on success. |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
Throws an exception on error. |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
=head2 delete_firewall_ipv6_address |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
Takes a firewall IPv6 address name. |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
Returns true on success. |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
Throws an exception on error. |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
=head2 list_firewall_ipv6_address_groups |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
Returns an arrayref of firewall IPv6 address groups. |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
=head2 get_firewall_ipv6_address_group |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
Takes a firewall IPv6 address group name and an optional parameter hashref. |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
Returns its data as a hashref. |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=head2 create_firewall_ipv6_address_group |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
Takes a firewall IPv6 address group name and a hashref of address group config. |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
Returns true on success. |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
Throws an exception on error. |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
=head2 update_firewall_ipv6_address_group |
845
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
Takes a firewall IPv6 address group name and a hashref of address group config. |
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
Returns true on success. |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
Throws an exception on error. |
851
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
=head2 delete_firewall_ipv6_address_group |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
Takes a firewall IPv6 address group name. |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
Returns true on success. |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
Throws an exception on error. |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
=head2 list_firewall_services |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
Returns an arrayref of firewall services. |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=head2 get_firewall_service |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
Takes a firewall service name and an optional parameter hashref. |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
Returns its data as a hashref. |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
=head2 create_firewall_service |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
Takes a firewall service name and a hashref of service config. |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
Returns true on success. |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
Throws an exception on error. |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
=head2 update_firewall_service |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
Takes a firewall service name and a hashref of service config. |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
Returns true on success. |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
Throws an exception on error. |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
=head2 delete_firewall_service |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
Takes a firewall service name. |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
Returns true on success. |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
Throws an exception on error. |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
=head2 list_firewall_service_groups |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
Returns an arrayref of firewall service groups. |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
=head2 get_firewall_service_group |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
Takes a firewall service group name and an optional parameter hashref. |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
Returns its data as a hashref. |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=head2 create_firewall_service_group |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
Takes a firewall service group name and a hashref of service group config. |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
Returns true on success. |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
Throws an exception on error. |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
=head2 update_firewall_service_group |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
Takes a firewall service group name and a hashref of service group config. |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
Returns true on success. |
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
Throws an exception on error. |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
=head2 delete_firewall_service_group |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
Takes a firewall service group name. |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
Returns true on success. |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
Throws an exception on error. |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
=head2 list_policy_packages |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
Takes optional parameters. |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
Returns an arrayref of policy packages. |
933
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
=head2 get_policy_package |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
Takes a policy package name and an optional parameter hashref. |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
Returns its data as a hashref. |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
=head2 create_policy_package |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
Takes a policy package name and a hashref of attributes. |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
Returns true on success. |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
Throws an exception on error. |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
The firewall policies are configured depending on the 'ngfw-mode'. |
949
|
|
|
|
|
|
|
For profile-based policy packages you have to use the 'policy' methods, |
950
|
|
|
|
|
|
|
for policy-based the 'security_policy' methods. |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
=head2 update_policy_package |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
Takes a policy package name and a hashref of attributes. |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
Returns true on success. |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
Throws an exception on error. |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
=head2 delete_policy_package |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
Takes a policy package name. |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
Returns true on success. |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
Throws an exception on error. |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
=head2 install_policy_package |
969
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
Takes a policy package name and a hashref of parameters. |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
Returns true on success. |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
Throws an exception on error. |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
=head2 list_tasks |
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
Takes optional parameters. |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
Returns an arrayref of tasks. |
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
=head2 get_task |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
Takes a task id and an optional parameter hashref. |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
Returns its data as a hashref. |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
=head2 list_firewall_policies |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
Takes a package name and optional parameters. |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
Returns an arrayref of firewall policies. |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=head2 get_firewall_policy |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
Takes a policy package name, a firewall policy id and an optional parameter |
997
|
|
|
|
|
|
|
hashref. |
998
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
Returns its data as a hashref. |
1000
|
|
|
|
|
|
|
|
1001
|
|
|
|
|
|
|
=head2 create_firewall_policy |
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
Takes a policy package name and a hashref of firewall policy attributes. |
1004
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
Returns the response data from the API on success which is a hashref |
1006
|
|
|
|
|
|
|
containing only the policyid. |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
Throws an exception on error. |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=head2 update_firewall_policy |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
Takes a policy package name, a firewall policy id and a hashref of firewall |
1013
|
|
|
|
|
|
|
policy attributes. |
1014
|
|
|
|
|
|
|
|
1015
|
|
|
|
|
|
|
Returns the response data from the API on success which is a hashref |
1016
|
|
|
|
|
|
|
containing only the policyid. |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
Throws an exception on error. |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
=head2 delete_firewall_policy |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
Takes a policy package name and a firewall policy id. |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
Returns true on success. |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
Throws an exception on error. |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
=head2 list_firewall_security_policies |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
Takes a package name and optional parameters. |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
Returns an arrayref of firewall security policies. |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
=head2 get_firewall_security_policy |
1035
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
Takes a policy package name, a firewall security policy id and an optional |
1037
|
|
|
|
|
|
|
parameter hashref. |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
Returns its data as a hashref. |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
=head2 create_firewall_security_policy |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
Takes a policy package name and a hashref of firewall security policy |
1044
|
|
|
|
|
|
|
attributes. |
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
Returns the response data from the API on success which is a hashref |
1047
|
|
|
|
|
|
|
containing only the policyid. |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
Throws an exception on error. |
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
=head2 update_firewall_security_policy |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
Takes a policy package name, a firewall security policy id and a hashref of |
1054
|
|
|
|
|
|
|
firewall security policy attributes. |
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
Returns the response data from the API on success which is a hashref |
1057
|
|
|
|
|
|
|
containing only the policyid. |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
Throws an exception on error. |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
=head2 delete_firewall_security_policy |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
Takes a policy package name and a firewall security policy id. |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
Returns true on success. |
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
Throws an exception on error. |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
=for Pod::Coverage has_user has_passwd has_api_key |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
=head1 TESTS |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
To run the live API tests the following environment variables need to be set: |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
=over |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
=item NET_FORTINET_FORTIMANAGER_HOSTNAME |
1078
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
=item NET_FORTINET_FORTIMANAGER_USERNAME |
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
=item NET_FORTINET_FORTIMANAGER_PASSWORD |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
=item NET_FORTINET_FORTIMANAGER_POLICY |
1084
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
=back |
1086
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
Several network objects are created as well as a policy package named by the |
1088
|
|
|
|
|
|
|
NET_FORTINET_FORTIMANAGER_POLICY environment variable. |
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
The test aborts if any of the objects can't be created, most likely if it |
1091
|
|
|
|
|
|
|
already exists. |
1092
|
|
|
|
|
|
|
All objects are deleted at the end of the test run, even when it aborts. |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
=head1 AUTHOR |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
Alexander Hartmaier <abraxxa@cpan.org> |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Alexander Hartmaier. |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
1103
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
=cut |