public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH proxmox-backup 1/2] cleanup src/api2/node/config.rs
Date: Mon, 10 May 2021 09:22:44 +0200	[thread overview]
Message-ID: <6b10ac2b-4ba9-d1b9-43d7-d8579ef94a2a@proxmox.com> (raw)
In-Reply-To: <20210510063914.7527-1-dietmar@proxmox.com>

applied

On 5/10/21 8:39 AM, Dietmar Maurer wrote:
> - 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>,




      parent reply	other threads:[~2021-05-10  7:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  6:39 [pbs-devel] " 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 ` Dietmar Maurer [this message]

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=6b10ac2b-4ba9-d1b9-43d7-d8579ef94a2a@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pbs-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal