aws_sdk_s3/operation/put_bucket_acl/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_acl::_put_bucket_acl_output::PutBucketAclOutputBuilder;
3
4pub use crate::operation::put_bucket_acl::_put_bucket_acl_input::PutBucketAclInputBuilder;
5
6impl crate::operation::put_bucket_acl::builders::PutBucketAclInputBuilder {
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_acl::PutBucketAclOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_bucket_acl::PutBucketAclError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_bucket_acl();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutBucketAcl`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Sets the permissions on an existing bucket using access control lists (ACL). For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html">Using ACLs</a>. To set the ACL of a bucket, you must have the <code>WRITE_ACP</code> permission.</p>
29/// <p>You can use one of the following two ways to set a bucket's permissions:</p>
30/// <ul>
31/// <li>
32/// <p>Specify the ACL in the request body</p></li>
33/// <li>
34/// <p>Specify permissions using request headers</p></li>
35/// </ul><note>
36/// <p>You cannot specify access permission using both the body and the request headers.</p>
37/// </note>
38/// <p>Depending on your application needs, you may choose to set the ACL on a bucket using either the request body or the headers. For example, if you have an existing application that updates a bucket ACL using the request body, then you can continue to use that approach.</p><important>
39/// <p>If your bucket uses the bucket owner enforced setting for S3 Object Ownership, ACLs are disabled and no longer affect permissions. You must use policies to grant access to your bucket and the objects in it. Requests to set ACLs or update ACLs fail and return the <code>AccessControlListNotSupported</code> error code. Requests to read ACLs are still supported. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html">Controlling object ownership</a> in the <i>Amazon S3 User Guide</i>.</p>
40/// </important>
41/// <dl>
42/// <dt>
43/// Permissions
44/// </dt>
45/// <dd>
46/// <p>You can set access permissions by using one of the following methods:</p>
47/// <ul>
48/// <li>
49/// <p>Specify a canned ACL with the <code>x-amz-acl</code> request header. Amazon S3 supports a set of predefined ACLs, known as <i>canned ACLs</i>. Each canned ACL has a predefined set of grantees and permissions. Specify the canned ACL name as the value of <code>x-amz-acl</code>. If you use this header, you cannot use other access control-specific headers in your request. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.</p></li>
50/// <li>
51/// <p>Specify access permissions explicitly with the <code>x-amz-grant-read</code>, <code>x-amz-grant-read-acp</code>, <code>x-amz-grant-write-acp</code>, and <code>x-amz-grant-full-control</code> headers. When using these headers, you specify explicit access permissions and grantees (Amazon Web Services accounts or Amazon S3 groups) who will receive the permission. If you use these ACL-specific headers, you cannot use the <code>x-amz-acl</code> header to set a canned ACL. These parameters map to the set of permissions that Amazon S3 supports in an ACL. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html">Access Control List (ACL) Overview</a>.</p>
52/// <p>You specify each grantee as a type=value pair, where the type is one of the following:</p>
53/// <ul>
54/// <li>
55/// <p><code>id</code> – if the value specified is the canonical user ID of an Amazon Web Services account</p></li>
56/// <li>
57/// <p><code>uri</code> – if you are granting permissions to a predefined group</p></li>
58/// <li>
59/// <p><code>emailAddress</code> – if the value specified is the email address of an Amazon Web Services account</p><note>
60/// <p>Using email addresses to specify a grantee is only supported in the following Amazon Web Services Regions:</p>
61/// <ul>
62/// <li>
63/// <p>US East (N. Virginia)</p></li>
64/// <li>
65/// <p>US West (N. California)</p></li>
66/// <li>
67/// <p>US West (Oregon)</p></li>
68/// <li>
69/// <p>Asia Pacific (Singapore)</p></li>
70/// <li>
71/// <p>Asia Pacific (Sydney)</p></li>
72/// <li>
73/// <p>Asia Pacific (Tokyo)</p></li>
74/// <li>
75/// <p>Europe (Ireland)</p></li>
76/// <li>
77/// <p>South America (São Paulo)</p></li>
78/// </ul>
79/// <p>For a list of all the Amazon S3 supported Regions and endpoints, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region">Regions and Endpoints</a> in the Amazon Web Services General Reference.</p>
80/// </note></li>
81/// </ul>
82/// <p>For example, the following <code>x-amz-grant-write</code> header grants create, overwrite, and delete objects permission to LogDelivery group predefined by Amazon S3 and two Amazon Web Services accounts identified by their email addresses.</p>
83/// <p><code>x-amz-grant-write: uri="http://acs.amazonaws.com/groups/s3/LogDelivery", id="111122223333", id="555566667777" </code></p></li>
84/// </ul>
85/// <p>You can use either a canned ACL or specify access permissions explicitly. You cannot do both.</p>
86/// </dd>
87/// <dt>
88/// Grantee Values
89/// </dt>
90/// <dd>
91/// <p>You can specify the person (grantee) to whom you're assigning access rights (using request elements) in the following ways:</p>
92/// <ul>
93/// <li>
94/// <p>By the person's ID:</p>
95/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
96/// <id>
97/// <>ID<>
98/// </id>
99/// <displayname>
100/// <>GranteesEmail<>
101/// </displayname>
102/// </grantee></code></p>
103/// <p>DisplayName is optional and ignored in the request</p></li>
104/// <li>
105/// <p>By URI:</p>
106/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
107/// <uri>
108/// <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<>
109/// </uri>
110/// </grantee></code></p></li>
111/// <li>
112/// <p>By Email address:</p>
113/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail">
114/// <emailaddress>
115/// <>Grantees@email.com<>
116/// </emailaddress>&
117/// </grantee></code></p>
118/// <p>The grantee is resolved to the CanonicalUser and, in a response to a GET Object acl request, appears as the CanonicalUser.</p><note>
119/// <p>Using email addresses to specify a grantee is only supported in the following Amazon Web Services Regions:</p>
120/// <ul>
121/// <li>
122/// <p>US East (N. Virginia)</p></li>
123/// <li>
124/// <p>US West (N. California)</p></li>
125/// <li>
126/// <p>US West (Oregon)</p></li>
127/// <li>
128/// <p>Asia Pacific (Singapore)</p></li>
129/// <li>
130/// <p>Asia Pacific (Sydney)</p></li>
131/// <li>
132/// <p>Asia Pacific (Tokyo)</p></li>
133/// <li>
134/// <p>Europe (Ireland)</p></li>
135/// <li>
136/// <p>South America (São Paulo)</p></li>
137/// </ul>
138/// <p>For a list of all the Amazon S3 supported Regions and endpoints, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region">Regions and Endpoints</a> in the Amazon Web Services General Reference.</p>
139/// </note></li>
140/// </ul>
141/// </dd>
142/// </dl>
143/// <p>The following operations are related to <code>PutBucketAcl</code>:</p>
144/// <ul>
145/// <li>
146/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html">CreateBucket</a></p></li>
147/// <li>
148/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html">DeleteBucket</a></p></li>
149/// <li>
150/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAcl.html">GetObjectAcl</a></p></li>
151/// </ul>
152#[derive(::std::clone::Clone, ::std::fmt::Debug)]
153pub struct PutBucketAclFluentBuilder {
154 handle: ::std::sync::Arc<crate::client::Handle>,
155 inner: crate::operation::put_bucket_acl::builders::PutBucketAclInputBuilder,
156 config_override: ::std::option::Option<crate::config::Builder>,
157}
158impl
159 crate::client::customize::internal::CustomizableSend<
160 crate::operation::put_bucket_acl::PutBucketAclOutput,
161 crate::operation::put_bucket_acl::PutBucketAclError,
162 > for PutBucketAclFluentBuilder
163{
164 fn send(
165 self,
166 config_override: crate::config::Builder,
167 ) -> crate::client::customize::internal::BoxFuture<
168 crate::client::customize::internal::SendResult<
169 crate::operation::put_bucket_acl::PutBucketAclOutput,
170 crate::operation::put_bucket_acl::PutBucketAclError,
171 >,
172 > {
173 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
174 }
175}
176impl PutBucketAclFluentBuilder {
177 /// Creates a new `PutBucketAclFluentBuilder`.
178 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
179 Self {
180 handle,
181 inner: ::std::default::Default::default(),
182 config_override: ::std::option::Option::None,
183 }
184 }
185 /// Access the PutBucketAcl as a reference.
186 pub fn as_input(&self) -> &crate::operation::put_bucket_acl::builders::PutBucketAclInputBuilder {
187 &self.inner
188 }
189 /// Sends the request and returns the response.
190 ///
191 /// If an error occurs, an `SdkError` will be returned with additional details that
192 /// can be matched against.
193 ///
194 /// By default, any retryable failures will be retried twice. Retry behavior
195 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
196 /// set when configuring the client.
197 pub async fn send(
198 self,
199 ) -> ::std::result::Result<
200 crate::operation::put_bucket_acl::PutBucketAclOutput,
201 ::aws_smithy_runtime_api::client::result::SdkError<
202 crate::operation::put_bucket_acl::PutBucketAclError,
203 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
204 >,
205 > {
206 let input = self
207 .inner
208 .build()
209 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
210 let runtime_plugins = crate::operation::put_bucket_acl::PutBucketAcl::operation_runtime_plugins(
211 self.handle.runtime_plugins.clone(),
212 &self.handle.conf,
213 self.config_override,
214 );
215 crate::operation::put_bucket_acl::PutBucketAcl::orchestrate(&runtime_plugins, input).await
216 }
217
218 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
219 pub fn customize(
220 self,
221 ) -> crate::client::customize::CustomizableOperation<
222 crate::operation::put_bucket_acl::PutBucketAclOutput,
223 crate::operation::put_bucket_acl::PutBucketAclError,
224 Self,
225 > {
226 crate::client::customize::CustomizableOperation::new(self)
227 }
228 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
229 self.set_config_override(::std::option::Option::Some(config_override.into()));
230 self
231 }
232
233 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
234 self.config_override = config_override;
235 self
236 }
237 /// <p>The canned ACL to apply to the bucket.</p>
238 pub fn acl(mut self, input: crate::types::BucketCannedAcl) -> Self {
239 self.inner = self.inner.acl(input);
240 self
241 }
242 /// <p>The canned ACL to apply to the bucket.</p>
243 pub fn set_acl(mut self, input: ::std::option::Option<crate::types::BucketCannedAcl>) -> Self {
244 self.inner = self.inner.set_acl(input);
245 self
246 }
247 /// <p>The canned ACL to apply to the bucket.</p>
248 pub fn get_acl(&self) -> &::std::option::Option<crate::types::BucketCannedAcl> {
249 self.inner.get_acl()
250 }
251 /// <p>Contains the elements that set the ACL permissions for an object per grantee.</p>
252 pub fn access_control_policy(mut self, input: crate::types::AccessControlPolicy) -> Self {
253 self.inner = self.inner.access_control_policy(input);
254 self
255 }
256 /// <p>Contains the elements that set the ACL permissions for an object per grantee.</p>
257 pub fn set_access_control_policy(mut self, input: ::std::option::Option<crate::types::AccessControlPolicy>) -> Self {
258 self.inner = self.inner.set_access_control_policy(input);
259 self
260 }
261 /// <p>Contains the elements that set the ACL permissions for an object per grantee.</p>
262 pub fn get_access_control_policy(&self) -> &::std::option::Option<crate::types::AccessControlPolicy> {
263 self.inner.get_access_control_policy()
264 }
265 /// <p>The bucket to which to apply the ACL.</p>
266 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
267 self.inner = self.inner.bucket(input.into());
268 self
269 }
270 /// <p>The bucket to which to apply the ACL.</p>
271 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
272 self.inner = self.inner.set_bucket(input);
273 self
274 }
275 /// <p>The bucket to which to apply the ACL.</p>
276 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
277 self.inner.get_bucket()
278 }
279 /// <p>The Base64 encoded 128-bit <code>MD5</code> digest of the data. This header must be used as a message integrity check to verify that the request body was not corrupted in transit. For more information, go to <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864.</a></p>
280 /// <p>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 Base64 encoded 128-bit <code>MD5</code> digest of the data. This header must be used as a message integrity check to verify that the request body was not corrupted in transit. For more information, go to <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864.</a></p>
286 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
287 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
288 self.inner = self.inner.set_content_md5(input);
289 self
290 }
291 /// <p>The Base64 encoded 128-bit <code>MD5</code> digest of the data. This header must be used as a message integrity check to verify that the request body was not corrupted in transit. For more information, go to <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864.</a></p>
292 /// <p>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 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>
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 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>
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 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>
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 /// <p>Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.</p>
314 pub fn grant_full_control(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
315 self.inner = self.inner.grant_full_control(input.into());
316 self
317 }
318 /// <p>Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.</p>
319 pub fn set_grant_full_control(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
320 self.inner = self.inner.set_grant_full_control(input);
321 self
322 }
323 /// <p>Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.</p>
324 pub fn get_grant_full_control(&self) -> &::std::option::Option<::std::string::String> {
325 self.inner.get_grant_full_control()
326 }
327 /// <p>Allows grantee to list the objects in the bucket.</p>
328 pub fn grant_read(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
329 self.inner = self.inner.grant_read(input.into());
330 self
331 }
332 /// <p>Allows grantee to list the objects in the bucket.</p>
333 pub fn set_grant_read(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
334 self.inner = self.inner.set_grant_read(input);
335 self
336 }
337 /// <p>Allows grantee to list the objects in the bucket.</p>
338 pub fn get_grant_read(&self) -> &::std::option::Option<::std::string::String> {
339 self.inner.get_grant_read()
340 }
341 /// <p>Allows grantee to read the bucket ACL.</p>
342 pub fn grant_read_acp(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
343 self.inner = self.inner.grant_read_acp(input.into());
344 self
345 }
346 /// <p>Allows grantee to read the bucket ACL.</p>
347 pub fn set_grant_read_acp(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
348 self.inner = self.inner.set_grant_read_acp(input);
349 self
350 }
351 /// <p>Allows grantee to read the bucket ACL.</p>
352 pub fn get_grant_read_acp(&self) -> &::std::option::Option<::std::string::String> {
353 self.inner.get_grant_read_acp()
354 }
355 /// <p>Allows grantee to create new objects in the bucket.</p>
356 /// <p>For the bucket and object owners of existing objects, also allows deletions and overwrites of those objects.</p>
357 pub fn grant_write(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
358 self.inner = self.inner.grant_write(input.into());
359 self
360 }
361 /// <p>Allows grantee to create new objects in the bucket.</p>
362 /// <p>For the bucket and object owners of existing objects, also allows deletions and overwrites of those objects.</p>
363 pub fn set_grant_write(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
364 self.inner = self.inner.set_grant_write(input);
365 self
366 }
367 /// <p>Allows grantee to create new objects in the bucket.</p>
368 /// <p>For the bucket and object owners of existing objects, also allows deletions and overwrites of those objects.</p>
369 pub fn get_grant_write(&self) -> &::std::option::Option<::std::string::String> {
370 self.inner.get_grant_write()
371 }
372 /// <p>Allows grantee to write the ACL for the applicable bucket.</p>
373 pub fn grant_write_acp(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
374 self.inner = self.inner.grant_write_acp(input.into());
375 self
376 }
377 /// <p>Allows grantee to write the ACL for the applicable bucket.</p>
378 pub fn set_grant_write_acp(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
379 self.inner = self.inner.set_grant_write_acp(input);
380 self
381 }
382 /// <p>Allows grantee to write the ACL for the applicable bucket.</p>
383 pub fn get_grant_write_acp(&self) -> &::std::option::Option<::std::string::String> {
384 self.inner.get_grant_write_acp()
385 }
386 /// <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>
387 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
388 self.inner = self.inner.expected_bucket_owner(input.into());
389 self
390 }
391 /// <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>
392 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
393 self.inner = self.inner.set_expected_bucket_owner(input);
394 self
395 }
396 /// <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>
397 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
398 self.inner.get_expected_bucket_owner()
399 }
400}