[pdm-devel] [PATCH proxmox v2 1/1] pve-api-types: generate missing `delete_token` method
Shan Shaji
s.shaji at proxmox.com
Wed Dec 10 17:37:36 CET 2025
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 <s.shaji at proxmox.com>
---
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
More information about the pdm-devel
mailing list