[pdm-devel] [PATCH datacenter-manager 05/21] pdm-client: add scan_remote and probe_tls methods
Dominik Csapak
d.csapak at proxmox.com
Fri May 16 15:35:55 CEST 2025
so we can use that in the ui instead of making the api calls manually
via the path.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
lib/pdm-client/src/lib.rs | 45 +++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 61a8ebd..d656ab1 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -3,6 +3,7 @@
use std::collections::HashMap;
use std::time::Duration;
+use pdm_api_types::remotes::ScanResult;
use pdm_api_types::resource::{PveResource, RemoteResources, TopEntities};
use pdm_api_types::rrddata::{
LxcDataPoint, NodeDataPoint, PbsDatastoreDataPoint, PbsNodeDataPoint, QemuDataPoint,
@@ -865,6 +866,50 @@ impl<T: HttpApiClient> PdmClient<T> {
.build();
Ok(self.0.get(&path).await?.expect_json()?.data)
}
+
+ /// uses /pve/scan to probe the tls connection to the given host
+ pub async fn pve_probe_tls(
+ &self,
+ hostname: &str,
+ fingerprint: Option<&str>,
+ ) -> Result<ScanResult, Error> {
+ let mut params = json!({
+ "hostname": hostname,
+ });
+ if let Some(fp) = fingerprint {
+ params["fingerprint"] = fp.into();
+ }
+ Ok(self
+ .0
+ .post("/api2/extjs/pve/scan", ¶ms)
+ .await?
+ .expect_json()?
+ .data)
+ }
+
+ /// Uses /pve/scan to scan the remote cluster for node/fingerprint information
+ pub async fn pve_scan_remote(
+ &self,
+ hostname: &str,
+ fingerprint: Option<&str>,
+ authid: &str,
+ token: &str,
+ ) -> Result<ScanResult, Error> {
+ let mut params = json!({
+ "hostname": hostname,
+ "authid": authid,
+ "token": token,
+ });
+ if let Some(fp) = fingerprint {
+ params["fingerprint"] = fp.into();
+ }
+ Ok(self
+ .0
+ .post("/api2/extjs/pve/scan", ¶ms)
+ .await?
+ .expect_json()?
+ .data)
+ }
}
/// Builder for migration parameters.
--
2.39.5
More information about the pdm-devel
mailing list