]>
git.proxmox.com Git - pve-firewall.git/blob - src/PVE/API2/Firewall/Host.pm
1 package PVE
::API2
::Firewall
::Host
;
5 use PVE
::JSONSchema
qw(get_standard_option);
10 use Data
::Dumper
; # fixme: remove
12 use base
qw(PVE::RESTHandler);
14 __PACKAGE__-
>register_method({
18 permissions
=> { user
=> 'all' },
19 description
=> "Directory index.",
21 additionalProperties
=> 0,
23 node
=> get_standard_option
('pve-node'),
32 links
=> [ { rel
=> 'child', href
=> "{name}" } ],
39 { name
=> 'options' },
45 __PACKAGE__-
>register_method({
49 description
=> "List host firewall rules.",
52 additionalProperties
=> 0,
54 node
=> get_standard_option
('pve-node'),
67 my $hostfw_conf = PVE
::Firewall
::load_hostfw_conf
();
69 my $rules = $hostfw_conf->{rules
} || [];
71 my $digest = $hostfw_conf->{digest
};
76 foreach my $rule (@$rules) {
77 push @$res, PVE
::Firewall
::cleanup_fw_rule
($rule, $digest, $ind++);
83 __PACKAGE__-
>register_method({
84 name
=> 'get_options',
87 description
=> "Get host firewall options.",
90 additionalProperties
=> 0,
92 node
=> get_standard_option
('pve-node'),
102 my $hostfw_conf = PVE
::Firewall
::load_hostfw_conf
();
104 my $options = $hostfw_conf->{options
} || {};
106 my $digest = $hostfw_conf->{digest
};
108 $options->{digest
} = $digest;