api: split max-depth schema/types
into the regular one (with default == MAX) and the one used for pull/sync, where the default is 'None' which actually means the remote end reduces the scope of sync automatically (or, if needed, backwards-compat mode without any remote namespaces at all). Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
66abc4cb7d
commit
e40c7fb906
|
@ -90,6 +90,12 @@ pub const NS_MAX_DEPTH_SCHEMA: Schema =
|
||||||
.default(0)
|
.default(0)
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
|
pub const NS_MAX_DEPTH_REDUCED_SCHEMA: Schema =
|
||||||
|
IntegerSchema::new("How many levels of namespaces should be operated on (0 == no recursion, empty == automatic full recursion, namespace depths reduce maximum allowed value)")
|
||||||
|
.minimum(0)
|
||||||
|
.maximum(MAX_NAMESPACE_DEPTH as isize)
|
||||||
|
.schema();
|
||||||
|
|
||||||
pub const DATASTORE_SCHEMA: Schema = StringSchema::new("Datastore name.")
|
pub const DATASTORE_SCHEMA: Schema = StringSchema::new("Datastore name.")
|
||||||
.format(&PROXMOX_SAFE_ID_FORMAT)
|
.format(&PROXMOX_SAFE_ID_FORMAT)
|
||||||
.min_length(3)
|
.min_length(3)
|
||||||
|
|
|
@ -9,7 +9,8 @@ use proxmox_schema::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
Authid, BackupNamespace, BackupType, RateLimitConfig, Userid, BACKUP_GROUP_SCHEMA,
|
Authid, BackupNamespace, BackupType, RateLimitConfig, Userid, BACKUP_GROUP_SCHEMA,
|
||||||
BACKUP_NAMESPACE_SCHEMA, DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
|
BACKUP_NAMESPACE_SCHEMA, DATASTORE_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
|
||||||
NS_MAX_DEPTH_SCHEMA, PROXMOX_SAFE_ID_FORMAT, REMOTE_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA,
|
NS_MAX_DEPTH_REDUCED_SCHEMA, PROXMOX_SAFE_ID_FORMAT, REMOTE_ID_SCHEMA,
|
||||||
|
SINGLE_LINE_COMMENT_SCHEMA,
|
||||||
};
|
};
|
||||||
|
|
||||||
const_regex! {
|
const_regex! {
|
||||||
|
@ -436,7 +437,7 @@ pub const GROUP_FILTER_LIST_SCHEMA: Schema =
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"max-depth": {
|
"max-depth": {
|
||||||
schema: NS_MAX_DEPTH_SCHEMA,
|
schema: NS_MAX_DEPTH_REDUCED_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
comment: {
|
comment: {
|
||||||
|
|
|
@ -10,8 +10,8 @@ use proxmox_sys::task_log;
|
||||||
|
|
||||||
use pbs_api_types::{
|
use pbs_api_types::{
|
||||||
Authid, BackupNamespace, GroupFilter, RateLimitConfig, SyncJobConfig, DATASTORE_SCHEMA,
|
Authid, BackupNamespace, GroupFilter, RateLimitConfig, SyncJobConfig, DATASTORE_SCHEMA,
|
||||||
GROUP_FILTER_LIST_SCHEMA, NS_MAX_DEPTH_SCHEMA, PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_PRUNE,
|
GROUP_FILTER_LIST_SCHEMA, NS_MAX_DEPTH_REDUCED_SCHEMA, PRIV_DATASTORE_BACKUP,
|
||||||
PRIV_REMOTE_READ, REMOTE_ID_SCHEMA, REMOVE_VANISHED_BACKUPS_SCHEMA,
|
PRIV_DATASTORE_PRUNE, PRIV_REMOTE_READ, REMOTE_ID_SCHEMA, REMOVE_VANISHED_BACKUPS_SCHEMA,
|
||||||
};
|
};
|
||||||
use pbs_config::CachedUserInfo;
|
use pbs_config::CachedUserInfo;
|
||||||
use proxmox_rest_server::WorkerTask;
|
use proxmox_rest_server::WorkerTask;
|
||||||
|
@ -193,7 +193,7 @@ pub fn do_sync_job(
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"max-depth": {
|
"max-depth": {
|
||||||
schema: NS_MAX_DEPTH_SCHEMA,
|
schema: NS_MAX_DEPTH_REDUCED_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"group-filter": {
|
"group-filter": {
|
||||||
|
|
Loading…
Reference in New Issue