mirror of
https://git.proxmox.com/git/proxmox-perl-rs
synced 2025-07-25 21:43:39 +00:00
common: notify: add bindings for get_targets
This allows us to drop the impl of that function on the perl side. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
This commit is contained in:
parent
7747ac46de
commit
21886bb2ac
@ -27,6 +27,7 @@ mod export {
|
|||||||
MatcherConfigUpdater, SeverityMatcher,
|
MatcherConfigUpdater, SeverityMatcher,
|
||||||
};
|
};
|
||||||
use proxmox_notify::{api, Config, Notification, Severity};
|
use proxmox_notify::{api, Config, Notification, Severity};
|
||||||
|
use proxmox_notify::api::Target;
|
||||||
|
|
||||||
pub struct NotificationConfig {
|
pub struct NotificationConfig {
|
||||||
config: Mutex<Config>,
|
config: Mutex<Config>,
|
||||||
@ -112,6 +113,14 @@ mod export {
|
|||||||
api::common::send(&config, ¬ification)
|
api::common::send(&config, ¬ification)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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)]
|
#[export(serialize_error)]
|
||||||
fn test_target(
|
fn test_target(
|
||||||
#[try_from_ref] this: &NotificationConfig,
|
#[try_from_ref] this: &NotificationConfig,
|
||||||
|
Loading…
Reference in New Issue
Block a user