aws_sdk_sns/operation/create_topic/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_topic::_create_topic_output::CreateTopicOutputBuilder;
3
4pub use crate::operation::create_topic::_create_topic_input::CreateTopicInputBuilder;
5
6impl crate::operation::create_topic::builders::CreateTopicInputBuilder {
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::create_topic::CreateTopicOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_topic::CreateTopicError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_topic();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateTopic`.
24///
25/// <p>Creates a topic to which notifications can be published. Users can create at most 100,000 standard topics (at most 1,000 FIFO topics). For more information, see <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html">Creating an Amazon SNS topic</a> in the <i>Amazon SNS Developer Guide</i>. This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateTopicFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::create_topic::builders::CreateTopicInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::create_topic::CreateTopicOutput,
35 crate::operation::create_topic::CreateTopicError,
36 > for CreateTopicFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::create_topic::CreateTopicOutput,
44 crate::operation::create_topic::CreateTopicError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl CreateTopicFluentBuilder {
51 /// Creates a new `CreateTopicFluentBuilder`.
52 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 /// Access the CreateTopic as a reference.
60 pub fn as_input(&self) -> &crate::operation::create_topic::builders::CreateTopicInputBuilder {
61 &self.inner
62 }
63 /// Sends the request and returns the response.
64 ///
65 /// If an error occurs, an `SdkError` will be returned with additional details that
66 /// can be matched against.
67 ///
68 /// By default, any retryable failures will be retried twice. Retry behavior
69 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70 /// set when configuring the client.
71 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::create_topic::CreateTopicOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::create_topic::CreateTopicError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::create_topic::CreateTopic::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::create_topic::CreateTopic::orchestrate(&runtime_plugins, input).await
90 }
91
92 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93 pub fn customize(
94 self,
95 ) -> crate::client::customize::CustomizableOperation<
96 crate::operation::create_topic::CreateTopicOutput,
97 crate::operation::create_topic::CreateTopicError,
98 Self,
99 > {
100 crate::client::customize::CustomizableOperation::new(self)
101 }
102 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108 self.config_override = config_override;
109 self
110 }
111 /// <p>The name of the topic you want to create.</p>
112 /// <p>Constraints: Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long.</p>
113 /// <p>For a FIFO (first-in-first-out) topic, the name must end with the <code>.fifo</code> suffix.</p>
114 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.name(input.into());
116 self
117 }
118 /// <p>The name of the topic you want to create.</p>
119 /// <p>Constraints: Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long.</p>
120 /// <p>For a FIFO (first-in-first-out) topic, the name must end with the <code>.fifo</code> suffix.</p>
121 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122 self.inner = self.inner.set_name(input);
123 self
124 }
125 /// <p>The name of the topic you want to create.</p>
126 /// <p>Constraints: Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long.</p>
127 /// <p>For a FIFO (first-in-first-out) topic, the name must end with the <code>.fifo</code> suffix.</p>
128 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
129 self.inner.get_name()
130 }
131 ///
132 /// Adds a key-value pair to `Attributes`.
133 ///
134 /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
135 ///
136 /// <p>A map of attributes with their corresponding values.</p>
137 /// <p>The following lists names, descriptions, and values of the special request parameters that the <code>CreateTopic</code> action uses:</p>
138 /// <ul>
139 /// <li>
140 /// <p><code>DeliveryPolicy</code> – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints.</p></li>
141 /// <li>
142 /// <p><code>DisplayName</code> – The display name to use for a topic with SMS subscriptions.</p></li>
143 /// <li>
144 /// <p><code>FifoTopic</code> – Set to true to create a FIFO topic.</p></li>
145 /// <li>
146 /// <p><code>Policy</code> – The policy that defines who can access your topic. By default, only the topic owner can publish or subscribe to the topic.</p></li>
147 /// <li>
148 /// <p><code>SignatureVersion</code> – The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS. By default, <code>SignatureVersion</code> is set to <code>1</code>.</p></li>
149 /// <li>
150 /// <p><code>TracingConfig</code> – Tracing mode of an Amazon SNS topic. By default <code>TracingConfig</code> is set to <code>PassThrough</code>, and the topic passes through the tracing header it receives from an Amazon SNS publisher to its subscriptions. If set to <code>Active</code>, Amazon SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. This is only supported on standard topics.</p></li>
151 /// </ul>
152 /// <p>The following attribute applies only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html">server-side encryption</a>:</p>
153 /// <ul>
154 /// <li>
155 /// <p><code>KmsMasterKeyId</code> – The ID of an Amazon Web Services managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html#sse-key-terms">Key Terms</a>. For more examples, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters">KeyId</a> in the <i>Key Management Service API Reference</i>.</p></li>
156 /// </ul>
157 /// <p>The following attributes apply only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-fifo-topics.html">FIFO topics</a>:</p>
158 /// <ul>
159 /// <li>
160 /// <p><code>ArchivePolicy</code> – The policy that sets the retention period for messages stored in the message archive of an Amazon SNS FIFO topic.</p></li>
161 /// <li>
162 /// <p><code>ContentBasedDeduplication</code> – Enables content-based deduplication for FIFO topics.</p>
163 /// <ul>
164 /// <li>
165 /// <p>By default, <code>ContentBasedDeduplication</code> is set to <code>false</code>. If you create a FIFO topic and this attribute is <code>false</code>, you must specify a value for the <code>MessageDeduplicationId</code> parameter for the <a href="https://docs.aws.amazon.com/sns/latest/api/API_Publish.html">Publish</a> action.</p></li>
166 /// <li>
167 /// <p>When you set <code>ContentBasedDeduplication</code> to <code>true</code>, 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>
168 /// <p>(Optional) To override the generated value, you can specify a value for the <code>MessageDeduplicationId</code> parameter for the <code>Publish</code> action.</p></li>
169 /// </ul></li>
170 /// </ul>
171 /// <ul>
172 /// <li>
173 /// <p><code>FifoThroughputScope</code> – Enables higher throughput for your FIFO topic by adjusting the scope of deduplication. This attribute has two possible values:</p>
174 /// <ul>
175 /// <li>
176 /// <p><code>Topic</code> – The scope of message deduplication is across the entire topic. This is the default value and maintains existing behavior, with a maximum throughput of 3000 messages per second or 20MB per second, whichever comes first.</p></li>
177 /// <li>
178 /// <p><code>MessageGroup</code> – The scope of deduplication is within each individual message group, which enables higher throughput per topic subject to regional quotas. For more information on quotas or to request an increase, see <a href="https://docs.aws.amazon.com/general/latest/gr/sns.html">Amazon SNS service quotas</a> in the Amazon Web Services General Reference.</p></li>
179 /// </ul></li>
180 /// </ul>
181 pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
182 self.inner = self.inner.attributes(k.into(), v.into());
183 self
184 }
185 /// <p>A map of attributes with their corresponding values.</p>
186 /// <p>The following lists names, descriptions, and values of the special request parameters that the <code>CreateTopic</code> action uses:</p>
187 /// <ul>
188 /// <li>
189 /// <p><code>DeliveryPolicy</code> – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints.</p></li>
190 /// <li>
191 /// <p><code>DisplayName</code> – The display name to use for a topic with SMS subscriptions.</p></li>
192 /// <li>
193 /// <p><code>FifoTopic</code> – Set to true to create a FIFO topic.</p></li>
194 /// <li>
195 /// <p><code>Policy</code> – The policy that defines who can access your topic. By default, only the topic owner can publish or subscribe to the topic.</p></li>
196 /// <li>
197 /// <p><code>SignatureVersion</code> – The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS. By default, <code>SignatureVersion</code> is set to <code>1</code>.</p></li>
198 /// <li>
199 /// <p><code>TracingConfig</code> – Tracing mode of an Amazon SNS topic. By default <code>TracingConfig</code> is set to <code>PassThrough</code>, and the topic passes through the tracing header it receives from an Amazon SNS publisher to its subscriptions. If set to <code>Active</code>, Amazon SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. This is only supported on standard topics.</p></li>
200 /// </ul>
201 /// <p>The following attribute applies only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html">server-side encryption</a>:</p>
202 /// <ul>
203 /// <li>
204 /// <p><code>KmsMasterKeyId</code> – The ID of an Amazon Web Services managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html#sse-key-terms">Key Terms</a>. For more examples, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters">KeyId</a> in the <i>Key Management Service API Reference</i>.</p></li>
205 /// </ul>
206 /// <p>The following attributes apply only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-fifo-topics.html">FIFO topics</a>:</p>
207 /// <ul>
208 /// <li>
209 /// <p><code>ArchivePolicy</code> – The policy that sets the retention period for messages stored in the message archive of an Amazon SNS FIFO topic.</p></li>
210 /// <li>
211 /// <p><code>ContentBasedDeduplication</code> – Enables content-based deduplication for FIFO topics.</p>
212 /// <ul>
213 /// <li>
214 /// <p>By default, <code>ContentBasedDeduplication</code> is set to <code>false</code>. If you create a FIFO topic and this attribute is <code>false</code>, you must specify a value for the <code>MessageDeduplicationId</code> parameter for the <a href="https://docs.aws.amazon.com/sns/latest/api/API_Publish.html">Publish</a> action.</p></li>
215 /// <li>
216 /// <p>When you set <code>ContentBasedDeduplication</code> to <code>true</code>, 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>
217 /// <p>(Optional) To override the generated value, you can specify a value for the <code>MessageDeduplicationId</code> parameter for the <code>Publish</code> action.</p></li>
218 /// </ul></li>
219 /// </ul>
220 /// <ul>
221 /// <li>
222 /// <p><code>FifoThroughputScope</code> – Enables higher throughput for your FIFO topic by adjusting the scope of deduplication. This attribute has two possible values:</p>
223 /// <ul>
224 /// <li>
225 /// <p><code>Topic</code> – The scope of message deduplication is across the entire topic. This is the default value and maintains existing behavior, with a maximum throughput of 3000 messages per second or 20MB per second, whichever comes first.</p></li>
226 /// <li>
227 /// <p><code>MessageGroup</code> – The scope of deduplication is within each individual message group, which enables higher throughput per topic subject to regional quotas. For more information on quotas or to request an increase, see <a href="https://docs.aws.amazon.com/general/latest/gr/sns.html">Amazon SNS service quotas</a> in the Amazon Web Services General Reference.</p></li>
228 /// </ul></li>
229 /// </ul>
230 pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
231 self.inner = self.inner.set_attributes(input);
232 self
233 }
234 /// <p>A map of attributes with their corresponding values.</p>
235 /// <p>The following lists names, descriptions, and values of the special request parameters that the <code>CreateTopic</code> action uses:</p>
236 /// <ul>
237 /// <li>
238 /// <p><code>DeliveryPolicy</code> – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints.</p></li>
239 /// <li>
240 /// <p><code>DisplayName</code> – The display name to use for a topic with SMS subscriptions.</p></li>
241 /// <li>
242 /// <p><code>FifoTopic</code> – Set to true to create a FIFO topic.</p></li>
243 /// <li>
244 /// <p><code>Policy</code> – The policy that defines who can access your topic. By default, only the topic owner can publish or subscribe to the topic.</p></li>
245 /// <li>
246 /// <p><code>SignatureVersion</code> – The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS. By default, <code>SignatureVersion</code> is set to <code>1</code>.</p></li>
247 /// <li>
248 /// <p><code>TracingConfig</code> – Tracing mode of an Amazon SNS topic. By default <code>TracingConfig</code> is set to <code>PassThrough</code>, and the topic passes through the tracing header it receives from an Amazon SNS publisher to its subscriptions. If set to <code>Active</code>, Amazon SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. This is only supported on standard topics.</p></li>
249 /// </ul>
250 /// <p>The following attribute applies only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html">server-side encryption</a>:</p>
251 /// <ul>
252 /// <li>
253 /// <p><code>KmsMasterKeyId</code> – The ID of an Amazon Web Services managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html#sse-key-terms">Key Terms</a>. For more examples, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters">KeyId</a> in the <i>Key Management Service API Reference</i>.</p></li>
254 /// </ul>
255 /// <p>The following attributes apply only to <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-fifo-topics.html">FIFO topics</a>:</p>
256 /// <ul>
257 /// <li>
258 /// <p><code>ArchivePolicy</code> – The policy that sets the retention period for messages stored in the message archive of an Amazon SNS FIFO topic.</p></li>
259 /// <li>
260 /// <p><code>ContentBasedDeduplication</code> – Enables content-based deduplication for FIFO topics.</p>
261 /// <ul>
262 /// <li>
263 /// <p>By default, <code>ContentBasedDeduplication</code> is set to <code>false</code>. If you create a FIFO topic and this attribute is <code>false</code>, you must specify a value for the <code>MessageDeduplicationId</code> parameter for the <a href="https://docs.aws.amazon.com/sns/latest/api/API_Publish.html">Publish</a> action.</p></li>
264 /// <li>
265 /// <p>When you set <code>ContentBasedDeduplication</code> to <code>true</code>, 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>
266 /// <p>(Optional) To override the generated value, you can specify a value for the <code>MessageDeduplicationId</code> parameter for the <code>Publish</code> action.</p></li>
267 /// </ul></li>
268 /// </ul>
269 /// <ul>
270 /// <li>
271 /// <p><code>FifoThroughputScope</code> – Enables higher throughput for your FIFO topic by adjusting the scope of deduplication. This attribute has two possible values:</p>
272 /// <ul>
273 /// <li>
274 /// <p><code>Topic</code> – The scope of message deduplication is across the entire topic. This is the default value and maintains existing behavior, with a maximum throughput of 3000 messages per second or 20MB per second, whichever comes first.</p></li>
275 /// <li>
276 /// <p><code>MessageGroup</code> – The scope of deduplication is within each individual message group, which enables higher throughput per topic subject to regional quotas. For more information on quotas or to request an increase, see <a href="https://docs.aws.amazon.com/general/latest/gr/sns.html">Amazon SNS service quotas</a> in the Amazon Web Services General Reference.</p></li>
277 /// </ul></li>
278 /// </ul>
279 pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
280 self.inner.get_attributes()
281 }
282 ///
283 /// Appends an item to `Tags`.
284 ///
285 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
286 ///
287 /// <p>The list of tags to add to a new topic.</p><note>
288 /// <p>To be able to tag a topic on creation, you must have the <code>sns:CreateTopic</code> and <code>sns:TagResource</code> permissions.</p>
289 /// </note>
290 pub fn tags(mut self, input: crate::types::Tag) -> Self {
291 self.inner = self.inner.tags(input);
292 self
293 }
294 /// <p>The list of tags to add to a new topic.</p><note>
295 /// <p>To be able to tag a topic on creation, you must have the <code>sns:CreateTopic</code> and <code>sns:TagResource</code> permissions.</p>
296 /// </note>
297 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
298 self.inner = self.inner.set_tags(input);
299 self
300 }
301 /// <p>The list of tags to add to a new topic.</p><note>
302 /// <p>To be able to tag a topic on creation, you must have the <code>sns:CreateTopic</code> and <code>sns:TagResource</code> permissions.</p>
303 /// </note>
304 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
305 self.inner.get_tags()
306 }
307 /// <p>The body of the policy document you want to use for this topic.</p>
308 /// <p>You can only add one policy per topic.</p>
309 /// <p>The policy must be in JSON string format.</p>
310 /// <p>Length Constraints: Maximum length of 30,720.</p>
311 pub fn data_protection_policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
312 self.inner = self.inner.data_protection_policy(input.into());
313 self
314 }
315 /// <p>The body of the policy document you want to use for this topic.</p>
316 /// <p>You can only add one policy per topic.</p>
317 /// <p>The policy must be in JSON string format.</p>
318 /// <p>Length Constraints: Maximum length of 30,720.</p>
319 pub fn set_data_protection_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
320 self.inner = self.inner.set_data_protection_policy(input);
321 self
322 }
323 /// <p>The body of the policy document you want to use for this topic.</p>
324 /// <p>You can only add one policy per topic.</p>
325 /// <p>The policy must be in JSON string format.</p>
326 /// <p>Length Constraints: Maximum length of 30,720.</p>
327 pub fn get_data_protection_policy(&self) -> &::std::option::Option<::std::string::String> {
328 self.inner.get_data_protection_policy()
329 }
330}