[pve-devel] [pbs-devel] [PATCH proxmox-perl-rs v2 04/12] common: notify: add bindings for get_targets

Max Carrara m.carrara at proxmox.com
Wed Jul 17 17:36:02 CEST 2024


And missed `cargo fmt` here too ;)

On Fri Jul 12, 2024 at 1:27 PM CEST, Lukas Wagner wrote:
> This allows us to drop the impl of that function on the perl side.
>
> Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
> ---
>  common/src/notify.rs | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/common/src/notify.rs b/common/src/notify.rs
> index fe192d5..0f8a35d 100644
> --- a/common/src/notify.rs
> +++ b/common/src/notify.rs
> @@ -27,6 +27,7 @@ mod export {
>          MatcherConfigUpdater, SeverityMatcher,
>      };
>      use proxmox_notify::{api, Config, Notification, Severity};
> +    use proxmox_notify::api::Target;
>  
>      pub struct NotificationConfig {
>          config: Mutex<Config>,
> @@ -112,6 +113,14 @@ mod export {
>          api::common::send(&config, &notification)
>      }
>  
> +    #[export(serialize_error)]
> +    fn get_targets(
> +        #[try_from_ref] this: &NotificationConfig,
> +    ) -> Result<Vec<Target>, HttpError> {
> +        let config = this.config.lock().unwrap();
> +        api::get_targets(&config)
> +    }
> +
>      #[export(serialize_error)]
>      fn test_target(
>          #[try_from_ref] this: &NotificationConfig,





More information about the pve-devel mailing list