Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 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 9d87b43..2743595 100644
--- a/PVE/API2/Qemu/Agent.pm
+++ b/PVE/API2/Qemu/Agent.pm
@@ -37,6 +37,44 @@ my $guest_agent_commands = [
 #         or a permission object
 my $ga_cmd_properties =  {};
 
+__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 (@$guest_agent_commands) {
+           push @$result, { name => $cmd };
+       }
+
+       return $result;
+    }});
+
 sub register_command {
     my ($class, $command, $method, $perm) = @_;
 
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to