From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3281D9CA5B for ; Thu, 1 Jun 2023 08:51:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 141B81A694 for ; Thu, 1 Jun 2023 08:50:43 +0200 (CEST) Received: from bastionodiso.odiso.net (bastionodiso.odiso.net [185.151.191.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 1 Jun 2023 08:50:42 +0200 (CEST) Received: from kvmformation3.odiso.net (formationkvm3.odiso.net [10.3.94.12]) by bastionodiso.odiso.net (Postfix) with ESMTP id 7CDE67A82; Thu, 1 Jun 2023 08:50:42 +0200 (CEST) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id 6A8762D636E; Thu, 1 Jun 2023 08:50:12 +0200 (CEST) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Thu, 1 Jun 2023 08:50:09 +0200 Message-Id: <20230601065011.2946694-2-aderumier@odiso.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230601065011.2946694-1-aderumier@odiso.com> References: <20230601065011.2946694-1-aderumier@odiso.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy HEADER_FROM_DIFFERENT_DOMAINS 0.25 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH pve-manager 1/2] api2: add /guests path X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2023 06:51:13 -0000 Signed-off-by: Alexandre Derumier --- 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