]>
Commit | Line | Data |
---|---|---|
fe0e04c6 | 1 | extern crate proxmox_backup; |
ea0b8b6e | 2 | |
576e3bf2 | 3 | //use proxmox_backup::api2; |
4de0e142 | 4 | use proxmox_backup::cli::*; |
211fabd7 | 5 | |
9f6ab1fc | 6 | fn datastore_commands() -> CommandLineInterface { |
ea0b8b6e | 7 | |
07b4694a | 8 | use proxmox_backup::config; |
576e3bf2 | 9 | use proxmox_backup::api2; |
bf7f1039 | 10 | |
6460764d | 11 | let cmd_def = CliCommandMap::new() |
576e3bf2 | 12 | .insert("list", CliCommand::new(api2::config::datastore::get()).into()) |
6460764d | 13 | .insert("create", |
576e3bf2 | 14 | CliCommand::new(api2::config::datastore::post()) |
6460764d DM |
15 | .arg_param(vec!["name", "path"]) |
16 | .into()) | |
17 | .insert("remove", | |
576e3bf2 | 18 | CliCommand::new(api2::config::datastore::delete()) |
6460764d | 19 | .arg_param(vec!["name"]) |
07b4694a | 20 | .completion_cb("name", config::datastore::complete_datastore_name) |
6460764d | 21 | .into()); |
211fabd7 | 22 | |
8f62336b | 23 | cmd_def.into() |
211fabd7 DM |
24 | } |
25 | ||
691c89a0 DM |
26 | |
27 | ||
28 | fn garbage_collection_commands() -> CommandLineInterface { | |
29 | ||
30 | use proxmox_backup::config; | |
576e3bf2 | 31 | use proxmox_backup::api2; |
691c89a0 DM |
32 | |
33 | let cmd_def = CliCommandMap::new() | |
34 | .insert("status", | |
576e3bf2 | 35 | CliCommand::new(api2::admin::datastore::api_method_garbage_collection_status()) |
9ac1045c WB |
36 | .arg_param(vec!["store"]) |
37 | .completion_cb("store", config::datastore::complete_datastore_name) | |
691c89a0 DM |
38 | .into()) |
39 | .insert("start", | |
576e3bf2 | 40 | CliCommand::new(api2::admin::datastore::api_method_start_garbage_collection()) |
9ac1045c WB |
41 | .arg_param(vec!["store"]) |
42 | .completion_cb("store", config::datastore::complete_datastore_name) | |
691c89a0 DM |
43 | .into()); |
44 | ||
45 | cmd_def.into() | |
46 | } | |
47 | ||
211fabd7 DM |
48 | fn main() { |
49 | ||
6460764d | 50 | let cmd_def = CliCommandMap::new() |
691c89a0 DM |
51 | .insert("datastore".to_owned(), datastore_commands()) |
52 | .insert("garbage-collection".to_owned(), garbage_collection_commands()); | |
34d3ba52 | 53 | |
698d9d44 | 54 | run_cli_command(cmd_def.into()); |
ea0b8b6e | 55 | } |