From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 8DA311FF136 for ; Mon, 23 Mar 2026 13:26:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0B35915CB1; Mon, 23 Mar 2026 13:26:49 +0100 (CET) Content-Type: text/plain; charset=UTF-8 Date: Mon, 23 Mar 2026 13:26:32 +0100 Message-Id: Subject: Re: [PATCH pve-manager 2/5] notifications: Add trigger-state-refresh endpoint From: "Lukas Wagner" To: "Arthur Bied-Charreton" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260213160415.609868-1-a.bied-charreton@proxmox.com> <20260213160415.609868-13-a.bied-charreton@proxmox.com> In-Reply-To: <20260213160415.609868-13-a.bied-charreton@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774268746457 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: B7JNHGYT4VZEXU36ZDVNIXVNQGW7NCDR X-Message-ID-Hash: B7JNHGYT4VZEXU36ZDVNIXVNQGW7NCDR 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: On Fri Feb 13, 2026 at 5:04 PM CET, Arthur Bied-Charreton wrote: > This endpoint allows triggering a refresh of the notification targets' > state, e.g., to prevent OAuth2 refresh tokens from expiring. > > Signed-off-by: Arthur Bied-Charreton > --- > PVE/API2/Cluster/Notifications.pm | 34 +++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/PVE/API2/Cluster/Notifications.pm b/PVE/API2/Cluster/Notific= ations.pm > index e7acea49..127d6710 100644 > --- a/PVE/API2/Cluster/Notifications.pm > +++ b/PVE/API2/Cluster/Notifications.pm > @@ -321,6 +321,40 @@ __PACKAGE__->register_method({ > }, > }); > =20 > +__PACKAGE__->register_method({ > + name =3D> "trigger_state_refresh", > + path =3D> 'trigger-state-refresh', > + protected =3D> 1, > + method =3D> 'POST', > + description =3D> 'Refresh state for all targets', Could be worth mentioning here that this will refresh tokens for OAUTH2 SMTP endpoints > + permissions =3D> { > + check =3D> [ > + 'and', > + ['perm', '/mapping/notifications', ['Mapping.Modify']], > + [ > + 'or', > + ['perm', '/', ['Sys.Audit', 'Sys.Modify']], > + ['perm', '/', ['Sys.AccessNetwork']], > + ], > + ], > + }, > + parameters =3D> { > + additionalProperties =3D> 0, > + properties =3D> {}, > + }, > + returns =3D> { type =3D> 'null' }, > + code =3D> sub { > + eval { > + my $config =3D PVE::Notify::read_config(); > + $config->trigger_state_refresh(); > + }; > + > + raise_api_error($@) if $@; > + > + return; > + }, > +}); > + > __PACKAGE__->register_method({ > name =3D> 'test_target', > path =3D> 'targets/{name}/test',