api2/types: add TAPE_RESTORE_SNAPSHOT_SCHEMA
which is 'store:type/id/time' needed to refactor SNAPSHOT_PATH_REGEX_STR from backup_info Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
82a4bb5e80
commit
5e42d38598
|
@ -114,6 +114,8 @@ const_regex!{
|
||||||
pub UUID_REGEX = r"^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$";
|
pub UUID_REGEX = r"^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$";
|
||||||
|
|
||||||
pub DATASTORE_MAP_REGEX = concat!(r"(:?", PROXMOX_SAFE_ID_REGEX_STR!(), r"=)?", PROXMOX_SAFE_ID_REGEX_STR!());
|
pub DATASTORE_MAP_REGEX = concat!(r"(:?", PROXMOX_SAFE_ID_REGEX_STR!(), r"=)?", PROXMOX_SAFE_ID_REGEX_STR!());
|
||||||
|
|
||||||
|
pub TAPE_RESTORE_SNAPSHOT_REGEX = concat!(r"^", PROXMOX_SAFE_ID_REGEX_STR!(), r":", SNAPSHOT_PATH_REGEX_STR!(), r"$");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const SYSTEMD_DATETIME_FORMAT: ApiStringFormat =
|
pub const SYSTEMD_DATETIME_FORMAT: ApiStringFormat =
|
||||||
|
@ -185,6 +187,9 @@ pub const BLOCKDEVICE_NAME_FORMAT: ApiStringFormat =
|
||||||
pub const DATASTORE_MAP_FORMAT: ApiStringFormat =
|
pub const DATASTORE_MAP_FORMAT: ApiStringFormat =
|
||||||
ApiStringFormat::Pattern(&DATASTORE_MAP_REGEX);
|
ApiStringFormat::Pattern(&DATASTORE_MAP_REGEX);
|
||||||
|
|
||||||
|
pub const TAPE_RESTORE_SNAPSHOT_FORMAT: ApiStringFormat =
|
||||||
|
ApiStringFormat::Pattern(&TAPE_RESTORE_SNAPSHOT_REGEX);
|
||||||
|
|
||||||
pub const PASSWORD_SCHEMA: Schema = StringSchema::new("Password.")
|
pub const PASSWORD_SCHEMA: Schema = StringSchema::new("Password.")
|
||||||
.format(&PASSWORD_FORMAT)
|
.format(&PASSWORD_FORMAT)
|
||||||
.min_length(1)
|
.min_length(1)
|
||||||
|
@ -396,6 +401,12 @@ pub const DATASTORE_MAP_LIST_SCHEMA: Schema = StringSchema::new(
|
||||||
.format(&ApiStringFormat::PropertyString(&DATASTORE_MAP_ARRAY_SCHEMA))
|
.format(&ApiStringFormat::PropertyString(&DATASTORE_MAP_ARRAY_SCHEMA))
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
|
pub const TAPE_RESTORE_SNAPSHOT_SCHEMA: Schema = StringSchema::new(
|
||||||
|
"A snapshot in the format: 'store:type/id/time")
|
||||||
|
.format(&TAPE_RESTORE_SNAPSHOT_FORMAT)
|
||||||
|
.type_text("store:type/id/time")
|
||||||
|
.schema();
|
||||||
|
|
||||||
pub const MEDIA_SET_UUID_SCHEMA: Schema =
|
pub const MEDIA_SET_UUID_SCHEMA: Schema =
|
||||||
StringSchema::new("MediaSet Uuid (We use the all-zero Uuid to reseve an empty media for a specific pool).")
|
StringSchema::new("MediaSet Uuid (We use the all-zero Uuid to reseve an empty media for a specific pool).")
|
||||||
.format(&UUID_FORMAT)
|
.format(&UUID_FORMAT)
|
||||||
|
|
|
@ -238,6 +238,7 @@ pub use fixed_index::*;
|
||||||
mod dynamic_index;
|
mod dynamic_index;
|
||||||
pub use dynamic_index::*;
|
pub use dynamic_index::*;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
mod backup_info;
|
mod backup_info;
|
||||||
pub use backup_info::*;
|
pub use backup_info::*;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,13 @@ macro_rules! BACKUP_TIME_RE {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! SNAPSHOT_PATH_REGEX_STR {
|
||||||
|
() => (
|
||||||
|
concat!(r"(", BACKUP_TYPE_RE!(), ")/(", BACKUP_ID_RE!(), ")/(", BACKUP_TIME_RE!(), r")")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const_regex! {
|
const_regex! {
|
||||||
BACKUP_FILE_REGEX = r"^.*\.([fd]idx|blob)$";
|
BACKUP_FILE_REGEX = r"^.*\.([fd]idx|blob)$";
|
||||||
|
|
||||||
|
@ -37,7 +44,7 @@ const_regex! {
|
||||||
GROUP_PATH_REGEX = concat!(r"^(", BACKUP_TYPE_RE!(), ")/(", BACKUP_ID_RE!(), r")$");
|
GROUP_PATH_REGEX = concat!(r"^(", BACKUP_TYPE_RE!(), ")/(", BACKUP_ID_RE!(), r")$");
|
||||||
|
|
||||||
SNAPSHOT_PATH_REGEX = concat!(
|
SNAPSHOT_PATH_REGEX = concat!(
|
||||||
r"^(", BACKUP_TYPE_RE!(), ")/(", BACKUP_ID_RE!(), ")/(", BACKUP_TIME_RE!(), r")$");
|
r"^", SNAPSHOT_PATH_REGEX_STR!(), r"$");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BackupGroup is a directory containing a list of BackupDir
|
/// BackupGroup is a directory containing a list of BackupDir
|
||||||
|
|
Loading…
Reference in New Issue