type: String,
description: "Backup group.",
},
+ "ns": {
+ type: BackupNamespace,
+ optional: true,
+ },
"new-owner": {
type: Authid,
},
/// Change owner of a backup group
async fn change_backup_owner(group: String, mut param: Value) -> Result<(), Error> {
let repo = extract_repository_from_value(¶m)?;
+ let ns = optional_ns_param(¶m)?;
let client = connect(&repo)?;
let group: BackupGroup = group.parse()?;
merge_group_into(param.as_object_mut().unwrap(), group);
+ if !ns.is_root() {
+ param["ns"] = serde_json::to_value(ns)?;
+ }
let path = format!("api2/json/admin/datastore/{}/change-owner", repo.store());
client.post(&path, Some(param)).await?;
let client = connect_rate_limited(&repo, rate_limit)?;
record_repository(&repo);
- let ns = match param.get("ns") {
- Some(Value::String(ns)) => ns.parse()?,
- Some(_) => bail!("invalid namespace parameter"),
- None => BackupNamespace::root(),
- };
+ let ns = optional_ns_param(¶m)?;
let path = json::required_string_param(¶m, "snapshot")?;
let backup_dir = dir_or_last_from_group(&client, &repo, &ns, &path).await?;
type: String,
description: "Backup group",
},
+ ns: {
+ type: BackupNamespace,
+ optional: true,
+ },
"prune-options": {
type: PruneOptions,
flatten: true,
mut param: Value,
) -> Result<Value, Error> {
let repo = extract_repository_from_value(¶m)?;
+ let ns = optional_ns_param(¶m)?;
let client = connect(&repo)?;
api_param["dry-run"] = dry_run.into();
}
merge_group_into(api_param.as_object_mut().unwrap(), group);
+ if !ns.is_root() {
+ api_param["ns"] = serde_json::to_value(ns)?;
+ }
let mut result = client.post(&path, Some(api_param)).await?;