aws_sdk_s3/operation/put_bucket_lifecycle_configuration/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_lifecycle_configuration::_put_bucket_lifecycle_configuration_output::PutBucketLifecycleConfigurationOutputBuilder;
3
4pub use crate::operation::put_bucket_lifecycle_configuration::_put_bucket_lifecycle_configuration_input::PutBucketLifecycleConfigurationInputBuilder;
5
6impl crate::operation::put_bucket_lifecycle_configuration::builders::PutBucketLifecycleConfigurationInputBuilder {
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_lifecycle_configuration::PutBucketLifecycleConfigurationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_bucket_lifecycle_configuration();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutBucketLifecycleConfiguration`.
24///
25/// <note>
26/// <p>This operation is not supported by directory buckets.</p>
27/// </note>
28/// <p>Creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration. Keep in mind that this will overwrite an existing lifecycle configuration, so if you want to retain any configuration details, they must be included in the new lifecycle configuration. For information about lifecycle configuration, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html">Managing your storage lifecycle</a>.</p><note>
29/// <p>Bucket lifecycle configuration now supports specifying a lifecycle rule using an object key name prefix, one or more object tags, object size, or any combination of these. Accordingly, this section describes the latest API. The previous version of the API supported filtering based only on an object key name prefix, which is supported for backward compatibility. For the related API description, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycle.html">PutBucketLifecycle</a>.</p>
30/// </note>
31/// <dl>
32/// <dt>
33/// Rules
34/// </dt>
35/// <dd>
36/// <p>You specify the lifecycle configuration in your request body. The lifecycle configuration is specified as XML consisting of one or more rules. An Amazon S3 Lifecycle configuration can have up to 1,000 rules. This limit is not adjustable. Each rule consists of the following:</p>
37/// <ul>
38/// <li>
39/// <p>A filter identifying a subset of objects to which the rule applies. The filter can be based on a key name prefix, object tags, object size, or any combination of these.</p></li>
40/// <li>
41/// <p>A status indicating whether the rule is in effect.</p></li>
42/// <li>
43/// <p>One or more lifecycle transition and expiration actions that you want Amazon S3 to perform on the objects identified by the filter. If the state of your bucket is versioning-enabled or versioning-suspended, you can have many versions of the same object (one current version and zero or more noncurrent versions). Amazon S3 provides predefined actions that you can specify for current and noncurrent object versions.</p></li>
44/// </ul>
45/// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html">Object Lifecycle Management</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html">Lifecycle Configuration Elements</a>.</p>
46/// </dd>
47/// <dt>
48/// Permissions
49/// </dt>
50/// <dd>
51/// <p>By default, all Amazon S3 resources are private, including buckets, objects, and related subresources (for example, lifecycle configuration and website configuration). Only the resource owner (that is, the Amazon Web Services account that created it) can access the resource. The resource owner can optionally grant access permissions to others by writing an access policy. For this operation, a user must get the <code>s3:PutLifecycleConfiguration</code> permission.</p>
52/// <p>You can also explicitly deny permissions. An explicit deny also supersedes any other permissions. If you want to block users or accounts from removing or deleting objects from your bucket, you must deny them permissions for the following actions:</p>
53/// <ul>
54/// <li>
55/// <p><code>s3:DeleteObject</code></p></li>
56/// <li>
57/// <p><code>s3:DeleteObjectVersion</code></p></li>
58/// <li>
59/// <p><code>s3:PutLifecycleConfiguration</code></p></li>
60/// </ul>
61/// <p>For more information about permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html">Managing Access Permissions to Your Amazon S3 Resources</a>.</p>
62/// </dd>
63/// </dl>
64/// <p>The following operations are related to <code>PutBucketLifecycleConfiguration</code>:</p>
65/// <ul>
66/// <li>
67/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-configuration-examples.html">Examples of Lifecycle Configuration</a></p></li>
68/// <li>
69/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycleConfiguration.html">GetBucketLifecycleConfiguration</a></p></li>
70/// <li>
71/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketLifecycle.html">DeleteBucketLifecycle</a></p></li>
72/// </ul>
73#[derive(::std::clone::Clone, ::std::fmt::Debug)]
74pub struct PutBucketLifecycleConfigurationFluentBuilder {
75    handle: ::std::sync::Arc<crate::client::Handle>,
76    inner: crate::operation::put_bucket_lifecycle_configuration::builders::PutBucketLifecycleConfigurationInputBuilder,
77    config_override: ::std::option::Option<crate::config::Builder>,
78}
79impl
80    crate::client::customize::internal::CustomizableSend<
81        crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationOutput,
82        crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationError,
83    > for PutBucketLifecycleConfigurationFluentBuilder
84{
85    fn send(
86        self,
87        config_override: crate::config::Builder,
88    ) -> crate::client::customize::internal::BoxFuture<
89        crate::client::customize::internal::SendResult<
90            crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationOutput,
91            crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationError,
92        >,
93    > {
94        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
95    }
96}
97impl PutBucketLifecycleConfigurationFluentBuilder {
98    /// Creates a new `PutBucketLifecycleConfigurationFluentBuilder`.
99    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
100        Self {
101            handle,
102            inner: ::std::default::Default::default(),
103            config_override: ::std::option::Option::None,
104        }
105    }
106    /// Access the PutBucketLifecycleConfiguration as a reference.
107    pub fn as_input(&self) -> &crate::operation::put_bucket_lifecycle_configuration::builders::PutBucketLifecycleConfigurationInputBuilder {
108        &self.inner
109    }
110    /// Sends the request and returns the response.
111    ///
112    /// If an error occurs, an `SdkError` will be returned with additional details that
113    /// can be matched against.
114    ///
115    /// By default, any retryable failures will be retried twice. Retry behavior
116    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
117    /// set when configuring the client.
118    pub async fn send(
119        self,
120    ) -> ::std::result::Result<
121        crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationOutput,
122        ::aws_smithy_runtime_api::client::result::SdkError<
123            crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationError,
124            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
125        >,
126    > {
127        let input = self
128            .inner
129            .build()
130            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
131        let runtime_plugins = crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfiguration::operation_runtime_plugins(
132            self.handle.runtime_plugins.clone(),
133            &self.handle.conf,
134            self.config_override,
135        );
136        crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfiguration::orchestrate(&runtime_plugins, input).await
137    }
138
139    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
140    pub fn customize(
141        self,
142    ) -> crate::client::customize::CustomizableOperation<
143        crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationOutput,
144        crate::operation::put_bucket_lifecycle_configuration::PutBucketLifecycleConfigurationError,
145        Self,
146    > {
147        crate::client::customize::CustomizableOperation::new(self)
148    }
149    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
150        self.set_config_override(::std::option::Option::Some(config_override.into()));
151        self
152    }
153
154    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
155        self.config_override = config_override;
156        self
157    }
158    /// <p>The name of the bucket for which to set the configuration.</p>
159    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.bucket(input.into());
161        self
162    }
163    /// <p>The name of the bucket for which to set the configuration.</p>
164    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_bucket(input);
166        self
167    }
168    /// <p>The name of the bucket for which to set the configuration.</p>
169    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_bucket()
171    }
172    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
173    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
174    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
175        self.inner = self.inner.checksum_algorithm(input);
176        self
177    }
178    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
179    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
180    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
181        self.inner = self.inner.set_checksum_algorithm(input);
182        self
183    }
184    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
185    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
186    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
187        self.inner.get_checksum_algorithm()
188    }
189    /// <p>Container for lifecycle rules. You can add as many as 1,000 rules.</p>
190    pub fn lifecycle_configuration(mut self, input: crate::types::BucketLifecycleConfiguration) -> Self {
191        self.inner = self.inner.lifecycle_configuration(input);
192        self
193    }
194    /// <p>Container for lifecycle rules. You can add as many as 1,000 rules.</p>
195    pub fn set_lifecycle_configuration(mut self, input: ::std::option::Option<crate::types::BucketLifecycleConfiguration>) -> Self {
196        self.inner = self.inner.set_lifecycle_configuration(input);
197        self
198    }
199    /// <p>Container for lifecycle rules. You can add as many as 1,000 rules.</p>
200    pub fn get_lifecycle_configuration(&self) -> &::std::option::Option<crate::types::BucketLifecycleConfiguration> {
201        self.inner.get_lifecycle_configuration()
202    }
203    /// <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>
204    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.expected_bucket_owner(input.into());
206        self
207    }
208    /// <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>
209    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210        self.inner = self.inner.set_expected_bucket_owner(input);
211        self
212    }
213    /// <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>
214    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
215        self.inner.get_expected_bucket_owner()
216    }
217}