Update existing bindings for compatibility with the OAuth2-related proxmox-notify API changes, and add binding for refresh_targets.
Signed-off-by: Arthur Bied-Charreton <[email protected]> --- common/src/bindings/notify.rs | 44 +++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/common/src/bindings/notify.rs b/common/src/bindings/notify.rs index 409270a..7d0c54b 100644 --- a/common/src/bindings/notify.rs +++ b/common/src/bindings/notify.rs @@ -26,8 +26,8 @@ pub mod proxmox_rs_notify { DeleteableSendmailProperty, SendmailConfig, SendmailConfigUpdater, }; use proxmox_notify::endpoints::smtp::{ - DeleteableSmtpProperty, SmtpConfig, SmtpConfigUpdater, SmtpMode, SmtpPrivateConfig, - SmtpPrivateConfigUpdater, + DeleteableSmtpProperty, SmtpAuthMethod, SmtpConfig, SmtpConfigUpdater, SmtpMode, + SmtpPrivateConfig, SmtpPrivateConfigUpdater, }; use proxmox_notify::endpoints::webhook::{ DeleteableWebhookProperty, WebhookConfig, WebhookConfigUpdater, @@ -141,6 +141,17 @@ pub mod proxmox_rs_notify { api::common::send(&config, ¬ification) } + /// Method: Refresh the state for all endpoints. + /// + /// This iterates through all configured targets, refreshing their state if needed. + /// + /// See [`api::common::refresh_targets`] + #[export(serialize_error)] + pub fn refresh_targets(#[try_from_ref] this: &NotificationConfig) -> Result<(), HttpError> { + let config = this.config.lock().unwrap(); + api::common::refresh_targets(&config) + } + /// Method: Get a list of all notification targets. /// /// See [`api::get_targets`]. @@ -396,6 +407,11 @@ pub mod proxmox_rs_notify { mode: Option<SmtpMode>, username: Option<String>, password: Option<String>, + auth_method: Option<SmtpAuthMethod>, + oauth2_client_id: Option<String>, + oauth2_client_secret: Option<String>, + oauth2_tenant_id: Option<String>, + oauth2_refresh_token: Option<String>, mailto: Option<Vec<String>>, mailto_user: Option<Vec<String>>, from_address: String, @@ -411,7 +427,10 @@ pub mod proxmox_rs_notify { server, port, mode, + auth_method, username, + oauth2_client_id, + oauth2_tenant_id, mailto: mailto.unwrap_or_default(), mailto_user: mailto_user.unwrap_or_default(), from_address, @@ -420,7 +439,12 @@ pub mod proxmox_rs_notify { disable, origin: None, }, - SmtpPrivateConfig { name, password }, + SmtpPrivateConfig { + name, + password, + oauth2_client_secret, + }, + oauth2_refresh_token, ) } @@ -437,6 +461,11 @@ pub mod proxmox_rs_notify { mode: Option<SmtpMode>, username: Option<String>, password: Option<String>, + auth_method: Option<SmtpAuthMethod>, + oauth2_client_id: Option<String>, + oauth2_client_secret: Option<String>, + oauth2_tenant_id: Option<String>, + oauth2_refresh_token: Option<String>, mailto: Option<Vec<String>>, mailto_user: Option<Vec<String>>, from_address: Option<String>, @@ -457,6 +486,9 @@ pub mod proxmox_rs_notify { port, mode, username, + auth_method, + oauth2_client_id, + oauth2_tenant_id, mailto, mailto_user, from_address, @@ -464,7 +496,11 @@ pub mod proxmox_rs_notify { comment, disable, }, - SmtpPrivateConfigUpdater { password }, + SmtpPrivateConfigUpdater { + password, + oauth2_client_secret, + }, + oauth2_refresh_token, delete.as_deref(), digest.as_deref(), ) -- 2.47.3
