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_output::UpdateObjectEncryptionOutputBuilder;
3
4pub use crate::operation::update_object_encryption::_update_object_encryption_input::UpdateObjectEncryptionInputBuilder;
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:PutObject</code></p></li>
44/// <li>
45/// <p><code>s3:UpdateObjectEncryption</code></p></li>
46/// <li>
47/// <p><code>kms:Encrypt</code></p></li>
48/// <li>
49/// <p><code>kms:Decrypt</code></p></li>
50/// <li>
51/// <p><code>kms:GenerateDataKey</code></p></li>
52/// <li>
53/// <p><code>kms:ReEncrypt*</code></p></li>
54/// </ul></li>
55/// <li>
56/// <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>
57/// </ul>
58/// </dd>
59/// </dl>
60/// <dl>
61/// <dt>
62/// Errors
63/// </dt>
64/// <dd>
65/// <ul>
66/// <li>
67/// <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>
68/// <ul>
69/// <li>
70/// <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>
71/// <li>
72/// <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>
73/// <li>
74/// <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>
75/// <li>
76/// <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>
77/// <li>
78/// <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>
79/// <li>
80/// <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>
81/// <li>
82/// <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>
83/// <li>
84/// <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>
85/// </ul></li>
86/// <li>
87/// <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>
88/// <ul>
89/// <li>
90/// <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>
91/// <li>
92/// <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>
93/// <li>
94/// <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>
95/// <li>
96/// <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>
97/// </ul></li>
98/// </ul>
99/// </dd>
100/// </dl>
101#[derive(::std::clone::Clone, ::std::fmt::Debug)]
102pub struct UpdateObjectEncryptionFluentBuilder {
103 handle: ::std::sync::Arc<crate::client::Handle>,
104 inner: crate::operation::update_object_encryption::builders::UpdateObjectEncryptionInputBuilder,
105 config_override: ::std::option::Option<crate::config::Builder>,
106}
107impl
108 crate::client::customize::internal::CustomizableSend<
109 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
110 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
111 > for UpdateObjectEncryptionFluentBuilder
112{
113 fn send(
114 self,
115 config_override: crate::config::Builder,
116 ) -> crate::client::customize::internal::BoxFuture<
117 crate::client::customize::internal::SendResult<
118 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
119 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
120 >,
121 > {
122 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
123 }
124}
125impl UpdateObjectEncryptionFluentBuilder {
126 /// Creates a new `UpdateObjectEncryptionFluentBuilder`.
127 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
128 Self {
129 handle,
130 inner: ::std::default::Default::default(),
131 config_override: ::std::option::Option::None,
132 }
133 }
134 /// Access the UpdateObjectEncryption as a reference.
135 pub fn as_input(&self) -> &crate::operation::update_object_encryption::builders::UpdateObjectEncryptionInputBuilder {
136 &self.inner
137 }
138 /// Sends the request and returns the response.
139 ///
140 /// If an error occurs, an `SdkError` will be returned with additional details that
141 /// can be matched against.
142 ///
143 /// By default, any retryable failures will be retried twice. Retry behavior
144 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
145 /// set when configuring the client.
146 pub async fn send(
147 self,
148 ) -> ::std::result::Result<
149 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
150 ::aws_smithy_runtime_api::client::result::SdkError<
151 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
152 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
153 >,
154 > {
155 let input = self
156 .inner
157 .build()
158 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
159 let runtime_plugins = crate::operation::update_object_encryption::UpdateObjectEncryption::operation_runtime_plugins(
160 self.handle.runtime_plugins.clone(),
161 &self.handle.conf,
162 self.config_override,
163 );
164 crate::operation::update_object_encryption::UpdateObjectEncryption::orchestrate(&runtime_plugins, input).await
165 }
166
167 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
168 pub fn customize(
169 self,
170 ) -> crate::client::customize::CustomizableOperation<
171 crate::operation::update_object_encryption::UpdateObjectEncryptionOutput,
172 crate::operation::update_object_encryption::UpdateObjectEncryptionError,
173 Self,
174 > {
175 crate::client::customize::CustomizableOperation::new(self)
176 }
177 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
178 self.set_config_override(::std::option::Option::Some(config_override.into()));
179 self
180 }
181
182 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
183 self.config_override = config_override;
184 self
185 }
186 /// <p>The name of the general purpose bucket that contains the specified object key name.</p>
187 /// <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>
188 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189 self.inner = self.inner.bucket(input.into());
190 self
191 }
192 /// <p>The name of the general purpose bucket that contains the specified object key name.</p>
193 /// <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>
194 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195 self.inner = self.inner.set_bucket(input);
196 self
197 }
198 /// <p>The name of the general purpose bucket that contains the specified object key name.</p>
199 /// <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>
200 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
201 self.inner.get_bucket()
202 }
203 /// <p>The key name of the object that you want to update the server-side encryption type for.</p>
204 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205 self.inner = self.inner.key(input.into());
206 self
207 }
208 /// <p>The key name of the object that you want to update the server-side encryption type for.</p>
209 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210 self.inner = self.inner.set_key(input);
211 self
212 }
213 /// <p>The key name of the object that you want to update the server-side encryption type for.</p>
214 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
215 self.inner.get_key()
216 }
217 /// <p>The version ID of the object that you want to update the server-side encryption type for.</p>
218 pub fn version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
219 self.inner = self.inner.version_id(input.into());
220 self
221 }
222 /// <p>The version ID of the object that you want to update the server-side encryption type for.</p>
223 pub fn set_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224 self.inner = self.inner.set_version_id(input);
225 self
226 }
227 /// <p>The version ID of the object that you want to update the server-side encryption type for.</p>
228 pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
229 self.inner.get_version_id()
230 }
231 /// <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>
232 /// <p>Valid Values: <code>SSES3</code> | <code>SSEKMS</code></p>
233 pub fn object_encryption(mut self, input: crate::types::ObjectEncryption) -> Self {
234 self.inner = self.inner.object_encryption(input);
235 self
236 }
237 /// <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>
238 /// <p>Valid Values: <code>SSES3</code> | <code>SSEKMS</code></p>
239 pub fn set_object_encryption(mut self, input: ::std::option::Option<crate::types::ObjectEncryption>) -> Self {
240 self.inner = self.inner.set_object_encryption(input);
241 self
242 }
243 /// <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>
244 /// <p>Valid Values: <code>SSES3</code> | <code>SSEKMS</code></p>
245 pub fn get_object_encryption(&self) -> &::std::option::Option<crate::types::ObjectEncryption> {
246 self.inner.get_object_encryption()
247 }
248 /// <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>
249 /// <p>This functionality is not supported for directory buckets.</p>
250 /// </note>
251 pub fn request_payer(mut self, input: crate::types::RequestPayer) -> Self {
252 self.inner = self.inner.request_payer(input);
253 self
254 }
255 /// <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>
256 /// <p>This functionality is not supported for directory buckets.</p>
257 /// </note>
258 pub fn set_request_payer(mut self, input: ::std::option::Option<crate::types::RequestPayer>) -> Self {
259 self.inner = self.inner.set_request_payer(input);
260 self
261 }
262 /// <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>
263 /// <p>This functionality is not supported for directory buckets.</p>
264 /// </note>
265 pub fn get_request_payer(&self) -> &::std::option::Option<crate::types::RequestPayer> {
266 self.inner.get_request_payer()
267 }
268 /// <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>
269 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
270 self.inner = self.inner.expected_bucket_owner(input.into());
271 self
272 }
273 /// <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>
274 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
275 self.inner = self.inner.set_expected_bucket_owner(input);
276 self
277 }
278 /// <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>
279 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
280 self.inner.get_expected_bucket_owner()
281 }
282 /// <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>
283 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
284 self.inner = self.inner.content_md5(input.into());
285 self
286 }
287 /// <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>
288 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
289 self.inner = self.inner.set_content_md5(input);
290 self
291 }
292 /// <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>
293 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
294 self.inner.get_content_md5()
295 }
296 /// <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>
297 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
298 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
299 self.inner = self.inner.checksum_algorithm(input);
300 self
301 }
302 /// <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>
303 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
304 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
305 self.inner = self.inner.set_checksum_algorithm(input);
306 self
307 }
308 /// <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>
309 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
310 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
311 self.inner.get_checksum_algorithm()
312 }
313}