From ad1f73b9e43b09d177b8283cd3d11e93be400e18 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 15 Feb 2018 14:04:50 +0100 Subject: [PATCH] add an guest agent index call Signed-off-by: Dominik Csapak --- PVE/API2/Qemu/Agent.pm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/PVE/API2/Qemu/Agent.pm b/PVE/API2/Qemu/Agent.pm index 93d47bc6..b046d2d6 100644 --- a/PVE/API2/Qemu/Agent.pm +++ b/PVE/API2/Qemu/Agent.pm @@ -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) = @_;