all lists on 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 proxmox 2/2] pve api types: add cluster options api call
Date: Fri, 28 Nov 2025 11:18:20 +0100	[thread overview]
Message-ID: <20251128101848.1580111-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251128101848.1580111-1-d.csapak@proxmox.com>

so we can get e.g. the datacenter notes.

The return schema for this is currently not defined and adding it in
pve-manager is rather hard.

The reason for this is that while we have defined the datacenter config
schema for the update call, the properties are all property-strings. In
the GET call however, we parse these and return a nested object.

We'd either have to copy the whole schema and make sure it does not
diverge, or find some more elegant way to modify the return schema to
include the parsed properties (for some properties this even happens
nested, e.g. a list in a property string gets split into an actual
array).

Since this is not feasible at the moment, the easiest way is to simply
use a Value for now.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pve-api-types/generate.pl           |  3 +++
 pve-api-types/src/generated/code.rs | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index 2caf1cff..8d509856 100755
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -395,6 +395,9 @@ Schema2Rust::register_format('pve-fw-conntrack-helper' => {
 });
 
 # options
+# FIXME: to use a better return value than `Value`, we first must fix the return schema there
+api(GET => '/cluster/options', 'cluster_options', 'output-type' => 'serde_json::Value');
+
 api(GET => '/cluster/firewall/options', 'cluster_firewall_options', 'return-name' => 'ClusterFirewallOptions');
 api(PUT => '/cluster/firewall/options', 'set_cluster_firewall_options', 'param-name' => 'UpdateClusterFirewallOptions');
 
diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
index 0dd6d8e1..ae86c93c 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -114,7 +114,6 @@
 /// - /cluster/notifications/targets
 /// - /cluster/notifications/targets/{name}
 /// - /cluster/notifications/targets/{name}/test
-/// - /cluster/options
 /// - /cluster/replication
 /// - /cluster/replication/{id}
 /// - /cluster/sdn/controllers/{controller}
@@ -403,6 +402,12 @@ pub trait PveClient {
         Err(Error::Other("cluster_metrics_export not implemented"))
     }
 
+    /// Get datacenter options. Without 'Sys.Audit' on '/' not all options are
+    /// returned.
+    async fn cluster_options(&self) -> Result<serde_json::Value, Error> {
+        Err(Error::Other("cluster_options not implemented"))
+    }
+
     /// Resources index (cluster wide).
     async fn cluster_resources(
         &self,
@@ -1009,6 +1014,13 @@ where
         Ok(self.0.get(url).await?.expect_json()?.data)
     }
 
+    /// Get datacenter options. Without 'Sys.Audit' on '/' not all options are
+    /// returned.
+    async fn cluster_options(&self) -> Result<serde_json::Value, Error> {
+        let url = "/api2/extjs/cluster/options";
+        Ok(self.0.get(url).await?.expect_json()?.data)
+    }
+
     /// Resources index (cluster wide).
     async fn cluster_resources(
         &self,
-- 
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:19 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 ` Dominik Csapak [this message]
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 ` [pdm-devel] [PATCH datacenter-manager 2/5] server: api: pve: add cluster options api call Dominik Csapak
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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal