From 632ab24359f64893cab6412e8f37fec3d6442a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 28 Oct 2021 15:00:48 +0200 Subject: [PATCH] api-types: add schema for backup group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the regex was already there, and we need a simple type/schema for passing in multiple groups as Vec/Array via the API. Signed-off-by: Fabian Grünbichler Reviewed-by: Dominik Csapak Signed-off-by: Thomas Lamprecht --- pbs-api-types/src/datastore.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 77c1258f..b1dd09d4 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -40,6 +40,7 @@ pub const BACKUP_ARCHIVE_NAME_SCHEMA: Schema = StringSchema::new("Backup archive .schema(); pub const BACKUP_ID_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&BACKUP_ID_REGEX); +pub const BACKUP_GROUP_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&GROUP_PATH_REGEX); pub const BACKUP_ID_SCHEMA: Schema = StringSchema::new("Backup ID.") .format(&BACKUP_ID_FORMAT) @@ -57,6 +58,10 @@ pub const BACKUP_TIME_SCHEMA: Schema = IntegerSchema::new("Backup time (Unix epo .minimum(1_547_797_308) .schema(); +pub const BACKUP_GROUP_SCHEMA: Schema = StringSchema::new("Backup Group") + .format(&BACKUP_GROUP_FORMAT) + .schema(); + pub const DATASTORE_SCHEMA: Schema = StringSchema::new("Datastore name.") .format(&PROXMOX_SAFE_ID_FORMAT) .min_length(3)