public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 2/5] server: api: pve: add cluster options api call
Date: Fri, 28 Nov 2025 11:18:23 +0100	[thread overview]
Message-ID: <20251128101848.1580111-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251128101848.1580111-1-d.csapak@proxmox.com>

just GET for now.

It returns a `serde_json::Value` since adding the proper return schema
is rather hard at the moment. See the relevant commit in the
pve-api-types crate.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 server/src/api/pve/mod.rs | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/server/src/api/pve/mod.rs b/server/src/api/pve/mod.rs
index 34d9b760..dddb5dc2 100644
--- a/server/src/api/pve/mod.rs
+++ b/server/src/api/pve/mod.rs
@@ -70,6 +70,7 @@ const REMOTE_SUBDIRS: SubdirMap = &sorted!([
     ("lxc", &lxc::ROUTER),
     ("firewall", &firewall::CLUSTER_FW_ROUTER),
     ("nodes", &NODES_ROUTER),
+    ("options", &OPTIONS_ROUTER),
     ("qemu", &qemu::ROUTER),
     ("resources", &RESOURCES_ROUTER),
     ("cluster-status", &STATUS_ROUTER),
@@ -84,6 +85,8 @@ const RESOURCES_ROUTER: Router = Router::new().get(&API_METHOD_CLUSTER_RESOURCES
 
 const STATUS_ROUTER: Router = Router::new().get(&API_METHOD_CLUSTER_STATUS);
 
+const OPTIONS_ROUTER: Router = Router::new().get(&API_METHOD_GET_OPTIONS);
+
 // converts a remote + PveUpid into a RemoteUpid and starts tracking it
 pub async fn new_remote_upid(remote: String, upid: PveUpid) -> Result<RemoteUpid, Error> {
     let remote_upid = remote_tasks::track_running_pve_task(remote, upid).await?;
@@ -498,3 +501,24 @@ pub async fn list_realm_remote_pve(
 
     Ok(list)
 }
+
+#[api(
+    input: {
+        properties: {
+            remote: { schema: REMOTE_ID_SCHEMA },
+        },
+    },
+    access: {
+        permission: &Permission::Privilege(&["resource", "{remote}"], PRIV_RESOURCE_AUDIT, false),
+    },
+)]
+/// Return the remote's cluster options.
+pub async fn get_options(remote: String) -> Result<serde_json::Value, Error> {
+    let (remotes, _) = pdm_config::remotes::config()?;
+
+    let options = connect_to_remote(&remotes, &remote)?
+        .cluster_options()
+        .await?;
+
+    Ok(options)
+}
-- 
2.47.3



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


  parent reply	other threads:[~2025-11-28 10:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 10:18 [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp 0/8] ui: add remote datacenter/node notes panels Dominik Csapak
2025-11-28 10:18 ` [pdm-devel] [PATCH proxmox 1/2] pve api types: add node config get api call Dominik Csapak
2025-11-28 10:18 ` [pdm-devel] [PATCH proxmox 2/2] pve api types: add cluster options " Dominik Csapak
2025-11-28 10:18 ` [pdm-devel] [PATCH yew-comp 1/1] notes edit: hide toolbar when editing is not possible Dominik Csapak
2025-11-28 10:18 ` [pdm-devel] [PATCH datacenter-manager 1/5] server: api: add nodes config api Dominik Csapak
2025-11-28 10:18 ` Dominik Csapak [this message]
2025-11-28 10:18 ` [pdm-devel] [PATCH datacenter-manager 3/5] ui: pve: rename remote module Dominik Csapak
2025-11-28 10:18 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: pve: nodes: add panel for notes Dominik Csapak
2025-11-28 10:18 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: pve: datacenter: add remote notes panel Dominik Csapak

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=20251128101848.1580111-6-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-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