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

55 lines
1.5 KiB
Rust
Raw Normal View History

2018-12-20 09:32:49 +00:00
extern crate proxmox_backup;
2019-12-02 10:56:29 +00:00
use proxmox::api::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()
.insert("list", CliCommand::new(&api2::config::datastore::GET))
.insert("create",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::config::datastore::POST)
.arg_param(&["name", "path"])
)
.insert("remove",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::config::datastore::DELETE)
.arg_param(&["name"])
2019-01-04 09:49:52 +00:00
.completion_cb("name", config::datastore::complete_datastore_name)
);
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(&["store"])
.completion_cb("store", config::datastore::complete_datastore_name)
)
.insert("start",
2019-11-21 08:36:41 +00:00
CliCommand::new(&api2::admin::datastore::API_METHOD_START_GARBAGE_COLLECTION)
.arg_param(&["store"])
.completion_cb("store", config::datastore::complete_datastore_name)
);
cmd_def.into()
}
fn main() {
let cmd_def = CliCommandMap::new()
.insert("datastore", datastore_commands())
.insert("garbage-collection", garbage_collection_commands());
run_cli_command(cmd_def);
}