]>
git.proxmox.com Git - pve-firewall.git/blob - src/PVE/API2/Firewall/VM.pm
1 package PVE
::API2
::Firewall
::VM
;
5 use PVE
::JSONSchema
qw(get_standard_option);
8 use PVE
::API2
::Firewall
::Rules
;
10 use Data
::Dumper
; # fixme: remove
12 use base
qw(PVE::RESTHandler);
14 __PACKAGE__-
>register_method ({
15 subclass
=> "PVE::API2::Firewall::VMRules",
19 __PACKAGE__-
>register_method({
23 permissions
=> { user
=> 'all' },
24 description
=> "Directory index.",
26 additionalProperties
=> 0,
28 node
=> get_standard_option
('pve-node'),
29 vmid
=> get_standard_option
('pve-vmid'),
38 links
=> [ { rel
=> 'child', href
=> "{name}" } ],
45 { name
=> 'options' },
51 __PACKAGE__-
>register_method({
52 name
=> 'get_options',
55 description
=> "Get host firewall options.",
58 additionalProperties
=> 0,
60 node
=> get_standard_option
('pve-node'),
61 vmid
=> get_standard_option
('pve-vmid'),
71 my $vmid = $param->{vmid
};
73 my $vmlist = PVE
::Cluster
::get_vmlist
();
75 die "no such VM ('$vmid')\n"
76 if !($vmlist && $vmlist->{ids
} && defined($vmlist->{ids
}->{$vmid}));
78 my $vmfw_conf = PVE
::Firewall
::load_vmfw_conf
($vmid);
80 my $options = $vmfw_conf->{options
} || {};
82 my $digest = $vmfw_conf->{digest
};
84 $options->{digest
} = $digest;