use anyhow::Error;
use serde_json::{json, Value};
-use proxmox_sys::fs::CreateOptions;
use proxmox_router::{cli::*, RpcEnvironment};
use proxmox_schema::api;
+use proxmox_sys::fs::CreateOptions;
-use pbs_client::{display_task_log, view_task_result};
-use pbs_config::sync;
-use pbs_tools::json::required_string_param;
use pbs_api_types::percent_encoding::percent_encode_component;
use pbs_api_types::{
- GroupFilter, SyncJobConfig,
- DATASTORE_SCHEMA, GROUP_FILTER_LIST_SCHEMA, IGNORE_VERIFIED_BACKUPS_SCHEMA, REMOTE_ID_SCHEMA,
- REMOVE_VANISHED_BACKUPS_SCHEMA, UPID_SCHEMA, VERIFICATION_OUTDATED_AFTER_SCHEMA,
+ GroupFilter, SyncJobConfig, DATASTORE_SCHEMA, GROUP_FILTER_LIST_SCHEMA,
+ IGNORE_VERIFIED_BACKUPS_SCHEMA, REMOTE_ID_SCHEMA, REMOVE_VANISHED_BACKUPS_SCHEMA, UPID_SCHEMA,
+ VERIFICATION_OUTDATED_AFTER_SCHEMA,
};
+use pbs_client::{display_task_log, view_task_result};
+use pbs_config::sync;
+use pbs_tools::json::required_string_param;
use proxmox_rest_server::wait_for_local_worker;
)]
/// Start garbage collection for a specific datastore.
async fn start_garbage_collection(param: Value) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let store = required_string_param(¶m, "store")?;
)]
/// Show garbage collection status for a specific datastore.
async fn garbage_collection_status(param: Value) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let store = required_string_param(¶m, "store")?;
}
fn garbage_collection_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
- .insert("status",
- CliCommand::new(&API_METHOD_GARBAGE_COLLECTION_STATUS)
+ .insert(
+ "status",
+ CliCommand::new(&API_METHOD_GARBAGE_COLLECTION_STATUS)
.arg_param(&["store"])
- .completion_cb("store", pbs_config::datastore::complete_datastore_name)
+ .completion_cb("store", pbs_config::datastore::complete_datastore_name),
)
- .insert("start",
- CliCommand::new(&API_METHOD_START_GARBAGE_COLLECTION)
+ .insert(
+ "start",
+ CliCommand::new(&API_METHOD_START_GARBAGE_COLLECTION)
.arg_param(&["store"])
- .completion_cb("store", pbs_config::datastore::complete_datastore_name)
+ .completion_cb("store", pbs_config::datastore::complete_datastore_name),
);
cmd_def.into()
)]
/// List running server tasks.
async fn task_list(param: Value) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let client = connect_to_localhost()?;
"start": 0,
"limit": limit,
});
- let mut result = client.get("api2/json/nodes/localhost/tasks", Some(args)).await?;
+ let mut result = client
+ .get("api2/json/nodes/localhost/tasks", Some(args))
+ .await?;
let mut data = result["data"].take();
let return_type = &api2::node::tasks::API_METHOD_LIST_TASKS.returns;
use pbs_tools::format::{render_epoch, render_task_status};
let options = default_table_format_options()
- .column(ColumnConfig::new("starttime").right_align(false).renderer(render_epoch))
- .column(ColumnConfig::new("endtime").right_align(false).renderer(render_epoch))
+ .column(
+ ColumnConfig::new("starttime")
+ .right_align(false)
+ .renderer(render_epoch),
+ )
+ .column(
+ ColumnConfig::new("endtime")
+ .right_align(false)
+ .renderer(render_epoch),
+ )
.column(ColumnConfig::new("upid"))
.column(ColumnConfig::new("status").renderer(render_task_status));
)]
/// Display the task log.
async fn task_log(param: Value) -> Result<Value, Error> {
-
let upid = required_string_param(¶m, "upid")?;
let client = connect_to_localhost()?;
)]
/// Try to stop a specific task.
async fn task_stop(param: Value) -> Result<Value, Error> {
-
let upid_str = required_string_param(¶m, "upid")?;
let client = connect_to_localhost()?;
- let path = format!("api2/json/nodes/localhost/tasks/{}", percent_encode_component(upid_str));
+ let path = format!(
+ "api2/json/nodes/localhost/tasks/{}",
+ percent_encode_component(upid_str)
+ );
let _ = client.delete(&path, None).await?;
Ok(Value::Null)
}
fn task_mgmt_cli() -> CommandLineInterface {
+ let task_log_cmd_def = CliCommand::new(&API_METHOD_TASK_LOG).arg_param(&["upid"]);
- let task_log_cmd_def = CliCommand::new(&API_METHOD_TASK_LOG)
- .arg_param(&["upid"]);
-
- let task_stop_cmd_def = CliCommand::new(&API_METHOD_TASK_STOP)
- .arg_param(&["upid"]);
+ let task_stop_cmd_def = CliCommand::new(&API_METHOD_TASK_STOP).arg_param(&["upid"]);
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_TASK_LIST))
group_filter: Option<Vec<GroupFilter>>,
param: Value,
) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let client = connect_to_localhost()?;
}
)]
/// Verify backups
-async fn verify(
- store: String,
- mut param: Value,
-) -> Result<Value, Error> {
-
+async fn verify(store: String, mut param: Value) -> Result<Value, Error> {
let output_format = extract_output_format(&mut param);
let client = connect_to_localhost()?;
let output_format = get_output_format(¶m);
let packages = crate::api2::node::apt::get_versions()?;
- let mut packages = json!(if verbose { &packages[..] } else { &packages[1..2] });
+ let mut packages = json!(if verbose {
+ &packages[..]
+ } else {
+ &packages[1..2]
+ });
let options = default_table_format_options()
.disable_sort()
.noborder(true) // just not helpful for version info which gets copy pasted often
.column(ColumnConfig::new("Package"))
.column(ColumnConfig::new("Version"))
- .column(ColumnConfig::new("ExtraInfo").header("Extra Info"))
- ;
+ .column(ColumnConfig::new("ExtraInfo").header("Extra Info"));
let return_type = &crate::api2::node::apt::API_METHOD_GET_VERSIONS.returns;
format_and_print_result_full(&mut packages, return_type, &output_format, &options);
}
async fn run() -> Result<(), Error> {
-
let cmd_def = CliCommandMap::new()
.insert("acl", acl_commands())
.insert("datastore", datastore_commands())
"pull",
CliCommand::new(&API_METHOD_PULL_DATASTORE)
.arg_param(&["remote", "remote-store", "local-store"])
- .completion_cb("local-store", pbs_config::datastore::complete_datastore_name)
+ .completion_cb(
+ "local-store",
+ pbs_config::datastore::complete_datastore_name,
+ )
.completion_cb("remote", pbs_config::remote::complete_remote_name)
.completion_cb("remote-store", complete_remote_datastore_name)
- .completion_cb("group_filter", complete_remote_datastore_group_filter)
+ .completion_cb("group_filter", complete_remote_datastore_group_filter),
)
.insert(
"verify",
CliCommand::new(&API_METHOD_VERIFY)
.arg_param(&["store"])
- .completion_cb("store", pbs_config::datastore::complete_datastore_name)
+ .completion_cb("store", pbs_config::datastore::complete_datastore_name),
)
- .insert("report",
- CliCommand::new(&API_METHOD_REPORT)
- )
- .insert("versions",
- CliCommand::new(&API_METHOD_GET_VERSIONS)
- );
+ .insert("report", CliCommand::new(&API_METHOD_REPORT))
+ .insert("versions", CliCommand::new(&API_METHOD_GET_VERSIONS));
let args: Vec<String> = std::env::args().take(2).collect();
let avoid_init = args.len() >= 2 && (args[1] == "bashcomplete" || args[1] == "printdoc");
if !avoid_init {
let backup_user = pbs_config::backup_user()?;
- let file_opts = CreateOptions::new().owner(backup_user.uid).group(backup_user.gid);
- proxmox_rest_server::init_worker_tasks(pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(), file_opts)?;
-
- let mut commando_sock = proxmox_rest_server::CommandSocket::new(proxmox_rest_server::our_ctrl_sock(), backup_user.gid);
+ let file_opts = CreateOptions::new()
+ .owner(backup_user.uid)
+ .group(backup_user.gid);
+ proxmox_rest_server::init_worker_tasks(
+ pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR_M!().into(),
+ file_opts,
+ )?;
+
+ let mut commando_sock = proxmox_rest_server::CommandSocket::new(
+ proxmox_rest_server::our_ctrl_sock(),
+ backup_user.gid,
+ );
proxmox_rest_server::register_task_control_commands(&mut commando_sock)?;
commando_sock.spawn()?;
}
}
fn main() -> Result<(), Error> {
-
proxmox_backup::tools::setup_safe_path_env();
proxmox_async::runtime::main(run())
}
fn get_remote(param: &HashMap<String, String>) -> Option<String> {
- param
- .get("remote")
- .map(|r| r.to_owned())
- .or_else(|| {
- if let Some(id) = param.get("id") {
- if let Ok(job) = get_sync_job(id) {
- return Some(job.remote);
- }
+ param.get("remote").map(|r| r.to_owned()).or_else(|| {
+ if let Some(id) = param.get("id") {
+ if let Ok(job) = get_sync_job(id) {
+ return Some(job.remote);
}
- None
- })
+ }
+ None
+ })
}
fn get_remote_store(param: &HashMap<String, String>) -> Option<(String, String)> {
let mut job: Option<SyncJobConfig> = None;
- let remote = param
- .get("remote")
- .map(|r| r.to_owned())
- .or_else(|| {
- if let Some(id) = param.get("id") {
- job = get_sync_job(id).ok();
- if let Some(ref job) = job {
- return Some(job.remote.clone());
- }
+ let remote = param.get("remote").map(|r| r.to_owned()).or_else(|| {
+ if let Some(id) = param.get("id") {
+ job = get_sync_job(id).ok();
+ if let Some(ref job) = job {
+ return Some(job.remote.clone());
}
- None
- });
+ }
+ None
+ });
if let Some(remote) = remote {
let store = param
.or_else(|| job.map(|job| job.remote_store));
if let Some(store) = store {
- return Some((remote, store))
+ return Some((remote, store));
}
}
// shell completion helper
pub fn complete_remote_datastore_name(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
-
let mut list = Vec::new();
if let Some(remote) = get_remote(param) {
if let Ok(data) = proxmox_async::runtime::block_on(async move {
- crate::api2::config::remote::scan_remote_datastores(remote).await
- }) {
-
+ crate::api2::config::remote::scan_remote_datastores(remote).await
+ }) {
for item in data {
list.push(item.store);
}
// shell completion helper
pub fn complete_remote_datastore_group(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
-
let mut list = Vec::new();
if let Some((remote, remote_store)) = get_remote_store(param) {
if let Ok(data) = proxmox_async::runtime::block_on(async move {
- crate::api2::config::remote::scan_remote_groups(remote.clone(), remote_store.clone()).await
+ crate::api2::config::remote::scan_remote_groups(remote.clone(), remote_store.clone())
+ .await
}) {
-
for item in data {
list.push(format!("{}/{}", item.backup_type, item.backup_id));
}
}
// shell completion helper
-pub fn complete_remote_datastore_group_filter(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
-
+pub fn complete_remote_datastore_group_filter(
+ _arg: &str,
+ param: &HashMap<String, String>,
+) -> Vec<String> {
let mut list = Vec::new();
list.push("regex:".to_string());
list.push("type:host".to_string());
list.push("type:vm".to_string());
- list.extend(complete_remote_datastore_group(_arg, param).iter().map(|group| format!("group:{}", group)));
+ list.extend(
+ complete_remote_datastore_group(_arg, param)
+ .iter()
+ .map(|group| format!("group:{}", group)),
+ );
list
}
)]
/// Access Control list.
fn list_acls(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::access::acl::API_METHOD_READ_ACL;
};
fn render_ugid(value: &Value, record: &Value) -> Result<String, Error> {
- if value.is_null() { return Ok(String::new()); }
+ if value.is_null() {
+ return Ok(String::new());
+ }
let ugid = value.as_str().unwrap();
let ugid_type = record["ugid_type"].as_str().unwrap();
}
pub fn acl_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_ACLS))
.insert(
CliCommand::new(&api2::access::acl::API_METHOD_UPDATE_ACL)
.arg_param(&["path", "role"])
.completion_cb("auth-id", pbs_config::user::complete_authid)
- .completion_cb("path", pbs_config::datastore::complete_acl_path)
-
+ .completion_cb("path", pbs_config::datastore::complete_acl_path),
);
cmd_def.into()
use anyhow::{bail, Error};
use serde_json::Value;
-use proxmox_sys::fs::file_get_contents;
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
+use proxmox_sys::fs::file_get_contents;
use proxmox_backup::acme::AcmeClient;
use proxmox_backup::api2;
use proxmox_router::cli::*;
use proxmox_schema::api;
-use proxmox_backup::config;
use proxmox_backup::auth_helpers::*;
+use proxmox_backup::config;
#[api]
/// Display node certificate information.
fn cert_info() -> Result<(), Error> {
-
let cert = proxmox_backup::cert_info()?;
println!("Subject: {}", cert.subject_name()?);
println!("Fingerprint (sha256): {}", cert.fingerprint()?);
let pubkey = cert.public_key()?;
- println!("Public key type: {}", openssl::nid::Nid::from_raw(pubkey.id().as_raw()).long_name()?);
+ println!(
+ "Public key type: {}",
+ openssl::nid::Nid::from_raw(pubkey.id().as_raw()).long_name()?
+ );
println!("Public key bits: {}", pubkey.bits());
Ok(())
)]
/// Update node certificates and generate all needed files/directories.
fn update_certs(force: Option<bool>) -> Result<(), Error> {
-
config::create_configdir()?;
if let Err(err) = generate_auth_key() {
}
pub fn cert_mgmt_cli() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("info", CliCommand::new(&API_METHOD_CERT_INFO))
.insert("update", CliCommand::new(&API_METHOD_UPDATE_CERTS));
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
-use pbs_client::view_task_result;
use pbs_api_types::{DataStoreConfig, DATASTORE_SCHEMA};
+use pbs_client::view_task_result;
use proxmox_backup::api2;
use proxmox_backup::client_helpers::connect_to_localhost;
)]
/// Datastore list.
fn list_datastores(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::datastore::API_METHOD_LIST_DATASTORES;
)]
/// Show datastore configuration
fn show_datastore(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::datastore::API_METHOD_READ_DATASTORE;
)]
/// Create new datastore config.
async fn create_datastore(mut param: Value) -> Result<Value, Error> {
-
let output_format = extract_output_format(&mut param);
let client = connect_to_localhost()?;
- let result = client.post("api2/json/config/datastore", Some(param)).await?;
+ let result = client
+ .post("api2/json/config/datastore", Some(param))
+ .await?;
view_task_result(&client, result, &output_format).await?;
}
pub fn datastore_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_DATASTORES))
- .insert("show",
- CliCommand::new(&API_METHOD_SHOW_DATASTORE)
+ .insert(
+ "show",
+ CliCommand::new(&API_METHOD_SHOW_DATASTORE)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::datastore::complete_datastore_name)
+ .completion_cb("name", pbs_config::datastore::complete_datastore_name),
)
- .insert("create",
- CliCommand::new(&API_METHOD_CREATE_DATASTORE)
- .arg_param(&["name", "path"])
+ .insert(
+ "create",
+ CliCommand::new(&API_METHOD_CREATE_DATASTORE).arg_param(&["name", "path"]),
)
- .insert("update",
- CliCommand::new(&api2::config::datastore::API_METHOD_UPDATE_DATASTORE)
+ .insert(
+ "update",
+ CliCommand::new(&api2::config::datastore::API_METHOD_UPDATE_DATASTORE)
.arg_param(&["name"])
.completion_cb("name", pbs_config::datastore::complete_datastore_name)
- .completion_cb("gc-schedule", pbs_config::datastore::complete_calendar_event)
- .completion_cb("prune-schedule", pbs_config::datastore::complete_calendar_event)
+ .completion_cb(
+ "gc-schedule",
+ pbs_config::datastore::complete_calendar_event,
+ )
+ .completion_cb(
+ "prune-schedule",
+ pbs_config::datastore::complete_calendar_event,
+ ),
)
- .insert("remove",
- CliCommand::new(&api2::config::datastore::API_METHOD_DELETE_DATASTORE)
+ .insert(
+ "remove",
+ CliCommand::new(&api2::config::datastore::API_METHOD_DELETE_DATASTORE)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::datastore::complete_datastore_name)
+ .completion_cb("name", pbs_config::datastore::complete_datastore_name),
);
cmd_def.into()
use proxmox_schema::api;
use pbs_api_types::{
- DISK_LIST_SCHEMA, ZFS_ASHIFT_SCHEMA, ZfsRaidLevel, ZfsCompressionType,
- BLOCKDEVICE_NAME_SCHEMA, DATASTORE_SCHEMA,
-};
-use proxmox_backup::tools::disks::{
- FileSystemType,
- SmartAttribute,
- complete_disk_name,
+ ZfsCompressionType, ZfsRaidLevel, BLOCKDEVICE_NAME_SCHEMA, DATASTORE_SCHEMA, DISK_LIST_SCHEMA,
+ ZFS_ASHIFT_SCHEMA,
};
+use proxmox_backup::tools::disks::{complete_disk_name, FileSystemType, SmartAttribute};
use proxmox_backup::api2;
)]
/// Local disk list.
fn list_disks(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
param["node"] = "localhost".into();
let render_wearout = |value: &Value, _record: &Value| -> Result<String, Error> {
match value.as_f64() {
- Some(value) => Ok(format!("{:.2} %", if value <= 100.0 { 100.0 - value } else { 0.0 })),
+ Some(value) => Ok(format!(
+ "{:.2} %",
+ if value <= 100.0 { 100.0 - value } else { 0.0 }
+ )),
None => Ok(String::from("-")),
}
};
.column(ColumnConfig::new("size"))
.column(ColumnConfig::new("model"))
.column(ColumnConfig::new("wearout").renderer(render_wearout))
- .column(ColumnConfig::new("status"))
- ;
+ .column(ColumnConfig::new("status"));
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
)]
/// Show SMART attributes.
fn smart_attributes(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
param["node"] = "localhost".into();
let mut data = data["attributes"].take();
let options = default_table_format_options();
- format_and_print_result_full(&mut data, &API_METHOD_SMART_ATTRIBUTES.returns, &output_format, &options);
+ format_and_print_result_full(
+ &mut data,
+ &API_METHOD_SMART_ATTRIBUTES.returns,
+ &output_format,
+ &options,
+ );
Ok(Value::Null)
}
mut param: Value,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
-
param["node"] = "localhost".into();
let info = &api2::node::disks::API_METHOD_INITIALIZE_DISK;
},
)]
/// create a zfs pool
-async fn create_zpool(
- mut param: Value,
- rpcenv: &mut dyn RpcEnvironment,
-) -> Result<Value, Error> {
-
+async fn create_zpool(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
param["node"] = "localhost".into();
let info = &api2::node::disks::zfs::API_METHOD_CREATE_ZPOOL;
)]
/// Local zfs pools.
fn list_zpools(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
param["node"] = "localhost".into();
if size == 0 {
bail!("got zero size");
}
- Ok(format!("{:.2} %", (value as f64)/(size as f64)))
+ Ok(format!("{:.2} %", (value as f64) / (size as f64)))
};
let options = default_table_format_options()
.column(ColumnConfig::new("name"))
.column(ColumnConfig::new("size"))
- .column(ColumnConfig::new("alloc").right_align(true).renderer(render_usage))
+ .column(
+ ColumnConfig::new("alloc")
+ .right_align(true)
+ .renderer(render_usage),
+ )
.column(ColumnConfig::new("health"));
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
}
pub fn zpool_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_ZPOOLS))
- .insert("create",
- CliCommand::new(&API_METHOD_CREATE_ZPOOL)
+ .insert(
+ "create",
+ CliCommand::new(&API_METHOD_CREATE_ZPOOL)
.arg_param(&["name"])
- .completion_cb("devices", complete_disk_name) // fixme: complete the list
+ .completion_cb("devices", complete_disk_name), // fixme: complete the list
);
cmd_def.into()
}
)]
/// List systemd datastore mount units.
-fn list_datastore_mounts(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
+fn list_datastore_mounts(
+ mut param: Value,
+ rpcenv: &mut dyn RpcEnvironment,
+) -> Result<Value, Error> {
let output_format = get_output_format(¶m);
param["node"] = "localhost".into();
mut param: Value,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
-
param["node"] = "localhost".into();
let info = &api2::node::disks::directory::API_METHOD_CREATE_DATASTORE_DISK;
}
pub fn filesystem_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_DATASTORE_MOUNTS))
- .insert("create",
- CliCommand::new(&API_METHOD_CREATE_DATASTORE_DISK)
+ .insert(
+ "create",
+ CliCommand::new(&API_METHOD_CREATE_DATASTORE_DISK)
.arg_param(&["name"])
- .completion_cb("disk", complete_disk_name)
+ .completion_cb("disk", complete_disk_name),
);
cmd_def.into()
}
pub fn disk_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_DISKS))
- .insert("smart-attributes",
- CliCommand::new(&API_METHOD_SMART_ATTRIBUTES)
+ .insert(
+ "smart-attributes",
+ CliCommand::new(&API_METHOD_SMART_ATTRIBUTES)
.arg_param(&["disk"])
- .completion_cb("disk", complete_disk_name)
+ .completion_cb("disk", complete_disk_name),
)
.insert("fs", filesystem_commands())
.insert("zpool", zpool_commands())
- .insert("initialize",
- CliCommand::new(&API_METHOD_INITIALIZE_DISK)
+ .insert(
+ "initialize",
+ CliCommand::new(&API_METHOD_INITIALIZE_DISK)
.arg_param(&["disk"])
- .completion_cb("disk", complete_disk_name)
+ .completion_cb("disk", complete_disk_name),
);
cmd_def.into()
)]
/// Read DNS settings
fn get_dns(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
param["node"] = "localhost".into();
_ => unreachable!(),
};
-
let options = default_table_format_options()
.column(ColumnConfig::new("search"))
.column(ColumnConfig::new("dns1"))
}
pub fn dns_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
- .insert(
- "get",
- CliCommand::new(&API_METHOD_GET_DNS)
- )
+ .insert("get", CliCommand::new(&API_METHOD_GET_DNS))
.insert(
"set",
CliCommand::new(&api2::node::dns::API_METHOD_UPDATE_DNS)
- .fixed_param("node", String::from("localhost"))
+ .fixed_param("node", String::from("localhost")),
);
cmd_def.into()
)]
/// Network device list.
fn list_network_devices(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
param["node"] = "localhost".into();
text.push_str(cidr);
}
if let Some(cidr) = record["cidr6"].as_str() {
- if !text.is_empty() { text.push('\n'); }
+ if !text.is_empty() {
+ text.push('\n');
+ }
text.push_str(cidr);
}
text.push_str(gateway);
}
if let Some(gateway) = record["gateway6"].as_str() {
- if !text.is_empty() { text.push('\n'); }
+ if !text.is_empty() {
+ text.push('\n');
+ }
text.push_str(gateway);
}
.column(ColumnConfig::new("autostart"))
.column(ColumnConfig::new("method"))
.column(ColumnConfig::new("method6"))
- .column(ColumnConfig::new("cidr").header("address").renderer(render_address))
- .column(ColumnConfig::new("gateway").header("gateway").renderer(render_gateway))
- .column(ColumnConfig::new("bridge_ports").header("ports/slaves").renderer(render_ports));
+ .column(
+ ColumnConfig::new("cidr")
+ .header("address")
+ .renderer(render_address),
+ )
+ .column(
+ ColumnConfig::new("gateway")
+ .header("gateway")
+ .renderer(render_gateway),
+ )
+ .column(
+ ColumnConfig::new("bridge_ports")
+ .header("ports/slaves")
+ .renderer(render_ports),
+ );
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
#[api()]
/// Show pending configuration changes (diff)
-fn pending_network_changes(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
+fn pending_network_changes(
+ mut param: Value,
+ rpcenv: &mut dyn RpcEnvironment,
+) -> Result<Value, Error> {
param["node"] = "localhost".into();
let info = &api2::node::network::API_METHOD_LIST_NETWORK_DEVICES;
}
pub fn network_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
- .insert(
- "list",
- CliCommand::new(&API_METHOD_LIST_NETWORK_DEVICES)
- )
+ .insert("list", CliCommand::new(&API_METHOD_LIST_NETWORK_DEVICES))
.insert(
"changes",
- CliCommand::new(&API_METHOD_PENDING_NETWORK_CHANGES)
+ CliCommand::new(&API_METHOD_PENDING_NETWORK_CHANGES),
)
.insert(
"create",
.arg_param(&["iface"])
.completion_cb("iface", pbs_config::network::complete_interface_name)
.completion_cb("bridge_ports", pbs_config::network::complete_port_list)
- .completion_cb("slaves", pbs_config::network::complete_port_list)
+ .completion_cb("slaves", pbs_config::network::complete_port_list),
)
.insert(
"update",
.arg_param(&["iface"])
.completion_cb("iface", pbs_config::network::complete_interface_name)
.completion_cb("bridge_ports", pbs_config::network::complete_port_list)
- .completion_cb("slaves", pbs_config::network::complete_port_list)
+ .completion_cb("slaves", pbs_config::network::complete_port_list),
)
.insert(
"remove",
CliCommand::new(&api2::node::network::API_METHOD_DELETE_INTERFACE)
.fixed_param("node", String::from("localhost"))
.arg_param(&["iface"])
- .completion_cb("iface", pbs_config::network::complete_interface_name)
+ .completion_cb("iface", pbs_config::network::complete_interface_name),
)
.insert(
"revert",
CliCommand::new(&api2::node::network::API_METHOD_REVERT_NETWORK_CONFIG)
- .fixed_param("node", String::from("localhost"))
+ .fixed_param("node", String::from("localhost")),
)
.insert(
"reload",
CliCommand::new(&api2::node::network::API_METHOD_RELOAD_NETWORK_CONFIG)
- .fixed_param("node", String::from("localhost"))
+ .fixed_param("node", String::from("localhost")),
);
cmd_def.into()
)]
/// Show node configuration
fn get_node_config(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::node::config::API_METHOD_GET_NODE_CONFIG;
pub fn node_commands() -> CommandLineInterface {
let cmd_def = CliCommandMap::new()
- .insert(
- "show",
- CliCommand::new(&API_METHOD_GET_NODE_CONFIG),
- )
+ .insert("show", CliCommand::new(&API_METHOD_GET_NODE_CONFIG))
.insert(
"update",
CliCommand::new(&api2::node::config::API_METHOD_UPDATE_NODE_CONFIG)
- .fixed_param("node", String::from("localhost"))
+ .fixed_param("node", String::from("localhost")),
);
cmd_def.into()
use proxmox_backup::api2;
-
#[api(
input: {
properties: {
)]
/// List configured OpenId realms
fn list_openid_realms(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::access::openid::API_METHOD_LIST_OPENID_REALMS;
/// Show OpenID realm configuration
fn show_openid_realm(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::access::openid::API_METHOD_READ_OPENID_REALM;
}
pub fn openid_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_OPENID_REALMS))
- .insert("show", CliCommand::new(&API_METHOD_SHOW_OPENID_REALM)
+ .insert(
+ "show",
+ CliCommand::new(&API_METHOD_SHOW_OPENID_REALM)
.arg_param(&["realm"])
- .completion_cb("realm", pbs_config::domains::complete_openid_realm_name)
+ .completion_cb("realm", pbs_config::domains::complete_openid_realm_name),
)
- .insert("create",
- CliCommand::new(&api2::config::access::openid::API_METHOD_CREATE_OPENID_REALM)
+ .insert(
+ "create",
+ CliCommand::new(&api2::config::access::openid::API_METHOD_CREATE_OPENID_REALM)
.arg_param(&["realm"])
.arg_param(&["realm"])
- .completion_cb("realm", pbs_config::domains::complete_openid_realm_name)
+ .completion_cb("realm", pbs_config::domains::complete_openid_realm_name),
)
- .insert("update",
- CliCommand::new(&api2::config::access::openid::API_METHOD_UPDATE_OPENID_REALM)
+ .insert(
+ "update",
+ CliCommand::new(&api2::config::access::openid::API_METHOD_UPDATE_OPENID_REALM)
.arg_param(&["realm"])
.arg_param(&["realm"])
- .completion_cb("realm", pbs_config::domains::complete_openid_realm_name)
+ .completion_cb("realm", pbs_config::domains::complete_openid_realm_name),
)
- .insert("delete",
- CliCommand::new(&api2::config::access::openid::API_METHOD_DELETE_OPENID_REALM)
+ .insert(
+ "delete",
+ CliCommand::new(&api2::config::access::openid::API_METHOD_DELETE_OPENID_REALM)
.arg_param(&["realm"])
.arg_param(&["realm"])
- .completion_cb("realm", pbs_config::domains::complete_openid_realm_name)
- )
- ;
+ .completion_cb("realm", pbs_config::domains::complete_openid_realm_name),
+ );
- cmd_def.into()
+ cmd_def.into()
}
use proxmox_backup::api2;
-
#[api(
input: {
properties: {
)]
/// List configured remotes.
fn list_remotes(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::remote::API_METHOD_LIST_REMOTES;
)]
/// Show remote configuration
fn show_remote(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::remote::API_METHOD_READ_REMOTE;
}
pub fn remote_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_REMOTES))
.insert(
"show",
CliCommand::new(&API_METHOD_SHOW_REMOTE)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::remote::complete_remote_name)
+ .completion_cb("name", pbs_config::remote::complete_remote_name),
)
.insert(
"create",
// fixme: howto handle password parameter?
- CliCommand::new(&api2::config::remote::API_METHOD_CREATE_REMOTE)
- .arg_param(&["name"])
+ CliCommand::new(&api2::config::remote::API_METHOD_CREATE_REMOTE).arg_param(&["name"]),
)
.insert(
"update",
CliCommand::new(&api2::config::remote::API_METHOD_UPDATE_REMOTE)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::remote::complete_remote_name)
+ .completion_cb("name", pbs_config::remote::complete_remote_name),
)
.insert(
"remove",
CliCommand::new(&api2::config::remote::API_METHOD_DELETE_REMOTE)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::remote::complete_remote_name)
+ .completion_cb("name", pbs_config::remote::complete_remote_name),
);
cmd_def.into()
)]
/// Read subscription info.
fn get(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::node::subscription::API_METHOD_GET_SUBSCRIPTION;
}
pub fn subscription_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("get", CliCommand::new(&API_METHOD_GET))
- .insert("set",
+ .insert(
+ "set",
CliCommand::new(&api2::node::subscription::API_METHOD_SET_SUBSCRIPTION)
.fixed_param("node", "localhost".into())
- .arg_param(&["key"])
+ .arg_param(&["key"]),
)
- .insert("update",
+ .insert(
+ "update",
CliCommand::new(&api2::node::subscription::API_METHOD_CHECK_SUBSCRIPTION)
- .fixed_param("node", "localhost".into())
+ .fixed_param("node", "localhost".into()),
)
- .insert("remove",
+ .insert(
+ "remove",
CliCommand::new(&api2::node::subscription::API_METHOD_DELETE_SUBSCRIPTION)
- .fixed_param("node", "localhost".into())
- )
- ;
+ .fixed_param("node", "localhost".into()),
+ );
cmd_def.into()
}
fn render_group_filter(value: &Value, _record: &Value) -> Result<String, Error> {
if let Some(group_filters) = value.as_array() {
- let group_filters:Vec<&str> = group_filters
- .iter()
- .filter_map(Value::as_str)
- .collect();
+ let group_filters: Vec<&str> = group_filters.iter().filter_map(Value::as_str).collect();
Ok(group_filters.join(" OR "))
} else {
Ok(String::from("all"))
)]
/// Sync job list.
fn list_sync_jobs(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::sync::API_METHOD_LIST_SYNC_JOBS;
)]
/// Show sync job configuration
fn show_sync_job(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::sync::API_METHOD_READ_SYNC_JOB;
}
pub fn sync_job_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_SYNC_JOBS))
- .insert("show",
- CliCommand::new(&API_METHOD_SHOW_SYNC_JOB)
+ .insert(
+ "show",
+ CliCommand::new(&API_METHOD_SHOW_SYNC_JOB)
.arg_param(&["id"])
- .completion_cb("id", pbs_config::sync::complete_sync_job_id)
+ .completion_cb("id", pbs_config::sync::complete_sync_job_id),
)
- .insert("create",
- CliCommand::new(&api2::config::sync::API_METHOD_CREATE_SYNC_JOB)
+ .insert(
+ "create",
+ CliCommand::new(&api2::config::sync::API_METHOD_CREATE_SYNC_JOB)
.arg_param(&["id"])
.completion_cb("id", pbs_config::sync::complete_sync_job_id)
.completion_cb("schedule", pbs_config::datastore::complete_calendar_event)
.completion_cb("store", pbs_config::datastore::complete_datastore_name)
.completion_cb("remote", pbs_config::remote::complete_remote_name)
.completion_cb("remote-store", crate::complete_remote_datastore_name)
- .completion_cb("groups", crate::complete_remote_datastore_group_filter)
+ .completion_cb("groups", crate::complete_remote_datastore_group_filter),
)
- .insert("update",
- CliCommand::new(&api2::config::sync::API_METHOD_UPDATE_SYNC_JOB)
+ .insert(
+ "update",
+ CliCommand::new(&api2::config::sync::API_METHOD_UPDATE_SYNC_JOB)
.arg_param(&["id"])
.completion_cb("id", pbs_config::sync::complete_sync_job_id)
.completion_cb("schedule", pbs_config::datastore::complete_calendar_event)
.completion_cb("store", pbs_config::datastore::complete_datastore_name)
.completion_cb("remote-store", crate::complete_remote_datastore_name)
- .completion_cb("groups", crate::complete_remote_datastore_group_filter)
+ .completion_cb("groups", crate::complete_remote_datastore_group_filter),
)
- .insert("remove",
- CliCommand::new(&api2::config::sync::API_METHOD_DELETE_SYNC_JOB)
+ .insert(
+ "remove",
+ CliCommand::new(&api2::config::sync::API_METHOD_DELETE_SYNC_JOB)
.arg_param(&["id"])
- .completion_cb("id", pbs_config::sync::complete_sync_job_id)
+ .completion_cb("id", pbs_config::sync::complete_sync_job_id),
);
cmd_def.into()
use proxmox_backup::api2;
use proxmox_backup::client_helpers::connect_to_localhost;
-
#[api(
input: {
properties: {
)]
/// List configured traffic control rules.
fn list_traffic_controls(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::traffic_control::API_METHOD_LIST_TRAFFIC_CONTROLS;
)]
/// Show traffic control configuration
fn show_traffic_control(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::traffic_control::API_METHOD_READ_TRAFFIC_CONTROL;
)]
/// Show current traffic for all rules.
async fn show_current_traffic(param: Value) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let client = connect_to_localhost()?;
}
pub fn traffic_control_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_TRAFFIC_CONTROLS))
.insert("traffic", CliCommand::new(&API_METHOD_SHOW_CURRENT_TRAFFIC))
"show",
CliCommand::new(&API_METHOD_SHOW_TRAFFIC_CONTROL)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::traffic_control::complete_traffic_control_name)
+ .completion_cb(
+ "name",
+ pbs_config::traffic_control::complete_traffic_control_name,
+ ),
)
.insert(
"create",
CliCommand::new(&api2::config::traffic_control::API_METHOD_CREATE_TRAFFIC_CONTROL)
- .arg_param(&["name"])
+ .arg_param(&["name"]),
)
.insert(
"update",
CliCommand::new(&api2::config::traffic_control::API_METHOD_UPDATE_TRAFFIC_CONTROL)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::traffic_control::complete_traffic_control_name)
+ .completion_cb(
+ "name",
+ pbs_config::traffic_control::complete_traffic_control_name,
+ ),
)
.insert(
"remove",
CliCommand::new(&api2::config::traffic_control::API_METHOD_DELETE_TRAFFIC_CONTROL)
.arg_param(&["name"])
- .completion_cb("name", pbs_config::traffic_control::complete_traffic_control_name)
+ .completion_cb(
+ "name",
+ pbs_config::traffic_control::complete_traffic_control_name,
+ ),
);
cmd_def.into()
use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
use proxmox_schema::api;
-use pbs_api_types::{ACL_PATH_SCHEMA, Authid, Userid};
+use pbs_api_types::{Authid, Userid, ACL_PATH_SCHEMA};
use proxmox_backup::api2;
fn render_expire(value: &Value, _record: &Value) -> Result<String, Error> {
let never = String::from("never");
- if value.is_null() { return Ok(never); }
+ if value.is_null() {
+ return Ok(never);
+ }
let text = match value.as_i64() {
Some(epoch) if epoch == 0 => never,
Some(epoch) => {
} else {
epoch.to_string()
}
- },
+ }
None => value.to_string(),
};
Ok(text)
)]
/// List configured users.
fn list_users(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::access::user::API_METHOD_LIST_USERS;
let options = default_table_format_options()
.column(ColumnConfig::new("userid"))
.column(
- ColumnConfig::new("enable")
- .renderer(pbs_tools::format::render_bool_with_default_true)
- )
- .column(
- ColumnConfig::new("expire")
- .renderer(render_expire)
+ ColumnConfig::new("enable").renderer(pbs_tools::format::render_bool_with_default_true),
)
+ .column(ColumnConfig::new("expire").renderer(render_expire))
.column(ColumnConfig::new("firstname"))
.column(ColumnConfig::new("lastname"))
.column(ColumnConfig::new("email"))
)]
/// List tokens associated with user.
fn list_tokens(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::access::user::API_METHOD_LIST_TOKENS;
let options = default_table_format_options()
.column(ColumnConfig::new("tokenid"))
.column(
- ColumnConfig::new("enable")
- .renderer(pbs_tools::format::render_bool_with_default_true)
- )
- .column(
- ColumnConfig::new("expire")
- .renderer(render_expire)
+ ColumnConfig::new("enable").renderer(pbs_tools::format::render_bool_with_default_true),
)
+ .column(ColumnConfig::new("expire").renderer(render_expire))
.column(ColumnConfig::new("comment"));
format_and_print_result_full(&mut data, &info.returns, &output_format, &options);
Ok(Value::Null)
}
-
#[api(
input: {
properties: {
)]
/// List permissions of user/token.
fn list_permissions(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::access::API_METHOD_LIST_PERMISSIONS;
if output_format == "text" {
println!("Privileges with (*) have the propagate flag set\n");
- let data:HashMap<String, HashMap<String, bool>> = serde_json::from_value(data)?;
- let mut paths:Vec<String> = data.keys().cloned().collect();
+ let data: HashMap<String, HashMap<String, bool>> = serde_json::from_value(data)?;
+ let mut paths: Vec<String> = data.keys().cloned().collect();
paths.sort_unstable();
for path in paths {
println!("Path: {}", path);
let priv_map = data.get(&path).unwrap();
- let mut privs:Vec<String> = priv_map.keys().cloned().collect();
+ let mut privs: Vec<String> = priv_map.keys().cloned().collect();
if privs.is_empty() {
println!("- NoAccess");
} else {
Ok(Value::Null)
}
-
pub fn user_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_USERS))
.insert(
"create",
// fixme: howto handle password parameter?
- CliCommand::new(&api2::access::user::API_METHOD_CREATE_USER)
- .arg_param(&["userid"])
+ CliCommand::new(&api2::access::user::API_METHOD_CREATE_USER).arg_param(&["userid"]),
)
.insert(
"update",
CliCommand::new(&api2::access::user::API_METHOD_UPDATE_USER)
.arg_param(&["userid"])
- .completion_cb("userid", pbs_config::user::complete_userid)
+ .completion_cb("userid", pbs_config::user::complete_userid),
)
.insert(
"remove",
CliCommand::new(&api2::access::user::API_METHOD_DELETE_USER)
.arg_param(&["userid"])
- .completion_cb("userid", pbs_config::user::complete_userid)
+ .completion_cb("userid", pbs_config::user::complete_userid),
)
.insert(
"list-tokens",
CliCommand::new(&API_METHOD_LIST_TOKENS)
.arg_param(&["userid"])
- .completion_cb("userid", pbs_config::user::complete_userid)
+ .completion_cb("userid", pbs_config::user::complete_userid),
)
.insert(
"generate-token",
CliCommand::new(&api2::access::user::API_METHOD_GENERATE_TOKEN)
.arg_param(&["userid", "token-name"])
- .completion_cb("userid", pbs_config::user::complete_userid)
+ .completion_cb("userid", pbs_config::user::complete_userid),
)
.insert(
"delete-token",
CliCommand::new(&api2::access::user::API_METHOD_DELETE_TOKEN)
.arg_param(&["userid", "token-name"])
.completion_cb("userid", pbs_config::user::complete_userid)
- .completion_cb("token-name", pbs_config::user::complete_token_name)
+ .completion_cb("token-name", pbs_config::user::complete_token_name),
)
.insert(
"permissions",
CliCommand::new(&API_METHOD_LIST_PERMISSIONS)
.arg_param(&["auth-id"])
.completion_cb("auth-id", pbs_config::user::complete_authid)
- .completion_cb("path", pbs_config::datastore::complete_acl_path)
+ .completion_cb("path", pbs_config::datastore::complete_acl_path),
);
cmd_def.into()
)]
/// List all verification jobs
fn list_verification_jobs(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::verify::API_METHOD_LIST_VERIFICATION_JOBS;
)]
/// Show verification job configuration
fn show_verification_job(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
-
let output_format = get_output_format(¶m);
let info = &api2::config::verify::API_METHOD_READ_VERIFICATION_JOB;
}
pub fn verify_job_commands() -> CommandLineInterface {
-
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_VERIFICATION_JOBS))
- .insert("show",
- CliCommand::new(&API_METHOD_SHOW_VERIFICATION_JOB)
+ .insert(
+ "show",
+ CliCommand::new(&API_METHOD_SHOW_VERIFICATION_JOB)
.arg_param(&["id"])
- .completion_cb("id", pbs_config::verify::complete_verification_job_id)
+ .completion_cb("id", pbs_config::verify::complete_verification_job_id),
)
- .insert("create",
- CliCommand::new(&api2::config::verify::API_METHOD_CREATE_VERIFICATION_JOB)
+ .insert(
+ "create",
+ CliCommand::new(&api2::config::verify::API_METHOD_CREATE_VERIFICATION_JOB)
.arg_param(&["id"])
.completion_cb("id", pbs_config::verify::complete_verification_job_id)
.completion_cb("schedule", pbs_config::datastore::complete_calendar_event)
- .completion_cb("store", pbs_config::datastore::complete_datastore_name)
+ .completion_cb("store", pbs_config::datastore::complete_datastore_name),
)
- .insert("update",
- CliCommand::new(&api2::config::verify::API_METHOD_UPDATE_VERIFICATION_JOB)
+ .insert(
+ "update",
+ CliCommand::new(&api2::config::verify::API_METHOD_UPDATE_VERIFICATION_JOB)
.arg_param(&["id"])
.completion_cb("id", pbs_config::verify::complete_verification_job_id)
.completion_cb("schedule", pbs_config::datastore::complete_calendar_event)
.completion_cb("store", pbs_config::datastore::complete_datastore_name)
- .completion_cb("remote-store", crate::complete_remote_datastore_name)
+ .completion_cb("remote-store", crate::complete_remote_datastore_name),
)
- .insert("remove",
- CliCommand::new(&api2::config::verify::API_METHOD_DELETE_VERIFICATION_JOB)
+ .insert(
+ "remove",
+ CliCommand::new(&api2::config::verify::API_METHOD_DELETE_VERIFICATION_JOB)
.arg_param(&["id"])
- .completion_cb("id", pbs_config::verify::complete_verification_job_id)
+ .completion_cb("id", pbs_config::verify::complete_verification_job_id),
);
cmd_def.into()