aws_sdk_pinpointemail/types/_mail_from_attributes.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A list of attributes that are associated with a MAIL FROM domain.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct MailFromAttributes {
7 /// <p>The name of a domain that an email identity uses as a custom MAIL FROM domain.</p>
8 pub mail_from_domain: ::std::string::String,
9 /// <p>The status of the MAIL FROM domain. This status can have the following values:</p>
10 /// <ul>
11 /// <li>
12 /// <p><code>PENDING</code> – Amazon Pinpoint hasn't started searching for the MX record yet.</p></li>
13 /// <li>
14 /// <p><code>SUCCESS</code> – Amazon Pinpoint detected the required MX record for the MAIL FROM domain.</p></li>
15 /// <li>
16 /// <p><code>FAILED</code> – Amazon Pinpoint can't find the required MX record, or the record no longer exists.</p></li>
17 /// <li>
18 /// <p><code>TEMPORARY_FAILURE</code> – A temporary issue occurred, which prevented Amazon Pinpoint from determining the status of the MAIL FROM domain.</p></li>
19 /// </ul>
20 pub mail_from_domain_status: crate::types::MailFromDomainStatus,
21 /// <p>The action that Amazon Pinpoint to takes if it can't read the required MX record for a custom MAIL FROM domain. When you set this value to <code>UseDefaultValue</code>, Amazon Pinpoint uses <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>RejectMessage</code>, Amazon Pinpoint returns a <code>MailFromDomainNotVerified</code> error, and doesn't attempt to deliver the email.</p>
22 /// <p>These behaviors are taken when the custom MAIL FROM domain configuration is in the <code>Pending</code>, <code>Failed</code>, and <code>TemporaryFailure</code> states.</p>
23 pub behavior_on_mx_failure: crate::types::BehaviorOnMxFailure,
24}
25impl MailFromAttributes {
26 /// <p>The name of a domain that an email identity uses as a custom MAIL FROM domain.</p>
27 pub fn mail_from_domain(&self) -> &str {
28 use std::ops::Deref;
29 self.mail_from_domain.deref()
30 }
31 /// <p>The status of the MAIL FROM domain. This status can have the following values:</p>
32 /// <ul>
33 /// <li>
34 /// <p><code>PENDING</code> – Amazon Pinpoint hasn't started searching for the MX record yet.</p></li>
35 /// <li>
36 /// <p><code>SUCCESS</code> – Amazon Pinpoint detected the required MX record for the MAIL FROM domain.</p></li>
37 /// <li>
38 /// <p><code>FAILED</code> – Amazon Pinpoint can't find the required MX record, or the record no longer exists.</p></li>
39 /// <li>
40 /// <p><code>TEMPORARY_FAILURE</code> – A temporary issue occurred, which prevented Amazon Pinpoint from determining the status of the MAIL FROM domain.</p></li>
41 /// </ul>
42 pub fn mail_from_domain_status(&self) -> &crate::types::MailFromDomainStatus {
43 &self.mail_from_domain_status
44 }
45 /// <p>The action that Amazon Pinpoint to takes if it can't read the required MX record for a custom MAIL FROM domain. When you set this value to <code>UseDefaultValue</code>, Amazon Pinpoint uses <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>RejectMessage</code>, Amazon Pinpoint returns a <code>MailFromDomainNotVerified</code> error, and doesn't attempt to deliver the email.</p>
46 /// <p>These behaviors are taken when the custom MAIL FROM domain configuration is in the <code>Pending</code>, <code>Failed</code>, and <code>TemporaryFailure</code> states.</p>
47 pub fn behavior_on_mx_failure(&self) -> &crate::types::BehaviorOnMxFailure {
48 &self.behavior_on_mx_failure
49 }
50}
51impl MailFromAttributes {
52 /// Creates a new builder-style object to manufacture [`MailFromAttributes`](crate::types::MailFromAttributes).
53 pub fn builder() -> crate::types::builders::MailFromAttributesBuilder {
54 crate::types::builders::MailFromAttributesBuilder::default()
55 }
56}
57
58/// A builder for [`MailFromAttributes`](crate::types::MailFromAttributes).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct MailFromAttributesBuilder {
62 pub(crate) mail_from_domain: ::std::option::Option<::std::string::String>,
63 pub(crate) mail_from_domain_status: ::std::option::Option<crate::types::MailFromDomainStatus>,
64 pub(crate) behavior_on_mx_failure: ::std::option::Option<crate::types::BehaviorOnMxFailure>,
65}
66impl MailFromAttributesBuilder {
67 /// <p>The name of a domain that an email identity uses as a custom MAIL FROM domain.</p>
68 /// This field is required.
69 pub fn mail_from_domain(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70 self.mail_from_domain = ::std::option::Option::Some(input.into());
71 self
72 }
73 /// <p>The name of a domain that an email identity uses as a custom MAIL FROM domain.</p>
74 pub fn set_mail_from_domain(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75 self.mail_from_domain = input;
76 self
77 }
78 /// <p>The name of a domain that an email identity uses as a custom MAIL FROM domain.</p>
79 pub fn get_mail_from_domain(&self) -> &::std::option::Option<::std::string::String> {
80 &self.mail_from_domain
81 }
82 /// <p>The status of the MAIL FROM domain. This status can have the following values:</p>
83 /// <ul>
84 /// <li>
85 /// <p><code>PENDING</code> – Amazon Pinpoint hasn't started searching for the MX record yet.</p></li>
86 /// <li>
87 /// <p><code>SUCCESS</code> – Amazon Pinpoint detected the required MX record for the MAIL FROM domain.</p></li>
88 /// <li>
89 /// <p><code>FAILED</code> – Amazon Pinpoint can't find the required MX record, or the record no longer exists.</p></li>
90 /// <li>
91 /// <p><code>TEMPORARY_FAILURE</code> – A temporary issue occurred, which prevented Amazon Pinpoint from determining the status of the MAIL FROM domain.</p></li>
92 /// </ul>
93 /// This field is required.
94 pub fn mail_from_domain_status(mut self, input: crate::types::MailFromDomainStatus) -> Self {
95 self.mail_from_domain_status = ::std::option::Option::Some(input);
96 self
97 }
98 /// <p>The status of the MAIL FROM domain. This status can have the following values:</p>
99 /// <ul>
100 /// <li>
101 /// <p><code>PENDING</code> – Amazon Pinpoint hasn't started searching for the MX record yet.</p></li>
102 /// <li>
103 /// <p><code>SUCCESS</code> – Amazon Pinpoint detected the required MX record for the MAIL FROM domain.</p></li>
104 /// <li>
105 /// <p><code>FAILED</code> – Amazon Pinpoint can't find the required MX record, or the record no longer exists.</p></li>
106 /// <li>
107 /// <p><code>TEMPORARY_FAILURE</code> – A temporary issue occurred, which prevented Amazon Pinpoint from determining the status of the MAIL FROM domain.</p></li>
108 /// </ul>
109 pub fn set_mail_from_domain_status(mut self, input: ::std::option::Option<crate::types::MailFromDomainStatus>) -> Self {
110 self.mail_from_domain_status = input;
111 self
112 }
113 /// <p>The status of the MAIL FROM domain. This status can have the following values:</p>
114 /// <ul>
115 /// <li>
116 /// <p><code>PENDING</code> – Amazon Pinpoint hasn't started searching for the MX record yet.</p></li>
117 /// <li>
118 /// <p><code>SUCCESS</code> – Amazon Pinpoint detected the required MX record for the MAIL FROM domain.</p></li>
119 /// <li>
120 /// <p><code>FAILED</code> – Amazon Pinpoint can't find the required MX record, or the record no longer exists.</p></li>
121 /// <li>
122 /// <p><code>TEMPORARY_FAILURE</code> – A temporary issue occurred, which prevented Amazon Pinpoint from determining the status of the MAIL FROM domain.</p></li>
123 /// </ul>
124 pub fn get_mail_from_domain_status(&self) -> &::std::option::Option<crate::types::MailFromDomainStatus> {
125 &self.mail_from_domain_status
126 }
127 /// <p>The action that Amazon Pinpoint to takes if it can't read the required MX record for a custom MAIL FROM domain. When you set this value to <code>UseDefaultValue</code>, Amazon Pinpoint uses <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>RejectMessage</code>, Amazon Pinpoint returns a <code>MailFromDomainNotVerified</code> error, and doesn't attempt to deliver the email.</p>
128 /// <p>These behaviors are taken when the custom MAIL FROM domain configuration is in the <code>Pending</code>, <code>Failed</code>, and <code>TemporaryFailure</code> states.</p>
129 /// This field is required.
130 pub fn behavior_on_mx_failure(mut self, input: crate::types::BehaviorOnMxFailure) -> Self {
131 self.behavior_on_mx_failure = ::std::option::Option::Some(input);
132 self
133 }
134 /// <p>The action that Amazon Pinpoint to takes if it can't read the required MX record for a custom MAIL FROM domain. When you set this value to <code>UseDefaultValue</code>, Amazon Pinpoint uses <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>RejectMessage</code>, Amazon Pinpoint returns a <code>MailFromDomainNotVerified</code> error, and doesn't attempt to deliver the email.</p>
135 /// <p>These behaviors are taken when the custom MAIL FROM domain configuration is in the <code>Pending</code>, <code>Failed</code>, and <code>TemporaryFailure</code> states.</p>
136 pub fn set_behavior_on_mx_failure(mut self, input: ::std::option::Option<crate::types::BehaviorOnMxFailure>) -> Self {
137 self.behavior_on_mx_failure = input;
138 self
139 }
140 /// <p>The action that Amazon Pinpoint to takes if it can't read the required MX record for a custom MAIL FROM domain. When you set this value to <code>UseDefaultValue</code>, Amazon Pinpoint uses <i>amazonses.com</i> as the MAIL FROM domain. When you set this value to <code>RejectMessage</code>, Amazon Pinpoint returns a <code>MailFromDomainNotVerified</code> error, and doesn't attempt to deliver the email.</p>
141 /// <p>These behaviors are taken when the custom MAIL FROM domain configuration is in the <code>Pending</code>, <code>Failed</code>, and <code>TemporaryFailure</code> states.</p>
142 pub fn get_behavior_on_mx_failure(&self) -> &::std::option::Option<crate::types::BehaviorOnMxFailure> {
143 &self.behavior_on_mx_failure
144 }
145 /// Consumes the builder and constructs a [`MailFromAttributes`](crate::types::MailFromAttributes).
146 /// This method will fail if any of the following fields are not set:
147 /// - [`mail_from_domain`](crate::types::builders::MailFromAttributesBuilder::mail_from_domain)
148 /// - [`mail_from_domain_status`](crate::types::builders::MailFromAttributesBuilder::mail_from_domain_status)
149 /// - [`behavior_on_mx_failure`](crate::types::builders::MailFromAttributesBuilder::behavior_on_mx_failure)
150 pub fn build(self) -> ::std::result::Result<crate::types::MailFromAttributes, ::aws_smithy_types::error::operation::BuildError> {
151 ::std::result::Result::Ok(crate::types::MailFromAttributes {
152 mail_from_domain: self.mail_from_domain.ok_or_else(|| {
153 ::aws_smithy_types::error::operation::BuildError::missing_field(
154 "mail_from_domain",
155 "mail_from_domain was not specified but it is required when building MailFromAttributes",
156 )
157 })?,
158 mail_from_domain_status: self.mail_from_domain_status.ok_or_else(|| {
159 ::aws_smithy_types::error::operation::BuildError::missing_field(
160 "mail_from_domain_status",
161 "mail_from_domain_status was not specified but it is required when building MailFromAttributes",
162 )
163 })?,
164 behavior_on_mx_failure: self.behavior_on_mx_failure.ok_or_else(|| {
165 ::aws_smithy_types::error::operation::BuildError::missing_field(
166 "behavior_on_mx_failure",
167 "behavior_on_mx_failure was not specified but it is required when building MailFromAttributes",
168 )
169 })?,
170 })
171 }
172}