aws_sdk_sesv2/operation/send_email/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::send_email::_send_email_output::SendEmailOutputBuilder;
3
4pub use crate::operation::send_email::_send_email_input::SendEmailInputBuilder;
5
6impl crate::operation::send_email::builders::SendEmailInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::send_email::SendEmailOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::send_email::SendEmailError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.send_email();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `SendEmail`.
24///
25/// <p>Sends an email message. You can use the Amazon SES API v2 to send the following types of messages:</p>
26/// <ul>
27/// <li>
28/// <p><b>Simple</b> – A standard email message. When you create this type of message, you specify the sender, the recipient, and the message body, and Amazon SES assembles the message for you.</p></li>
29/// <li>
30/// <p><b>Raw</b> – A raw, MIME-formatted email message. When you send this type of email, you have to specify all of the message headers, as well as the message body. You can use this message type to send messages that contain attachments. The message that you specify has to be a valid MIME message.</p></li>
31/// <li>
32/// <p><b>Templated</b> – A message that contains personalization tags. When you send this type of email, Amazon SES API v2 automatically replaces the tags with values that you specify.</p></li>
33/// </ul>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct SendEmailFluentBuilder {
36 handle: ::std::sync::Arc<crate::client::Handle>,
37 inner: crate::operation::send_email::builders::SendEmailInputBuilder,
38 config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl crate::client::customize::internal::CustomizableSend<crate::operation::send_email::SendEmailOutput, crate::operation::send_email::SendEmailError>
41 for SendEmailFluentBuilder
42{
43 fn send(
44 self,
45 config_override: crate::config::Builder,
46 ) -> crate::client::customize::internal::BoxFuture<
47 crate::client::customize::internal::SendResult<crate::operation::send_email::SendEmailOutput, crate::operation::send_email::SendEmailError>,
48 > {
49 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50 }
51}
52impl SendEmailFluentBuilder {
53 /// Creates a new `SendEmailFluentBuilder`.
54 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55 Self {
56 handle,
57 inner: ::std::default::Default::default(),
58 config_override: ::std::option::Option::None,
59 }
60 }
61 /// Access the SendEmail as a reference.
62 pub fn as_input(&self) -> &crate::operation::send_email::builders::SendEmailInputBuilder {
63 &self.inner
64 }
65 /// Sends the request and returns the response.
66 ///
67 /// If an error occurs, an `SdkError` will be returned with additional details that
68 /// can be matched against.
69 ///
70 /// By default, any retryable failures will be retried twice. Retry behavior
71 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72 /// set when configuring the client.
73 pub async fn send(
74 self,
75 ) -> ::std::result::Result<
76 crate::operation::send_email::SendEmailOutput,
77 ::aws_smithy_runtime_api::client::result::SdkError<
78 crate::operation::send_email::SendEmailError,
79 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80 >,
81 > {
82 let input = self
83 .inner
84 .build()
85 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86 let runtime_plugins = crate::operation::send_email::SendEmail::operation_runtime_plugins(
87 self.handle.runtime_plugins.clone(),
88 &self.handle.conf,
89 self.config_override,
90 );
91 crate::operation::send_email::SendEmail::orchestrate(&runtime_plugins, input).await
92 }
93
94 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95 pub fn customize(
96 self,
97 ) -> crate::client::customize::CustomizableOperation<
98 crate::operation::send_email::SendEmailOutput,
99 crate::operation::send_email::SendEmailError,
100 Self,
101 > {
102 crate::client::customize::CustomizableOperation::new(self)
103 }
104 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105 self.set_config_override(::std::option::Option::Some(config_override.into()));
106 self
107 }
108
109 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110 self.config_override = config_override;
111 self
112 }
113 /// <p>The email address to use as the "From" address for the email. The address that you specify has to be verified.</p>
114 pub fn from_email_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.from_email_address(input.into());
116 self
117 }
118 /// <p>The email address to use as the "From" address for the email. The address that you specify has to be verified.</p>
119 pub fn set_from_email_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120 self.inner = self.inner.set_from_email_address(input);
121 self
122 }
123 /// <p>The email address to use as the "From" address for the email. The address that you specify has to be verified.</p>
124 pub fn get_from_email_address(&self) -> &::std::option::Option<::std::string::String> {
125 self.inner.get_from_email_address()
126 }
127 /// <p>This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the <code>FromEmailAddress</code> parameter.</p>
128 /// <p>For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use sender@example.com, then you would specify the <code>FromEmailAddressIdentityArn</code> to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the <code>FromEmailAddress</code> to be sender@example.com.</p>
129 /// <p>For more information about sending authorization, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html">Amazon SES Developer Guide</a>.</p>
130 /// <p>For Raw emails, the <code>FromEmailAddressIdentityArn</code> value overrides the X-SES-SOURCE-ARN and X-SES-FROM-ARN headers specified in raw email message content.</p>
131 pub fn from_email_address_identity_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132 self.inner = self.inner.from_email_address_identity_arn(input.into());
133 self
134 }
135 /// <p>This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the <code>FromEmailAddress</code> parameter.</p>
136 /// <p>For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use sender@example.com, then you would specify the <code>FromEmailAddressIdentityArn</code> to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the <code>FromEmailAddress</code> to be sender@example.com.</p>
137 /// <p>For more information about sending authorization, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html">Amazon SES Developer Guide</a>.</p>
138 /// <p>For Raw emails, the <code>FromEmailAddressIdentityArn</code> value overrides the X-SES-SOURCE-ARN and X-SES-FROM-ARN headers specified in raw email message content.</p>
139 pub fn set_from_email_address_identity_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.inner = self.inner.set_from_email_address_identity_arn(input);
141 self
142 }
143 /// <p>This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the <code>FromEmailAddress</code> parameter.</p>
144 /// <p>For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use sender@example.com, then you would specify the <code>FromEmailAddressIdentityArn</code> to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the <code>FromEmailAddress</code> to be sender@example.com.</p>
145 /// <p>For more information about sending authorization, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html">Amazon SES Developer Guide</a>.</p>
146 /// <p>For Raw emails, the <code>FromEmailAddressIdentityArn</code> value overrides the X-SES-SOURCE-ARN and X-SES-FROM-ARN headers specified in raw email message content.</p>
147 pub fn get_from_email_address_identity_arn(&self) -> &::std::option::Option<::std::string::String> {
148 self.inner.get_from_email_address_identity_arn()
149 }
150 /// <p>An object that contains the recipients of the email message.</p>
151 pub fn destination(mut self, input: crate::types::Destination) -> Self {
152 self.inner = self.inner.destination(input);
153 self
154 }
155 /// <p>An object that contains the recipients of the email message.</p>
156 pub fn set_destination(mut self, input: ::std::option::Option<crate::types::Destination>) -> Self {
157 self.inner = self.inner.set_destination(input);
158 self
159 }
160 /// <p>An object that contains the recipients of the email message.</p>
161 pub fn get_destination(&self) -> &::std::option::Option<crate::types::Destination> {
162 self.inner.get_destination()
163 }
164 ///
165 /// Appends an item to `ReplyToAddresses`.
166 ///
167 /// To override the contents of this collection use [`set_reply_to_addresses`](Self::set_reply_to_addresses).
168 ///
169 /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
170 pub fn reply_to_addresses(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171 self.inner = self.inner.reply_to_addresses(input.into());
172 self
173 }
174 /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
175 pub fn set_reply_to_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
176 self.inner = self.inner.set_reply_to_addresses(input);
177 self
178 }
179 /// <p>The "Reply-to" email addresses for the message. When the recipient replies to the message, each Reply-to address receives the reply.</p>
180 pub fn get_reply_to_addresses(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
181 self.inner.get_reply_to_addresses()
182 }
183 /// <p>The address that you want bounce and complaint notifications to be sent to.</p>
184 pub fn feedback_forwarding_email_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
185 self.inner = self.inner.feedback_forwarding_email_address(input.into());
186 self
187 }
188 /// <p>The address that you want bounce and complaint notifications to be sent to.</p>
189 pub fn set_feedback_forwarding_email_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190 self.inner = self.inner.set_feedback_forwarding_email_address(input);
191 self
192 }
193 /// <p>The address that you want bounce and complaint notifications to be sent to.</p>
194 pub fn get_feedback_forwarding_email_address(&self) -> &::std::option::Option<::std::string::String> {
195 self.inner.get_feedback_forwarding_email_address()
196 }
197 /// <p>This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the <code>FeedbackForwardingEmailAddress</code> parameter.</p>
198 /// <p>For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the <code>FeedbackForwardingEmailAddressIdentityArn</code> to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the <code>FeedbackForwardingEmailAddress</code> to be feedback@example.com.</p>
199 /// <p>For more information about sending authorization, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html">Amazon SES Developer Guide</a>.</p>
200 pub fn feedback_forwarding_email_address_identity_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201 self.inner = self.inner.feedback_forwarding_email_address_identity_arn(input.into());
202 self
203 }
204 /// <p>This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the <code>FeedbackForwardingEmailAddress</code> parameter.</p>
205 /// <p>For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the <code>FeedbackForwardingEmailAddressIdentityArn</code> to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the <code>FeedbackForwardingEmailAddress</code> to be feedback@example.com.</p>
206 /// <p>For more information about sending authorization, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html">Amazon SES Developer Guide</a>.</p>
207 pub fn set_feedback_forwarding_email_address_identity_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
208 self.inner = self.inner.set_feedback_forwarding_email_address_identity_arn(input);
209 self
210 }
211 /// <p>This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the <code>FeedbackForwardingEmailAddress</code> parameter.</p>
212 /// <p>For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the <code>FeedbackForwardingEmailAddressIdentityArn</code> to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the <code>FeedbackForwardingEmailAddress</code> to be feedback@example.com.</p>
213 /// <p>For more information about sending authorization, see the <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-authorization.html">Amazon SES Developer Guide</a>.</p>
214 pub fn get_feedback_forwarding_email_address_identity_arn(&self) -> &::std::option::Option<::std::string::String> {
215 self.inner.get_feedback_forwarding_email_address_identity_arn()
216 }
217 /// <p>An object that contains the body of the message. You can send either a Simple message, Raw message, or a Templated message.</p>
218 pub fn content(mut self, input: crate::types::EmailContent) -> Self {
219 self.inner = self.inner.content(input);
220 self
221 }
222 /// <p>An object that contains the body of the message. You can send either a Simple message, Raw message, or a Templated message.</p>
223 pub fn set_content(mut self, input: ::std::option::Option<crate::types::EmailContent>) -> Self {
224 self.inner = self.inner.set_content(input);
225 self
226 }
227 /// <p>An object that contains the body of the message. You can send either a Simple message, Raw message, or a Templated message.</p>
228 pub fn get_content(&self) -> &::std::option::Option<crate::types::EmailContent> {
229 self.inner.get_content()
230 }
231 ///
232 /// Appends an item to `EmailTags`.
233 ///
234 /// To override the contents of this collection use [`set_email_tags`](Self::set_email_tags).
235 ///
236 /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
237 pub fn email_tags(mut self, input: crate::types::MessageTag) -> Self {
238 self.inner = self.inner.email_tags(input);
239 self
240 }
241 /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
242 pub fn set_email_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MessageTag>>) -> Self {
243 self.inner = self.inner.set_email_tags(input);
244 self
245 }
246 /// <p>A list of tags, in the form of name/value pairs, to apply to an email that you send using the <code>SendEmail</code> operation. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.</p>
247 pub fn get_email_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MessageTag>> {
248 self.inner.get_email_tags()
249 }
250 /// <p>The name of the configuration set to use when sending the email.</p>
251 pub fn configuration_set_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
252 self.inner = self.inner.configuration_set_name(input.into());
253 self
254 }
255 /// <p>The name of the configuration set to use when sending the email.</p>
256 pub fn set_configuration_set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
257 self.inner = self.inner.set_configuration_set_name(input);
258 self
259 }
260 /// <p>The name of the configuration set to use when sending the email.</p>
261 pub fn get_configuration_set_name(&self) -> &::std::option::Option<::std::string::String> {
262 self.inner.get_configuration_set_name()
263 }
264 /// <p>The ID of the multi-region endpoint (global-endpoint).</p>
265 pub fn endpoint_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
266 self.inner = self.inner.endpoint_id(input.into());
267 self
268 }
269 /// <p>The ID of the multi-region endpoint (global-endpoint).</p>
270 pub fn set_endpoint_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
271 self.inner = self.inner.set_endpoint_id(input);
272 self
273 }
274 /// <p>The ID of the multi-region endpoint (global-endpoint).</p>
275 pub fn get_endpoint_id(&self) -> &::std::option::Option<::std::string::String> {
276 self.inner.get_endpoint_id()
277 }
278 /// <p>The name of the tenant through which this email will be sent.</p><note>
279 /// <p>The email sending operation will only succeed if all referenced resources (identities, configuration sets, and templates) are associated with this tenant.</p>
280 /// </note>
281 pub fn tenant_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
282 self.inner = self.inner.tenant_name(input.into());
283 self
284 }
285 /// <p>The name of the tenant through which this email will be sent.</p><note>
286 /// <p>The email sending operation will only succeed if all referenced resources (identities, configuration sets, and templates) are associated with this tenant.</p>
287 /// </note>
288 pub fn set_tenant_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
289 self.inner = self.inner.set_tenant_name(input);
290 self
291 }
292 /// <p>The name of the tenant through which this email will be sent.</p><note>
293 /// <p>The email sending operation will only succeed if all referenced resources (identities, configuration sets, and templates) are associated with this tenant.</p>
294 /// </note>
295 pub fn get_tenant_name(&self) -> &::std::option::Option<::std::string::String> {
296 self.inner.get_tenant_name()
297 }
298 /// <p>An object used to specify a list or topic to which an email belongs, which will be used when a contact chooses to unsubscribe.</p>
299 pub fn list_management_options(mut self, input: crate::types::ListManagementOptions) -> Self {
300 self.inner = self.inner.list_management_options(input);
301 self
302 }
303 /// <p>An object used to specify a list or topic to which an email belongs, which will be used when a contact chooses to unsubscribe.</p>
304 pub fn set_list_management_options(mut self, input: ::std::option::Option<crate::types::ListManagementOptions>) -> Self {
305 self.inner = self.inner.set_list_management_options(input);
306 self
307 }
308 /// <p>An object used to specify a list or topic to which an email belongs, which will be used when a contact chooses to unsubscribe.</p>
309 pub fn get_list_management_options(&self) -> &::std::option::Option<crate::types::ListManagementOptions> {
310 self.inner.get_list_management_options()
311 }
312}