public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-datacenter-manager 1/4] connection: add access to "raw" client
Date: Wed,  5 Nov 2025 15:13:10 +0100	[thread overview]
Message-ID: <20251105141335.1230493-9-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20251105141335.1230493-1-f.gruenbichler@proxmox.com>

needed for websocket connections and similar lower level access.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 server/src/connection.rs                        | 11 +++++++++++
 server/src/metric_collection/collection_task.rs |  5 +++++
 server/src/test_support/fake_remote.rs          |  5 +++++
 3 files changed, 21 insertions(+)

diff --git a/server/src/connection.rs b/server/src/connection.rs
index e749c1a..1c0069e 100644
--- a/server/src/connection.rs
+++ b/server/src/connection.rs
@@ -252,6 +252,9 @@ pub trait ClientFactory {
     ///
     /// Note: currently does not support two factor authentication.
     async fn make_pbs_client_and_login(&self, remote: &Remote) -> Result<Box<PbsClient>, Error>;
+
+    /// Create a new API client for raw acess to the given remote
+    fn make_raw_client(&self, remote: &Remote) -> Result<Box<Client>, Error>;
 }
 
 /// Default production client factory
@@ -346,6 +349,10 @@ impl ClientFactory for DefaultClientFactory {
         ConnectionCache::get().make_pve_client(remote)
     }
 
+    fn make_raw_client(&self, remote: &Remote) -> Result<Box<Client>, Error> {
+        Ok(Box::new(crate::connection::connect(remote, None)?))
+    }
+
     fn make_pbs_client(&self, remote: &Remote) -> Result<Box<PbsClient>, Error> {
         let client = crate::connection::connect(remote, None)?;
         Ok(Box::new(PbsClient(client)))
@@ -418,6 +425,10 @@ pub fn make_pbs_client(remote: &Remote) -> Result<Box<PbsClient>, Error> {
     instance().make_pbs_client(remote)
 }
 
+pub fn make_raw_client(remote: &Remote) -> Result<Box<Client>, Error> {
+    instance().make_raw_client(remote)
+}
+
 /// Create a new API client for PVE remotes.
 ///
 /// In case the remote has a user configured (instead of an API token), it will connect and get a
diff --git a/server/src/metric_collection/collection_task.rs b/server/src/metric_collection/collection_task.rs
index a6c8443..cc1a460 100644
--- a/server/src/metric_collection/collection_task.rs
+++ b/server/src/metric_collection/collection_task.rs
@@ -387,6 +387,7 @@ pub(super) mod tests {
     use http::StatusCode;
 
     use pdm_api_types::Authid;
+    use proxmox_client::Client;
     use pve_api_types::{ClusterMetrics, ClusterMetricsData};
 
     use crate::{
@@ -430,6 +431,10 @@ pub(super) mod tests {
             bail!("not implemented")
         }
 
+        fn make_raw_client(&self, _remote: &Remote) -> Result<Box<Client>, Error> {
+            bail!("not implemented")
+        }
+
         async fn make_pve_client_and_login(
             &self,
             _remote: &Remote,
diff --git a/server/src/test_support/fake_remote.rs b/server/src/test_support/fake_remote.rs
index cd2ccf6..62dd869 100644
--- a/server/src/test_support/fake_remote.rs
+++ b/server/src/test_support/fake_remote.rs
@@ -5,6 +5,7 @@ use serde::Deserialize;
 
 use pdm_api_types::{remotes::Remote, Authid, ConfigDigest};
 use pdm_config::remotes::RemoteConfig;
+use proxmox_client::Client;
 use proxmox_product_config::ApiLockGuard;
 use proxmox_section_config::typed::SectionConfigData;
 use pve_api_types::{
@@ -100,6 +101,10 @@ impl ClientFactory for FakeClientFactory {
         bail!("not implemented")
     }
 
+    fn make_raw_client(&self, _remote: &Remote) -> Result<Box<Client>, Error> {
+        bail!("not implemented")
+    }
+
     async fn make_pve_client_and_login(&self, _remote: &Remote) -> Result<Arc<PveClient>, Error> {
         bail!("not implemented")
     }
-- 
2.47.3



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

  parent reply	other threads:[~2025-11-05 14:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 14:13 [pve-devel] [RFC access-control/manager/proxmox{, -yew-comp, -datacenter-manager}/xtermjs 00/11] add remote node shell Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH pve-xtermjs 1/1] xtermjs: add support for remote node shells via PDM Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH access-control 1/1] api: ticket: allow token-owned VNC ticket verification Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH manager 1/2] api: termproxy/vncwebsocket: allow tokens Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH manager 2/2] api: termproxy: add description to return schema Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox 1/2] pve-api-types: add termproxy call and types Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox 2/2] http: websocket: add proxy helper Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-yew-comp 1/1] xtermjs: add remote support Fabian Grünbichler
2025-11-05 14:13 ` Fabian Grünbichler [this message]
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 2/4] api: pve: add termproxy endpoint Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 3/4] api: pve: add vncwebsocket endpoint Fabian Grünbichler
2025-11-05 14:13 ` [pve-devel] [PATCH proxmox-datacenter-manager 4/4] ui: pve: node: add shell tab Fabian Grünbichler

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=20251105141335.1230493-9-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.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