* [PATCH datacenter-manager v4 1/6] server: pbs-client: add method to delete token from remote
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 2/6] fix #6914: api: add support " Shan Shaji
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: pdm-devel
Inorder to allow deleting the generated token of PBS from PDM, add
method inside the `PbsClient` to delete the token.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v3:
- use percent_encoding to encode the userid.
- change the function name from delete_admin_token to delete_token.
- nit: change "API-Token" to "API token".
- pass &TokennameRef from callsite.
server/src/pbs_client.rs | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs
index f4f1f82..6158da7 100644
--- a/server/src/pbs_client.rs
+++ b/server/src/pbs_client.rs
@@ -13,7 +13,7 @@ use proxmox_router::stream::JsonRecords;
use proxmox_schema::api;
use proxmox_section_config::typed::SectionConfigData;
-use pbs_api_types::{Authid, Tokenname, Userid};
+use pbs_api_types::{Authid, Tokenname, TokennameRef, Userid};
use pdm_api_types::remotes::{Remote, RemoteType};
@@ -260,6 +260,20 @@ impl PbsClient {
Ok(token)
}
+ /// Delete API token from the PBS remote.
+ pub async fn delete_token(&self, userid: &Userid, tokenid: &TokennameRef) -> Result<(), Error> {
+ let path = format!(
+ "/api2/extjs/access/users/{}/token/{}",
+ percent_encoding::percent_encode(
+ userid.as_str().as_bytes(),
+ percent_encoding::NON_ALPHANUMERIC
+ ),
+ tokenid.as_str()
+ );
+ self.0.delete(&path).await?.nodata()?;
+ Ok(())
+ }
+
/// Return the status the Proxmox Backup Server instance
pub async fn node_status(&self) -> Result<pbs_api_types::NodeStatus, Error> {
let path = "/api2/extjs/nodes/localhost/status";
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH datacenter-manager v4 2/6] fix #6914: api: add support to delete token from remote
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 1/6] server: pbs-client: add method to delete token from remote Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 3/6] pdm-client: accept `delete-token` argument for deleting api token Shan Shaji
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: pdm-devel
previously, when removing a remote, the token was still present in the
remote configuration. When users tried to add the remote again, they
received an error because a token with the same name already existed.
To support deleting the token from the remote, add an optional
parameter `delete-token` to the API endpoint which by default will
be `false`.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v3: Thanks @Lukas
- remove 'type:bool' from the schema.
- change description.
- set `default` to false.
- add comment for the `short-delete_err` function.
- removed {pve,pbs}_connect_or_login function and replaced with
`connection::make_{pve,pbs}_client(remote)`
server/src/api/remotes.rs | 46 +++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/server/src/api/remotes.rs b/server/src/api/remotes.rs
index 298ad13..a9d424d 100644
--- a/server/src/api/remotes.rs
+++ b/server/src/api/remotes.rs
@@ -292,16 +292,58 @@ pub fn update_remote(
input: {
properties: {
id: { schema: REMOTE_ID_SCHEMA },
+ "delete-token": {
+ optional: true,
+ default: false,
+ description: "If true, deletes the API token on the remote.",
+ }
},
},
access: {
permission: &Permission::Privilege(&["resource"], PRIV_RESOURCE_MODIFY, false),
},
)]
-/// List all the remotes this instance is managing.
-pub fn remove_remote(id: String) -> Result<(), Error> {
+/// Remove a remote that this instance is managing.
+pub async fn remove_remote(id: String, delete_token: bool) -> Result<(), Error> {
+ let _lock = pdm_config::remotes::lock_config()?;
let (mut remotes, _) = pdm_config::remotes::config()?;
+ if delete_token {
+ let remote = remotes
+ .get(&id)
+ .ok_or_else(|| http_err!(NOT_FOUND, "no such remote {id:?}"))?;
+
+ let user = remote.authid.user();
+
+ // With the `Client`'s error type the message gets a bit long, shorten it:
+ let short_delete_err = |err: proxmox_client::Error| {
+ format_err!("error deleting token: {}", err.source().unwrap_or(&err))
+ };
+
+ let token_name = remote
+ .authid
+ .tokenname()
+ .ok_or_else(|| format_err!("Unable to find the token for the remote {id:?}"))?;
+
+ // connect to remote and delete the already existing token.
+ match remote.ty {
+ RemoteType::Pve => {
+ let client = connection::make_pve_client(remote)?;
+ client
+ .delete_token(user.as_str(), token_name.as_str())
+ .await
+ .map_err(short_delete_err)?
+ }
+ RemoteType::Pbs => {
+ let client = connection::make_pbs_client(remote)?;
+ client
+ .delete_token(user, token_name)
+ .await
+ .map_err(short_delete_err)?
+ }
+ };
+ }
+
if remotes.remove(&id).is_none() {
http_bail!(NOT_FOUND, "no such entry {id:?}");
}
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH datacenter-manager v4 3/6] pdm-client: accept `delete-token` argument for deleting api token
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 1/6] server: pbs-client: add method to delete token from remote Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 2/6] fix #6914: api: add support " Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 4/6] fix #6914: cli-client: add option to delete token from remote Shan Shaji
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: pdm-devel
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v3:
- replace use of &Option<bool> with Option<bool>.
lib/pdm-client/src/lib.rs | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/pdm-client/src/lib.rs b/lib/pdm-client/src/lib.rs
index 01ee6f7..0fee97a 100644
--- a/lib/pdm-client/src/lib.rs
+++ b/lib/pdm-client/src/lib.rs
@@ -136,8 +136,15 @@ impl<T: HttpApiClient> PdmClient<T> {
Ok(())
}
- pub async fn delete_remote(&self, remote: &str) -> Result<(), Error> {
- let path = format!("/api2/extjs/remotes/remote/{remote}");
+ /// Deletes a remote, with optional flag to handle remote token deletion.
+ pub async fn delete_remote(
+ &self,
+ remote: &str,
+ delete_token: Option<bool>,
+ ) -> Result<(), Error> {
+ let path = ApiPathBuilder::new(format!("/api2/extjs/remotes/remote/{remote}"))
+ .maybe_arg("delete-token", &delete_token)
+ .build();
self.0.delete(&path).await?.nodata()?;
Ok(())
}
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH datacenter-manager v4 4/6] fix #6914: cli-client: add option to delete token from remote
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
` (2 preceding siblings ...)
2026-02-18 16:41 ` [PATCH datacenter-manager v4 3/6] pdm-client: accept `delete-token` argument for deleting api token Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 5/6] fix #6914: ui: add remove remote dialog with optional token deletion Shan Shaji
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: pdm-devel
The `delete-token` option will be `true` by default. If not specified
the token will be deleted automatically. Inorder to skip the token
deletion, set the `delete-token` to `false`.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v3: Thanks @Lukas
- change description.
- added `default` to the schema and dropped `type`.
- update commit message.
cli/client/src/remotes.rs | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/cli/client/src/remotes.rs b/cli/client/src/remotes.rs
index 4145dac..e087809 100644
--- a/cli/client/src/remotes.rs
+++ b/cli/client/src/remotes.rs
@@ -116,12 +116,17 @@ async fn update_remote(id: String, updater: RemoteUpdater) -> Result<(), Error>
input: {
properties: {
id: { schema: REMOTE_ID_SCHEMA },
+ "delete-token": {
+ optional: true,
+ default: true,
+ description: "If set to false, token deletion on the remote is skipped."
+ }
}
}
)]
-/// Add a new remote.
-async fn delete_remote(id: String) -> Result<(), Error> {
- client()?.delete_remote(&id).await?;
+/// Delete a remote.
+async fn delete_remote(id: String, delete_token: bool) -> Result<(), Error> {
+ client()?.delete_remote(&id, Some(delete_token)).await?;
Ok(())
}
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH datacenter-manager v4 5/6] fix #6914: ui: add remove remote dialog with optional token deletion
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
` (3 preceding siblings ...)
2026-02-18 16:41 ` [PATCH datacenter-manager v4 4/6] fix #6914: cli-client: add option to delete token from remote Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
2026-02-18 16:41 ` [PATCH datacenter-manager v4 6/6] fix #6914: cli-admin: add option to delete token from remote Shan Shaji
2026-02-18 16:41 ` [PATCH proxmox v4 1/1] pve-api-types: generate missing `delete_token` method Shan Shaji
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: pdm-devel
previously, removing a remote did not remove its token, which
prevented users from re-adding the same remote later with the same token
name. To fix this, add a new checkbox that lets users choose whether to
delete the token from remote.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v3:
- use the `ConfirmDialog` widget to create the dialog.
- made the token deletion as an opt-out feature. If the user wants to
keep the token, then the checkbox needs to checked.
- fixed clippy warnings.
- changed the checkbox label.
- remove the use of `pub` keyword.
ui/src/remotes/config.rs | 38 ++++++++----
ui/src/remotes/mod.rs | 2 +
ui/src/remotes/remove_remote.rs | 103 ++++++++++++++++++++++++++++++++
3 files changed, 133 insertions(+), 10 deletions(-)
create mode 100644 ui/src/remotes/remove_remote.rs
diff --git a/ui/src/remotes/config.rs b/ui/src/remotes/config.rs
index 0737f1b..0481c78 100644
--- a/ui/src/remotes/config.rs
+++ b/ui/src/remotes/config.rs
@@ -7,6 +7,7 @@ use anyhow::Error;
use proxmox_schema::property_string::PropertyString;
use crate::remotes::edit_remote::EditRemote;
+use crate::remotes::remove_remote::RemoveRemote;
//use pwt::widget::form::{Field, FormContext, InputType};
use pdm_api_types::remotes::Remote;
@@ -17,7 +18,7 @@ use proxmox_yew_comp::percent_encoding::percent_encode_component;
//use proxmox_schema::api_types::{CERT_FINGERPRINT_SHA256_SCHEMA, DNS_NAME_OR_IP_SCHEMA};
-use serde_json::Value;
+use serde_json::{json, Value};
use yew::virtual_dom::{Key, VComp, VNode};
use pwt::prelude::*;
@@ -32,7 +33,7 @@ use pwt::widget::{
//use proxmox_yew_comp::EditWindow;
use proxmox_yew_comp::{
- ConfirmButton, LoadableComponent, LoadableComponentContext, LoadableComponentMaster,
+ LoadableComponent, LoadableComponentContext, LoadableComponentMaster,
LoadableComponentScopeExt, LoadableComponentState,
};
@@ -42,10 +43,13 @@ async fn load_remotes() -> Result<Vec<Remote>, Error> {
proxmox_yew_comp::http_get("/remotes/remote", None).await
}
-async fn delete_item(key: Key) -> Result<(), Error> {
+async fn delete_item(key: Key, delete_token: bool) -> Result<(), Error> {
let id = key.to_string();
+ let param = Some(json!({
+ "delete-token": delete_token,
+ }));
let url = format!("/remotes/remote/{}", percent_encode_component(&id));
- proxmox_yew_comp::http_delete(&url, None).await?;
+ proxmox_yew_comp::http_delete(&url, param).await?;
Ok(())
}
@@ -100,10 +104,11 @@ impl RemoteConfigPanel {
pub enum ViewState {
Add(RemoteType),
Edit,
+ Remove,
}
pub enum Msg {
- RemoveItem,
+ RemoveItem(bool),
}
pub struct PbsRemoteConfigPanel {
@@ -156,11 +161,11 @@ impl LoadableComponent for PbsRemoteConfigPanel {
fn update(&mut self, ctx: &LoadableComponentContext<Self>, msg: Self::Message) -> bool {
match msg {
- Msg::RemoveItem => {
+ Msg::RemoveItem(v) => {
if let Some(key) = self.selection.selected_key() {
let link = ctx.link().clone();
self.spawn(async move {
- if let Err(err) = delete_item(key).await {
+ if let Err(err) = delete_item(key, v).await {
link.show_error(tr!("Unable to delete item"), err, true);
}
link.send_reload();
@@ -205,10 +210,9 @@ impl LoadableComponent for PbsRemoteConfigPanel {
.onclick(link.change_view_callback(|_| Some(ViewState::Edit))),
)
.with_child(
- ConfirmButton::new(tr!("Remove"))
- .confirm_message(tr!("Are you sure you want to remove this remote?"))
+ Button::new(tr!("Remove"))
.disabled(disabled)
- .on_activate(link.callback(|_| Msg::RemoveItem)),
+ .on_activate(link.change_view_callback(|_| Some(ViewState::Remove))),
)
.with_flex_spacer()
.with_child({
@@ -243,6 +247,7 @@ impl LoadableComponent for PbsRemoteConfigPanel {
.selection
.selected_key()
.map(|key| self.create_edit_dialog(ctx, key)),
+ ViewState::Remove => Some(self.create_remove_remote_dialog(ctx)),
}
}
}
@@ -303,6 +308,19 @@ impl PbsRemoteConfigPanel {
.on_done(ctx.link().change_view_callback(|_| None))
.into()
}
+
+ fn create_remove_remote_dialog(&self, ctx: &LoadableComponentContext<Self>) -> Html {
+ let link = ctx.link().clone();
+ let close = link.change_view_callback(|_| None);
+
+ RemoveRemote::new()
+ .on_dismiss(close.clone())
+ .on_confirm(Callback::from(move |v| {
+ link.send_message(Msg::RemoveItem(v));
+ link.change_view(None);
+ }))
+ .into()
+ }
}
impl From<RemoteConfigPanel> for VNode {
diff --git a/ui/src/remotes/mod.rs b/ui/src/remotes/mod.rs
index 603077c..bfe9dc0 100644
--- a/ui/src/remotes/mod.rs
+++ b/ui/src/remotes/mod.rs
@@ -27,6 +27,8 @@ pub use tasks::RemoteTaskList;
mod updates;
pub use updates::UpdateTree;
+mod remove_remote;
+
mod firewall;
pub use firewall::FirewallTree;
diff --git a/ui/src/remotes/remove_remote.rs b/ui/src/remotes/remove_remote.rs
new file mode 100644
index 0000000..45cbd18
--- /dev/null
+++ b/ui/src/remotes/remove_remote.rs
@@ -0,0 +1,103 @@
+use std::rc::Rc;
+
+use yew::html::IntoEventCallback;
+use yew::prelude::*;
+use yew::virtual_dom::{VComp, VNode};
+
+use pwt::prelude::*;
+use pwt::widget::form::Checkbox;
+use pwt::widget::{Column, ConfirmDialog};
+
+use pwt_macros::builder;
+
+#[derive(PartialEq, Properties)]
+#[builder]
+pub struct RemoveRemote {
+ /// A callback for an action that needs to be confirmed by the user.
+ #[prop_or_default]
+ #[builder_cb(IntoEventCallback, into_event_callback, bool)]
+ pub on_confirm: Option<Callback<bool>>,
+
+ /// A callback that will trigger if the user dismisses the dialog.
+ #[prop_or_default]
+ #[builder_cb(IntoEventCallback, into_event_callback, ())]
+ pub on_dismiss: Option<Callback<()>>,
+}
+
+impl Default for RemoveRemote {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl RemoveRemote {
+ pub fn new() -> Self {
+ yew::props!(Self {})
+ }
+}
+
+enum Msg {
+ SelectCheckBox(bool),
+}
+
+struct PdmRemoveRemote {
+ keep_api_token: bool,
+}
+
+impl Component for PdmRemoveRemote {
+ type Message = Msg;
+ type Properties = RemoveRemote;
+
+ fn create(_ctx: &Context<Self>) -> Self {
+ Self {
+ keep_api_token: false,
+ }
+ }
+
+ fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
+ match msg {
+ Msg::SelectCheckBox(v) => {
+ self.keep_api_token = v;
+ true
+ }
+ }
+ }
+
+ fn view(&self, ctx: &Context<Self>) -> Html {
+ let props = ctx.props();
+ let keep_api_token = self.keep_api_token;
+
+ let on_confirm = props.on_confirm.clone();
+ let on_dismiss = props.on_dismiss.clone();
+
+ let content = Column::new()
+ .gap(2)
+ .with_child(tr!("Are you sure you want to remove this remote?"))
+ .with_child(
+ Checkbox::new()
+ .box_label(tr!("Keep the API token on the remote"))
+ .checked(keep_api_token)
+ .on_change(ctx.link().callback(Msg::SelectCheckBox)),
+ );
+
+ let mut dialog = ConfirmDialog::default()
+ .on_confirm(Callback::from(move |_| {
+ if let Some(on_confirm) = &on_confirm {
+ on_confirm.emit(!keep_api_token);
+ }
+ }))
+ .on_close(on_dismiss.clone())
+ .on_dismiss(on_dismiss);
+
+ dialog.set_confirm_message(content);
+
+ dialog.into()
+ }
+}
+
+impl From<RemoveRemote> for VNode {
+ fn from(val: RemoveRemote) -> Self {
+ let comp = VComp::new::<PdmRemoveRemote>(Rc::new(val), None);
+ VNode::from(comp)
+ }
+}
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH datacenter-manager v4 6/6] fix #6914: cli-admin: add option to delete token from remote
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
` (4 preceding siblings ...)
2026-02-18 16:41 ` [PATCH datacenter-manager v4 5/6] fix #6914: ui: add remove remote dialog with optional token deletion Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
2026-02-18 16:41 ` [PATCH proxmox v4 1/1] pve-api-types: generate missing `delete_token` method Shan Shaji
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: pdm-devel
The `delete-token` option will be `true` by default. If not specified
the token will be deleted automatically. Inorder to skip the token
deletion, set the `delete-token` to `false`.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v3: Thanks @Lukas
- updated commit message.
- drop `type` and set the `default` prop.
cli/admin/src/remotes.rs | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/cli/admin/src/remotes.rs b/cli/admin/src/remotes.rs
index edd3fd8..c2930b7 100644
--- a/cli/admin/src/remotes.rs
+++ b/cli/admin/src/remotes.rs
@@ -217,16 +217,25 @@ fn update_remote(
input: {
properties: {
id: { schema: REMOTE_ID_SCHEMA },
+ "delete-token": {
+ optional: true,
+ default: true,
+ description: "If set to false, token deletion on the remote is skipped."
+ }
}
}
)]
-/// Add a new remote.
-fn remove_remote(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
- let param = json!({ "id": id });
+/// Remove a remote.
+async fn remove_remote(
+ id: String,
+ delete_token: bool,
+ rpcenv: &mut dyn RpcEnvironment,
+) -> Result<(), Error> {
+ let param = json!({ "id": id, "delete-token": delete_token });
let info = &dc_api::remotes::API_METHOD_REMOVE_REMOTE;
match info.handler {
- ApiHandler::Sync(handler) => (handler)(param, info, rpcenv).map(drop),
+ ApiHandler::Async(handler) => (handler)(param, info, rpcenv).await.map(drop),
_ => unreachable!(),
}
}
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH proxmox v4 1/1] pve-api-types: generate missing `delete_token` method
2026-02-18 16:41 [PATCH datacenter-manager/proxmox v4 0/7] fix #6914: add option to remove already existing token Shan Shaji
` (5 preceding siblings ...)
2026-02-18 16:41 ` [PATCH datacenter-manager v4 6/6] fix #6914: cli-admin: add option to delete token from remote Shan Shaji
@ 2026-02-18 16:41 ` Shan Shaji
6 siblings, 0 replies; 8+ messages in thread
From: Shan Shaji @ 2026-02-18 16:41 UTC (permalink / raw)
To: 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 <s.shaji@proxmox.com>
---
changes since v3: No changes
pve-api-types/generate.pl | 1 +
pve-api-types/src/generated/code.rs | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index e5c5d051..da8c2d47 100755
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -362,6 +362,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 bdf93884..c12f6bbe 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -634,6 +634,11 @@ pub trait PveClient {
))
}
+ /// 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 APT repository information.
async fn get_apt_repositories(&self, node: &str) -> Result<APTRepositoriesResult, Error> {
Err(Error::Other("get_apt_repositories not implemented"))
@@ -1802,6 +1807,16 @@ where
self.0.delete(url).await?.nodata()
}
+ /// 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/{}/token/{}",
+ percent_encode(userid.as_bytes(), percent_encoding::NON_ALPHANUMERIC),
+ percent_encode(tokenid.as_bytes(), percent_encoding::NON_ALPHANUMERIC)
+ );
+ self.0.delete(url).await?.nodata()
+ }
+
/// Get APT repository information.
async fn get_apt_repositories(&self, node: &str) -> Result<APTRepositoriesResult, Error> {
let url = &format!(
--
2.47.3
^ permalink raw reply [flat|nested] 8+ messages in thread