[pdm-devel] [PATCH datacenter-manager v3 06/23] pdm-client: add scan_remote and probe_tls methods
Lukas Wagner
l.wagner at proxmox.com
Thu Aug 21 13:46:08 CEST 2025
On Thu Aug 21, 2025 at 10:39 AM CEST, Dominik Csapak wrote:
> 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..58d8963 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::TlsProbeOutcome;
> 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
^ outdated doc comment here
> + pub async fn pve_probe_tls(
> + &self,
> + hostname: &str,
> + fingerprint: Option<&str>,
> + ) -> Result<TlsProbeOutcome, Error> {
> + let mut params = json!({
> + "hostname": hostname,
> + });
> + if let Some(fp) = fingerprint {
> + params["fingerprint"] = fp.into();
> + }
> + Ok(self
> + .0
> + .post("/api2/extjs/pve/probe-tls", ¶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<Remote, 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.
More information about the pdm-devel
mailing list