aws_sdk_s3/operation/head_bucket/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::head_bucket::_head_bucket_output::HeadBucketOutputBuilder;
3
4pub use crate::operation::head_bucket::_head_bucket_input::HeadBucketInputBuilder;
5
6impl crate::operation::head_bucket::builders::HeadBucketInputBuilder {
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::head_bucket::HeadBucketOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::head_bucket::HeadBucketError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.head_bucket();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `HeadBucket`.
24///
25/// <p>You can use this operation to determine if a bucket exists and if you have permission to access it. The action returns a <code>200 OK</code> HTTP status code if the bucket exists and you have permission to access it. You can make a <code>HeadBucket</code> call on any bucket name to any Region in the partition, and regardless of the permissions on the bucket, you will receive a response header with the correct bucket location so that you can then make a proper, signed request to the appropriate Regional endpoint.</p><note>
26/// <p>If the bucket doesn't exist or you don't have permission to access it, the <code>HEAD</code> request returns a generic <code>400 Bad Request</code>, <code>403 Forbidden</code>, or <code>404 Not Found</code> HTTP status code. A message body isn't included, so you can't determine the exception beyond these HTTP response codes.</p>
27/// </note>
28/// <dl>
29/// <dt>
30/// Authentication and authorization
31/// </dt>
32/// <dd>
33/// <p><b>General purpose buckets</b> - Request to public buckets that grant the s3:ListBucket permission publicly do not need to be signed. All other <code>HeadBucket</code> requests must be authenticated and signed by using IAM credentials (access key ID and secret access key for the IAM identities). All headers with the <code>x-amz-</code> prefix, including <code>x-amz-copy-source</code>, must be signed. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html">REST Authentication</a>.</p>
34/// <p><b>Directory buckets</b> - You must use IAM credentials to authenticate and authorize your access to the <code>HeadBucket</code> API operation, instead of using the temporary security credentials through the <code>CreateSession</code> API operation.</p>
35/// <p>Amazon Web Services CLI or SDKs handles authentication and authorization on your behalf.</p>
36/// </dd>
37/// <dt>
38/// Permissions
39/// </dt>
40/// <dd>
41/// <p></p>
42/// <ul>
43/// <li>
44/// <p><b>General purpose bucket permissions</b> - To use this operation, you must have permissions to perform the <code>s3:ListBucket</code> action. The bucket owner has this permission by default and can grant this permission to others. For more information about permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html">Managing access permissions to your Amazon S3 resources</a> in the <i>Amazon S3 User Guide</i>.</p></li>
45/// <li>
46/// <p><b>Directory bucket permissions</b> - You must have the <b> <code>s3express:CreateSession</code> </b> permission in the <code>Action</code> element of a policy. By default, the session is in the <code>ReadWrite</code> mode. If you want to restrict the access, you can explicitly set the <code>s3express:SessionMode</code> condition key to <code>ReadOnly</code> on the bucket.</p>
47/// <p>For more information about example bucket policies, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-security-iam-example-bucket-policies.html">Example bucket policies for S3 Express One Zone</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-security-iam-identity-policies.html">Amazon Web Services Identity and Access Management (IAM) identity-based policies for S3 Express One Zone</a> in the <i>Amazon S3 User Guide</i>.</p></li>
48/// </ul>
49/// </dd>
50/// <dt>
51/// HTTP Host header syntax
52/// </dt>
53/// <dd>
54/// <p><b>Directory buckets </b> - The HTTP Host header syntax is <code> <i>Bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</code>.</p><note>
55/// <p>You must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format <code>https://<i>bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</code>. Path-style requests are not supported. For more information about endpoints in Availability Zones, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/endpoint-directory-buckets-AZ.html">Regional and Zonal endpoints for directory buckets in Availability Zones</a> in the <i>Amazon S3 User Guide</i>. For more information about endpoints in Local Zones, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-lzs-for-directory-buckets.html">Concepts for directory buckets in Local Zones</a> in the <i>Amazon S3 User Guide</i>.</p>
56/// </note>
57/// </dd>
58/// </dl><important>
59/// <p>You must URL encode any signed header values that contain spaces. For example, if your header value is <code>my file.txt</code>, containing two spaces after <code>my</code>, you must URL encode this value to <code>my%20%20file.txt</code>.</p>
60/// </important>
61#[derive(::std::clone::Clone, ::std::fmt::Debug)]
62pub struct HeadBucketFluentBuilder {
63 handle: ::std::sync::Arc<crate::client::Handle>,
64 inner: crate::operation::head_bucket::builders::HeadBucketInputBuilder,
65 config_override: ::std::option::Option<crate::config::Builder>,
66}
67impl
68 crate::client::customize::internal::CustomizableSend<
69 crate::operation::head_bucket::HeadBucketOutput,
70 crate::operation::head_bucket::HeadBucketError,
71 > for HeadBucketFluentBuilder
72{
73 fn send(
74 self,
75 config_override: crate::config::Builder,
76 ) -> crate::client::customize::internal::BoxFuture<
77 crate::client::customize::internal::SendResult<
78 crate::operation::head_bucket::HeadBucketOutput,
79 crate::operation::head_bucket::HeadBucketError,
80 >,
81 > {
82 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
83 }
84}
85impl HeadBucketFluentBuilder {
86 /// Creates a new `HeadBucketFluentBuilder`.
87 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
88 Self {
89 handle,
90 inner: ::std::default::Default::default(),
91 config_override: ::std::option::Option::None,
92 }
93 }
94 /// Access the HeadBucket as a reference.
95 pub fn as_input(&self) -> &crate::operation::head_bucket::builders::HeadBucketInputBuilder {
96 &self.inner
97 }
98 /// Sends the request and returns the response.
99 ///
100 /// If an error occurs, an `SdkError` will be returned with additional details that
101 /// can be matched against.
102 ///
103 /// By default, any retryable failures will be retried twice. Retry behavior
104 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
105 /// set when configuring the client.
106 pub async fn send(
107 self,
108 ) -> ::std::result::Result<
109 crate::operation::head_bucket::HeadBucketOutput,
110 ::aws_smithy_runtime_api::client::result::SdkError<
111 crate::operation::head_bucket::HeadBucketError,
112 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
113 >,
114 > {
115 let input = self
116 .inner
117 .build()
118 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
119 let runtime_plugins = crate::operation::head_bucket::HeadBucket::operation_runtime_plugins(
120 self.handle.runtime_plugins.clone(),
121 &self.handle.conf,
122 self.config_override,
123 );
124 crate::operation::head_bucket::HeadBucket::orchestrate(&runtime_plugins, input).await
125 }
126
127 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
128 pub fn customize(
129 self,
130 ) -> crate::client::customize::CustomizableOperation<
131 crate::operation::head_bucket::HeadBucketOutput,
132 crate::operation::head_bucket::HeadBucketError,
133 Self,
134 > {
135 crate::client::customize::CustomizableOperation::new(self)
136 }
137 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
138 self.set_config_override(::std::option::Option::Some(config_override.into()));
139 self
140 }
141
142 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
143 self.config_override = config_override;
144 self
145 }
146 /// <p>The bucket name.</p>
147 /// <p><b>Directory buckets</b> - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format <code> <i>Bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>amzn-s3-demo-bucket</i>--<i>usw2-az1</i>--x-s3</code>). For information about bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in the <i>Amazon S3 User Guide</i>.</p>
148 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action 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/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
149 /// <p><b>Object Lambda access points</b> - When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code <code>InvalidAccessPointAliasError</code> is returned. For more information about <code>InvalidAccessPointAliasError</code>, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList">List of Error Codes</a>.</p><note>
150 /// <p>Object Lambda access points are not supported by directory buckets.</p>
151 /// </note>
152 /// <p><b>S3 on Outposts</b> - When you use this action with S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form <code> <i>AccessPointName</i>-<i>AccountId</i>.<i>outpostID</i>.s3-outposts.<i>Region</i>.amazonaws.com</code>. When you use this action with S3 on Outposts, the destination bucket must be the Outposts access point ARN or the access point alias. For more information about S3 on Outposts, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">What is S3 on Outposts?</a> in the <i>Amazon S3 User Guide</i>.</p>
153 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154 self.inner = self.inner.bucket(input.into());
155 self
156 }
157 /// <p>The bucket name.</p>
158 /// <p><b>Directory buckets</b> - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format <code> <i>Bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>amzn-s3-demo-bucket</i>--<i>usw2-az1</i>--x-s3</code>). For information about bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in the <i>Amazon S3 User Guide</i>.</p>
159 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action 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/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
160 /// <p><b>Object Lambda access points</b> - When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code <code>InvalidAccessPointAliasError</code> is returned. For more information about <code>InvalidAccessPointAliasError</code>, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList">List of Error Codes</a>.</p><note>
161 /// <p>Object Lambda access points are not supported by directory buckets.</p>
162 /// </note>
163 /// <p><b>S3 on Outposts</b> - When you use this action with S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form <code> <i>AccessPointName</i>-<i>AccountId</i>.<i>outpostID</i>.s3-outposts.<i>Region</i>.amazonaws.com</code>. When you use this action with S3 on Outposts, the destination bucket must be the Outposts access point ARN or the access point alias. For more information about S3 on Outposts, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">What is S3 on Outposts?</a> in the <i>Amazon S3 User Guide</i>.</p>
164 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165 self.inner = self.inner.set_bucket(input);
166 self
167 }
168 /// <p>The bucket name.</p>
169 /// <p><b>Directory buckets</b> - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format <code> <i>Bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>amzn-s3-demo-bucket</i>--<i>usw2-az1</i>--x-s3</code>). For information about bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in the <i>Amazon S3 User Guide</i>.</p>
170 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action 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/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
171 /// <p><b>Object Lambda access points</b> - When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code <code>InvalidAccessPointAliasError</code> is returned. For more information about <code>InvalidAccessPointAliasError</code>, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList">List of Error Codes</a>.</p><note>
172 /// <p>Object Lambda access points are not supported by directory buckets.</p>
173 /// </note>
174 /// <p><b>S3 on Outposts</b> - When you use this action with S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form <code> <i>AccessPointName</i>-<i>AccountId</i>.<i>outpostID</i>.s3-outposts.<i>Region</i>.amazonaws.com</code>. When you use this action with S3 on Outposts, the destination bucket must be the Outposts access point ARN or the access point alias. For more information about S3 on Outposts, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">What is S3 on Outposts?</a> in the <i>Amazon S3 User Guide</i>.</p>
175 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
176 self.inner.get_bucket()
177 }
178 /// <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>
179 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180 self.inner = self.inner.expected_bucket_owner(input.into());
181 self
182 }
183 /// <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>
184 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
185 self.inner = self.inner.set_expected_bucket_owner(input);
186 self
187 }
188 /// <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>
189 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
190 self.inner.get_expected_bucket_owner()
191 }
192}