public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 1/1] api2: add /guests path
Date: Thu,  1 Jun 2023 00:28:33 +0200	[thread overview]
Message-ID: <20230531222834.1915972-2-aderumier@odiso.com> (raw)
In-Reply-To: <20230531222834.1915972-1-aderumier@odiso.com>

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/API2.pm        |  6 +++++
 PVE/API2/Guests.pm | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 PVE/API2/Makefile  |  1 +
 3 files changed, 62 insertions(+)
 create mode 100644 PVE/API2/Guests.pm

diff --git a/PVE/API2.pm b/PVE/API2.pm
index 42941fd2..092c6df7 100644
--- a/PVE/API2.pm
+++ b/PVE/API2.pm
@@ -17,6 +17,7 @@ use PVE::API2::Nodes;
 use PVE::API2::Pool;
 use PVE::API2::AccessControl;
 use PVE::API2::Storage::Config;
+use PVE::API2::Guests;
 
 __PACKAGE__->register_method ({
     subclass => "PVE::API2::Cluster",
@@ -38,6 +39,11 @@ __PACKAGE__->register_method ({
     path => 'access',
 });
 
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::Guests",
+    path => 'guests',
+});
+
 __PACKAGE__->register_method ({
     subclass => "PVE::API2::Pool",
     path => 'pools',
diff --git a/PVE/API2/Guests.pm b/PVE/API2/Guests.pm
new file mode 100644
index 00000000..9be96393
--- /dev/null
+++ b/PVE/API2/Guests.pm
@@ -0,0 +1,55 @@
+package PVE::API2::Guests;
+
+use strict;
+use warnings;
+
+use PVE::RESTHandler;
+
+use base qw(PVE::RESTHandler);
+
+# preload classes
+use PVE::API2::Qemu;
+use PVE::API2::LXC;
+
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::Qemu",
+    path => 'qemu',
+});
+
+__PACKAGE__->register_method ({
+    subclass => "PVE::API2::LXC",
+    path => 'lxc',
+});
+
+__PACKAGE__->register_method ({
+    name => 'index',
+    path => '',
+    method => 'GET',
+    permissions => { user => 'all' },
+    description => "Directory index.",
+    parameters => {
+	additionalProperties => 0,
+	properties => {},
+    },
+    returns => {
+	type => 'array',
+	items => {
+	    type => "object",
+	    properties => {
+		subdir => { type => 'string' },
+	    },
+	},
+	links => [ { rel => 'child', href => "{subdir}" } ],
+    },
+    code => sub {
+	my ($param) = @_;
+
+        my $res = [
+            { subdir => 'qemu' },
+            { subdir => 'lxc' },
+        ];
+
+        return $res;
+    }});
+1;
diff --git a/PVE/API2/Makefile b/PVE/API2/Makefile
index 97f1cc20..b1ece7d6 100644
--- a/PVE/API2/Makefile
+++ b/PVE/API2/Makefile
@@ -12,6 +12,7 @@ PERLSOURCE = 			\
 	Ceph.pm			\
 	Certificates.pm		\
 	Cluster.pm		\
+	Guests.pm		\
 	HAConfig.pm		\
 	Hardware.pm		\
 	Network.pm		\
-- 
2.30.2




  reply	other threads:[~2023-05-31 22:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 22:28 [pve-devel] [PATCH-SERIES pve-manager/qemu-server] fix#4689 autofind node with proxyto_callback Alexandre Derumier
2023-05-31 22:28 ` Alexandre Derumier [this message]
2023-05-31 22:28 ` [pve-devel] [PATCH qemu-server 1/1] api2: qemu: add proxyto_callback to find node if not defined Alexandre Derumier
2023-06-03 13:57 ` [pve-devel] [PATCH-SERIES pve-manager/qemu-server] fix#4689 autofind node with proxyto_callback Thomas Lamprecht
2023-06-04  6:40   ` DERUMIER, Alexandre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531222834.1915972-2-aderumier@odiso.com \
    --to=aderumier@odiso.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal