aws_sdk_sns/operation/publish_batch/
_publish_batch_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct PublishBatchInput {
6    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
7    pub topic_arn: ::std::option::Option<::std::string::String>,
8    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
9    pub publish_batch_request_entries: ::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>>,
10}
11impl PublishBatchInput {
12    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
13    pub fn topic_arn(&self) -> ::std::option::Option<&str> {
14        self.topic_arn.as_deref()
15    }
16    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
17    ///
18    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.publish_batch_request_entries.is_none()`.
19    pub fn publish_batch_request_entries(&self) -> &[crate::types::PublishBatchRequestEntry] {
20        self.publish_batch_request_entries.as_deref().unwrap_or_default()
21    }
22}
23impl PublishBatchInput {
24    /// Creates a new builder-style object to manufacture [`PublishBatchInput`](crate::operation::publish_batch::PublishBatchInput).
25    pub fn builder() -> crate::operation::publish_batch::builders::PublishBatchInputBuilder {
26        crate::operation::publish_batch::builders::PublishBatchInputBuilder::default()
27    }
28}
29
30/// A builder for [`PublishBatchInput`](crate::operation::publish_batch::PublishBatchInput).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct PublishBatchInputBuilder {
34    pub(crate) topic_arn: ::std::option::Option<::std::string::String>,
35    pub(crate) publish_batch_request_entries: ::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>>,
36}
37impl PublishBatchInputBuilder {
38    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
39    /// This field is required.
40    pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.topic_arn = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
45    pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.topic_arn = input;
47        self
48    }
49    /// <p>The Amazon resource name (ARN) of the topic you want to batch publish to.</p>
50    pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
51        &self.topic_arn
52    }
53    /// Appends an item to `publish_batch_request_entries`.
54    ///
55    /// To override the contents of this collection use [`set_publish_batch_request_entries`](Self::set_publish_batch_request_entries).
56    ///
57    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
58    pub fn publish_batch_request_entries(mut self, input: crate::types::PublishBatchRequestEntry) -> Self {
59        let mut v = self.publish_batch_request_entries.unwrap_or_default();
60        v.push(input);
61        self.publish_batch_request_entries = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
65    pub fn set_publish_batch_request_entries(
66        mut self,
67        input: ::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>>,
68    ) -> Self {
69        self.publish_batch_request_entries = input;
70        self
71    }
72    /// <p>A list of <code>PublishBatch</code> request entries to be sent to the SNS topic.</p>
73    pub fn get_publish_batch_request_entries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PublishBatchRequestEntry>> {
74        &self.publish_batch_request_entries
75    }
76    /// Consumes the builder and constructs a [`PublishBatchInput`](crate::operation::publish_batch::PublishBatchInput).
77    pub fn build(
78        self,
79    ) -> ::std::result::Result<crate::operation::publish_batch::PublishBatchInput, ::aws_smithy_types::error::operation::BuildError> {
80        ::std::result::Result::Ok(crate::operation::publish_batch::PublishBatchInput {
81            topic_arn: self.topic_arn,
82            publish_batch_request_entries: self.publish_batch_request_entries,
83        })
84    }
85}