aws_sdk_sns/operation/publish_batch/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::publish_batch::_publish_batch_output::PublishBatchOutputBuilder;
3
4pub use crate::operation::publish_batch::_publish_batch_input::PublishBatchInputBuilder;
5
6impl crate::operation::publish_batch::builders::PublishBatchInputBuilder {
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::publish_batch::PublishBatchOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::publish_batch::PublishBatchError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.publish_batch();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PublishBatch`.
24///
25/// <p>Publishes up to ten messages to the specified topic. This is a batch version of <code>Publish</code>. For FIFO topics, multiple messages within a single batch are published in the order they are sent, and messages are deduplicated within the batch and across batches for 5 minutes.</p>
26/// <p>The result of publishing each message is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of <code>200</code>.</p>
27/// <p>The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths of all of the batched messages) are both 256 KB (262,144 bytes).</p>
28/// <p>Some actions take lists of parameters. These lists are specified using the <code>param.n</code> notation. Values of <code>n</code> are integers starting from 1. For example, a parameter list with two elements looks like this:</p>
29/// <p>&amp;AttributeName.1=first</p>
30/// <p>&amp;AttributeName.2=second</p>
31/// <p>If you send a batch message to a topic, Amazon SNS publishes the batch message to each endpoint that is subscribed to the topic. The format of the batch message depends on the notification protocol for each subscribed endpoint.</p>
32/// <p>When a <code>messageId</code> is returned, the batch message is saved and Amazon SNS immediately delivers the message to subscribers.</p>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct PublishBatchFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::publish_batch::builders::PublishBatchInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40    crate::client::customize::internal::CustomizableSend<
41        crate::operation::publish_batch::PublishBatchOutput,
42        crate::operation::publish_batch::PublishBatchError,
43    > for PublishBatchFluentBuilder
44{
45    fn send(
46        self,
47        config_override: crate::config::Builder,
48    ) -> crate::client::customize::internal::BoxFuture<
49        crate::client::customize::internal::SendResult<
50            crate::operation::publish_batch::PublishBatchOutput,
51            crate::operation::publish_batch::PublishBatchError,
52        >,
53    > {
54        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55    }
56}
57impl PublishBatchFluentBuilder {
58    /// Creates a new `PublishBatchFluentBuilder`.
59    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60        Self {
61            handle,
62            inner: ::std::default::Default::default(),
63            config_override: ::std::option::Option::None,
64        }
65    }
66    /// Access the PublishBatch as a reference.
67    pub fn as_input(&self) -> &crate::operation::publish_batch::builders::PublishBatchInputBuilder {
68        &self.inner
69    }
70    /// Sends the request and returns the response.
71    ///
72    /// If an error occurs, an `SdkError` will be returned with additional details that
73    /// can be matched against.
74    ///
75    /// By default, any retryable failures will be retried twice. Retry behavior
76    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77    /// set when configuring the client.
78    pub async fn send(
79        self,
80    ) -> ::std::result::Result<
81        crate::operation::publish_batch::PublishBatchOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::publish_batch::PublishBatchError,
84            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85        >,
86    > {
87        let input = self
88            .inner
89            .build()
90            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91        let runtime_plugins = crate::operation::publish_batch::PublishBatch::operation_runtime_plugins(
92            self.handle.runtime_plugins.clone(),
93            &self.handle.conf,
94            self.config_override,
95        );
96        crate::operation::publish_batch::PublishBatch::orchestrate(&runtime_plugins, input).await
97    }
98
99    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100    pub fn customize(
101        self,
102    ) -> crate::client::customize::CustomizableOperation<
103        crate::operation::publish_batch::PublishBatchOutput,
104        crate::operation::publish_batch::PublishBatchError,
105        Self,
106    > {
107        crate::client::customize::CustomizableOperation::new(self)
108    }
109    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110        self.set_config_override(::std::option::Option::Some(config_override.into()));
111        self
112    }
113
114    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115        self.config_override = config_override;
116        self
117    }
118    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
119    pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.inner = self.inner.topic_arn(input.into());
121        self
122    }
123    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
124    pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.inner = self.inner.set_topic_arn(input);
126        self
127    }
128    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
129    pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
130        self.inner.get_topic_arn()
131    }
132    ///
133    /// Appends an item to `PublishBatchRequestEntries`.
134    ///
135    /// To override the contents of this collection use [`set_publish_batch_request_entries`](Self::set_publish_batch_request_entries).
136    ///
137    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
138    pub fn publish_batch_request_entries(mut self, input: crate::types::PublishBatchRequestEntry) -> Self {
139        self.inner = self.inner.publish_batch_request_entries(input);
140        self
141    }
142    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
143    pub fn set_publish_batch_request_entries(
144        mut self,
145        input: ::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>>,
146    ) -> Self {
147        self.inner = self.inner.set_publish_batch_request_entries(input);
148        self
149    }
150    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
151    pub fn get_publish_batch_request_entries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>> {
152        self.inner.get_publish_batch_request_entries()
153    }
154}