proxmox-backup/src/bin/proxmox-backup-manager.rs

56 lines
1.7 KiB
Rust
Raw Normal View History

2018-12-20 09:32:49 +00:00
extern crate proxmox_backup;
//use proxmox_backup::api2;
2019-02-21 08:07:25 +00:00
use proxmox_backup::cli::*;
2018-12-10 12:40:10 +00:00
fn datastore_commands() -> CommandLineInterface {
2019-01-04 09:49:52 +00:00
use proxmox_backup::config;
use proxmox_backup::api2;
let cmd_def = CliCommandMap::new()
2019-11-21 08:36:41 +00:00
.insert("list", CliCommand::new(&api2::config::datastore::GET).into())
.insert("create",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::config::datastore::POST)
.arg_param(vec!["name", "path"])
.into())
.insert("remove",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::config::datastore::DELETE)
.arg_param(vec!["name"])
2019-01-04 09:49:52 +00:00
.completion_cb("name", config::datastore::complete_datastore_name)
.into());
2018-12-10 12:51:10 +00:00
cmd_def.into()
}
fn garbage_collection_commands() -> CommandLineInterface {
use proxmox_backup::config;
use proxmox_backup::api2;
let cmd_def = CliCommandMap::new()
.insert("status",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::admin::datastore::API_METHOD_GARBAGE_COLLECTION_STATUS)
.arg_param(vec!["store"])
.completion_cb("store", config::datastore::complete_datastore_name)
.into())
.insert("start",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::admin::datastore::API_METHOD_START_GARBAGE_COLLECTION)
.arg_param(vec!["store"])
.completion_cb("store", config::datastore::complete_datastore_name)
.into());
cmd_def.into()
}
fn main() {
let cmd_def = CliCommandMap::new()
.insert("datastore".to_owned(), datastore_commands())
.insert("garbage-collection".to_owned(), garbage_collection_commands());
2019-02-23 14:10:48 +00:00
run_cli_command(cmd_def.into());
}