diff --git a/src/api2/types.rs b/src/api2/types.rs index cf6edfb6..2bc4132b 100644 --- a/src/api2/types.rs +++ b/src/api2/types.rs @@ -67,6 +67,8 @@ const_regex!{ pub PROXMOX_USER_ID_REGEX = concat!(r"^", USER_ID_REGEX_STR!(), r"$"); + pub BACKUP_REPO_URL_REGEX = concat!(r"^^(?:(?:(", USER_ID_REGEX_STR!(), ")@)?(", DNS_NAME!(), "|", IPRE!() ,"):)?(", PROXMOX_SAFE_ID_REGEX_STR!(), r")$"); + pub PROXMOX_GROUP_ID_REGEX = concat!(r"^", GROUP_NAME_REGEX_STR!(), r"$"); pub CERT_FINGERPRINT_SHA256_REGEX = r"^(?:[0-9a-fA-F][0-9a-fA-F])(?::[0-9a-fA-F][0-9a-fA-F]){31}$"; diff --git a/src/client/backup_repo.rs b/src/client/backup_repo.rs index bf3bb1fa..d02a1859 100644 --- a/src/client/backup_repo.rs +++ b/src/client/backup_repo.rs @@ -3,12 +3,8 @@ use std::fmt; use anyhow::{format_err, Error}; use proxmox::api::schema::*; -use proxmox::const_regex; -const_regex! { - /// Regular expression to parse repository URLs - pub BACKUP_REPO_URL_REGEX = r"^(?:(?:([\w@]+)@)?([\w\-_.]+):)?(\w+)$"; -} +use crate::api2::types::*; /// API schema format definition for repository URLs pub const BACKUP_REPO_URL: ApiStringFormat = ApiStringFormat::Pattern(&BACKUP_REPO_URL_REGEX);