aws_sdk_s3/operation/put_bucket_notification_configuration/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_notification_configuration::_put_bucket_notification_configuration_output::PutBucketNotificationConfigurationOutputBuilder;
3
4pub use crate::operation::put_bucket_notification_configuration::_put_bucket_notification_configuration_input::PutBucketNotificationConfigurationInputBuilder;
5
6impl crate::operation::put_bucket_notification_configuration::builders::PutBucketNotificationConfigurationInputBuilder {
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::put_bucket_notification_configuration::PutBucketNotificationConfigurationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_bucket_notification_configuration();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutBucketNotificationConfiguration`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Enables notifications of specified events for a bucket. For more information about event notifications, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html">Configuring Event Notifications</a>.</p>
29/// <p>Using this API, you can replace an existing notification configuration. The configuration is an XML file that defines the event types that you want Amazon S3 to publish and the destination where you want Amazon S3 to publish an event notification when it detects an event of the specified type.</p>
30/// <p>By default, your bucket has no event notifications configured. That is, the notification configuration will be an empty <code>NotificationConfiguration</code>.</p>
31/// <p><code><notificationconfiguration></notificationconfiguration></code></p>
32/// <p><code></code></p>
33/// <p>This action replaces the existing notification configuration with the configuration you include in the request body.</p>
34/// <p>After Amazon S3 receives this request, it first verifies that any Amazon Simple Notification Service (Amazon SNS) or Amazon Simple Queue Service (Amazon SQS) destination exists, and that the bucket owner has permission to publish to it by sending a test notification. In the case of Lambda destinations, Amazon S3 verifies that the Lambda function permissions grant Amazon S3 permission to invoke the function from the Amazon S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html">Configuring Notifications for Amazon S3 Events</a>.</p>
35/// <p>You can disable notifications by adding the empty NotificationConfiguration element.</p>
36/// <p>For more information about the number of event notification configurations that you can create per bucket, see <a href="https://docs.aws.amazon.com/general/latest/gr/s3.html#limits_s3">Amazon S3 service quotas</a> in <i>Amazon Web Services General Reference</i>.</p>
37/// <p>By default, only the bucket owner can configure notifications on a bucket. However, bucket owners can use a bucket policy to grant permission to other users to set this configuration with the required <code>s3:PutBucketNotification</code> permission.</p><note>
38/// <p>The PUT notification is an atomic operation. For example, suppose your notification configuration includes SNS topic, SQS queue, and Lambda function configurations. When you send a PUT request with this configuration, Amazon S3 sends test messages to your SNS topic. If the message fails, the entire PUT action will fail, and Amazon S3 will not add the configuration to your bucket.</p>
39/// </note>
40/// <p>If the configuration in the request body includes only one <code>TopicConfiguration</code> specifying only the <code>s3:ReducedRedundancyLostObject</code> event type, the response will also include the <code>x-amz-sns-test-message-id</code> header containing the message ID of the test notification sent to the topic.</p>
41/// <p>The following action is related to <code>PutBucketNotificationConfiguration</code>:</p>
42/// <ul>
43/// <li>
44/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotificationConfiguration.html">GetBucketNotificationConfiguration</a></p></li>
45/// </ul>
46#[derive(::std::clone::Clone, ::std::fmt::Debug)]
47pub struct PutBucketNotificationConfigurationFluentBuilder {
48    handle: ::std::sync::Arc<crate::client::Handle>,
49    inner: crate::operation::put_bucket_notification_configuration::builders::PutBucketNotificationConfigurationInputBuilder,
50    config_override: ::std::option::Option<crate::config::Builder>,
51}
52impl
53    crate::client::customize::internal::CustomizableSend<
54        crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationOutput,
55        crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationError,
56    > for PutBucketNotificationConfigurationFluentBuilder
57{
58    fn send(
59        self,
60        config_override: crate::config::Builder,
61    ) -> crate::client::customize::internal::BoxFuture<
62        crate::client::customize::internal::SendResult<
63            crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationOutput,
64            crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationError,
65        >,
66    > {
67        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68    }
69}
70impl PutBucketNotificationConfigurationFluentBuilder {
71    /// Creates a new `PutBucketNotificationConfigurationFluentBuilder`.
72    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73        Self {
74            handle,
75            inner: ::std::default::Default::default(),
76            config_override: ::std::option::Option::None,
77        }
78    }
79    /// Access the PutBucketNotificationConfiguration as a reference.
80    pub fn as_input(&self) -> &crate::operation::put_bucket_notification_configuration::builders::PutBucketNotificationConfigurationInputBuilder {
81        &self.inner
82    }
83    /// Sends the request and returns the response.
84    ///
85    /// If an error occurs, an `SdkError` will be returned with additional details that
86    /// can be matched against.
87    ///
88    /// By default, any retryable failures will be retried twice. Retry behavior
89    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90    /// set when configuring the client.
91    pub async fn send(
92        self,
93    ) -> ::std::result::Result<
94        crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationOutput,
95        ::aws_smithy_runtime_api::client::result::SdkError<
96            crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationError,
97            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98        >,
99    > {
100        let input = self
101            .inner
102            .build()
103            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104        let runtime_plugins = crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfiguration::operation_runtime_plugins(
105            self.handle.runtime_plugins.clone(),
106            &self.handle.conf,
107            self.config_override,
108        );
109        crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfiguration::orchestrate(&runtime_plugins, input).await
110    }
111
112    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113    pub fn customize(
114        self,
115    ) -> crate::client::customize::CustomizableOperation<
116        crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationOutput,
117        crate::operation::put_bucket_notification_configuration::PutBucketNotificationConfigurationError,
118        Self,
119    > {
120        crate::client::customize::CustomizableOperation::new(self)
121    }
122    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123        self.set_config_override(::std::option::Option::Some(config_override.into()));
124        self
125    }
126
127    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128        self.config_override = config_override;
129        self
130    }
131    /// <p>The name of the bucket.</p>
132    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.bucket(input.into());
134        self
135    }
136    /// <p>The name of the bucket.</p>
137    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_bucket(input);
139        self
140    }
141    /// <p>The name of the bucket.</p>
142    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_bucket()
144    }
145    /// <p>A container for specifying the notification configuration of the bucket. If this element is empty, notifications are turned off for the bucket.</p>
146    pub fn notification_configuration(mut self, input: crate::types::NotificationConfiguration) -> Self {
147        self.inner = self.inner.notification_configuration(input);
148        self
149    }
150    /// <p>A container for specifying the notification configuration of the bucket. If this element is empty, notifications are turned off for the bucket.</p>
151    pub fn set_notification_configuration(mut self, input: ::std::option::Option<crate::types::NotificationConfiguration>) -> Self {
152        self.inner = self.inner.set_notification_configuration(input);
153        self
154    }
155    /// <p>A container for specifying the notification configuration of the bucket. If this element is empty, notifications are turned off for the bucket.</p>
156    pub fn get_notification_configuration(&self) -> &::std::option::Option<crate::types::NotificationConfiguration> {
157        self.inner.get_notification_configuration()
158    }
159    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
160    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.expected_bucket_owner(input.into());
162        self
163    }
164    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
165    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_expected_bucket_owner(input);
167        self
168    }
169    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
170    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_expected_bucket_owner()
172    }
173    /// <p>Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or false value.</p>
174    pub fn skip_destination_validation(mut self, input: bool) -> Self {
175        self.inner = self.inner.skip_destination_validation(input);
176        self
177    }
178    /// <p>Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or false value.</p>
179    pub fn set_skip_destination_validation(mut self, input: ::std::option::Option<bool>) -> Self {
180        self.inner = self.inner.set_skip_destination_validation(input);
181        self
182    }
183    /// <p>Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or false value.</p>
184    pub fn get_skip_destination_validation(&self) -> &::std::option::Option<bool> {
185        self.inner.get_skip_destination_validation()
186    }
187}