]> git.proxmox.com Git - proxmox-backup.git/blob - src/bin/backup-client.rs
bin/backup-client.rs: nbew tool to play with chunk store
[proxmox-backup.git] / src / bin / backup-client.rs
1 extern crate apitest;
2
3 use failure::*;
4
5 use std::collections::HashMap;
6
7 use apitest::cli::command::*;
8 use apitest::api::schema::*;
9 use apitest::api::router::*;
10 use apitest::backup::chunk_store::*;
11 use serde_json::{json, Value};
12 use std::path::{Path, PathBuf};
13
14 use apitest::config::datastore;
15
16 fn backup_file(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
17
18 println!("Backup file '{}'", param["filename"].as_str().unwrap());
19
20 Ok(Value::Null)
21 }
22
23
24 fn main() {
25
26 let cmd_def = CliCommand::new(
27 ApiMethod::new(
28 backup_file,
29 ObjectSchema::new("Create backup from file.")
30 .required("filename", StringSchema::new("Source file name."))
31 .required("store", StringSchema::new("Datastore name."))
32 ))
33 .arg_param(vec!["filename"]);
34
35 if let Err(err) = run_cli_command(&cmd_def.into()) {
36 eprintln!("Error: {}", err);
37 print_cli_usage();
38 std::process::exit(-1);
39 }
40
41 }