all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] cleanup src/api2/node/config.rs
@ 2021-05-10  6:39 Dietmar Maurer
  2021-05-10  6:39 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix 3296: add http_proxy to node config, and provide a cli Dietmar Maurer
  2021-05-10  7:22 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] cleanup src/api2/node/config.rs Dietmar Maurer
  0 siblings, 2 replies; 4+ messages in thread
From: Dietmar Maurer @ 2021-05-10  6:39 UTC (permalink / raw)
  To: pbs-devel

- add return type
- fix permissions
- fix descriptions
---
 src/api2/node/config.rs | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/api2/node/config.rs b/src/api2/node/config.rs
index fd997062..92c0100e 100644
--- a/src/api2/node/config.rs
+++ b/src/api2/node/config.rs
@@ -1,12 +1,11 @@
 use anyhow::Error;
-use serde_json::Value;
 
 use proxmox::api::schema::Updatable;
 use proxmox::api::{api, Permission, Router, RpcEnvironment};
 
 use crate::api2::types::NODE_SCHEMA;
-use crate::config::acl::PRIV_SYS_MODIFY;
-use crate::config::node::NodeConfigUpdater;
+use crate::config::acl::{PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};
+use crate::config::node::{NodeConfig, NodeConfigUpdater};
 
 pub const ROUTER: Router = Router::new()
     .get(&API_METHOD_GET_NODE_CONFIG)
@@ -19,14 +18,17 @@ pub const ROUTER: Router = Router::new()
         },
     },
     access: {
-        permission: &Permission::Privilege(&["system"], PRIV_SYS_MODIFY, false),
+        permission: &Permission::Privilege(&["system"], PRIV_SYS_AUDIT, false),
+    },
+    returns: {
+        type: NodeConfig,
     },
 )]
-/// Create a new changer device.
-pub fn get_node_config(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
+/// Get the node configuration
+pub fn get_node_config(mut rpcenv: &mut dyn RpcEnvironment) -> Result<NodeConfig, Error> {
     let (config, digest) = crate::config::node::config()?;
     rpcenv["digest"] = proxmox::tools::digest_to_hex(&digest).into();
-    Ok(serde_json::to_value(config)?)
+    Ok(config)
 }
 
 #[api(
@@ -52,7 +54,7 @@ pub fn get_node_config(mut rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Err
     },
     protected: true,
 )]
-/// Create a new changer device.
+/// Update the node configuration
 pub fn update_node_config(
     updater: NodeConfigUpdater,
     delete: Option<String>,
-- 
2.20.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-10  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  6:39 [pbs-devel] [PATCH proxmox-backup 1/2] cleanup src/api2/node/config.rs Dietmar Maurer
2021-05-10  6:39 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix 3296: add http_proxy to node config, and provide a cli Dietmar Maurer
2021-05-10  7:23   ` [pbs-devel] applied: " Dietmar Maurer
2021-05-10  7:22 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] cleanup src/api2/node/config.rs Dietmar Maurer

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