]> git.proxmox.com Git - proxmox-backup.git/blob - src/bin/proxmox-backup-manager.rs
src/bin/proxmox-backup-client.rs: impl restore
[proxmox-backup.git] / src / bin / proxmox-backup-manager.rs
1 extern crate proxmox_backup;
2
3 //use proxmox_backup::api2;
4 use proxmox_backup::cli::*;
5
6 fn datastore_commands() -> CommandLineInterface {
7
8 use proxmox_backup::config;
9 use proxmox_backup::api2;
10
11 let cmd_def = CliCommandMap::new()
12 .insert("list", CliCommand::new(api2::config::datastore::get()).into())
13 .insert("create",
14 CliCommand::new(api2::config::datastore::post())
15 .arg_param(vec!["name", "path"])
16 .into())
17 .insert("remove",
18 CliCommand::new(api2::config::datastore::delete())
19 .arg_param(vec!["name"])
20 .completion_cb("name", config::datastore::complete_datastore_name)
21 .into());
22
23 cmd_def.into()
24 }
25
26
27
28 fn garbage_collection_commands() -> CommandLineInterface {
29
30 use proxmox_backup::config;
31 use proxmox_backup::api2;
32
33 let cmd_def = CliCommandMap::new()
34 .insert("status",
35 CliCommand::new(api2::admin::datastore::api_method_garbage_collection_status())
36 .arg_param(vec!["store"])
37 .completion_cb("store", config::datastore::complete_datastore_name)
38 .into())
39 .insert("start",
40 CliCommand::new(api2::admin::datastore::api_method_start_garbage_collection())
41 .arg_param(vec!["store"])
42 .completion_cb("store", config::datastore::complete_datastore_name)
43 .into());
44
45 cmd_def.into()
46 }
47
48 fn main() {
49
50 let cmd_def = CliCommandMap::new()
51 .insert("datastore".to_owned(), datastore_commands())
52 .insert("garbage-collection".to_owned(), garbage_collection_commands());
53
54 run_cli_command(cmd_def.into());
55 }