1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Specifies the default message for all channels.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DefaultMessage {
/// <p>The default body of the message.</p>
#[doc(hidden)]
pub body: std::option::Option<std::string::String>,
/// <p>The default message variables to use in the message. You can override these default variables with individual address variables.</p>
#[doc(hidden)]
pub substitutions: std::option::Option<
std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>,
>,
}
impl DefaultMessage {
/// <p>The default body of the message.</p>
pub fn body(&self) -> std::option::Option<&str> {
self.body.as_deref()
}
/// <p>The default message variables to use in the message. You can override these default variables with individual address variables.</p>
pub fn substitutions(
&self,
) -> std::option::Option<
&std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>,
> {
self.substitutions.as_ref()
}
}
impl DefaultMessage {
/// Creates a new builder-style object to manufacture [`DefaultMessage`](crate::types::DefaultMessage).
pub fn builder() -> crate::types::builders::DefaultMessageBuilder {
crate::types::builders::DefaultMessageBuilder::default()
}
}
/// A builder for [`DefaultMessage`](crate::types::DefaultMessage).
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct DefaultMessageBuilder {
pub(crate) body: std::option::Option<std::string::String>,
pub(crate) substitutions: std::option::Option<
std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>,
>,
}
impl DefaultMessageBuilder {
/// <p>The default body of the message.</p>
pub fn body(mut self, input: impl Into<std::string::String>) -> Self {
self.body = Some(input.into());
self
}
/// <p>The default body of the message.</p>
pub fn set_body(mut self, input: std::option::Option<std::string::String>) -> Self {
self.body = input;
self
}
/// Adds a key-value pair to `substitutions`.
///
/// To override the contents of this collection use [`set_substitutions`](Self::set_substitutions).
///
/// <p>The default message variables to use in the message. You can override these default variables with individual address variables.</p>
pub fn substitutions(
mut self,
k: impl Into<std::string::String>,
v: std::vec::Vec<std::string::String>,
) -> Self {
let mut hash_map = self.substitutions.unwrap_or_default();
hash_map.insert(k.into(), v);
self.substitutions = Some(hash_map);
self
}
/// <p>The default message variables to use in the message. You can override these default variables with individual address variables.</p>
pub fn set_substitutions(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>,
>,
) -> Self {
self.substitutions = input;
self
}
/// Consumes the builder and constructs a [`DefaultMessage`](crate::types::DefaultMessage).
pub fn build(self) -> crate::types::DefaultMessage {
crate::types::DefaultMessage {
body: self.body,
substitutions: self.substitutions,
}
}
}