aws_sdk_s3/operation/put_bucket_versioning/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_versioning::_put_bucket_versioning_output::PutBucketVersioningOutputBuilder;
3
4pub use crate::operation::put_bucket_versioning::_put_bucket_versioning_input::PutBucketVersioningInputBuilder;
5
6impl crate::operation::put_bucket_versioning::builders::PutBucketVersioningInputBuilder {
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_versioning::PutBucketVersioningOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_bucket_versioning::PutBucketVersioningError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_bucket_versioning();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutBucketVersioning`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note> <note>
28/// <p>When you enable versioning on a bucket for the first time, it might take a short amount of time for the change to be fully propagated. While this change is propagating, you might encounter intermittent <code>HTTP 404 NoSuchKey</code> errors for requests to objects created or updated after enabling versioning. We recommend that you wait for 15 minutes after enabling versioning before issuing write operations (<code>PUT</code> or <code>DELETE</code>) on objects in the bucket.</p>
29/// </note>
30/// <p>Sets the versioning state of an existing bucket.</p>
31/// <p>You can set the versioning state with one of the following values:</p>
32/// <p><b>Enabled</b>—Enables versioning for the objects in the bucket. All objects added to the bucket receive a unique version ID.</p>
33/// <p><b>Suspended</b>—Disables versioning for the objects in the bucket. All objects added to the bucket receive the version ID null.</p>
34/// <p>If the versioning state has never been set on a bucket, it has no versioning state; a <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html">GetBucketVersioning</a> request does not return a versioning state value.</p>
35/// <p>In order to enable MFA Delete, you must be the bucket owner. If you are the bucket owner and want to enable MFA Delete in the bucket versioning configuration, you must include the <code>x-amz-mfa request</code> header and the <code>Status</code> and the <code>MfaDelete</code> request elements in a request to set the versioning state of the bucket.</p><important>
36/// <p>If you have an object expiration lifecycle configuration in your non-versioned bucket and you want to maintain the same permanent delete behavior when you enable versioning, you must add a noncurrent expiration policy. The noncurrent expiration lifecycle configuration will manage the deletes of the noncurrent object versions in the version-enabled bucket. (A version-enabled bucket maintains one current and zero or more noncurrent object versions.) For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html#lifecycle-and-other-bucket-config">Lifecycle and Versioning</a>.</p>
37/// </important>
38/// <p>The following operations are related to <code>PutBucketVersioning</code>:</p>
39/// <ul>
40/// <li>
41/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html">CreateBucket</a></p></li>
42/// <li>
43/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html">DeleteBucket</a></p></li>
44/// <li>
45/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html">GetBucketVersioning</a></p></li>
46/// </ul><important>
47/// <p>You must URL encode any signed header values that contain spaces. For example, if your header value is <code>my file.txt</code>, containing two spaces after <code>my</code>, you must URL encode this value to <code>my%20%20file.txt</code>.</p>
48/// </important>
49#[derive(::std::clone::Clone, ::std::fmt::Debug)]
50pub struct PutBucketVersioningFluentBuilder {
51    handle: ::std::sync::Arc<crate::client::Handle>,
52    inner: crate::operation::put_bucket_versioning::builders::PutBucketVersioningInputBuilder,
53    config_override: ::std::option::Option<crate::config::Builder>,
54}
55impl
56    crate::client::customize::internal::CustomizableSend<
57        crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
58        crate::operation::put_bucket_versioning::PutBucketVersioningError,
59    > for PutBucketVersioningFluentBuilder
60{
61    fn send(
62        self,
63        config_override: crate::config::Builder,
64    ) -> crate::client::customize::internal::BoxFuture<
65        crate::client::customize::internal::SendResult<
66            crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
67            crate::operation::put_bucket_versioning::PutBucketVersioningError,
68        >,
69    > {
70        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
71    }
72}
73impl PutBucketVersioningFluentBuilder {
74    /// Creates a new `PutBucketVersioningFluentBuilder`.
75    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
76        Self {
77            handle,
78            inner: ::std::default::Default::default(),
79            config_override: ::std::option::Option::None,
80        }
81    }
82    /// Access the PutBucketVersioning as a reference.
83    pub fn as_input(&self) -> &crate::operation::put_bucket_versioning::builders::PutBucketVersioningInputBuilder {
84        &self.inner
85    }
86    /// Sends the request and returns the response.
87    ///
88    /// If an error occurs, an `SdkError` will be returned with additional details that
89    /// can be matched against.
90    ///
91    /// By default, any retryable failures will be retried twice. Retry behavior
92    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
93    /// set when configuring the client.
94    pub async fn send(
95        self,
96    ) -> ::std::result::Result<
97        crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
98        ::aws_smithy_runtime_api::client::result::SdkError<
99            crate::operation::put_bucket_versioning::PutBucketVersioningError,
100            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
101        >,
102    > {
103        let input = self
104            .inner
105            .build()
106            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
107        let runtime_plugins = crate::operation::put_bucket_versioning::PutBucketVersioning::operation_runtime_plugins(
108            self.handle.runtime_plugins.clone(),
109            &self.handle.conf,
110            self.config_override,
111        );
112        crate::operation::put_bucket_versioning::PutBucketVersioning::orchestrate(&runtime_plugins, input).await
113    }
114
115    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
116    pub fn customize(
117        self,
118    ) -> crate::client::customize::CustomizableOperation<
119        crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
120        crate::operation::put_bucket_versioning::PutBucketVersioningError,
121        Self,
122    > {
123        crate::client::customize::CustomizableOperation::new(self)
124    }
125    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
126        self.set_config_override(::std::option::Option::Some(config_override.into()));
127        self
128    }
129
130    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
131        self.config_override = config_override;
132        self
133    }
134    /// <p>The bucket name.</p>
135    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.bucket(input.into());
137        self
138    }
139    /// <p>The bucket name.</p>
140    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_bucket(input);
142        self
143    }
144    /// <p>The bucket name.</p>
145    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_bucket()
147    }
148    /// <p>&gt;The Base64 encoded 128-bit <code>MD5</code> digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>.</p>
149    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
150    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.content_md5(input.into());
152        self
153    }
154    /// <p>&gt;The Base64 encoded 128-bit <code>MD5</code> digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>.</p>
155    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
156    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_content_md5(input);
158        self
159    }
160    /// <p>&gt;The Base64 encoded 128-bit <code>MD5</code> digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>.</p>
161    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
162    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
163        self.inner.get_content_md5()
164    }
165    /// <p>Indicates the algorithm used to create the checksum for the request 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>
166    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
167    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
168        self.inner = self.inner.checksum_algorithm(input);
169        self
170    }
171    /// <p>Indicates the algorithm used to create the checksum for the request 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>
172    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
173    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
174        self.inner = self.inner.set_checksum_algorithm(input);
175        self
176    }
177    /// <p>Indicates the algorithm used to create the checksum for the request 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>
178    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
179    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
180        self.inner.get_checksum_algorithm()
181    }
182    /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. The serial number is the number that uniquely identifies the MFA device. For physical MFA devices, this is the unique serial number that's provided with the device. For virtual MFA devices, the serial number is the device ARN. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html">Enabling versioning on buckets</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiFactorAuthenticationDelete.html">Configuring MFA delete</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p>
183    pub fn mfa(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.inner = self.inner.mfa(input.into());
185        self
186    }
187    /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. The serial number is the number that uniquely identifies the MFA device. For physical MFA devices, this is the unique serial number that's provided with the device. For virtual MFA devices, the serial number is the device ARN. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html">Enabling versioning on buckets</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiFactorAuthenticationDelete.html">Configuring MFA delete</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p>
188    pub fn set_mfa(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.inner = self.inner.set_mfa(input);
190        self
191    }
192    /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. The serial number is the number that uniquely identifies the MFA device. For physical MFA devices, this is the unique serial number that's provided with the device. For virtual MFA devices, the serial number is the device ARN. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html">Enabling versioning on buckets</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiFactorAuthenticationDelete.html">Configuring MFA delete</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p>
193    pub fn get_mfa(&self) -> &::std::option::Option<::std::string::String> {
194        self.inner.get_mfa()
195    }
196    /// <p>Container for setting the versioning state.</p>
197    pub fn versioning_configuration(mut self, input: crate::types::VersioningConfiguration) -> Self {
198        self.inner = self.inner.versioning_configuration(input);
199        self
200    }
201    /// <p>Container for setting the versioning state.</p>
202    pub fn set_versioning_configuration(mut self, input: ::std::option::Option<crate::types::VersioningConfiguration>) -> Self {
203        self.inner = self.inner.set_versioning_configuration(input);
204        self
205    }
206    /// <p>Container for setting the versioning state.</p>
207    pub fn get_versioning_configuration(&self) -> &::std::option::Option<crate::types::VersioningConfiguration> {
208        self.inner.get_versioning_configuration()
209    }
210    /// <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>
211    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
212        self.inner = self.inner.expected_bucket_owner(input.into());
213        self
214    }
215    /// <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>
216    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
217        self.inner = self.inner.set_expected_bucket_owner(input);
218        self
219    }
220    /// <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>
221    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
222        self.inner.get_expected_bucket_owner()
223    }
224}