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 D837A1FF1A6 for ; Fri, 5 Dec 2025 19:04:30 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 266DAEBBC; Fri, 5 Dec 2025 19:05:06 +0100 (CET) From: Shan Shaji To: pdm-devel@lists.proxmox.com Date: Fri, 5 Dec 2025 19:04:47 +0100 Message-ID: <20251205180447.441371-7-s.shaji@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251205180447.441371-1-s.shaji@proxmox.com> References: <20251205180447.441371-1-s.shaji@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764957899895 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.113 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 Subject: [pdm-devel] [PATCH proxmox 1/1] pve-api-types: generate missing `delete_token` method X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Removing a remote node from PDM and adding it again is prevented by the already existing token. Inorder to allow deletion of token from PVE generate the endpoint that is necessary to call from PDM. Signed-off-by: Shan Shaji --- pve-api-types/generate.pl | 1 + pve-api-types/src/generated/code.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl index 3cebe321..ee02d91b 100755 --- a/pve-api-types/generate.pl +++ b/pve-api-types/generate.pl @@ -359,6 +359,7 @@ Schema2Rust::derive('ListRealm' => 'Clone', 'PartialEq'); # api(GET => '/access/users/{userid}', 'get_user', 'return-name' => 'User'); api(POST => '/access/users/{userid}/token/{tokenid}', 'create_token', 'param-name' => 'CreateToken'); Schema2Rust::derive('CreateToken' => 'Default'); +api(DELETE => '/access/users/{userid}/token/{tokenid}', 'delete_token'); api(GET => '/nodes/{node}/apt/update', 'list_available_updates', 'return-name' => 'AptUpdateInfo'); api(POST => '/nodes/{node}/apt/update', 'update_apt_database', 'output-type' => 'PveUpid', 'param-name' => 'AptUpdateParams'); diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs index f364f9cd..3de2e554 100644 --- a/pve-api-types/src/generated/code.rs +++ b/pve-api-types/src/generated/code.rs @@ -450,6 +450,11 @@ pub trait PveClient { Err(Error::Other("get_apt_repositories not implemented")) } + /// Remove API token for a specific user. + async fn delete_token(&self, userid: &str, tokenid: &str) -> Result<(), Error> { + Err(Error::Other("delete_token not implemented")) + } + /// Get package changelogs. async fn get_package_changelog( &self, @@ -1089,6 +1094,12 @@ where Ok(self.0.get(url).await?.expect_json()?.data) } + /// Remove API token for a specific user. + async fn delete_token(&self, userid: &str, tokenid: &str) -> Result<(), Error> { + let url = &format!("/api2/extjs/access/users/{userid}/token/{tokenid}"); + self.0.delete(url).await?.nodata() + } + /// Get package changelogs. async fn get_package_changelog( &self, -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel