From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D57B11FF183 for ; Wed, 24 Sep 2025 10:19:25 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3DAD01ECE2; Wed, 24 Sep 2025 10:19:56 +0200 (CEST) Message-ID: <3b4256c7-93f7-47fc-a084-bae5a7ac9ab6@proxmox.com> Date: Wed, 24 Sep 2025 10:19:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Hannes Laimer , pmg-devel@lists.proxmox.com References: <20250923093332.57010-1-h.laimer@proxmox.com> <20250923093332.57010-2-h.laimer@proxmox.com> <76ba4d2f-ee09-4cb1-b5e5-ad7dc389c445@proxmox.com> <7104c7f5-da14-43f1-a0b4-6507ae1f9e46@proxmox.com> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <7104c7f5-da14-43f1-a0b4-6507ae1f9e46@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758701980091 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.026 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [postfix.pm] Subject: Re: [pmg-devel] [PATCH pmg-api v2 1/1] fix #3450: api: queue: add POST endpoint for batch deletion/delivery X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" Am 24.09.25 um 07:43 schrieb Hannes Laimer: > On 23.09.25 15:22, Thomas Lamprecht wrote: >> Am 23.09.25 um 11:33 schrieb Hannes Laimer: >>> - single POST endpoitn that takes type(delete/deliver) and list of id's >> >> Fine for delivery, but why not add a new optional ids parameter to the >> existing DELETE endpoint? >> > > To have it mentioned here, the reason is that > DELETE doesn't take data, at least our proxy doesn't, and something like > `.../{queue}/?ids=AABC234,DDEF4543,EEFG6473,...` > is at best odd and brittle. Meh, nothing should speak against DELETE taking a body from a technical POV, but fair enough. > I should have included this and I'll add it for v3. Yes, please do! >>> diff --git a/src/PMG/API2/Postfix.pm b/src/PMG/API2/Postfix.pm >>> index ba0689c..90a74e9 100644 >>> --- a/src/PMG/API2/Postfix.pm >>> +++ b/src/PMG/API2/Postfix.pm >>> @@ -335,6 +335,49 @@ __PACKAGE__->register_method({ >>> }, >>> }); >>> +__PACKAGE__->register_method({ >>> + name => 'queue_action', >>> + path => 'queue/{queue}', >>> + method => 'POST', >>> + description => "Perform an action on the given queue IDs (delete/deliver).", >>> + proxyto => 'node', >>> + permissions => { check => ['admin'] }, >>> + protected => 1, >>> + parameters => { >>> + additionalProperties => 0, >>> + properties => { >>> + node => get_standard_option('pve-node'), >>> + queue => $queue_name_option, >>> + action => { >>> + description => 'Operation to perform on the given IDs.', >>> + type => 'string', >>> + enum => ['delete', 'deliver'], >>> + }, >>> + id => { >> >> "ids" would slightly better signal that this can be more than one. >> >>> + description => 'Queue ID(s), separated by semicolons (;).', >>> + type => 'string', >>> + pattern => '[A-Za-z0-9]{8,20}(;[A-Za-z0-9]{8,20})*', >> >> hmm, don't we have a format for this or at least an existing regex >> we can reuse? >> > > not really, there's only > ``` > my $queue_id_option = { > description => "The Message queue ID.", > type => 'string', > pattern => '[a-zA-Z0-9]+', > minLength => 8, > maxLength => 20, > }; > ``` > but I don't think a thing for just `[a-zA-Z0-9]+` adds much. it's obviously trivial and indeed does not add much on it's own from a low-level POV, but these can be abstractions that still help to argue and reason about the code nonetheless; that said, I'm fine with deciding some not so hard cuts on a case by case basis, and for me it can be fine to keep this as is then if there is nothing factored out already. _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel