Skip to main content

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

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct SendMessageRequest {
16    #[builder(default, into)]
17    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
18    title: Option<String>,
19    #[builder(into)]
20    #[serde(rename = "message")]
21    message: String,
22    #[builder(default, list(item(type = String, into)))]
23    #[serde(rename = "tags", skip_serializing_if = "Vec::is_empty", default)]
24    tags: Vec<String>,
25    #[builder(default, into)]
26    #[serde(rename = "opsGenieAlias", skip_serializing_if = "Option::is_none", default)]
27    ops_genie_alias: Option<String>,
28    #[serde(rename = "integrationRid")]
29    integration_rid: super::IntegrationRid,
30    #[builder(default, into)]
31    #[serde(rename = "priority", skip_serializing_if = "Option::is_none", default)]
32    priority: Option<super::super::super::api::Priority>,
33}
34impl SendMessageRequest {
35    /// Constructs a new instance of the type.
36    #[inline]
37    pub fn new(
38        message: impl Into<String>,
39        integration_rid: super::IntegrationRid,
40    ) -> Self {
41        Self::builder().message(message).integration_rid(integration_rid).build()
42    }
43    /// Optional title for the message. 130 characters max.
44    #[inline]
45    pub fn title(&self) -> Option<&str> {
46        self.title.as_ref().map(|o| &**o)
47    }
48    #[inline]
49    pub fn message(&self) -> &str {
50        &*self.message
51    }
52    /// 20 tags max, 50 characters max each. Tags are used to filter messages in Opsgenie. For other integrations, tags are ignored.
53    #[inline]
54    pub fn tags(&self) -> &[String] {
55        &*self.tags
56    }
57    /// Alias to use for the Opsgenie alert deduplication. 512 characters max.
58    #[inline]
59    pub fn ops_genie_alias(&self) -> Option<&str> {
60        self.ops_genie_alias.as_ref().map(|o| &**o)
61    }
62    #[inline]
63    pub fn integration_rid(&self) -> &super::IntegrationRid {
64        &self.integration_rid
65    }
66    #[inline]
67    pub fn priority(&self) -> Option<&super::super::super::api::Priority> {
68        self.priority.as_ref().map(|o| &*o)
69    }
70}