add an guest agent index call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2018-02-15 14:04:50 +01:00 committed by Thomas Lamprecht
parent ea2bceaf19
commit ad1f73b9e4

View File

@ -63,6 +63,44 @@ my $guest_agent_commands = {
},
};
__PACKAGE__->register_method({
name => 'index',
path => '',
proxyto => 'node',
method => 'GET',
description => "Qemu Agent command index.",
permissions => {
user => 'all',
},
parameters => {
additionalProperties => 1,
properties => {
node => get_standard_option('pve-node'),
vmid => get_standard_option('pve-vmid', {
completion => \&PVE::QemuServer::complete_vmid_running }),
},
},
returns => {
type => 'array',
items => {
type => "object",
properties => {},
},
links => [ { rel => 'child', href => '{name}' } ],
description => "Returns the list of Qemu Agent commands",
},
code => sub {
my ($param) = @_;
my $result = [];
for my $cmd (sort keys %$guest_agent_commands) {
push @$result, { name => $cmd };
}
return $result;
}});
sub register_command {
my ($class, $command, $method, $perm) = @_;