From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 024641FF0B7 for ; Fri, 13 Nov 2026 16:09:54 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E0E4F21759; Fri, 13 Nov 2026 16:08:59 +0100 (CET) From: Lukas Wagner To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox 11/55] notify: move Origin type to api_types module Date: Fri, 13 Nov 2026 16:07:44 +0100 Message-ID: <20261113150828.756836-12-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261113150828.756836-1-l.wagner@proxmox.com> References: <20261113150828.756836-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794582524348 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.214 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: RUSQNNVR57XJ56MMVETBANA4KN7YAH3E X-Message-ID-Hash: RUSQNNVR57XJ56MMVETBANA4KN7YAH3E X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This is another step in cleaning up the crate root in lib.rs. Signed-off-by: Lukas Wagner --- proxmox-notify/src/api/mod.rs | 3 ++- proxmox-notify/src/api_types/gotify.rs | 3 ++- proxmox-notify/src/api_types/matcher/mod.rs | 3 ++- proxmox-notify/src/api_types/mod.rs | 17 +++++++++++++++++ proxmox-notify/src/api_types/sendmail.rs | 6 ++---- proxmox-notify/src/api_types/smtp.rs | 2 +- proxmox-notify/src/api_types/webhook.rs | 5 ++++- proxmox-notify/src/lib.rs | 17 +---------------- 8 files changed, 31 insertions(+), 25 deletions(-) diff --git a/proxmox-notify/src/api/mod.rs b/proxmox-notify/src/api/mod.rs index 0dbb15b91..8bd5633da 100644 --- a/proxmox-notify/src/api/mod.rs +++ b/proxmox-notify/src/api/mod.rs @@ -6,7 +6,8 @@ use serde::{Deserialize, Serialize}; use proxmox_http_error::HttpError; use proxmox_schema::api; -use crate::{Config, Origin}; +use crate::Config; +use crate::api_types::Origin; pub mod common; pub mod gotify; diff --git a/proxmox-notify/src/api_types/gotify.rs b/proxmox-notify/src/api_types/gotify.rs index 48193ff3c..cefdefe02 100644 --- a/proxmox-notify/src/api_types/gotify.rs +++ b/proxmox-notify/src/api_types/gotify.rs @@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize}; use proxmox_schema::{Updater, api, api_types::COMMENT_SCHEMA}; -use crate::{Origin, schema::ENTITY_NAME_SCHEMA}; +use crate::api_types::Origin; +use crate::schema::ENTITY_NAME_SCHEMA; pub const GOTIFY_TYPENAME: &str = "gotify"; diff --git a/proxmox-notify/src/api_types/matcher/mod.rs b/proxmox-notify/src/api_types/matcher/mod.rs index 815c9e8ff..3e8bc4dbe 100644 --- a/proxmox-notify/src/api_types/matcher/mod.rs +++ b/proxmox-notify/src/api_types/matcher/mod.rs @@ -9,8 +9,9 @@ use proxmox_api_macro::api; use proxmox_schema::Updater; use proxmox_schema::api_types::COMMENT_SCHEMA; +use crate::api_types::Origin; use crate::schema::ENTITY_NAME_SCHEMA; -use crate::{Error, Notification, Origin}; +use crate::{Error, Notification}; pub mod calendar; pub mod expression; diff --git a/proxmox-notify/src/api_types/mod.rs b/proxmox-notify/src/api_types/mod.rs index 443dea336..1e2509f19 100644 --- a/proxmox-notify/src/api_types/mod.rs +++ b/proxmox-notify/src/api_types/mod.rs @@ -5,6 +5,10 @@ //! - the generic target listing //! - send receipts. +use serde::{Deserialize, Serialize}; + +use proxmox_schema::api; + mod gotify; pub use gotify::*; @@ -19,3 +23,16 @@ pub use smtp::*; mod matcher; pub use matcher::*; + +#[api] +#[derive(Clone, Debug, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd)] +#[serde(rename_all = "kebab-case")] +/// The origin of a notification configuration entry. +pub enum Origin { + /// User-created config entry + UserCreated, + /// Config entry provided by the system + Builtin, + /// Config entry provided by the system, but modified by the user. + ModifiedBuiltin, +} diff --git a/proxmox-notify/src/api_types/sendmail.rs b/proxmox-notify/src/api_types/sendmail.rs index 921970265..c3437bc1f 100644 --- a/proxmox-notify/src/api_types/sendmail.rs +++ b/proxmox-notify/src/api_types/sendmail.rs @@ -2,10 +2,8 @@ use serde::{Deserialize, Serialize}; use proxmox_schema::{Updater, api, api_types::COMMENT_SCHEMA}; -use crate::{ - Origin, - schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA}, -}; +use crate::api_types::Origin; +use crate::schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA}; pub const SENDMAIL_TYPENAME: &str = "sendmail"; diff --git a/proxmox-notify/src/api_types/smtp.rs b/proxmox-notify/src/api_types/smtp.rs index d30f1dfee..cc19bd7a1 100644 --- a/proxmox-notify/src/api_types/smtp.rs +++ b/proxmox-notify/src/api_types/smtp.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use proxmox_schema::{Updater, api, api_types::COMMENT_SCHEMA}; -use crate::Origin; +use crate::api_types::Origin; use crate::schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA}; pub const SMTP_TYPENAME: &str = "smtp"; diff --git a/proxmox-notify/src/api_types/webhook.rs b/proxmox-notify/src/api_types/webhook.rs index ad65f617e..7e49188b7 100644 --- a/proxmox-notify/src/api_types/webhook.rs +++ b/proxmox-notify/src/api_types/webhook.rs @@ -4,7 +4,10 @@ use proxmox_schema::{ }; use serde::{Deserialize, Serialize}; -use crate::{Error, Origin, schema::ENTITY_NAME_SCHEMA}; +use crate::Error; +use crate::api_types::Origin; + +use crate::schema::ENTITY_NAME_SCHEMA; /// This will be used as a section type in the public/private configuration file. pub const WEBHOOK_TYPENAME: &str = "webhook"; diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs index 2061d9150..8f0b962e7 100644 --- a/proxmox-notify/src/lib.rs +++ b/proxmox-notify/src/lib.rs @@ -1,9 +1,7 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![deny(unsafe_code)] -use std::collections::HashMap; -use std::fmt::Display; -use std::str::FromStr; +use std::{collections::HashMap, fmt::Display, str::FromStr}; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -78,19 +76,6 @@ impl FromStr for Severity { } } -#[api()] -#[derive(Clone, Debug, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd)] -#[serde(rename_all = "kebab-case")] -/// The origin of a notification configuration entry. -pub enum Origin { - /// User-created config entry - UserCreated, - /// Config entry provided by the system - Builtin, - /// Config entry provided by the system, but modified by the user. - ModifiedBuiltin, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum Content { -- 2.47.3