diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs index 7e596a1b..7cbd8805 100644 --- a/src/bin/proxmox_backup_manager/datastore.rs +++ b/src/bin/proxmox_backup_manager/datastore.rs @@ -5,6 +5,11 @@ use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler}; use proxmox_backup::config; use proxmox_backup::api2::{self, types::* }; +use proxmox_backup::client::{ + connect_to_localhost, + view_task_result, +}; +use proxmox_backup::config::datastore::DIR_NAME_SCHEMA; #[api( input: { @@ -67,6 +72,81 @@ fn show_datastore(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result Result { + + let output_format = extract_output_format(&mut param); + + let mut client = connect_to_localhost()?; + + let result = client.post(&"api2/json/config/datastore", Some(param)).await?; + + view_task_result(&mut client, result, &output_format).await?; + + Ok(Value::Null) +} + pub fn datastore_commands() -> CommandLineInterface { let cmd_def = CliCommandMap::new() @@ -77,7 +157,7 @@ pub fn datastore_commands() -> CommandLineInterface { .completion_cb("name", config::datastore::complete_datastore_name) ) .insert("create", - CliCommand::new(&api2::config::datastore::API_METHOD_CREATE_DATASTORE) + CliCommand::new(&API_METHOD_CREATE_DATASTORE) .arg_param(&["name", "path"]) ) .insert("update",