bin/backup-client.rs: nbew tool to play with chunk store

This commit is contained in:
root 2018-12-14 08:28:56 +01:00
parent 15b64d4606
commit ff5d37074d
1 changed files with 41 additions and 0 deletions

41
src/bin/backup-client.rs Normal file
View File

@ -0,0 +1,41 @@
extern crate apitest;
use failure::*;
use std::collections::HashMap;
use apitest::cli::command::*;
use apitest::api::schema::*;
use apitest::api::router::*;
use apitest::backup::chunk_store::*;
use serde_json::{json, Value};
use std::path::{Path, PathBuf};
use apitest::config::datastore;
fn backup_file(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
println!("Backup file '{}'", param["filename"].as_str().unwrap());
Ok(Value::Null)
}
fn main() {
let cmd_def = CliCommand::new(
ApiMethod::new(
backup_file,
ObjectSchema::new("Create backup from file.")
.required("filename", StringSchema::new("Source file name."))
.required("store", StringSchema::new("Datastore name."))
))
.arg_param(vec!["filename"]);
if let Err(err) = run_cli_command(&cmd_def.into()) {
eprintln!("Error: {}", err);
print_cli_usage();
std::process::exit(-1);
}
}