aws_sdk_s3control/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 sets the versioning state for S3 on Outposts buckets only. To set the versioning state for an S3 bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketVersioning.html">PutBucketVersioning</a> in the <i>Amazon S3 API Reference</i>.</p>
27/// </note>
28/// <p>Sets the versioning state for an S3 on Outposts bucket. With S3 Versioning, you can save multiple distinct copies of your objects and recover from unintended user actions and application failures.</p>
29/// <p>You can set the versioning state to one of the following:</p>
30/// <ul>
31/// <li>
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></li>
33/// <li>
34/// <p><b>Suspended</b> - Suspends versioning for the objects in the bucket. All objects added to the bucket receive the version ID <code>null</code>.</p></li>
35/// </ul>
36/// <p>If you've never set versioning on your bucket, it has no versioning state. In that case, a <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketVersioning.html"> GetBucketVersioning</a> request does not return a versioning state value.</p>
37/// <p>When you enable S3 Versioning, for each object in your bucket, you have a current version and zero or more noncurrent versions. You can configure your bucket S3 Lifecycle rules to expire noncurrent versions after a specified time period. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsLifecycleManaging.html"> Creating and managing a lifecycle configuration for your S3 on Outposts bucket</a> in the <i>Amazon S3 User Guide</i>.</p>
38/// <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. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html">Versioning</a> in the <i>Amazon S3 User Guide</i>.</p>
39/// <p>All Amazon S3 on Outposts REST API requests for this action require an additional parameter of <code>x-amz-outpost-id</code> to be passed with the request. In addition, you must use an S3 on Outposts endpoint hostname prefix instead of <code>s3-control</code>. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the <code>x-amz-outpost-id</code> derived by using the access point ARN, see the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketVersioning.html#API_control_PutBucketVersioning_Examples">Examples</a> section.</p>
40/// <p>The following operations are related to <code>PutBucketVersioning</code> for S3 on Outposts.</p>
41/// <ul>
42/// <li>
43/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketVersioning.html">GetBucketVersioning</a></p></li>
44/// <li>
45/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html">PutBucketLifecycleConfiguration</a></p></li>
46/// <li>
47/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketLifecycleConfiguration.html">GetBucketLifecycleConfiguration</a></p></li>
48/// </ul>
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 Amazon Web Services account ID of the S3 on Outposts bucket.</p>
135 pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.inner = self.inner.account_id(input.into());
137 self
138 }
139 /// <p>The Amazon Web Services account ID of the S3 on Outposts bucket.</p>
140 pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141 self.inner = self.inner.set_account_id(input);
142 self
143 }
144 /// <p>The Amazon Web Services account ID of the S3 on Outposts bucket.</p>
145 pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
146 self.inner.get_account_id()
147 }
148 /// <p>The S3 on Outposts bucket to set the versioning state for.</p>
149 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150 self.inner = self.inner.bucket(input.into());
151 self
152 }
153 /// <p>The S3 on Outposts bucket to set the versioning state for.</p>
154 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155 self.inner = self.inner.set_bucket(input);
156 self
157 }
158 /// <p>The S3 on Outposts bucket to set the versioning state for.</p>
159 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
160 self.inner.get_bucket()
161 }
162 /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.</p>
163 pub fn mfa(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164 self.inner = self.inner.mfa(input.into());
165 self
166 }
167 /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.</p>
168 pub fn set_mfa(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169 self.inner = self.inner.set_mfa(input);
170 self
171 }
172 /// <p>The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.</p>
173 pub fn get_mfa(&self) -> &::std::option::Option<::std::string::String> {
174 self.inner.get_mfa()
175 }
176 /// <p>The root-level tag for the <code>VersioningConfiguration</code> parameters.</p>
177 pub fn versioning_configuration(mut self, input: crate::types::VersioningConfiguration) -> Self {
178 self.inner = self.inner.versioning_configuration(input);
179 self
180 }
181 /// <p>The root-level tag for the <code>VersioningConfiguration</code> parameters.</p>
182 pub fn set_versioning_configuration(mut self, input: ::std::option::Option<crate::types::VersioningConfiguration>) -> Self {
183 self.inner = self.inner.set_versioning_configuration(input);
184 self
185 }
186 /// <p>The root-level tag for the <code>VersioningConfiguration</code> parameters.</p>
187 pub fn get_versioning_configuration(&self) -> &::std::option::Option<crate::types::VersioningConfiguration> {
188 self.inner.get_versioning_configuration()
189 }
190}