aws-sdk-sns 1.121.0

AWS SDK for Amazon Simple Notification Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::publish_batch::_publish_batch_input::PublishBatchInputBuilder;

pub use crate::operation::publish_batch::_publish_batch_output::PublishBatchOutputBuilder;

impl crate::operation::publish_batch::builders::PublishBatchInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::publish_batch::PublishBatchOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::publish_batch::PublishBatchError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.publish_batch();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `PublishBatch`.
///
/// <p>Publishes up to 10 messages to the specified topic in a single batch. This is a batch version of the <code>Publish</code> API. If you try to send more than 10 messages in a single batch request, you will receive a <code>TooManyEntriesInBatchRequest</code> exception.</p>
/// <p>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 five minutes.</p>
/// <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 200.</p>
/// <p>By default, 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 KiB (262,144 bytes). To publish larger batches, set the topic's <code>MaximumMessageSize</code> attribute, which supports values up to 1 MiB (1,048,576 bytes). The combined size of all messages in the batch, including each message's body and attributes, must not exceed the topic's <code>MaximumMessageSize</code>.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/sns/latest/dg/large-message-payloads.html">Large message payloads</a> in the <i>Amazon SNS Developer Guide.</i></p><important>
/// <p>The <code>PublishBatch</code> API can send up to 10 messages at a time. If you attempt to send more than 10 messages in one request, you will encounter a <code>TooManyEntriesInBatchRequest</code> exception. In such cases, split your messages into multiple requests, each containing no more than 10 messages.</p>
/// </important>
/// <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 <b>1</b>. For example, a parameter list with two elements looks like this:</p>
/// <p><code>&amp;AttributeName.1=first</code></p>
/// <p><code>&amp;AttributeName.2=second</code></p>
/// <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>
/// <p>When a <code>messageId</code> is returned, the batch message is saved, and Amazon SNS immediately delivers the message to subscribers.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct PublishBatchFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::publish_batch::builders::PublishBatchInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::publish_batch::PublishBatchOutput,
        crate::operation::publish_batch::PublishBatchError,
    > for PublishBatchFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::publish_batch::PublishBatchOutput,
            crate::operation::publish_batch::PublishBatchError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl PublishBatchFluentBuilder {
    /// Creates a new `PublishBatchFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the PublishBatch as a reference.
    pub fn as_input(&self) -> &crate::operation::publish_batch::builders::PublishBatchInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::publish_batch::PublishBatchOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::publish_batch::PublishBatchError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::publish_batch::PublishBatch::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::publish_batch::PublishBatch::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::publish_batch::PublishBatchOutput,
        crate::operation::publish_batch::PublishBatchError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
    pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.topic_arn(input.into());
        self
    }
    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
    pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_topic_arn(input);
        self
    }
    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
    pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_topic_arn()
    }
    ///
    /// Appends an item to `PublishBatchRequestEntries`.
    ///
    /// To override the contents of this collection use [`set_publish_batch_request_entries`](Self::set_publish_batch_request_entries).
    ///
    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
    pub fn publish_batch_request_entries(mut self, input: crate::types::PublishBatchRequestEntry) -> Self {
        self.inner = self.inner.publish_batch_request_entries(input);
        self
    }
    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
    pub fn set_publish_batch_request_entries(
        mut self,
        input: ::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>>,
    ) -> Self {
        self.inner = self.inner.set_publish_batch_request_entries(input);
        self
    }
    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
    pub fn get_publish_batch_request_entries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>> {
        self.inner.get_publish_batch_request_entries()
    }
}