[pdm-devel] [PATCH proxmox v2 03/14] network-types: implement api type for Fqdn
Lukas Wagner
l.wagner at proxmox.com
Tue Dec 9 10:13:41 CET 2025
Reviewed-by: Lukas Wagner <l.wagner at proxmox.com>
On Fri Dec 5, 2025 at 12:25 PM CET, Christoph Heiss wrote:
> Pretty straight-forward, as we already got a fitting regex defined for a
> FQDN.
>
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
> Changes v1 -> v2:
> * no changes
>
> proxmox-network-types/src/fqdn.rs | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/proxmox-network-types/src/fqdn.rs b/proxmox-network-types/src/fqdn.rs
> index 9582639d..3c1bd475 100644
> --- a/proxmox-network-types/src/fqdn.rs
> +++ b/proxmox-network-types/src/fqdn.rs
> @@ -2,6 +2,9 @@
>
> use std::{fmt, str::FromStr};
>
> +#[cfg(feature = "api-types")]
> +use proxmox_schema::UpdaterType;
> +
> use serde::Deserialize;
>
> /// Possible errors that might occur when parsing FQDNs.
> @@ -55,6 +58,7 @@ impl fmt::Display for FqdnParseError {
> /// [RFC4343]: <https://www.ietf.org/rfc/rfc4343.txt>
> /// [hostname(7)]: <https://manpages.debian.org/stable/manpages/hostname.7.en.html>
> #[derive(Clone, Debug, Eq)]
> +#[cfg_attr(feature = "api-types", derive(UpdaterType))]
> pub struct Fqdn {
> parts: Vec<String>,
> }
> @@ -132,6 +136,16 @@ impl Fqdn {
> }
> }
>
> +#[cfg(feature = "api-types")]
> +impl proxmox_schema::ApiType for Fqdn {
> + const API_SCHEMA: proxmox_schema::Schema =
> + proxmox_schema::StringSchema::new("Fully-qualified domain name")
> + .format(&proxmox_schema::ApiStringFormat::Pattern(
> + &proxmox_schema::api_types::DNS_NAME_REGEX,
> + ))
> + .schema();
> +}
> +
> impl FromStr for Fqdn {
> type Err = FqdnParseError;
>
More information about the pdm-devel
mailing list