aws_sdk_sqs/operation/send_message_batch/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::send_message_batch::_send_message_batch_output::SendMessageBatchOutputBuilder;
3
4pub use crate::operation::send_message_batch::_send_message_batch_input::SendMessageBatchInputBuilder;
5
6impl crate::operation::send_message_batch::builders::SendMessageBatchInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::send_message_batch::SendMessageBatchOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::send_message_batch::SendMessageBatchError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.send_message_batch();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `SendMessageBatch`.
24///
25/// <p>You can use <code>SendMessageBatch</code> to send up to 10 messages to the specified queue by assigning either identical or different values to each message (or by not assigning values at all). This is a batch version of <code> <code>SendMessage</code>.</code> For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent.</p>
26/// <p>The result of sending 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 1 MiB 1,048,576 bytes.</p><important>
28/// <p>A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed. For more information, see the <a href="http://www.w3.org/TR/REC-xml/#charsets">W3C specification for characters</a>.</p>
29/// <p><code>#x9</code> | <code>#xA</code> | <code>#xD</code> | <code>#x20</code> to <code>#xD7FF</code> | <code>#xE000</code> to <code>#xFFFD</code> | <code>#x10000</code> to <code>#x10FFFF</code></p>
30/// <p>If a message contains characters outside the allowed set, Amazon SQS rejects the message and returns an InvalidMessageContents error. Ensure that your message body includes only valid characters to avoid this exception.</p>
31/// </important>
32/// <p>If you don't specify the <code>DelaySeconds</code> parameter for an entry, Amazon SQS uses the default value for the queue.</p>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct SendMessageBatchFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::send_message_batch::builders::SendMessageBatchInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40    crate::client::customize::internal::CustomizableSend<
41        crate::operation::send_message_batch::SendMessageBatchOutput,
42        crate::operation::send_message_batch::SendMessageBatchError,
43    > for SendMessageBatchFluentBuilder
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::send_message_batch::SendMessageBatchOutput,
51            crate::operation::send_message_batch::SendMessageBatchError,
52        >,
53    > {
54        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55    }
56}
57impl SendMessageBatchFluentBuilder {
58    /// Creates a new `SendMessageBatchFluentBuilder`.
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 SendMessageBatch as a reference.
67    pub fn as_input(&self) -> &crate::operation::send_message_batch::builders::SendMessageBatchInputBuilder {
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::send_message_batch::SendMessageBatchOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::send_message_batch::SendMessageBatchError,
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::send_message_batch::SendMessageBatch::operation_runtime_plugins(
92            self.handle.runtime_plugins.clone(),
93            &self.handle.conf,
94            self.config_override,
95        );
96        crate::operation::send_message_batch::SendMessageBatch::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::send_message_batch::SendMessageBatchOutput,
104        crate::operation::send_message_batch::SendMessageBatchError,
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 URL of the Amazon SQS queue to which batched messages are sent.</p>
119    /// <p>Queue URLs and names are case-sensitive.</p>
120    pub fn queue_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.queue_url(input.into());
122        self
123    }
124    /// <p>The URL of the Amazon SQS queue to which batched messages are sent.</p>
125    /// <p>Queue URLs and names are case-sensitive.</p>
126    pub fn set_queue_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_queue_url(input);
128        self
129    }
130    /// <p>The URL of the Amazon SQS queue to which batched messages are sent.</p>
131    /// <p>Queue URLs and names are case-sensitive.</p>
132    pub fn get_queue_url(&self) -> &::std::option::Option<::std::string::String> {
133        self.inner.get_queue_url()
134    }
135    ///
136    /// Appends an item to `Entries`.
137    ///
138    /// To override the contents of this collection use [`set_entries`](Self::set_entries).
139    ///
140    /// <p>A list of <code> <code>SendMessageBatchRequestEntry</code> </code> items.</p>
141    pub fn entries(mut self, input: crate::types::SendMessageBatchRequestEntry) -> Self {
142        self.inner = self.inner.entries(input);
143        self
144    }
145    /// <p>A list of <code> <code>SendMessageBatchRequestEntry</code> </code> items.</p>
146    pub fn set_entries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SendMessageBatchRequestEntry>>) -> Self {
147        self.inner = self.inner.set_entries(input);
148        self
149    }
150    /// <p>A list of <code> <code>SendMessageBatchRequestEntry</code> </code> items.</p>
151    pub fn get_entries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SendMessageBatchRequestEntry>> {
152        self.inner.get_entries()
153    }
154}