aws_sdk_s3/operation/update_object_encryption/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_object_encryption::_update_object_encryption_input::UpdateObjectEncryptionInputBuilder;
3
4pub use crate::operation::update_object_encryption::_update_object_encryption_output::UpdateObjectEncryptionOutputBuilder;
5
6impl crate::operation::update_object_encryption::builders::UpdateObjectEncryptionInputBuilder {
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::update_object_encryption::UpdateObjectEncryptionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_object_encryption();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateObjectEncryption`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets or Amazon S3 on Outposts buckets.</p>
27/// </note>
28/// <p>Updates the server-side encryption type of an existing encrypted object in a general purpose bucket. You can use the <code>UpdateObjectEncryption</code> operation to change encrypted objects from server-side encryption with Amazon S3 managed keys (SSE-S3) to server-side encryption with Key Management Service (KMS) keys (SSE-KMS), or to apply S3 Bucket Keys. You can also use the <code>UpdateObjectEncryption</code> operation to change the customer-managed KMS key used to encrypt your data so that you can comply with custom key-rotation standards.</p>
29/// <p>Using the <code>UpdateObjectEncryption</code> operation, you can atomically update the server-side encryption type of an existing object in a general purpose bucket without any data movement. The <code>UpdateObjectEncryption</code> operation uses envelope encryption to re-encrypt the data key used to encrypt and decrypt your object with your newly specified server-side encryption type. In other words, when you use the <code>UpdateObjectEncryption</code> operation, your data isn't copied, archived objects in the S3 Glacier Flexible Retrieval and S3 Glacier Deep Archive storage classes aren't restored, and objects in the S3 Intelligent-Tiering storage class aren't moved between tiers. Additionally, the <code>UpdateObjectEncryption</code> operation preserves all object metadata properties, including the storage class, creation date, last modified date, ETag, and checksum properties. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/update-sse-encryption.html"> Updating server-side encryption for existing objects</a> in the <i>Amazon S3 User Guide</i>.</p>
30/// <p>By default, all <code>UpdateObjectEncryption</code> requests that specify a customer-managed KMS key are restricted to KMS keys that are owned by the bucket owner's Amazon Web Services account. If you're using Organizations, you can request the ability to use KMS keys owned by other member accounts within your organization by contacting Amazon Web Services Support.</p><note>
31/// <p>Source objects that are unencrypted, or encrypted with either dual-layer server-side encryption with KMS keys (DSSE-KMS) or server-side encryption with customer-provided keys (SSE-C) aren't supported by this operation. Additionally, you cannot specify SSE-S3 encryption as the requested new encryption type <code>UpdateObjectEncryption</code> request.</p>
32/// </note>
33/// <dl>
34/// <dt>
35/// Permissions
36/// </dt>
37/// <dd>
38/// <ul>
39/// <li>
40/// <p>To use the <code>UpdateObjectEncryption</code> operation, you must have the following permissions:</p>
41/// <ul>
42/// <li>
43/// <p><code>s3:UpdateObjectEncryption</code></p></li>
44/// <li>
45/// <p><code>kms:Encrypt</code></p></li>
46/// <li>
47/// <p><code>kms:Decrypt</code></p></li>
48/// <li>
49/// <p><code>kms:GenerateDataKey</code></p></li>
50/// <li>
51/// <p><code>kms:ReEncrypt*</code></p></li>
52/// </ul></li>
53/// <li>
54/// <p>If you're using Organizations, to use this operation with customer-managed KMS keys from other Amazon Web Services accounts within your organization, you must have the <code>organizations:DescribeAccount</code> permission.</p></li>
55/// </ul>
56/// </dd>
57/// </dl>
58/// <dl>
59/// <dt>
60/// Errors
61/// </dt>
62/// <dd>
63/// <ul>
64/// <li>
65/// <p>You might receive an <code>InvalidRequest</code> error for several reasons. Depending on the reason for the error, you might receive one of the following messages:</p>
66/// <ul>
67/// <li>
68/// <p>The <code>UpdateObjectEncryption</code> operation doesn't supported unencrypted source objects. Only source objects encrypted with SSE-S3 or SSE-KMS are supported.</p></li>
69/// <li>
70/// <p>The <code>UpdateObjectEncryption</code> operation doesn't support source objects with the encryption type DSSE-KMS or SSE-C. Only source objects encrypted with SSE-S3 or SSE-KMS are supported.</p></li>
71/// <li>
72/// <p>The <code>UpdateObjectEncryption</code> operation doesn't support updating the encryption type to DSSE-KMS or SSE-C. Modify the request to specify SSE-KMS for the updated encryption type, and then try again.</p></li>
73/// <li>
74/// <p>Requests that modify an object encryption configuration require Amazon Web Services Signature Version 4. Modify the request to use Amazon Web Services Signature Version 4, and then try again.</p></li>
75/// <li>
76/// <p>Requests that modify an object encryption configuration require a valid new encryption type. Valid values are <code>SSEKMS</code>. Modify the request to specify SSE-KMS for the updated encryption type, and then try again.</p></li>
77/// <li>
78/// <p>Requests that modify an object's encryption type to SSE-KMS require an Amazon Web Services KMS key Amazon Resource Name (ARN). Modify the request to specify a KMS key ARN, and then try again.</p></li>
79/// <li>
80/// <p>Requests that modify an object's encryption type to SSE-KMS require a valid Amazon Web Services KMS key Amazon Resource Name (ARN). Confirm that you have a correctly formatted KMS key ARN in your request, and then try again.</p></li>
81/// <li>
82/// <p>The <code>BucketKeyEnabled</code> value isn't valid. Valid values are <code>true</code> or <code>false</code>. Modify the request to specify a valid value, and then try again.</p></li>
83/// </ul></li>
84/// <li>
85/// <p>You might receive an <code>AccessDenied</code> error for several reasons. Depending on the reason for the error, you might receive one of the following messages:</p>
86/// <ul>
87/// <li>
88/// <p>The Amazon Web Services KMS key in the request must be owned by the same account as the bucket. Modify the request to specify a KMS key from the same account, and then try again.</p></li>
89/// <li>
90/// <p>The bucket owner's account was approved to make <code>UpdateObjectEncryption</code> requests that use any Amazon Web Services KMS key in their organization, but the bucket owner's account isn't part of an organization in Organizations. Make sure that the bucket owner's account and the specified KMS key belong to the same organization, and then try again.</p></li>
91/// <li>
92/// <p>The specified Amazon Web Services KMS key must be from the same organization in Organizations as the bucket. Specify a KMS key that belongs to the same organization as the bucket, and then try again.</p></li>
93/// <li>
94/// <p>The encryption type for the specified object can’t be updated because that object is protected by S3 Object Lock. If the object has a governance-mode retention period or a legal hold, you must first remove the Object Lock status on the object before you issue your <code>UpdateObjectEncryption</code> request. You can't use the <code>UpdateObjectEncryption</code> operation with objects that have an Object Lock compliance mode retention period applied to them.</p></li>
95/// </ul></li>
96/// </ul>
97/// </dd>
98/// </dl>
99#[derive(::std::clone::Clone, ::std::fmt::Debug)]
100pub struct UpdateObjectEncryptionFluentBuilder {
101 handle: ::std::sync::Arc<crate::client::Handle>,
102 inner: crate::operation::update_object_encryption::builders::UpdateObjectEncryptionInputBuilder,
103 config_override: ::std::option::Option<crate::config::Builder>,
104}
105impl
106 crate::client::customize::internal::CustomizableSend<
107 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
108 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
109 > for UpdateObjectEncryptionFluentBuilder
110{
111 fn send(
112 self,
113 config_override: crate::config::Builder,
114 ) -> crate::client::customize::internal::BoxFuture<
115 crate::client::customize::internal::SendResult<
116 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
117 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
118 >,
119 > {
120 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
121 }
122}
123impl UpdateObjectEncryptionFluentBuilder {
124 /// Creates a new `UpdateObjectEncryptionFluentBuilder`.
125 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
126 Self {
127 handle,
128 inner: ::std::default::Default::default(),
129 config_override: ::std::option::Option::None,
130 }
131 }
132 /// Access the UpdateObjectEncryption as a reference.
133 pub fn as_input(&self) -> &crate::operation::update_object_encryption::builders::UpdateObjectEncryptionInputBuilder {
134 &self.inner
135 }
136 /// Sends the request and returns the response.
137 ///
138 /// If an error occurs, an `SdkError` will be returned with additional details that
139 /// can be matched against.
140 ///
141 /// By default, any retryable failures will be retried twice. Retry behavior
142 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
143 /// set when configuring the client.
144 pub async fn send(
145 self,
146 ) -> ::std::result::Result<
147 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
148 ::aws_smithy_runtime_api::client::result::SdkError<
149 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
150 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
151 >,
152 > {
153 let input = self
154 .inner
155 .build()
156 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
157 let runtime_plugins = crate::operation::update_object_encryption::UpdateObjectEncryption::operation_runtime_plugins(
158 self.handle.runtime_plugins.clone(),
159 &self.handle.conf,
160 self.config_override,
161 );
162 crate::operation::update_object_encryption::UpdateObjectEncryption::orchestrate(&runtime_plugins, input).await
163 }
164
165 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
166 pub fn customize(
167 self,
168 ) -> crate::client::customize::CustomizableOperation<
169 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
170 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
171 Self,
172 > {
173 crate::client::customize::CustomizableOperation::new(self)
174 }
175 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
176 self.set_config_override(::std::option::Option::Some(config_override.into()));
177 self
178 }
179
180 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
181 self.config_override = config_override;
182 self
183 }
184 /// <p>The name of the general purpose bucket that contains the specified object key name.</p>
185 /// <p>When you use this operation with an access point attached to a general purpose bucket, you must either provide the alias of the access point in place of the bucket name or you must specify the access point Amazon Resource Name (ARN). When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <code> <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com</code>. When using this operation with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-naming.html"> Referencing access points</a> in the <i>Amazon S3 User Guide</i>.</p>
186 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187 self.inner = self.inner.bucket(input.into());
188 self
189 }
190 /// <p>The name of the general purpose bucket that contains the specified object key name.</p>
191 /// <p>When you use this operation with an access point attached to a general purpose bucket, you must either provide the alias of the access point in place of the bucket name or you must specify the access point Amazon Resource Name (ARN). When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <code> <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com</code>. When using this operation with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-naming.html"> Referencing access points</a> in the <i>Amazon S3 User Guide</i>.</p>
192 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193 self.inner = self.inner.set_bucket(input);
194 self
195 }
196 /// <p>The name of the general purpose bucket that contains the specified object key name.</p>
197 /// <p>When you use this operation with an access point attached to a general purpose bucket, you must either provide the alias of the access point in place of the bucket name or you must specify the access point Amazon Resource Name (ARN). When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <code> <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com</code>. When using this operation with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-naming.html"> Referencing access points</a> in the <i>Amazon S3 User Guide</i>.</p>
198 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
199 self.inner.get_bucket()
200 }
201 /// <p>The key name of the object that you want to update the server-side encryption type for.</p>
202 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
203 self.inner = self.inner.key(input.into());
204 self
205 }
206 /// <p>The key name of the object that you want to update the server-side encryption type for.</p>
207 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
208 self.inner = self.inner.set_key(input);
209 self
210 }
211 /// <p>The key name of the object that you want to update the server-side encryption type for.</p>
212 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
213 self.inner.get_key()
214 }
215 /// <p>The version ID of the object that you want to update the server-side encryption type for.</p>
216 pub fn version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217 self.inner = self.inner.version_id(input.into());
218 self
219 }
220 /// <p>The version ID of the object that you want to update the server-side encryption type for.</p>
221 pub fn set_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222 self.inner = self.inner.set_version_id(input);
223 self
224 }
225 /// <p>The version ID of the object that you want to update the server-side encryption type for.</p>
226 pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
227 self.inner.get_version_id()
228 }
229 /// <p>The updated server-side encryption type for this object. The <code>UpdateObjectEncryption</code> operation supports the SSE-S3 and SSE-KMS encryption types.</p>
230 /// <p>Valid Values: <code>SSES3</code> | <code>SSEKMS</code></p>
231 pub fn object_encryption(mut self, input: crate::types::ObjectEncryption) -> Self {
232 self.inner = self.inner.object_encryption(input);
233 self
234 }
235 /// <p>The updated server-side encryption type for this object. The <code>UpdateObjectEncryption</code> operation supports the SSE-S3 and SSE-KMS encryption types.</p>
236 /// <p>Valid Values: <code>SSES3</code> | <code>SSEKMS</code></p>
237 pub fn set_object_encryption(mut self, input: ::std::option::Option<crate::types::ObjectEncryption>) -> Self {
238 self.inner = self.inner.set_object_encryption(input);
239 self
240 }
241 /// <p>The updated server-side encryption type for this object. The <code>UpdateObjectEncryption</code> operation supports the SSE-S3 and SSE-KMS encryption types.</p>
242 /// <p>Valid Values: <code>SSES3</code> | <code>SSEKMS</code></p>
243 pub fn get_object_encryption(&self) -> &::std::option::Option<crate::types::ObjectEncryption> {
244 self.inner.get_object_encryption()
245 }
246 /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for the corresponding charges. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
247 /// <p>This functionality is not supported for directory buckets.</p>
248 /// </note>
249 pub fn request_payer(mut self, input: crate::types::RequestPayer) -> Self {
250 self.inner = self.inner.request_payer(input);
251 self
252 }
253 /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for the corresponding charges. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
254 /// <p>This functionality is not supported for directory buckets.</p>
255 /// </note>
256 pub fn set_request_payer(mut self, input: ::std::option::Option<crate::types::RequestPayer>) -> Self {
257 self.inner = self.inner.set_request_payer(input);
258 self
259 }
260 /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for the corresponding charges. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
261 /// <p>This functionality is not supported for directory buckets.</p>
262 /// </note>
263 pub fn get_request_payer(&self) -> &::std::option::Option<crate::types::RequestPayer> {
264 self.inner.get_request_payer()
265 }
266 /// <p>The account ID of the expected bucket owner. If the account ID that you provide doesn't match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
267 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
268 self.inner = self.inner.expected_bucket_owner(input.into());
269 self
270 }
271 /// <p>The account ID of the expected bucket owner. If the account ID that you provide doesn't match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
272 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
273 self.inner = self.inner.set_expected_bucket_owner(input);
274 self
275 }
276 /// <p>The account ID of the expected bucket owner. If the account ID that you provide doesn't match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
277 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
278 self.inner.get_expected_bucket_owner()
279 }
280 /// <p>The MD5 hash for the request body. For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
281 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
282 self.inner = self.inner.content_md5(input.into());
283 self
284 }
285 /// <p>The MD5 hash for the request body. For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
286 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
287 self.inner = self.inner.set_content_md5(input);
288 self
289 }
290 /// <p>The MD5 hash for the request body. For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
291 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
292 self.inner.get_content_md5()
293 }
294 /// <p>Indicates the algorithm used to create the checksum for the object when you use an Amazon Web Services SDK. This header doesn't 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>
295 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
296 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
297 self.inner = self.inner.checksum_algorithm(input);
298 self
299 }
300 /// <p>Indicates the algorithm used to create the checksum for the object when you use an Amazon Web Services SDK. This header doesn't 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>
301 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
302 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
303 self.inner = self.inner.set_checksum_algorithm(input);
304 self
305 }
306 /// <p>Indicates the algorithm used to create the checksum for the object when you use an Amazon Web Services SDK. This header doesn't 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>
307 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
308 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
309 self.inner.get_checksum_algorithm()
310 }
311}