]> git.proxmox.com Git - proxmox-backup.git/blob - src/bin/proxmox_backup_manager/node.rs
4210996057e1eb7724b03c3a45ccdbdd67f64cd3
[proxmox-backup.git] / src / bin / proxmox_backup_manager / node.rs
1 use proxmox::api::{api, cli::*, ApiHandler, RpcEnvironment};
2 use anyhow::Error;
3 use serde_json::Value;
4
5 use proxmox_backup::api2;
6
7 #[api(
8 input: {
9 properties: {
10 "output-format": {
11 schema: OUTPUT_FORMAT,
12 optional: true,
13 },
14 }
15 }
16 )]
17 /// Show node configuration
18 fn get_node_config(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
19
20 let output_format = get_output_format(&param);
21
22 let info = &api2::node::config::API_METHOD_GET_NODE_CONFIG;
23 let mut data = match info.handler {
24 ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
25 _ => unreachable!(),
26 };
27
28 let options = default_table_format_options();
29 format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
30
31 Ok(Value::Null)
32 }
33
34 pub fn node_commands() -> CommandLineInterface {
35 let cmd_def = CliCommandMap::new()
36 .insert(
37 "show",
38 CliCommand::new(&API_METHOD_GET_NODE_CONFIG),
39 )
40 .insert(
41 "update",
42 CliCommand::new(&api2::node::config::API_METHOD_UPDATE_NODE_CONFIG)
43 .fixed_param("node", String::from("localhost"))
44 );
45
46 cmd_def.into()
47 }