Skip to main content

nominal_api/conjure/objects/scout/integrations/api/
notification_configuration.rs

1/// Configuration details to send notifications to a linked integration.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct NotificationConfiguration {
17    #[serde(rename = "integrationRid")]
18    integration_rid: super::IntegrationRid,
19    #[builder(default, into)]
20    #[serde(
21        rename = "notificationFilters",
22        skip_serializing_if = "Option::is_none",
23        default
24    )]
25    notification_filters: Option<std::collections::BTreeSet<super::NotificationFilter>>,
26    #[builder(default, into)]
27    #[serde(
28        rename = "appendedWorkbookRid",
29        skip_serializing_if = "Option::is_none",
30        default
31    )]
32    appended_workbook_rid: Option<super::super::super::rids::api::NotebookRid>,
33    #[builder(default, list(item(type = String, into)))]
34    #[serde(rename = "tags", skip_serializing_if = "Vec::is_empty", default)]
35    tags: Vec<String>,
36    #[builder(default, into)]
37    #[serde(rename = "muteUntil", skip_serializing_if = "Option::is_none", default)]
38    mute_until: Option<conjure_object::DateTime<conjure_object::Utc>>,
39}
40impl NotificationConfiguration {
41    /// Constructs a new instance of the type.
42    #[inline]
43    pub fn new(integration_rid: super::IntegrationRid) -> Self {
44        Self::builder().integration_rid(integration_rid).build()
45    }
46    #[inline]
47    pub fn integration_rid(&self) -> &super::IntegrationRid {
48        &self.integration_rid
49    }
50    /// Specifies the type of notifications to filter. If not provided, all notifications are sent.
51    #[inline]
52    pub fn notification_filters(
53        &self,
54    ) -> Option<&std::collections::BTreeSet<super::NotificationFilter>> {
55        self.notification_filters.as_ref().map(|o| &*o)
56    }
57    /// If provided, appends a link to the workbook specified by the RID to the notification.
58    #[inline]
59    pub fn appended_workbook_rid(
60        &self,
61    ) -> Option<&super::super::super::rids::api::NotebookRid> {
62        self.appended_workbook_rid.as_ref().map(|o| &*o)
63    }
64    /// 20 tags max, 50 characters max each. Tags are used to filter messages in Opsgenie. For other integrations, tags are ignored.
65    #[inline]
66    pub fn tags(&self) -> &[String] {
67        &*self.tags
68    }
69    /// If provided, all notifications for this channel are suppressed until the specified time.
70    /// The streaming checklist continues to evaluate, but no notifications are sent.
71    /// Once the time has passed, notifications resume automatically.
72    #[inline]
73    pub fn mute_until(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
74        self.mute_until.as_ref().map(|o| *o)
75    }
76}