src/bin/proxmox-backup-client.rs: use new json_object_to_query
This commit is contained in:
parent
f5f13ebc5a
commit
421c9ba1d9
@ -37,19 +37,18 @@ fn backup_directory<P: AsRef<Path>>(
|
|||||||
chunk_size: Option<u64>,
|
chunk_size: Option<u64>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
|
||||||
let mut query = url::form_urlencoded::Serializer::new(String::new());
|
let mut param = json!({
|
||||||
|
"archive-name": archive_name,
|
||||||
query
|
"type": "host",
|
||||||
.append_pair("archive-name", archive_name)
|
"id": &tools::nodename(),
|
||||||
.append_pair("type", "host")
|
"time": backup_time.timestamp(),
|
||||||
.append_pair("id", &tools::nodename())
|
});
|
||||||
.append_pair("time", &backup_time.timestamp().to_string());
|
|
||||||
|
|
||||||
if let Some(size) = chunk_size {
|
if let Some(size) = chunk_size {
|
||||||
query.append_pair("chunk-size", &size.to_string());
|
param["chunk-size"] = size.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
let query = query.finish();
|
let query = tools::json_object_to_query(param)?;
|
||||||
|
|
||||||
let path = format!("api2/json/admin/datastore/{}/catar?{}", repo.store, query);
|
let path = format!("api2/json/admin/datastore/{}/catar?{}", repo.store, query);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user