[pdm-devel] [PATCH proxmox 1/1] pve-api-types: generate missing `delete_token` method

Shannon Sterz s.sterz at proxmox.com
Tue Dec 9 10:37:18 CET 2025


other than the nits in-line, consider this:

Reviewed-by: Shannon Sterz <s.sterz at proxmox.com>

note i didn't test this, but other then the nits the code looks ok to
me.

On Fri Dec 5, 2025 at 7:04 PM CET, Shan Shaji wrote:
> 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,





More information about the pdm-devel mailing list