icinga2_api/api/query/monitoring_objects/
notification.rs1crate::types::query::query_with_joins!(
4 ListNotifications,
5 ListNotificationsBuilder,
6 monitoring_objects,
7 notification,
8 IcingaNotification,
9 IcingaNotificationJoinTypes,
10 IcingaNotificationJoins,
11 IcingaObjectType::Notification,
12 "v1/objects/notifications"
13);
14
15#[cfg(test)]
16mod test {
17 use super::*;
18 use std::error::Error;
19 use tracing_test::traced_test;
20
21 use crate::{
22 api::blocking::Icinga2,
23 types::{join_types::IcingaJoins, metadata::IcingaMetadataType},
24 };
25
26 #[traced_test]
27 #[test]
28 fn test_notifications() -> Result<(), Box<dyn Error>> {
29 dotenvy::dotenv()?;
30 let icinga2 = Icinga2::from_config_file(std::path::Path::new(&std::env::var(
31 "ICINGA_TEST_INSTANCE_CONFIG",
32 )?))?;
33 let api_endpoint = ListNotifications::builder()
34 .joins(IcingaJoins::AllJoins)
35 .meta([IcingaMetadataType::UsedBy, IcingaMetadataType::Location])
36 .build()?;
37 let _: ResultsWrapper<
38 QueryResultObjectWithJoins<IcingaNotification, IcingaNotificationJoins>,
39 > = icinga2.rest(api_endpoint)?;
40 Ok(())
41 }
42}