From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id A302B1FF0C0 for ; Wed, 18 Nov 2026 10:44:53 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 92E55216D5; Wed, 18 Nov 2026 10:44:33 +0100 (CET) From: Lukas Wagner To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox v2 13/63] notify: move Target type to api_types module Date: Wed, 18 Nov 2026 10:42:57 +0100 Message-ID: <20261118094348.273646-14-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118094348.273646-1-l.wagner@proxmox.com> References: <20261118094348.273646-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: 1794995036472 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.199 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: XF6RUHKPDMXSWBX4MDDDW4UGMSNGPEE2 X-Message-ID-Hash: XF6RUHKPDMXSWBX4MDDDW4UGMSNGPEE2 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: Since it is a serializable API type, all fields were made public as well. Signed-off-by: Lukas Wagner --- proxmox-notify/src/api/mod.rs | 38 +---------------------------- proxmox-notify/src/api_types/mod.rs | 35 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/proxmox-notify/src/api/mod.rs b/proxmox-notify/src/api/mod.rs index c7288ae15..d93cb8353 100644 --- a/proxmox-notify/src/api/mod.rs +++ b/proxmox-notify/src/api/mod.rs @@ -4,10 +4,9 @@ use serde::{Deserialize, Serialize}; use proxmox_config_digest::ConfigDigest; use proxmox_http_error::HttpError; -use proxmox_schema::api; use crate::Config; -use crate::api_types::Origin; +use crate::api_types::{EndpointType, Origin, Target}; pub mod common; pub mod gotify; @@ -40,41 +39,6 @@ macro_rules! http_bail { pub use http_bail; pub use http_err; -#[api] -#[derive(Clone, Debug, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd)] -#[serde(rename_all = "kebab-case")] -/// Type of the endpoint. -pub enum EndpointType { - /// Sendmail endpoint - Sendmail, - /// SMTP endpoint - Smtp, - /// Gotify endpoint - Gotify, - /// Webhook endpoint - Webhook, -} - -#[api] -#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd)] -#[serde(rename_all = "kebab-case")] -/// Target information -pub struct Target { - /// Name of the endpoint - name: String, - /// Origin of the endpoint - origin: Origin, - /// Type of the endpoint - #[serde(rename = "type")] - endpoint_type: EndpointType, - /// Target is disabled - #[serde(skip_serializing_if = "Option::is_none")] - disable: Option, - /// Comment - #[serde(skip_serializing_if = "Option::is_none")] - comment: Option, -} - /// Get a list of all notification targets. pub fn get_targets(config: &Config) -> Result, HttpError> { let mut targets = Vec::new(); diff --git a/proxmox-notify/src/api_types/mod.rs b/proxmox-notify/src/api_types/mod.rs index 1e2509f19..a72ddbc16 100644 --- a/proxmox-notify/src/api_types/mod.rs +++ b/proxmox-notify/src/api_types/mod.rs @@ -36,3 +36,38 @@ pub enum Origin { /// Config entry provided by the system, but modified by the user. ModifiedBuiltin, } + +#[api] +#[derive(Clone, Debug, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd)] +#[serde(rename_all = "kebab-case")] +/// Type of the endpoint. +pub enum EndpointType { + /// Sendmail endpoint + Sendmail, + /// SMTP endpoint + Smtp, + /// Gotify endpoint + Gotify, + /// Webhook endpoint + Webhook, +} + +#[api] +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd)] +#[serde(rename_all = "kebab-case")] +/// Target information +pub struct Target { + /// Name of the endpoint + pub name: String, + /// Origin of the endpoint + pub origin: Origin, + /// Type of the endpoint + #[serde(rename = "type")] + pub endpoint_type: EndpointType, + /// Target is disabled + #[serde(skip_serializing_if = "Option::is_none")] + pub disable: Option, + /// Comment + #[serde(skip_serializing_if = "Option::is_none")] + pub comment: Option, +} -- 2.47.3