[pbs-devel] [PATCH v3 proxmox-backup 06/10] api: apt: add repositories call

Fabian Ebner f.ebner at proxmox.com
Mon Mar 22 12:59:41 CET 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

No changes from v2.

 src/api2/node/apt.rs | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
index e77b89fa..4dad2e73 100644
--- a/src/api2/node/apt.rs
+++ b/src/api2/node/apt.rs
@@ -6,6 +6,8 @@ use proxmox::list_subdirs_api_method;
 use proxmox::api::{api, RpcEnvironment, RpcEnvironmentType, Permission};
 use proxmox::api::router::{Router, SubdirMap};
 
+use proxmox_apt::types::APTRepository;
+
 use crate::server::WorkerTask;
 use crate::tools::{apt, http, subscription};
 
@@ -350,8 +352,33 @@ pub fn get_versions() -> Result<Vec<APTUpdateInfo>, Error> {
     Ok(packages)
 }
 
+#[api(
+    input: {
+        properties: {
+            node: {
+                schema: NODE_SCHEMA,
+            },
+        },
+    },
+    returns: {
+        description: "List of configured APT repositories",
+        type: Array,
+        items: {
+            type: APTRepository,
+        },
+    },
+    access: {
+        permission: &Permission::Privilege(&[], PRIV_SYS_AUDIT, false),
+    },
+)]
+/// Get APT repository information
+pub fn get_repositories() -> Result<Vec<APTRepository>, Error> {
+    proxmox_apt::repositories::repositories()
+}
+
 const SUBDIRS: SubdirMap = &[
     ("changelog", &Router::new().get(&API_METHOD_APT_GET_CHANGELOG)),
+    ("repositories", &Router::new().get(&API_METHOD_GET_REPOSITORIES)),
     ("update", &Router::new()
         .get(&API_METHOD_APT_UPDATE_AVAILABLE)
         .post(&API_METHOD_APT_UPDATE_DATABASE)
-- 
2.20.1






More information about the pbs-devel mailing list