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>
47#[derive(::std::clone::Clone, ::std::fmt::Debug)]
48pub struct PutBucketVersioningFluentBuilder {
49 handle: ::std::sync::Arc<crate::client::Handle>,
50 inner: crate::operation::put_bucket_versioning::builders::PutBucketVersioningInputBuilder,
51 config_override: ::std::option::Option<crate::config::Builder>,
52}
53impl
54 crate::client::customize::internal::CustomizableSend<
55 crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
56 crate::operation::put_bucket_versioning::PutBucketVersioningError,
57 > for PutBucketVersioningFluentBuilder
58{
59 fn send(
60 self,
61 config_override: crate::config::Builder,
62 ) -> crate::client::customize::internal::BoxFuture<
63 crate::client::customize::internal::SendResult<
64 crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
65 crate::operation::put_bucket_versioning::PutBucketVersioningError,
66 >,
67 > {
68 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
69 }
70}
71impl PutBucketVersioningFluentBuilder {
72 /// Creates a new `PutBucketVersioningFluentBuilder`.
73 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
74 Self {
75 handle,
76 inner: ::std::default::Default::default(),
77 config_override: ::std::option::Option::None,
78 }
79 }
80 /// Access the PutBucketVersioning as a reference.
81 pub fn as_input(&self) -> &crate::operation::put_bucket_versioning::builders::PutBucketVersioningInputBuilder {
82 &self.inner
83 }
84 /// Sends the request and returns the response.
85 ///
86 /// If an error occurs, an `SdkError` will be returned with additional details that
87 /// can be matched against.
88 ///
89 /// By default, any retryable failures will be retried twice. Retry behavior
90 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
91 /// set when configuring the client.
92 pub async fn send(
93 self,
94 ) -> ::std::result::Result<
95 crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
96 ::aws_smithy_runtime_api::client::result::SdkError<
97 crate::operation::put_bucket_versioning::PutBucketVersioningError,
98 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
99 >,
100 > {
101 let input = self
102 .inner
103 .build()
104 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
105 let runtime_plugins = crate::operation::put_bucket_versioning::PutBucketVersioning::operation_runtime_plugins(
106 self.handle.runtime_plugins.clone(),
107 &self.handle.conf,
108 self.config_override,
109 );
110 crate::operation::put_bucket_versioning::PutBucketVersioning::orchestrate(&runtime_plugins, input).await
111 }
112
113 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
114 pub fn customize(
115 self,
116 ) -> crate::client::customize::CustomizableOperation<
117 crate::operation::put_bucket_versioning::PutBucketVersioningOutput,
118 crate::operation::put_bucket_versioning::PutBucketVersioningError,
119 Self,
120 > {
121 crate::client::customize::CustomizableOperation::new(self)
122 }
123 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124 self.set_config_override(::std::option::Option::Some(config_override.into()));
125 self
126 }
127
128 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
129 self.config_override = config_override;
130 self
131 }
132 /// <p>The bucket name.</p>
133 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.bucket(input.into());
135 self
136 }
137 /// <p>The bucket name.</p>
138 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_bucket(input);
140 self
141 }
142 /// <p>The bucket name.</p>
143 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_bucket()
145 }
146 /// <p>>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>
147 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
148 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149 self.inner = self.inner.content_md5(input.into());
150 self
151 }
152 /// <p>>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>
153 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
154 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155 self.inner = self.inner.set_content_md5(input);
156 self
157 }
158 /// <p>>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>
159 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
160 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
161 self.inner.get_content_md5()
162 }
163 /// <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>
164 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
165 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
166 self.inner = self.inner.checksum_algorithm(input);
167 self
168 }
169 /// <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>
170 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
171 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
172 self.inner = self.inner.set_checksum_algorithm(input);
173 self
174 }
175 /// <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>
176 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
177 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
178 self.inner.get_checksum_algorithm()
179 }
180 /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.</p>
181 pub fn mfa(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
182 self.inner = self.inner.mfa(input.into());
183 self
184 }
185 /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.</p>
186 pub fn set_mfa(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
187 self.inner = self.inner.set_mfa(input);
188 self
189 }
190 /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.</p>
191 pub fn get_mfa(&self) -> &::std::option::Option<::std::string::String> {
192 self.inner.get_mfa()
193 }
194 /// <p>Container for setting the versioning state.</p>
195 pub fn versioning_configuration(mut self, input: crate::types::VersioningConfiguration) -> Self {
196 self.inner = self.inner.versioning_configuration(input);
197 self
198 }
199 /// <p>Container for setting the versioning state.</p>
200 pub fn set_versioning_configuration(mut self, input: ::std::option::Option<crate::types::VersioningConfiguration>) -> Self {
201 self.inner = self.inner.set_versioning_configuration(input);
202 self
203 }
204 /// <p>Container for setting the versioning state.</p>
205 pub fn get_versioning_configuration(&self) -> &::std::option::Option<crate::types::VersioningConfiguration> {
206 self.inner.get_versioning_configuration()
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 expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
210 self.inner = self.inner.expected_bucket_owner(input.into());
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 set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
215 self.inner = self.inner.set_expected_bucket_owner(input);
216 self
217 }
218 /// <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>
219 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
220 self.inner.get_expected_bucket_owner()
221 }
222}