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