From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 1/7] pdm-api-types: remote upid: add helpers for getting native UPID type
Date: Wed, 12 Nov 2025 10:41:57 +0100 [thread overview]
Message-ID: <20251112094203.112452-2-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251112094203.112452-1-l.wagner@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
lib/pdm-api-types/src/remote_upid.rs | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lib/pdm-api-types/src/remote_upid.rs b/lib/pdm-api-types/src/remote_upid.rs
index 10d3c1dc..080837db 100644
--- a/lib/pdm-api-types/src/remote_upid.rs
+++ b/lib/pdm-api-types/src/remote_upid.rs
@@ -70,6 +70,28 @@ impl RemoteUpid {
})
}
+ /// Get the parsed PVE UPID.
+ ///
+ /// If the UPID could not be parsed, or has an unexpected format (PBS),
+ /// an error is returned.
+ pub fn pve_upid(&self) -> Result<pve_api_types::PveUpid, Error> {
+ match self.native_upid()? {
+ NativeUpid::PveUpid(pve_upid) => Ok(pve_upid),
+ NativeUpid::PbsUpid(_) => bail!("got a PBS UPID when expecting a PVE UPID"),
+ }
+ }
+
+ /// Get the parsed PBS UPID.
+ ///
+ /// If the UPID could not be parsed, or has an unexpected format (PVE),
+ /// an error is returned.
+ pub fn pbs_upid(&self) -> Result<pbs_api_types::UPID, Error> {
+ match self.native_upid()? {
+ NativeUpid::PveUpid(_) => bail!("got a PVE UPID when expecting a PBS UPID"),
+ NativeUpid::PbsUpid(pbs_upid) => Ok(pbs_upid),
+ }
+ }
+
fn deduce_type(raw_upid: &str) -> Result<RemoteType, Error> {
if raw_upid.parse::<pve_api_types::PveUpid>().is_ok() {
Ok(RemoteType::Pve)
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-11-12 9:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 9:41 [pdm-devel] [PATCH datacenter-manager 0/7] PBS remotes: task API and task cache support Lukas Wagner
2025-11-12 9:41 ` Lukas Wagner [this message]
2025-11-12 9:41 ` [pdm-devel] [PATCH datacenter-manager 2/7] pbs-client: add bindings for task list, task status, task log Lukas Wagner
2025-11-12 20:23 ` Thomas Lamprecht
2025-11-12 9:41 ` [pdm-devel] [PATCH datacenter-manager 3/7] pdm-api-types: api: factor out schema definitions for task log params Lukas Wagner
2025-11-12 9:42 ` [pdm-devel] [PATCH datacenter-manager 4/7] api: pbs tasks: add PBS task API Lukas Wagner
2025-11-12 9:42 ` [pdm-devel] [PATCH datacenter-manager 5/7] api: pve tasks: use shared helpers for RemoteUpid handling Lukas Wagner
2025-11-12 9:42 ` [pdm-devel] [PATCH datacenter-manager 6/7] remote tasks: fetch/track PBS tasks Lukas Wagner
2025-11-12 9:42 ` [pdm-devel] [PATCH datacenter-manager 7/7] remote updates: re-enable PBS update fetching Lukas Wagner
2025-11-12 20:26 ` Thomas Lamprecht
2025-11-12 20:27 ` [pdm-devel] applied-series: [PATCH datacenter-manager 0/7] PBS remotes: task API and task cache support Thomas Lamprecht
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=20251112094203.112452-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox