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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>When included in a receipt rule, this action rejects the received email by returning a bounce response to the sender and, optionally, publishes a notification to Amazon Simple Notification Service (Amazon SNS).</p>
/// <p>For information about sending a bounce message in response to a received email, see the <a href="https://docs.aws.amazon.com/ses/latest/dg/receiving-email-action-bounce.html">Amazon SES Developer Guide</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct BounceAction {
/// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the bounce action is taken. You can find the ARN of a topic by using the <a href="https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html">ListTopics</a> operation in Amazon SNS.</p>
/// <p>For more information about Amazon SNS topics, see the <a href="https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html">Amazon SNS Developer Guide</a>.</p>
pub topic_arn: ::std::option::Option<::std::string::String>,
/// <p>The SMTP reply code, as defined by <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a>.</p>
pub smtp_reply_code: ::std::string::String,
/// <p>The SMTP enhanced status code, as defined by <a href="https://tools.ietf.org/html/rfc3463">RFC 3463</a>.</p>
pub status_code: ::std::option::Option<::std::string::String>,
/// <p>Human-readable text to include in the bounce message.</p>
pub message: ::std::string::String,
/// <p>The email address of the sender of the bounced email. This is the address from which the bounce message is sent.</p>
pub sender: ::std::string::String,
}
impl BounceAction {
/// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the bounce action is taken. You can find the ARN of a topic by using the <a href="https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html">ListTopics</a> operation in Amazon SNS.</p>
/// <p>For more information about Amazon SNS topics, see the <a href="https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html">Amazon SNS Developer Guide</a>.</p>
pub fn topic_arn(&self) -> ::std::option::Option<&str> {
self.topic_arn.as_deref()
}
/// <p>The SMTP reply code, as defined by <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a>.</p>
pub fn smtp_reply_code(&self) -> &str {
use std::ops::Deref;
self.smtp_reply_code.deref()
}
/// <p>The SMTP enhanced status code, as defined by <a href="https://tools.ietf.org/html/rfc3463">RFC 3463</a>.</p>
pub fn status_code(&self) -> ::std::option::Option<&str> {
self.status_code.as_deref()
}
/// <p>Human-readable text to include in the bounce message.</p>
pub fn message(&self) -> &str {
use std::ops::Deref;
self.message.deref()
}
/// <p>The email address of the sender of the bounced email. This is the address from which the bounce message is sent.</p>
pub fn sender(&self) -> &str {
use std::ops::Deref;
self.sender.deref()
}
}
impl BounceAction {
/// Creates a new builder-style object to manufacture [`BounceAction`](crate::types::BounceAction).
pub fn builder() -> crate::types::builders::BounceActionBuilder {
crate::types::builders::BounceActionBuilder::default()
}
}
/// A builder for [`BounceAction`](crate::types::BounceAction).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct BounceActionBuilder {
pub(crate) topic_arn: ::std::option::Option<::std::string::String>,
pub(crate) smtp_reply_code: ::std::option::Option<::std::string::String>,
pub(crate) status_code: ::std::option::Option<::std::string::String>,
pub(crate) message: ::std::option::Option<::std::string::String>,
pub(crate) sender: ::std::option::Option<::std::string::String>,
}
impl BounceActionBuilder {
/// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the bounce action is taken. You can find the ARN of a topic by using the <a href="https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html">ListTopics</a> operation in Amazon SNS.</p>
/// <p>For more information about Amazon SNS topics, see the <a href="https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html">Amazon SNS Developer Guide</a>.</p>
pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.topic_arn = ::std::option::Option::Some(input.into());
self
}
/// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the bounce action is taken. You can find the ARN of a topic by using the <a href="https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html">ListTopics</a> operation in Amazon SNS.</p>
/// <p>For more information about Amazon SNS topics, see the <a href="https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html">Amazon SNS Developer Guide</a>.</p>
pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.topic_arn = input;
self
}
/// <p>The Amazon Resource Name (ARN) of the Amazon SNS topic to notify when the bounce action is taken. You can find the ARN of a topic by using the <a href="https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html">ListTopics</a> operation in Amazon SNS.</p>
/// <p>For more information about Amazon SNS topics, see the <a href="https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html">Amazon SNS Developer Guide</a>.</p>
pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.topic_arn
}
/// <p>The SMTP reply code, as defined by <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a>.</p>
/// This field is required.
pub fn smtp_reply_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.smtp_reply_code = ::std::option::Option::Some(input.into());
self
}
/// <p>The SMTP reply code, as defined by <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a>.</p>
pub fn set_smtp_reply_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.smtp_reply_code = input;
self
}
/// <p>The SMTP reply code, as defined by <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a>.</p>
pub fn get_smtp_reply_code(&self) -> &::std::option::Option<::std::string::String> {
&self.smtp_reply_code
}
/// <p>The SMTP enhanced status code, as defined by <a href="https://tools.ietf.org/html/rfc3463">RFC 3463</a>.</p>
pub fn status_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.status_code = ::std::option::Option::Some(input.into());
self
}
/// <p>The SMTP enhanced status code, as defined by <a href="https://tools.ietf.org/html/rfc3463">RFC 3463</a>.</p>
pub fn set_status_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.status_code = input;
self
}
/// <p>The SMTP enhanced status code, as defined by <a href="https://tools.ietf.org/html/rfc3463">RFC 3463</a>.</p>
pub fn get_status_code(&self) -> &::std::option::Option<::std::string::String> {
&self.status_code
}
/// <p>Human-readable text to include in the bounce message.</p>
/// This field is required.
pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.message = ::std::option::Option::Some(input.into());
self
}
/// <p>Human-readable text to include in the bounce message.</p>
pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.message = input;
self
}
/// <p>Human-readable text to include in the bounce message.</p>
pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
&self.message
}
/// <p>The email address of the sender of the bounced email. This is the address from which the bounce message is sent.</p>
/// This field is required.
pub fn sender(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.sender = ::std::option::Option::Some(input.into());
self
}
/// <p>The email address of the sender of the bounced email. This is the address from which the bounce message is sent.</p>
pub fn set_sender(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.sender = input;
self
}
/// <p>The email address of the sender of the bounced email. This is the address from which the bounce message is sent.</p>
pub fn get_sender(&self) -> &::std::option::Option<::std::string::String> {
&self.sender
}
/// Consumes the builder and constructs a [`BounceAction`](crate::types::BounceAction).
/// This method will fail if any of the following fields are not set:
/// - [`smtp_reply_code`](crate::types::builders::BounceActionBuilder::smtp_reply_code)
/// - [`message`](crate::types::builders::BounceActionBuilder::message)
/// - [`sender`](crate::types::builders::BounceActionBuilder::sender)
pub fn build(self) -> ::std::result::Result<crate::types::BounceAction, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::BounceAction {
topic_arn: self.topic_arn,
smtp_reply_code: self.smtp_reply_code.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"smtp_reply_code",
"smtp_reply_code was not specified but it is required when building BounceAction",
)
})?,
status_code: self.status_code,
message: self.message.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"message",
"message was not specified but it is required when building BounceAction",
)
})?,
sender: self.sender.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"sender",
"sender was not specified but it is required when building BounceAction",
)
})?,
})
}
}