all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2 07/13] pbs-client: add bindings for APT-related API calls
Date: Fri, 17 Oct 2025 14:10:03 +0200	[thread overview]
Message-ID: <20251017121009.212499-8-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251017121009.212499-1-l.wagner@proxmox.com>

This commit adds bindings for the following API methods:
  GET /node/<node>/apt/update
  POST /node/<node>/apt/update
  GET /node/<node>/apt/changelog

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
Tested-by: Shannon Sterz <s.sterz@proxmox.com>
---
 server/src/pbs_client.rs | 51 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs
index 433b5d4b..49087360 100644
--- a/server/src/pbs_client.rs
+++ b/server/src/pbs_client.rs
@@ -114,6 +114,17 @@ pub struct DatstoreListNamespaces {
     pub max_depth: Option<usize>,
 }
 
+#[api]
+/// Parameters for updating the APT database
+#[derive(serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "kebab-case")]
+pub struct AptUpdateParams {
+    /// Send notification in case of new updates.
+    pub notify: Option<bool>,
+    /// Don't show progress information in the output.
+    pub quiet: Option<bool>,
+}
+
 impl PbsClient {
     /// API version details, including some parts of the global datacenter config.
     pub async fn version(&self) -> Result<pve_api_types::VersionResponse, Error> {
@@ -267,6 +278,46 @@ impl PbsClient {
             .expect_json()?
             .data)
     }
+
+    /// Return a list of available system updates.
+    pub async fn list_available_updates(&self) -> Result<Vec<pbs_api_types::APTUpdateInfo>, Error> {
+        Ok(self
+            .0
+            .get("/api2/extjs/nodes/localhost/apt/update")
+            .await?
+            .expect_json()?
+            .data)
+    }
+
+    /// Update the APT database.
+    pub async fn update_apt_database(
+        &self,
+        params: AptUpdateParams,
+    ) -> Result<pbs_api_types::UPID, Error> {
+        Ok(self
+            .0
+            .post("/api2/extjs/nodes/localhost/apt/update", &params)
+            .await?
+            .expect_json()?
+            .data)
+    }
+
+    /// Get changelog for a single package.
+    ///
+    /// `package`: Package name to get the changelog of.
+    /// `version`: Package version to get changelog of. Omit to use candidate version.
+    pub async fn get_package_changelog(
+        &self,
+        package: String,
+        version: Option<String>,
+    ) -> Result<String, Error> {
+        let path = ApiPathBuilder::new("/api2/extjs/nodes/localhost/apt/changelog")
+            .arg("name", &package)
+            .maybe_arg("version", &version)
+            .build();
+
+        Ok(self.0.get(&path).await?.expect_json()?.data)
+    }
 }
 
 #[derive(Deserialize)]
-- 
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-10-17 12:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 12:09 [pdm-devel] [PATCH datacenter-manager v2 00/13] add global remote update view Lukas Wagner
2025-10-17 12:09 ` [pdm-devel] [PATCH datacenter-manager v2 01/13] metric collection task: tests: add missing parameter for cluster_metric_export Lukas Wagner
2025-10-21 19:24   ` [pdm-devel] applied: " Thomas Lamprecht
2025-10-17 12:09 ` [pdm-devel] [PATCH datacenter-manager v2 02/13] pdm-api-types: add types for remote upgrade summary Lukas Wagner
2025-10-17 12:09 ` [pdm-devel] [PATCH datacenter-manager v2 03/13] remote updates: add cache for remote update availability Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 04/13] api: add API for retrieving/refreshing the remote update summary Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 05/13] unprivileged api daemon: tasks: add remote update refresh task Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 06/13] pdm-client: add API methods for remote update summaries Lukas Wagner
2025-10-17 12:10 ` Lukas Wagner [this message]
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 08/13] task cache: use separate functions for tracking PVE and PBS tasks Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 09/13] remote updates: add support for PBS remotes Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 10/13] api: add APT endpoints " Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 11/13] ui: add remote update view Lukas Wagner
2025-10-21 19:18   ` Thomas Lamprecht
2025-10-22 10:22     ` Lukas Wagner
2025-10-23  8:36       ` Thomas Lamprecht
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 12/13] ui: show new remote update view in the 'Remotes' section Lukas Wagner
2025-10-17 12:10 ` [pdm-devel] [PATCH datacenter-manager v2 13/13] remote updates: avoid unnecessary clone 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=20251017121009.212499-8-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal