From ed3dd6644e6b81cdba4cf5eab90ebb15ab9b05a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 13 May 2022 11:26:55 +0200 Subject: [PATCH] api: split max-depth schema/types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pbs-api-types/src/datastore.rs | 6 ++++++ pbs-api-types/src/jobs.rs | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 47813cbd..1212ff89 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -90,6 +90,12 @@ pub const NS_MAX_DEPTH_SCHEMA: Schema = .default(0) .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.") .format(&PROXMOX_SAFE_ID_FORMAT) .min_length(3) diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs index 56d87e2b..2df19cfb 100644 --- a/pbs-api-types/src/jobs.rs +++ b/pbs-api-types/src/jobs.rs @@ -9,7 +9,8 @@ use proxmox_schema::*; use crate::{ Authid, BackupNamespace, BackupType, RateLimitConfig, Userid, BACKUP_GROUP_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! { @@ -436,7 +437,7 @@ pub const GROUP_FILTER_LIST_SCHEMA: Schema = optional: true, }, "max-depth": { - schema: NS_MAX_DEPTH_SCHEMA, + schema: NS_MAX_DEPTH_REDUCED_SCHEMA, optional: true, }, comment: {