]> git.proxmox.com Git - proxmox-backup.git/blame - src/bin/backup-client.rs
bin/backup-client.rs: nbew tool to play with chunk store
[proxmox-backup.git] / src / bin / backup-client.rs
CommitLineData
ff5d3707 1extern crate apitest;
2
3use failure::*;
4
5use std::collections::HashMap;
6
7use apitest::cli::command::*;
8use apitest::api::schema::*;
9use apitest::api::router::*;
10use apitest::backup::chunk_store::*;
11use serde_json::{json, Value};
12use std::path::{Path, PathBuf};
13
14use apitest::config::datastore;
15
16fn 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
24fn 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}