aws_sdk_sns/operation/publish/
_publish_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Input for Publish action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct PublishInput {
7    /// <p>The topic you want to publish to.</p>
8    /// <p>If you don't specify a value for the <code>TopicArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TargetArn</code> parameters.</p>
9    pub topic_arn: ::std::option::Option<::std::string::String>,
10    /// <p>If you don't specify a value for the <code>TargetArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TopicArn</code> parameters.</p>
11    pub target_arn: ::std::option::Option<::std::string::String>,
12    /// <p>The phone number to which you want to deliver an SMS message. Use E.164 format.</p>
13    /// <p>If you don't specify a value for the <code>PhoneNumber</code> parameter, you must specify a value for the <code>TargetArn</code> or <code>TopicArn</code> parameters.</p>
14    pub phone_number: ::std::option::Option<::std::string::String>,
15    /// <p>The message you want to send.</p>
16    /// <p>If you are publishing to a topic and you want to send the same message to all transport protocols, include the text of the message as a String value. If you want to send different messages for each transport protocol, set the value of the <code>MessageStructure</code> parameter to <code>json</code> and use a JSON object for the <code>Message</code> parameter.</p>
17    /// <p></p>
18    /// <p>Constraints:</p>
19    /// <ul>
20    /// <li>
21    /// <p>With the exception of SMS, messages must be UTF-8 encoded strings and at most 256 KB in size (262,144 bytes, not 262,144 characters).</p></li>
22    /// <li>
23    /// <p>For SMS, each message can contain up to 140 characters. This character limit depends on the encoding schema. For example, an SMS message can contain 160 GSM characters, 140 ASCII characters, or 70 UCS-2 characters.</p>
24    /// <p>If you publish a message that exceeds this size limit, Amazon SNS sends the message as multiple messages, each fitting within the size limit. Messages aren't truncated mid-word but are cut off at whole-word boundaries.</p>
25    /// <p>The total size limit for a single SMS <code>Publish</code> action is 1,600 characters.</p></li>
26    /// </ul>
27    /// <p>JSON-specific constraints:</p>
28    /// <ul>
29    /// <li>
30    /// <p>Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.</p></li>
31    /// <li>
32    /// <p>The values will be parsed (unescaped) before they are used in outgoing messages.</p></li>
33    /// <li>
34    /// <p>Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).</p></li>
35    /// <li>
36    /// <p>Values have a minimum length of 0 (the empty string, "", is allowed).</p></li>
37    /// <li>
38    /// <p>Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).</p></li>
39    /// <li>
40    /// <p>Non-string values will cause the key to be ignored.</p></li>
41    /// <li>
42    /// <p>Keys that do not correspond to supported transport protocols are ignored.</p></li>
43    /// <li>
44    /// <p>Duplicate keys are not allowed.</p></li>
45    /// <li>
46    /// <p>Failure to parse or validate any key or value in the message will cause the <code>Publish</code> call to return an error (no partial delivery).</p></li>
47    /// </ul>
48    pub message: ::std::option::Option<::std::string::String>,
49    /// <p>Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.</p>
50    /// <p>Constraints: Subjects must be UTF-8 text with no line breaks or control characters, and less than 100 characters long.</p>
51    pub subject: ::std::option::Option<::std::string::String>,
52    /// <p>Set <code>MessageStructure</code> to <code>json</code> if you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you set <code>MessageStructure</code> to <code>json</code>, the value of the <code>Message</code> parameter must:</p>
53    /// <ul>
54    /// <li>
55    /// <p>be a syntactically valid JSON object; and</p></li>
56    /// <li>
57    /// <p>contain at least a top-level JSON key of "default" with a value that is a string.</p></li>
58    /// </ul>
59    /// <p>You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").</p>
60    /// <p>Valid value: <code>json</code></p>
61    pub message_structure: ::std::option::Option<::std::string::String>,
62    /// <p>Message attributes for Publish action.</p>
63    pub message_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MessageAttributeValue>>,
64    /// <ul>
65    /// <li>
66    /// <p>This parameter applies only to FIFO (first-in-first-out) topics. The <code>MessageDeduplicationId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p></li>
67    /// <li>
68    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>, which is a token used for deduplication of sent messages within the 5 minute minimum deduplication interval.</p></li>
69    /// <li>
70    /// <p>The scope of deduplication depends on the <code>FifoThroughputScope</code> attribute, when set to <code>Topic</code> the message deduplication scope is across the entire topic, when set to <code>MessageGroup</code> the message deduplication scope is within each individual message group.</p></li>
71    /// <li>
72    /// <p>If a message with a particular <code>MessageDeduplicationId</code> is sent successfully, subsequent messages within the deduplication scope and interval, with the same <code>MessageDeduplicationId</code>, are accepted successfully but aren't delivered.</p></li>
73    /// <li>
74    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>:</p>
75    /// <ul>
76    /// <li>
77    /// <p>You may provide a <code>MessageDeduplicationId</code> explicitly.</p></li>
78    /// <li>
79    /// <p>If you aren't able to provide a <code>MessageDeduplicationId</code> and you enable <code>ContentBasedDeduplication</code> for your topic, Amazon SNS uses a SHA-256 hash to generate the <code>MessageDeduplicationId</code> using the body of the message (but not the attributes of the message).</p></li>
80    /// <li>
81    /// <p>If you don't provide a <code>MessageDeduplicationId</code> and the topic doesn't have <code>ContentBasedDeduplication</code> set, the action fails with an error.</p></li>
82    /// <li>
83    /// <p>If the topic has a <code>ContentBasedDeduplication</code> set, your <code>MessageDeduplicationId</code> overrides the generated one.</p></li>
84    /// </ul></li>
85    /// <li>
86    /// <p>When <code>ContentBasedDeduplication</code> is in effect, messages with identical content sent within the deduplication scope and interval are treated as duplicates and only one copy of the message is delivered.</p></li>
87    /// <li>
88    /// <p>If you send one message with <code>ContentBasedDeduplication</code> enabled, and then another message with a <code>MessageDeduplicationId</code> that is the same as the one generated for the first <code>MessageDeduplicationId</code>, the two messages are treated as duplicates, within the deduplication scope and interval, and only one copy of the message is delivered.</p></li>
89    /// </ul>
90    pub message_deduplication_id: ::std::option::Option<::std::string::String>,
91    /// <p>The <code>MessageGroupId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p>
92    /// <p>For FIFO topics: The <code>MessageGroupId</code> is a tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). Every message must include a <code>MessageGroupId</code>.</p>
93    /// <p>For standard topics: The <code>MessageGroupId</code> is optional and is forwarded only to Amazon SQS standard subscriptions to activate <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fair-queues.html">fair queues</a>. The <code>MessageGroupId</code> is not used for, or sent to, any other endpoint types. When provided, the same validation rules apply as for FIFO topics.</p>
94    pub message_group_id: ::std::option::Option<::std::string::String>,
95}
96impl PublishInput {
97    /// <p>The topic you want to publish to.</p>
98    /// <p>If you don't specify a value for the <code>TopicArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TargetArn</code> parameters.</p>
99    pub fn topic_arn(&self) -> ::std::option::Option<&str> {
100        self.topic_arn.as_deref()
101    }
102    /// <p>If you don't specify a value for the <code>TargetArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TopicArn</code> parameters.</p>
103    pub fn target_arn(&self) -> ::std::option::Option<&str> {
104        self.target_arn.as_deref()
105    }
106    /// <p>The phone number to which you want to deliver an SMS message. Use E.164 format.</p>
107    /// <p>If you don't specify a value for the <code>PhoneNumber</code> parameter, you must specify a value for the <code>TargetArn</code> or <code>TopicArn</code> parameters.</p>
108    pub fn phone_number(&self) -> ::std::option::Option<&str> {
109        self.phone_number.as_deref()
110    }
111    /// <p>The message you want to send.</p>
112    /// <p>If you are publishing to a topic and you want to send the same message to all transport protocols, include the text of the message as a String value. If you want to send different messages for each transport protocol, set the value of the <code>MessageStructure</code> parameter to <code>json</code> and use a JSON object for the <code>Message</code> parameter.</p>
113    /// <p></p>
114    /// <p>Constraints:</p>
115    /// <ul>
116    /// <li>
117    /// <p>With the exception of SMS, messages must be UTF-8 encoded strings and at most 256 KB in size (262,144 bytes, not 262,144 characters).</p></li>
118    /// <li>
119    /// <p>For SMS, each message can contain up to 140 characters. This character limit depends on the encoding schema. For example, an SMS message can contain 160 GSM characters, 140 ASCII characters, or 70 UCS-2 characters.</p>
120    /// <p>If you publish a message that exceeds this size limit, Amazon SNS sends the message as multiple messages, each fitting within the size limit. Messages aren't truncated mid-word but are cut off at whole-word boundaries.</p>
121    /// <p>The total size limit for a single SMS <code>Publish</code> action is 1,600 characters.</p></li>
122    /// </ul>
123    /// <p>JSON-specific constraints:</p>
124    /// <ul>
125    /// <li>
126    /// <p>Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.</p></li>
127    /// <li>
128    /// <p>The values will be parsed (unescaped) before they are used in outgoing messages.</p></li>
129    /// <li>
130    /// <p>Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).</p></li>
131    /// <li>
132    /// <p>Values have a minimum length of 0 (the empty string, "", is allowed).</p></li>
133    /// <li>
134    /// <p>Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).</p></li>
135    /// <li>
136    /// <p>Non-string values will cause the key to be ignored.</p></li>
137    /// <li>
138    /// <p>Keys that do not correspond to supported transport protocols are ignored.</p></li>
139    /// <li>
140    /// <p>Duplicate keys are not allowed.</p></li>
141    /// <li>
142    /// <p>Failure to parse or validate any key or value in the message will cause the <code>Publish</code> call to return an error (no partial delivery).</p></li>
143    /// </ul>
144    pub fn message(&self) -> ::std::option::Option<&str> {
145        self.message.as_deref()
146    }
147    /// <p>Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.</p>
148    /// <p>Constraints: Subjects must be UTF-8 text with no line breaks or control characters, and less than 100 characters long.</p>
149    pub fn subject(&self) -> ::std::option::Option<&str> {
150        self.subject.as_deref()
151    }
152    /// <p>Set <code>MessageStructure</code> to <code>json</code> if you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you set <code>MessageStructure</code> to <code>json</code>, the value of the <code>Message</code> parameter must:</p>
153    /// <ul>
154    /// <li>
155    /// <p>be a syntactically valid JSON object; and</p></li>
156    /// <li>
157    /// <p>contain at least a top-level JSON key of "default" with a value that is a string.</p></li>
158    /// </ul>
159    /// <p>You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").</p>
160    /// <p>Valid value: <code>json</code></p>
161    pub fn message_structure(&self) -> ::std::option::Option<&str> {
162        self.message_structure.as_deref()
163    }
164    /// <p>Message attributes for Publish action.</p>
165    pub fn message_attributes(
166        &self,
167    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::MessageAttributeValue>> {
168        self.message_attributes.as_ref()
169    }
170    /// <ul>
171    /// <li>
172    /// <p>This parameter applies only to FIFO (first-in-first-out) topics. The <code>MessageDeduplicationId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p></li>
173    /// <li>
174    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>, which is a token used for deduplication of sent messages within the 5 minute minimum deduplication interval.</p></li>
175    /// <li>
176    /// <p>The scope of deduplication depends on the <code>FifoThroughputScope</code> attribute, when set to <code>Topic</code> the message deduplication scope is across the entire topic, when set to <code>MessageGroup</code> the message deduplication scope is within each individual message group.</p></li>
177    /// <li>
178    /// <p>If a message with a particular <code>MessageDeduplicationId</code> is sent successfully, subsequent messages within the deduplication scope and interval, with the same <code>MessageDeduplicationId</code>, are accepted successfully but aren't delivered.</p></li>
179    /// <li>
180    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>:</p>
181    /// <ul>
182    /// <li>
183    /// <p>You may provide a <code>MessageDeduplicationId</code> explicitly.</p></li>
184    /// <li>
185    /// <p>If you aren't able to provide a <code>MessageDeduplicationId</code> and you enable <code>ContentBasedDeduplication</code> for your topic, Amazon SNS uses a SHA-256 hash to generate the <code>MessageDeduplicationId</code> using the body of the message (but not the attributes of the message).</p></li>
186    /// <li>
187    /// <p>If you don't provide a <code>MessageDeduplicationId</code> and the topic doesn't have <code>ContentBasedDeduplication</code> set, the action fails with an error.</p></li>
188    /// <li>
189    /// <p>If the topic has a <code>ContentBasedDeduplication</code> set, your <code>MessageDeduplicationId</code> overrides the generated one.</p></li>
190    /// </ul></li>
191    /// <li>
192    /// <p>When <code>ContentBasedDeduplication</code> is in effect, messages with identical content sent within the deduplication scope and interval are treated as duplicates and only one copy of the message is delivered.</p></li>
193    /// <li>
194    /// <p>If you send one message with <code>ContentBasedDeduplication</code> enabled, and then another message with a <code>MessageDeduplicationId</code> that is the same as the one generated for the first <code>MessageDeduplicationId</code>, the two messages are treated as duplicates, within the deduplication scope and interval, and only one copy of the message is delivered.</p></li>
195    /// </ul>
196    pub fn message_deduplication_id(&self) -> ::std::option::Option<&str> {
197        self.message_deduplication_id.as_deref()
198    }
199    /// <p>The <code>MessageGroupId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p>
200    /// <p>For FIFO topics: The <code>MessageGroupId</code> is a tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). Every message must include a <code>MessageGroupId</code>.</p>
201    /// <p>For standard topics: The <code>MessageGroupId</code> is optional and is forwarded only to Amazon SQS standard subscriptions to activate <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fair-queues.html">fair queues</a>. The <code>MessageGroupId</code> is not used for, or sent to, any other endpoint types. When provided, the same validation rules apply as for FIFO topics.</p>
202    pub fn message_group_id(&self) -> ::std::option::Option<&str> {
203        self.message_group_id.as_deref()
204    }
205}
206impl ::std::fmt::Debug for PublishInput {
207    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
208        let mut formatter = f.debug_struct("PublishInput");
209        formatter.field("topic_arn", &self.topic_arn);
210        formatter.field("target_arn", &self.target_arn);
211        formatter.field("phone_number", &"*** Sensitive Data Redacted ***");
212        formatter.field("message", &self.message);
213        formatter.field("subject", &self.subject);
214        formatter.field("message_structure", &self.message_structure);
215        formatter.field("message_attributes", &self.message_attributes);
216        formatter.field("message_deduplication_id", &self.message_deduplication_id);
217        formatter.field("message_group_id", &self.message_group_id);
218        formatter.finish()
219    }
220}
221impl PublishInput {
222    /// Creates a new builder-style object to manufacture [`PublishInput`](crate::operation::publish::PublishInput).
223    pub fn builder() -> crate::operation::publish::builders::PublishInputBuilder {
224        crate::operation::publish::builders::PublishInputBuilder::default()
225    }
226}
227
228/// A builder for [`PublishInput`](crate::operation::publish::PublishInput).
229#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
230#[non_exhaustive]
231pub struct PublishInputBuilder {
232    pub(crate) topic_arn: ::std::option::Option<::std::string::String>,
233    pub(crate) target_arn: ::std::option::Option<::std::string::String>,
234    pub(crate) phone_number: ::std::option::Option<::std::string::String>,
235    pub(crate) message: ::std::option::Option<::std::string::String>,
236    pub(crate) subject: ::std::option::Option<::std::string::String>,
237    pub(crate) message_structure: ::std::option::Option<::std::string::String>,
238    pub(crate) message_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MessageAttributeValue>>,
239    pub(crate) message_deduplication_id: ::std::option::Option<::std::string::String>,
240    pub(crate) message_group_id: ::std::option::Option<::std::string::String>,
241}
242impl PublishInputBuilder {
243    /// <p>The topic you want to publish to.</p>
244    /// <p>If you don't specify a value for the <code>TopicArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TargetArn</code> parameters.</p>
245    pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246        self.topic_arn = ::std::option::Option::Some(input.into());
247        self
248    }
249    /// <p>The topic you want to publish to.</p>
250    /// <p>If you don't specify a value for the <code>TopicArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TargetArn</code> parameters.</p>
251    pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252        self.topic_arn = input;
253        self
254    }
255    /// <p>The topic you want to publish to.</p>
256    /// <p>If you don't specify a value for the <code>TopicArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TargetArn</code> parameters.</p>
257    pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
258        &self.topic_arn
259    }
260    /// <p>If you don't specify a value for the <code>TargetArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TopicArn</code> parameters.</p>
261    pub fn target_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
262        self.target_arn = ::std::option::Option::Some(input.into());
263        self
264    }
265    /// <p>If you don't specify a value for the <code>TargetArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TopicArn</code> parameters.</p>
266    pub fn set_target_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
267        self.target_arn = input;
268        self
269    }
270    /// <p>If you don't specify a value for the <code>TargetArn</code> parameter, you must specify a value for the <code>PhoneNumber</code> or <code>TopicArn</code> parameters.</p>
271    pub fn get_target_arn(&self) -> &::std::option::Option<::std::string::String> {
272        &self.target_arn
273    }
274    /// <p>The phone number to which you want to deliver an SMS message. Use E.164 format.</p>
275    /// <p>If you don't specify a value for the <code>PhoneNumber</code> parameter, you must specify a value for the <code>TargetArn</code> or <code>TopicArn</code> parameters.</p>
276    pub fn phone_number(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
277        self.phone_number = ::std::option::Option::Some(input.into());
278        self
279    }
280    /// <p>The phone number to which you want to deliver an SMS message. Use E.164 format.</p>
281    /// <p>If you don't specify a value for the <code>PhoneNumber</code> parameter, you must specify a value for the <code>TargetArn</code> or <code>TopicArn</code> parameters.</p>
282    pub fn set_phone_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
283        self.phone_number = input;
284        self
285    }
286    /// <p>The phone number to which you want to deliver an SMS message. Use E.164 format.</p>
287    /// <p>If you don't specify a value for the <code>PhoneNumber</code> parameter, you must specify a value for the <code>TargetArn</code> or <code>TopicArn</code> parameters.</p>
288    pub fn get_phone_number(&self) -> &::std::option::Option<::std::string::String> {
289        &self.phone_number
290    }
291    /// <p>The message you want to send.</p>
292    /// <p>If you are publishing to a topic and you want to send the same message to all transport protocols, include the text of the message as a String value. If you want to send different messages for each transport protocol, set the value of the <code>MessageStructure</code> parameter to <code>json</code> and use a JSON object for the <code>Message</code> parameter.</p>
293    /// <p></p>
294    /// <p>Constraints:</p>
295    /// <ul>
296    /// <li>
297    /// <p>With the exception of SMS, messages must be UTF-8 encoded strings and at most 256 KB in size (262,144 bytes, not 262,144 characters).</p></li>
298    /// <li>
299    /// <p>For SMS, each message can contain up to 140 characters. This character limit depends on the encoding schema. For example, an SMS message can contain 160 GSM characters, 140 ASCII characters, or 70 UCS-2 characters.</p>
300    /// <p>If you publish a message that exceeds this size limit, Amazon SNS sends the message as multiple messages, each fitting within the size limit. Messages aren't truncated mid-word but are cut off at whole-word boundaries.</p>
301    /// <p>The total size limit for a single SMS <code>Publish</code> action is 1,600 characters.</p></li>
302    /// </ul>
303    /// <p>JSON-specific constraints:</p>
304    /// <ul>
305    /// <li>
306    /// <p>Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.</p></li>
307    /// <li>
308    /// <p>The values will be parsed (unescaped) before they are used in outgoing messages.</p></li>
309    /// <li>
310    /// <p>Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).</p></li>
311    /// <li>
312    /// <p>Values have a minimum length of 0 (the empty string, "", is allowed).</p></li>
313    /// <li>
314    /// <p>Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).</p></li>
315    /// <li>
316    /// <p>Non-string values will cause the key to be ignored.</p></li>
317    /// <li>
318    /// <p>Keys that do not correspond to supported transport protocols are ignored.</p></li>
319    /// <li>
320    /// <p>Duplicate keys are not allowed.</p></li>
321    /// <li>
322    /// <p>Failure to parse or validate any key or value in the message will cause the <code>Publish</code> call to return an error (no partial delivery).</p></li>
323    /// </ul>
324    /// This field is required.
325    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
326        self.message = ::std::option::Option::Some(input.into());
327        self
328    }
329    /// <p>The message you want to send.</p>
330    /// <p>If you are publishing to a topic and you want to send the same message to all transport protocols, include the text of the message as a String value. If you want to send different messages for each transport protocol, set the value of the <code>MessageStructure</code> parameter to <code>json</code> and use a JSON object for the <code>Message</code> parameter.</p>
331    /// <p></p>
332    /// <p>Constraints:</p>
333    /// <ul>
334    /// <li>
335    /// <p>With the exception of SMS, messages must be UTF-8 encoded strings and at most 256 KB in size (262,144 bytes, not 262,144 characters).</p></li>
336    /// <li>
337    /// <p>For SMS, each message can contain up to 140 characters. This character limit depends on the encoding schema. For example, an SMS message can contain 160 GSM characters, 140 ASCII characters, or 70 UCS-2 characters.</p>
338    /// <p>If you publish a message that exceeds this size limit, Amazon SNS sends the message as multiple messages, each fitting within the size limit. Messages aren't truncated mid-word but are cut off at whole-word boundaries.</p>
339    /// <p>The total size limit for a single SMS <code>Publish</code> action is 1,600 characters.</p></li>
340    /// </ul>
341    /// <p>JSON-specific constraints:</p>
342    /// <ul>
343    /// <li>
344    /// <p>Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.</p></li>
345    /// <li>
346    /// <p>The values will be parsed (unescaped) before they are used in outgoing messages.</p></li>
347    /// <li>
348    /// <p>Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).</p></li>
349    /// <li>
350    /// <p>Values have a minimum length of 0 (the empty string, "", is allowed).</p></li>
351    /// <li>
352    /// <p>Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).</p></li>
353    /// <li>
354    /// <p>Non-string values will cause the key to be ignored.</p></li>
355    /// <li>
356    /// <p>Keys that do not correspond to supported transport protocols are ignored.</p></li>
357    /// <li>
358    /// <p>Duplicate keys are not allowed.</p></li>
359    /// <li>
360    /// <p>Failure to parse or validate any key or value in the message will cause the <code>Publish</code> call to return an error (no partial delivery).</p></li>
361    /// </ul>
362    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
363        self.message = input;
364        self
365    }
366    /// <p>The message you want to send.</p>
367    /// <p>If you are publishing to a topic and you want to send the same message to all transport protocols, include the text of the message as a String value. If you want to send different messages for each transport protocol, set the value of the <code>MessageStructure</code> parameter to <code>json</code> and use a JSON object for the <code>Message</code> parameter.</p>
368    /// <p></p>
369    /// <p>Constraints:</p>
370    /// <ul>
371    /// <li>
372    /// <p>With the exception of SMS, messages must be UTF-8 encoded strings and at most 256 KB in size (262,144 bytes, not 262,144 characters).</p></li>
373    /// <li>
374    /// <p>For SMS, each message can contain up to 140 characters. This character limit depends on the encoding schema. For example, an SMS message can contain 160 GSM characters, 140 ASCII characters, or 70 UCS-2 characters.</p>
375    /// <p>If you publish a message that exceeds this size limit, Amazon SNS sends the message as multiple messages, each fitting within the size limit. Messages aren't truncated mid-word but are cut off at whole-word boundaries.</p>
376    /// <p>The total size limit for a single SMS <code>Publish</code> action is 1,600 characters.</p></li>
377    /// </ul>
378    /// <p>JSON-specific constraints:</p>
379    /// <ul>
380    /// <li>
381    /// <p>Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.</p></li>
382    /// <li>
383    /// <p>The values will be parsed (unescaped) before they are used in outgoing messages.</p></li>
384    /// <li>
385    /// <p>Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).</p></li>
386    /// <li>
387    /// <p>Values have a minimum length of 0 (the empty string, "", is allowed).</p></li>
388    /// <li>
389    /// <p>Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).</p></li>
390    /// <li>
391    /// <p>Non-string values will cause the key to be ignored.</p></li>
392    /// <li>
393    /// <p>Keys that do not correspond to supported transport protocols are ignored.</p></li>
394    /// <li>
395    /// <p>Duplicate keys are not allowed.</p></li>
396    /// <li>
397    /// <p>Failure to parse or validate any key or value in the message will cause the <code>Publish</code> call to return an error (no partial delivery).</p></li>
398    /// </ul>
399    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
400        &self.message
401    }
402    /// <p>Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.</p>
403    /// <p>Constraints: Subjects must be UTF-8 text with no line breaks or control characters, and less than 100 characters long.</p>
404    pub fn subject(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
405        self.subject = ::std::option::Option::Some(input.into());
406        self
407    }
408    /// <p>Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.</p>
409    /// <p>Constraints: Subjects must be UTF-8 text with no line breaks or control characters, and less than 100 characters long.</p>
410    pub fn set_subject(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
411        self.subject = input;
412        self
413    }
414    /// <p>Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.</p>
415    /// <p>Constraints: Subjects must be UTF-8 text with no line breaks or control characters, and less than 100 characters long.</p>
416    pub fn get_subject(&self) -> &::std::option::Option<::std::string::String> {
417        &self.subject
418    }
419    /// <p>Set <code>MessageStructure</code> to <code>json</code> if you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you set <code>MessageStructure</code> to <code>json</code>, the value of the <code>Message</code> parameter must:</p>
420    /// <ul>
421    /// <li>
422    /// <p>be a syntactically valid JSON object; and</p></li>
423    /// <li>
424    /// <p>contain at least a top-level JSON key of "default" with a value that is a string.</p></li>
425    /// </ul>
426    /// <p>You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").</p>
427    /// <p>Valid value: <code>json</code></p>
428    pub fn message_structure(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
429        self.message_structure = ::std::option::Option::Some(input.into());
430        self
431    }
432    /// <p>Set <code>MessageStructure</code> to <code>json</code> if you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you set <code>MessageStructure</code> to <code>json</code>, the value of the <code>Message</code> parameter must:</p>
433    /// <ul>
434    /// <li>
435    /// <p>be a syntactically valid JSON object; and</p></li>
436    /// <li>
437    /// <p>contain at least a top-level JSON key of "default" with a value that is a string.</p></li>
438    /// </ul>
439    /// <p>You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").</p>
440    /// <p>Valid value: <code>json</code></p>
441    pub fn set_message_structure(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
442        self.message_structure = input;
443        self
444    }
445    /// <p>Set <code>MessageStructure</code> to <code>json</code> if you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you set <code>MessageStructure</code> to <code>json</code>, the value of the <code>Message</code> parameter must:</p>
446    /// <ul>
447    /// <li>
448    /// <p>be a syntactically valid JSON object; and</p></li>
449    /// <li>
450    /// <p>contain at least a top-level JSON key of "default" with a value that is a string.</p></li>
451    /// </ul>
452    /// <p>You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").</p>
453    /// <p>Valid value: <code>json</code></p>
454    pub fn get_message_structure(&self) -> &::std::option::Option<::std::string::String> {
455        &self.message_structure
456    }
457    /// Adds a key-value pair to `message_attributes`.
458    ///
459    /// To override the contents of this collection use [`set_message_attributes`](Self::set_message_attributes).
460    ///
461    /// <p>Message attributes for Publish action.</p>
462    pub fn message_attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::MessageAttributeValue) -> Self {
463        let mut hash_map = self.message_attributes.unwrap_or_default();
464        hash_map.insert(k.into(), v);
465        self.message_attributes = ::std::option::Option::Some(hash_map);
466        self
467    }
468    /// <p>Message attributes for Publish action.</p>
469    pub fn set_message_attributes(
470        mut self,
471        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MessageAttributeValue>>,
472    ) -> Self {
473        self.message_attributes = input;
474        self
475    }
476    /// <p>Message attributes for Publish action.</p>
477    pub fn get_message_attributes(
478        &self,
479    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MessageAttributeValue>> {
480        &self.message_attributes
481    }
482    /// <ul>
483    /// <li>
484    /// <p>This parameter applies only to FIFO (first-in-first-out) topics. The <code>MessageDeduplicationId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p></li>
485    /// <li>
486    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>, which is a token used for deduplication of sent messages within the 5 minute minimum deduplication interval.</p></li>
487    /// <li>
488    /// <p>The scope of deduplication depends on the <code>FifoThroughputScope</code> attribute, when set to <code>Topic</code> the message deduplication scope is across the entire topic, when set to <code>MessageGroup</code> the message deduplication scope is within each individual message group.</p></li>
489    /// <li>
490    /// <p>If a message with a particular <code>MessageDeduplicationId</code> is sent successfully, subsequent messages within the deduplication scope and interval, with the same <code>MessageDeduplicationId</code>, are accepted successfully but aren't delivered.</p></li>
491    /// <li>
492    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>:</p>
493    /// <ul>
494    /// <li>
495    /// <p>You may provide a <code>MessageDeduplicationId</code> explicitly.</p></li>
496    /// <li>
497    /// <p>If you aren't able to provide a <code>MessageDeduplicationId</code> and you enable <code>ContentBasedDeduplication</code> for your topic, Amazon SNS uses a SHA-256 hash to generate the <code>MessageDeduplicationId</code> using the body of the message (but not the attributes of the message).</p></li>
498    /// <li>
499    /// <p>If you don't provide a <code>MessageDeduplicationId</code> and the topic doesn't have <code>ContentBasedDeduplication</code> set, the action fails with an error.</p></li>
500    /// <li>
501    /// <p>If the topic has a <code>ContentBasedDeduplication</code> set, your <code>MessageDeduplicationId</code> overrides the generated one.</p></li>
502    /// </ul></li>
503    /// <li>
504    /// <p>When <code>ContentBasedDeduplication</code> is in effect, messages with identical content sent within the deduplication scope and interval are treated as duplicates and only one copy of the message is delivered.</p></li>
505    /// <li>
506    /// <p>If you send one message with <code>ContentBasedDeduplication</code> enabled, and then another message with a <code>MessageDeduplicationId</code> that is the same as the one generated for the first <code>MessageDeduplicationId</code>, the two messages are treated as duplicates, within the deduplication scope and interval, and only one copy of the message is delivered.</p></li>
507    /// </ul>
508    pub fn message_deduplication_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
509        self.message_deduplication_id = ::std::option::Option::Some(input.into());
510        self
511    }
512    /// <ul>
513    /// <li>
514    /// <p>This parameter applies only to FIFO (first-in-first-out) topics. The <code>MessageDeduplicationId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p></li>
515    /// <li>
516    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>, which is a token used for deduplication of sent messages within the 5 minute minimum deduplication interval.</p></li>
517    /// <li>
518    /// <p>The scope of deduplication depends on the <code>FifoThroughputScope</code> attribute, when set to <code>Topic</code> the message deduplication scope is across the entire topic, when set to <code>MessageGroup</code> the message deduplication scope is within each individual message group.</p></li>
519    /// <li>
520    /// <p>If a message with a particular <code>MessageDeduplicationId</code> is sent successfully, subsequent messages within the deduplication scope and interval, with the same <code>MessageDeduplicationId</code>, are accepted successfully but aren't delivered.</p></li>
521    /// <li>
522    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>:</p>
523    /// <ul>
524    /// <li>
525    /// <p>You may provide a <code>MessageDeduplicationId</code> explicitly.</p></li>
526    /// <li>
527    /// <p>If you aren't able to provide a <code>MessageDeduplicationId</code> and you enable <code>ContentBasedDeduplication</code> for your topic, Amazon SNS uses a SHA-256 hash to generate the <code>MessageDeduplicationId</code> using the body of the message (but not the attributes of the message).</p></li>
528    /// <li>
529    /// <p>If you don't provide a <code>MessageDeduplicationId</code> and the topic doesn't have <code>ContentBasedDeduplication</code> set, the action fails with an error.</p></li>
530    /// <li>
531    /// <p>If the topic has a <code>ContentBasedDeduplication</code> set, your <code>MessageDeduplicationId</code> overrides the generated one.</p></li>
532    /// </ul></li>
533    /// <li>
534    /// <p>When <code>ContentBasedDeduplication</code> is in effect, messages with identical content sent within the deduplication scope and interval are treated as duplicates and only one copy of the message is delivered.</p></li>
535    /// <li>
536    /// <p>If you send one message with <code>ContentBasedDeduplication</code> enabled, and then another message with a <code>MessageDeduplicationId</code> that is the same as the one generated for the first <code>MessageDeduplicationId</code>, the two messages are treated as duplicates, within the deduplication scope and interval, and only one copy of the message is delivered.</p></li>
537    /// </ul>
538    pub fn set_message_deduplication_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
539        self.message_deduplication_id = input;
540        self
541    }
542    /// <ul>
543    /// <li>
544    /// <p>This parameter applies only to FIFO (first-in-first-out) topics. The <code>MessageDeduplicationId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p></li>
545    /// <li>
546    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>, which is a token used for deduplication of sent messages within the 5 minute minimum deduplication interval.</p></li>
547    /// <li>
548    /// <p>The scope of deduplication depends on the <code>FifoThroughputScope</code> attribute, when set to <code>Topic</code> the message deduplication scope is across the entire topic, when set to <code>MessageGroup</code> the message deduplication scope is within each individual message group.</p></li>
549    /// <li>
550    /// <p>If a message with a particular <code>MessageDeduplicationId</code> is sent successfully, subsequent messages within the deduplication scope and interval, with the same <code>MessageDeduplicationId</code>, are accepted successfully but aren't delivered.</p></li>
551    /// <li>
552    /// <p>Every message must have a unique <code>MessageDeduplicationId</code>:</p>
553    /// <ul>
554    /// <li>
555    /// <p>You may provide a <code>MessageDeduplicationId</code> explicitly.</p></li>
556    /// <li>
557    /// <p>If you aren't able to provide a <code>MessageDeduplicationId</code> and you enable <code>ContentBasedDeduplication</code> for your topic, Amazon SNS uses a SHA-256 hash to generate the <code>MessageDeduplicationId</code> using the body of the message (but not the attributes of the message).</p></li>
558    /// <li>
559    /// <p>If you don't provide a <code>MessageDeduplicationId</code> and the topic doesn't have <code>ContentBasedDeduplication</code> set, the action fails with an error.</p></li>
560    /// <li>
561    /// <p>If the topic has a <code>ContentBasedDeduplication</code> set, your <code>MessageDeduplicationId</code> overrides the generated one.</p></li>
562    /// </ul></li>
563    /// <li>
564    /// <p>When <code>ContentBasedDeduplication</code> is in effect, messages with identical content sent within the deduplication scope and interval are treated as duplicates and only one copy of the message is delivered.</p></li>
565    /// <li>
566    /// <p>If you send one message with <code>ContentBasedDeduplication</code> enabled, and then another message with a <code>MessageDeduplicationId</code> that is the same as the one generated for the first <code>MessageDeduplicationId</code>, the two messages are treated as duplicates, within the deduplication scope and interval, and only one copy of the message is delivered.</p></li>
567    /// </ul>
568    pub fn get_message_deduplication_id(&self) -> &::std::option::Option<::std::string::String> {
569        &self.message_deduplication_id
570    }
571    /// <p>The <code>MessageGroupId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p>
572    /// <p>For FIFO topics: The <code>MessageGroupId</code> is a tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). Every message must include a <code>MessageGroupId</code>.</p>
573    /// <p>For standard topics: The <code>MessageGroupId</code> is optional and is forwarded only to Amazon SQS standard subscriptions to activate <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fair-queues.html">fair queues</a>. The <code>MessageGroupId</code> is not used for, or sent to, any other endpoint types. When provided, the same validation rules apply as for FIFO topics.</p>
574    pub fn message_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
575        self.message_group_id = ::std::option::Option::Some(input.into());
576        self
577    }
578    /// <p>The <code>MessageGroupId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p>
579    /// <p>For FIFO topics: The <code>MessageGroupId</code> is a tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). Every message must include a <code>MessageGroupId</code>.</p>
580    /// <p>For standard topics: The <code>MessageGroupId</code> is optional and is forwarded only to Amazon SQS standard subscriptions to activate <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fair-queues.html">fair queues</a>. The <code>MessageGroupId</code> is not used for, or sent to, any other endpoint types. When provided, the same validation rules apply as for FIFO topics.</p>
581    pub fn set_message_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
582        self.message_group_id = input;
583        self
584    }
585    /// <p>The <code>MessageGroupId</code> can contain up to 128 alphanumeric characters <code>(a-z, A-Z, 0-9)</code> and punctuation <code>(!"#$%&amp;'()*+,-./:;&lt;=&gt;?@\[\\]^_`{|}~)</code>.</p>
586    /// <p>For FIFO topics: The <code>MessageGroupId</code> is a tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). Every message must include a <code>MessageGroupId</code>.</p>
587    /// <p>For standard topics: The <code>MessageGroupId</code> is optional and is forwarded only to Amazon SQS standard subscriptions to activate <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fair-queues.html">fair queues</a>. The <code>MessageGroupId</code> is not used for, or sent to, any other endpoint types. When provided, the same validation rules apply as for FIFO topics.</p>
588    pub fn get_message_group_id(&self) -> &::std::option::Option<::std::string::String> {
589        &self.message_group_id
590    }
591    /// Consumes the builder and constructs a [`PublishInput`](crate::operation::publish::PublishInput).
592    pub fn build(self) -> ::std::result::Result<crate::operation::publish::PublishInput, ::aws_smithy_types::error::operation::BuildError> {
593        ::std::result::Result::Ok(crate::operation::publish::PublishInput {
594            topic_arn: self.topic_arn,
595            target_arn: self.target_arn,
596            phone_number: self.phone_number,
597            message: self.message,
598            subject: self.subject,
599            message_structure: self.message_structure,
600            message_attributes: self.message_attributes,
601            message_deduplication_id: self.message_deduplication_id,
602            message_group_id: self.message_group_id,
603        })
604    }
605}
606impl ::std::fmt::Debug for PublishInputBuilder {
607    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
608        let mut formatter = f.debug_struct("PublishInputBuilder");
609        formatter.field("topic_arn", &self.topic_arn);
610        formatter.field("target_arn", &self.target_arn);
611        formatter.field("phone_number", &"*** Sensitive Data Redacted ***");
612        formatter.field("message", &self.message);
613        formatter.field("subject", &self.subject);
614        formatter.field("message_structure", &self.message_structure);
615        formatter.field("message_attributes", &self.message_attributes);
616        formatter.field("message_deduplication_id", &self.message_deduplication_id);
617        formatter.field("message_group_id", &self.message_group_id);
618        formatter.finish()
619    }
620}