]> git.proxmox.com Git - pve-manager.git/commitdiff
api: cluster/backupinfo: rework bogus index endpoint
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 09:34:32 +0000 (11:34 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 2 Jul 2021 09:34:34 +0000 (11:34 +0200)
This had a myriad of issues:

* marked as protected, thus forwarded to the privileged daemon even
  if it just returned static information
* did not return directory index but a "stub" string, which does not
  makes sense.
* not named index

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/BackupInfo.pm

index 4c461e59298657867f96c11016c5611fd2dcbf03..484a8485bd29a9a0b0e2b744b8f430c42cd19a04 100644 (file)
@@ -32,21 +32,32 @@ sub get_included_vmids {
 }
 
 __PACKAGE__->register_method({
-    name => 'get_backupinfo',
+    name => 'index',
     path => '',
     method => 'GET',
-    protected => 1,
-    description => "Stub, waits for future use.",
+    description => "Index for backup info related endpoints",
     parameters => {
-       additionalProperties => 0,
-       properties => {},
+       additionalProperties => 0,
+       properties => {},
     },
     returns => {
-       type => 'string',
-       description => 'Shows stub message',
+       type => 'array',
+       description => 'Directory index.',
+       items => {
+           type => "object",
+           properties => {
+               subdir => {
+                   type => 'string',
+                   description => 'API sub-directory endpoint',
+               },
+           },
+       },
+       links => [ { rel => 'child', href => "{subdir}" } ],
     },
     code => sub {
-       return "Stub endpoint. There is nothing here yet.";
+       return [
+          { subdir => 'not_backed_up' },
+       ];
     }});
 
 __PACKAGE__->register_method({