client: switch to PruneJobsOptions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-05-24 11:18:06 +02:00
parent dba37e212b
commit 434dd3cc84
1 changed files with 3 additions and 11 deletions

View File

@ -24,7 +24,7 @@ use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation};
use pbs_api_types::{ use pbs_api_types::{
Authid, BackupDir, BackupGroup, BackupNamespace, BackupPart, BackupType, CryptMode, Authid, BackupDir, BackupGroup, BackupNamespace, BackupPart, BackupType, CryptMode,
Fingerprint, GroupListItem, HumanByte, PruneListItem, PruneOptions, RateLimitConfig, Fingerprint, GroupListItem, HumanByte, PruneJobOptions, PruneListItem, RateLimitConfig,
SnapshotListItem, StorageStatus, BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, SnapshotListItem, StorageStatus, BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA,
BACKUP_TYPE_SCHEMA, TRAFFIC_CONTROL_BURST_SCHEMA, TRAFFIC_CONTROL_RATE_SCHEMA, BACKUP_TYPE_SCHEMA, TRAFFIC_CONTROL_BURST_SCHEMA, TRAFFIC_CONTROL_RATE_SCHEMA,
}; };
@ -1417,12 +1417,8 @@ async fn restore(param: Value) -> Result<Value, Error> {
type: String, type: String,
description: "Backup group", description: "Backup group",
}, },
ns: {
type: BackupNamespace,
optional: true,
},
"prune-options": { "prune-options": {
type: PruneOptions, type: PruneJobOptions,
flatten: true, flatten: true,
}, },
"output-format": { "output-format": {
@ -1446,12 +1442,11 @@ async fn restore(param: Value) -> Result<Value, Error> {
async fn prune( async fn prune(
dry_run: Option<bool>, dry_run: Option<bool>,
group: String, group: String,
prune_options: PruneOptions, prune_options: PruneJobOptions,
quiet: bool, quiet: bool,
mut param: Value, mut param: Value,
) -> Result<Value, Error> { ) -> Result<Value, Error> {
let repo = extract_repository_from_value(&param)?; let repo = extract_repository_from_value(&param)?;
let ns = optional_ns_param(&param)?;
let client = connect(&repo)?; let client = connect(&repo)?;
@ -1466,9 +1461,6 @@ async fn prune(
api_param["dry-run"] = dry_run.into(); api_param["dry-run"] = dry_run.into();
} }
merge_group_into(api_param.as_object_mut().unwrap(), group); 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?; let mut result = client.post(&path, Some(api_param)).await?;