api: add remaining missing backup-ns parameters
these are the ones for non-#[api] methods, also fill in the namespace in prune operations Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
4c7cc5b39e
commit
33f2c2a1bf
@ -35,8 +35,8 @@ use pbs_api_types::{
|
|||||||
Authid, BackupContent, BackupNamespace, BackupType, Counts, CryptMode, DataStoreListItem,
|
Authid, BackupContent, BackupNamespace, BackupType, Counts, CryptMode, DataStoreListItem,
|
||||||
DataStoreStatus, GarbageCollectionStatus, GroupListItem, Operation, PruneOptions, RRDMode,
|
DataStoreStatus, GarbageCollectionStatus, GroupListItem, Operation, PruneOptions, RRDMode,
|
||||||
RRDTimeFrame, SnapshotListItem, SnapshotVerifyState, BACKUP_ARCHIVE_NAME_SCHEMA,
|
RRDTimeFrame, SnapshotListItem, SnapshotVerifyState, BACKUP_ARCHIVE_NAME_SCHEMA,
|
||||||
BACKUP_ID_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, DATASTORE_SCHEMA,
|
BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA,
|
||||||
IGNORE_VERIFIED_BACKUPS_SCHEMA, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP,
|
DATASTORE_SCHEMA, IGNORE_VERIFIED_BACKUPS_SCHEMA, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP,
|
||||||
PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, PRIV_DATASTORE_READ, PRIV_DATASTORE_VERIFY,
|
PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, PRIV_DATASTORE_READ, PRIV_DATASTORE_VERIFY,
|
||||||
UPID_SCHEMA, VERIFICATION_OUTDATED_AFTER_SCHEMA,
|
UPID_SCHEMA, VERIFICATION_OUTDATED_AFTER_SCHEMA,
|
||||||
};
|
};
|
||||||
@ -835,13 +835,18 @@ pub fn prune(
|
|||||||
for (info, mark) in prune_info {
|
for (info, mark) in prune_info {
|
||||||
let keep = keep_all || mark.keep();
|
let keep = keep_all || mark.keep();
|
||||||
|
|
||||||
prune_result.push(json!({
|
let mut result = json!({
|
||||||
"backup-type": info.backup_dir.backup_type(),
|
"backup-type": info.backup_dir.backup_type(),
|
||||||
"backup-id": info.backup_dir.backup_id(),
|
"backup-id": info.backup_dir.backup_id(),
|
||||||
"backup-time": info.backup_dir.backup_time(),
|
"backup-time": info.backup_dir.backup_time(),
|
||||||
"keep": keep,
|
"keep": keep,
|
||||||
"protected": mark.protected(),
|
"protected": mark.protected(),
|
||||||
}));
|
});
|
||||||
|
let ns = info.backup_dir.backup_ns();
|
||||||
|
if !ns.is_root() {
|
||||||
|
result["backup-ns"] = serde_json::to_value(ns)?;
|
||||||
|
}
|
||||||
|
prune_result.push(result);
|
||||||
}
|
}
|
||||||
return Ok(json!(prune_result));
|
return Ok(json!(prune_result));
|
||||||
}
|
}
|
||||||
@ -876,13 +881,17 @@ pub fn prune(
|
|||||||
|
|
||||||
task_log!(worker, "{}", msg);
|
task_log!(worker, "{}", msg);
|
||||||
|
|
||||||
prune_result.push(json!({
|
let mut result = json!({
|
||||||
"backup-type": group.ty,
|
"backup-type": group.ty,
|
||||||
"backup-id": group.id,
|
"backup-id": group.id,
|
||||||
"backup-time": backup_time,
|
"backup-time": backup_time,
|
||||||
"keep": keep,
|
"keep": keep,
|
||||||
"protected": mark.protected(),
|
"protected": mark.protected(),
|
||||||
}));
|
});
|
||||||
|
if !group.ns.is_root() {
|
||||||
|
result["backup-ns"] = serde_json::to_value(&group.ns)?;
|
||||||
|
}
|
||||||
|
prune_result.push(result);
|
||||||
|
|
||||||
if !(dry_run || keep) {
|
if !(dry_run || keep) {
|
||||||
if let Err(err) = datastore.remove_backup_dir(info.backup_dir.as_ref(), false) {
|
if let Err(err) = datastore.remove_backup_dir(info.backup_dir.as_ref(), false) {
|
||||||
@ -1075,6 +1084,7 @@ pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
|||||||
"Download single raw file from backup snapshot.",
|
"Download single raw file from backup snapshot.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
("store", false, &DATASTORE_SCHEMA),
|
||||||
|
("backup-ns", true, &BACKUP_NAMESPACE_SCHEMA),
|
||||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||||
@ -1154,6 +1164,7 @@ pub const API_METHOD_DOWNLOAD_FILE_DECODED: ApiMethod = ApiMethod::new(
|
|||||||
"Download single decoded file from backup snapshot. Only works if it's not encrypted.",
|
"Download single decoded file from backup snapshot. Only works if it's not encrypted.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
("store", false, &DATASTORE_SCHEMA),
|
||||||
|
("backup-ns", true, &BACKUP_NAMESPACE_SCHEMA),
|
||||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||||
@ -1283,6 +1294,7 @@ pub const API_METHOD_UPLOAD_BACKUP_LOG: ApiMethod = ApiMethod::new(
|
|||||||
"Upload the client backup log file into a backup snapshot ('client.log.blob').",
|
"Upload the client backup log file into a backup snapshot ('client.log.blob').",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
("store", false, &DATASTORE_SCHEMA),
|
||||||
|
("backup-ns", true, &BACKUP_NAMESPACE_SCHEMA),
|
||||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||||
@ -1420,6 +1432,7 @@ pub const API_METHOD_PXAR_FILE_DOWNLOAD: ApiMethod = ApiMethod::new(
|
|||||||
"Download single file from pxar file of a backup snapshot. Only works if it's not encrypted.",
|
"Download single file from pxar file of a backup snapshot. Only works if it's not encrypted.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
("store", false, &DATASTORE_SCHEMA),
|
||||||
|
("backup-ns", true, &BACKUP_NAMESPACE_SCHEMA),
|
||||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||||
|
@ -18,8 +18,8 @@ use proxmox_sys::sortable;
|
|||||||
|
|
||||||
use pbs_api_types::{
|
use pbs_api_types::{
|
||||||
Authid, BackupType, Operation, SnapshotVerifyState, VerifyState, BACKUP_ARCHIVE_NAME_SCHEMA,
|
Authid, BackupType, Operation, SnapshotVerifyState, VerifyState, BACKUP_ARCHIVE_NAME_SCHEMA,
|
||||||
BACKUP_ID_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, CHUNK_DIGEST_SCHEMA,
|
BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA,
|
||||||
DATASTORE_SCHEMA, PRIV_DATASTORE_BACKUP,
|
CHUNK_DIGEST_SCHEMA, DATASTORE_SCHEMA, PRIV_DATASTORE_BACKUP,
|
||||||
};
|
};
|
||||||
use pbs_config::CachedUserInfo;
|
use pbs_config::CachedUserInfo;
|
||||||
use pbs_datastore::index::IndexFile;
|
use pbs_datastore::index::IndexFile;
|
||||||
@ -44,6 +44,7 @@ pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
|
|||||||
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_PROTOCOL_ID_V1!(), "')."),
|
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_PROTOCOL_ID_V1!(), "')."),
|
||||||
&sorted!([
|
&sorted!([
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
("store", false, &DATASTORE_SCHEMA),
|
||||||
|
("backup-ns", true, &BACKUP_NAMESPACE_SCHEMA),
|
||||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||||
|
@ -17,9 +17,9 @@ use proxmox_schema::{BooleanSchema, ObjectSchema};
|
|||||||
use proxmox_sys::sortable;
|
use proxmox_sys::sortable;
|
||||||
|
|
||||||
use pbs_api_types::{
|
use pbs_api_types::{
|
||||||
Authid, Operation, BACKUP_ARCHIVE_NAME_SCHEMA, BACKUP_ID_SCHEMA, BACKUP_TIME_SCHEMA,
|
Authid, Operation, BACKUP_ARCHIVE_NAME_SCHEMA, BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA,
|
||||||
BACKUP_TYPE_SCHEMA, CHUNK_DIGEST_SCHEMA, DATASTORE_SCHEMA, PRIV_DATASTORE_BACKUP,
|
BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, CHUNK_DIGEST_SCHEMA, DATASTORE_SCHEMA,
|
||||||
PRIV_DATASTORE_READ,
|
PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_READ,
|
||||||
};
|
};
|
||||||
use pbs_config::CachedUserInfo;
|
use pbs_config::CachedUserInfo;
|
||||||
use pbs_datastore::index::IndexFile;
|
use pbs_datastore::index::IndexFile;
|
||||||
@ -47,6 +47,7 @@ pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
|
|||||||
),
|
),
|
||||||
&sorted!([
|
&sorted!([
|
||||||
("store", false, &DATASTORE_SCHEMA),
|
("store", false, &DATASTORE_SCHEMA),
|
||||||
|
("backup-ns", true, &BACKUP_NAMESPACE_SCHEMA),
|
||||||
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
("backup-type", false, &BACKUP_TYPE_SCHEMA),
|
||||||
("backup-id", false, &BACKUP_ID_SCHEMA),
|
("backup-id", false, &BACKUP_ID_SCHEMA),
|
||||||
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
("backup-time", false, &BACKUP_TIME_SCHEMA),
|
||||||
|
Loading…
Reference in New Issue
Block a user