parameter name cleanups (use '-' instead of '_')
This commit is contained in:
parent
ad20d19877
commit
49dc074007
|
@ -308,9 +308,9 @@ fn get_backup_list(
|
||||||
|
|
||||||
for info in datastore.list_backups()? {
|
for info in datastore.list_backups()? {
|
||||||
list.push(json!({
|
list.push(json!({
|
||||||
"backup_type": info.backup_dir.group.backup_type,
|
"backup-type": info.backup_dir.group.backup_type,
|
||||||
"backup_id": info.backup_dir.group.backup_id,
|
"backup-id": info.backup_dir.group.backup_id,
|
||||||
"backup_time": info.backup_dir.backup_time.timestamp(),
|
"backup-time": info.backup_dir.backup_time.timestamp(),
|
||||||
"files": info.files,
|
"files": info.files,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ fn upload_catar(
|
||||||
) -> Result<BoxFut, Error> {
|
) -> Result<BoxFut, Error> {
|
||||||
|
|
||||||
let store = tools::required_string_param(¶m, "store")?;
|
let store = tools::required_string_param(¶m, "store")?;
|
||||||
let mut archive_name = String::from(tools::required_string_param(¶m, "archive_name")?);
|
let mut archive_name = String::from(tools::required_string_param(¶m, "archive-name")?);
|
||||||
|
|
||||||
if !archive_name.ends_with(".catar") {
|
if !archive_name.ends_with(".catar") {
|
||||||
bail!("got wront file extension (expected '.catar')");
|
bail!("got wront file extension (expected '.catar')");
|
||||||
|
@ -108,7 +108,7 @@ pub fn api_method_upload_catar() -> ApiAsyncMethod {
|
||||||
upload_catar,
|
upload_catar,
|
||||||
ObjectSchema::new("Upload .catar backup file.")
|
ObjectSchema::new("Upload .catar backup file.")
|
||||||
.required("store", StringSchema::new("Datastore name."))
|
.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.")
|
.required("type", StringSchema::new("Backup type.")
|
||||||
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
|
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
|
||||||
.required("id", StringSchema::new("Backup ID."))
|
.required("id", StringSchema::new("Backup ID."))
|
||||||
|
@ -133,7 +133,7 @@ fn download_catar(
|
||||||
) -> Result<BoxFut, Error> {
|
) -> Result<BoxFut, Error> {
|
||||||
|
|
||||||
let store = tools::required_string_param(¶m, "store")?;
|
let store = tools::required_string_param(¶m, "store")?;
|
||||||
let archive_name = tools::required_string_param(¶m, "archive_name")?;
|
let archive_name = tools::required_string_param(¶m, "archive-name")?;
|
||||||
|
|
||||||
let backup_type = tools::required_string_param(¶m, "type")?;
|
let backup_type = tools::required_string_param(¶m, "type")?;
|
||||||
let backup_id = tools::required_string_param(¶m, "id")?;
|
let backup_id = tools::required_string_param(¶m, "id")?;
|
||||||
|
@ -177,7 +177,7 @@ pub fn api_method_download_catar() -> ApiAsyncMethod {
|
||||||
download_catar,
|
download_catar,
|
||||||
ObjectSchema::new("Download .catar backup file.")
|
ObjectSchema::new("Download .catar backup file.")
|
||||||
.required("store", StringSchema::new("Datastore name."))
|
.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.")
|
.required("type", StringSchema::new("Backup type.")
|
||||||
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
|
.format(Arc::new(ApiStringFormat::Enum(vec!["ct".into(), "host".into()]))))
|
||||||
.required("id", StringSchema::new("Backup ID."))
|
.required("id", StringSchema::new("Backup ID."))
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn backup_directory<P: AsRef<Path>>(
|
||||||
let mut query = url::form_urlencoded::Serializer::new(String::new());
|
let mut query = url::form_urlencoded::Serializer::new(String::new());
|
||||||
|
|
||||||
query
|
query
|
||||||
.append_pair("archive_name", archive_name)
|
.append_pair("archive-name", archive_name)
|
||||||
.append_pair("type", "host")
|
.append_pair("type", "host")
|
||||||
.append_pair("id", &tools::nodename())
|
.append_pair("id", &tools::nodename())
|
||||||
.append_pair("time", &backup_time.timestamp().to_string());
|
.append_pair("time", &backup_time.timestamp().to_string());
|
||||||
|
@ -108,9 +108,9 @@ fn list_backups(
|
||||||
|
|
||||||
for item in list {
|
for item in list {
|
||||||
|
|
||||||
let id = item["backup_id"].as_str().unwrap();
|
let id = item["backup-id"].as_str().unwrap();
|
||||||
let btype = item["backup_type"].as_str().unwrap();
|
let btype = item["backup-type"].as_str().unwrap();
|
||||||
let epoch = item["backup_time"].as_i64().unwrap();
|
let epoch = item["backup-time"].as_i64().unwrap();
|
||||||
let backup_time = Local.timestamp(epoch, 0);
|
let backup_time = Local.timestamp(epoch, 0);
|
||||||
|
|
||||||
let backup_dir = BackupDir {
|
let backup_dir = BackupDir {
|
||||||
|
|
Loading…
Reference in New Issue