parameter name cleanups (use '-' instead of '_')

This commit is contained in:
Dietmar Maurer 2019-03-02 16:34:10 +01:00
parent ad20d19877
commit 49dc074007
3 changed files with 11 additions and 11 deletions

View File

@ -308,9 +308,9 @@ fn get_backup_list(
for info in datastore.list_backups()? {
list.push(json!({
"backup_type": info.backup_dir.group.backup_type,
"backup_id": info.backup_dir.group.backup_id,
"backup_time": info.backup_dir.backup_time.timestamp(),
"backup-type": info.backup_dir.group.backup_type,
"backup-id": info.backup_dir.group.backup_id,
"backup-time": info.backup_dir.backup_time.timestamp(),
"files": info.files,
}));
}

View File

@ -55,7 +55,7 @@ fn upload_catar(
) -> Result<BoxFut, Error> {
let store = tools::required_string_param(&param, "store")?;
let mut archive_name = String::from(tools::required_string_param(&param, "archive_name")?);
let mut archive_name = String::from(tools::required_string_param(&param, "archive-name")?);
if !archive_name.ends_with(".catar") {
bail!("got wront file extension (expected '.catar')");
@ -108,7 +108,7 @@ pub fn api_method_upload_catar() -> ApiAsyncMethod {
upload_catar,
ObjectSchema::new("Upload .catar backup file.")
.required("store", StringSchema::new("Datastore name."))
.required("archive_name", StringSchema::new("Backup archive name."))
.required("archive-name", StringSchema::new("Backup archive name."))
.required("type", StringSchema::new("Backup type.")
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
.required("id", StringSchema::new("Backup ID."))
@ -133,7 +133,7 @@ fn download_catar(
) -> Result<BoxFut, Error> {
let store = tools::required_string_param(&param, "store")?;
let archive_name = tools::required_string_param(&param, "archive_name")?;
let archive_name = tools::required_string_param(&param, "archive-name")?;
let backup_type = tools::required_string_param(&param, "type")?;
let backup_id = tools::required_string_param(&param, "id")?;
@ -177,7 +177,7 @@ pub fn api_method_download_catar() -> ApiAsyncMethod {
download_catar,
ObjectSchema::new("Download .catar backup file.")
.required("store", StringSchema::new("Datastore name."))
.required("archive_name", StringSchema::new("Backup archive name."))
.required("archive-name", StringSchema::new("Backup archive name."))
.required("type", StringSchema::new("Backup type.")
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
.required("id", StringSchema::new("Backup ID."))

View File

@ -40,7 +40,7 @@ fn backup_directory<P: AsRef<Path>>(
let mut query = url::form_urlencoded::Serializer::new(String::new());
query
.append_pair("archive_name", archive_name)
.append_pair("archive-name", archive_name)
.append_pair("type", "host")
.append_pair("id", &tools::nodename())
.append_pair("time", &backup_time.timestamp().to_string());
@ -108,9 +108,9 @@ fn list_backups(
for item in list {
let id = item["backup_id"].as_str().unwrap();
let btype = item["backup_type"].as_str().unwrap();
let epoch = item["backup_time"].as_i64().unwrap();
let id = item["backup-id"].as_str().unwrap();
let btype = item["backup-type"].as_str().unwrap();
let epoch = item["backup-time"].as_i64().unwrap();
let backup_time = Local.timestamp(epoch, 0);
let backup_dir = BackupDir {