icinga2_api/api/query/monitoring_objects/
notification_command.rs

1//! Icinga2 notification commands
2
3crate::types::query::query!(
4    ListNotificationCommands,
5    ListNotificationCommandsBuilder,
6    monitoring_objects,
7    notification_command,
8    IcingaNotificationCommand,
9    IcingaObjectType::NotificationCommand,
10    "v1/objects/notificationcommands"
11);
12
13#[cfg(test)]
14mod test {
15    use super::*;
16    use crate::{api::blocking::Icinga2, types::metadata::IcingaMetadataType};
17    use std::error::Error;
18    use tracing_test::traced_test;
19
20    #[traced_test]
21    #[test]
22    fn test_notification_commands() -> Result<(), Box<dyn Error>> {
23        dotenvy::dotenv()?;
24        let icinga2 = Icinga2::from_config_file(std::path::Path::new(&std::env::var(
25            "ICINGA_TEST_INSTANCE_CONFIG",
26        )?))?;
27        let api_endpoint = ListNotificationCommands::builder()
28            .meta([IcingaMetadataType::UsedBy, IcingaMetadataType::Location])
29            .build()?;
30        let _: ResultsWrapper<QueryResultObject<IcingaNotificationCommand>> =
31            icinga2.rest(api_endpoint)?;
32        Ok(())
33    }
34}