From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager v2 2/7] api: pbs: add /pbs/realms endpoint
Date: Tue, 24 Feb 2026 10:59:08 +0100 [thread overview]
Message-ID: <20260224095913.73320-3-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260224095913.73320-1-l.wagner@proxmox.com>
This one allows us to enumerate available authentication realms for PBS
remotes.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Shan Shaji <s.shaji@proxmox.com>
Tested-by: Shan Shaji <s.shaji@proxmox.com>
---
server/src/api/pbs/mod.rs | 55 +++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/server/src/api/pbs/mod.rs b/server/src/api/pbs/mod.rs
index badefc39..73f8fdd8 100644
--- a/server/src/api/pbs/mod.rs
+++ b/server/src/api/pbs/mod.rs
@@ -33,6 +33,10 @@ const SUBDIRS: SubdirMap = &sorted!([
("remotes", &REMOTES_ROUTER),
("scan", &Router::new().post(&API_METHOD_SCAN_REMOTE_PBS)),
("probe-tls", &Router::new().post(&API_METHOD_PROBE_TLS)),
+ (
+ "realms",
+ &Router::new().get(&API_METHOD_LIST_REALM_REMOTE_PBS)
+ )
]);
const REMOTES_ROUTER: Router = Router::new()
@@ -290,6 +294,57 @@ pub async fn scan_remote_pbs(
Ok(remote)
}
+#[api(
+ input: {
+ properties: {
+ hostname: {
+ type: String,
+ format: &HOST_OPTIONAL_PORT_FORMAT,
+ description: "Hostname (with optional port) of the target remote",
+ },
+ fingerprint: {
+ type: String,
+ description: "Fingerprint of the target remote.",
+ optional: true,
+ },
+ },
+ },
+ access: {
+ permission:
+ &Permission::Privilege(&["/"], PRIV_SYS_MODIFY, false),
+ },
+ returns: {
+ type: Array,
+ description: "A list of realms of a PBS remote.",
+ items: {
+ type: pbs_api_types::BasicRealmInfo,
+ }
+ },
+)]
+/// List available authentication realms of a PBS remote.
+pub async fn list_realm_remote_pbs(
+ hostname: String,
+ fingerprint: Option<String>,
+) -> Result<Vec<pbs_api_types::BasicRealmInfo>, Error> {
+ // dummy remote to connect
+ let remote = Remote {
+ ty: RemoteType::Pbs,
+ id: String::new(),
+ nodes: vec![PropertyString::new(NodeUrl {
+ hostname,
+ fingerprint,
+ })],
+ authid: "root@pam".parse()?,
+ token: String::new(),
+ web_url: None,
+ };
+
+ let client = connection::make_pbs_client(&remote)?;
+ let list = client.list_domains().await?;
+
+ Ok(list)
+}
+
#[api(
input: {
properties: {
--
2.47.3
next prev parent reply other threads:[~2026-02-24 9:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 9:59 [PATCH datacenter-manager v2 0/7] fix #7192: properly enumerate PBS realms in 'Add Remote' wizard Lukas Wagner
2026-02-24 9:59 ` [PATCH datacenter-manager v2 1/7] pbs-client: add `list_domains` Lukas Wagner
2026-02-24 9:59 ` Lukas Wagner [this message]
2026-02-24 9:59 ` [PATCH datacenter-manager v2 3/7] ui: rename pve_realm_selector module to remote_realm_selector Lukas Wagner
2026-02-24 9:59 ` [PATCH datacenter-manager v2 4/7] ui: widgets: rename PveRealmSelector to RemoteRealmSelector Lukas Wagner
2026-02-24 9:59 ` [PATCH datacenter-manager v2 5/7] ui: widgets: make RemoteRealmSelectorComp private Lukas Wagner
2026-02-24 9:59 ` [PATCH datacenter-manager v2 6/7] ui: widget: remote realm selector: add missing docstrings Lukas Wagner
2026-02-24 9:59 ` [PATCH datacenter-manager v2 7/7] ui: widgets: remote realm selector: support PBS remotes Lukas Wagner
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=20260224095913.73320-3-l.wagner@proxmox.com \
--to=l.wagner@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.