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 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> if the bucket exists and you have permission to access it.</p>
26/// <p>If the bucket does not exist or you do not 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> code. A message body is not included, so you cannot determine the exception beyond these HTTP response codes.</p><note>
27/// <p><b>Directory buckets </b> - 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>az_id</i>.<i>region</i>.amazonaws.com</code>. Path-style requests are not supported. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-Regions-and-Zones.html">Regional and Zonal endpoints</a> in the <i>Amazon S3 User Guide</i>.</p>
28/// </note>
29/// <dl>
30/// <dt>
31/// Authentication and authorization
32/// </dt>
33/// <dd>
34/// <p>All <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>
35/// <p><b>Directory bucket</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>
36/// <p>Amazon Web Services CLI or SDKs handles authentication and authorization on your behalf.</p>
37/// </dd>
38/// <dt>
39/// Permissions
40/// </dt>
41/// <dd>
42/// <p></p>
43/// <ul>
44/// <li>
45/// <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>
46/// <li>
47/// <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>
48/// <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>
49/// </ul>
50/// </dd>
51/// <dt>
52/// HTTP Host header syntax
53/// </dt>
54/// <dd>
55/// <p><b>Directory buckets </b> - The HTTP Host header syntax is <code> <i>Bucket_name</i>.s3express-<i>az_id</i>.<i>region</i>.amazonaws.com</code>.</p>
56/// </dd>
57/// </dl>
58#[derive(::std::clone::Clone, ::std::fmt::Debug)]
59pub struct HeadBucketFluentBuilder {
60 handle: ::std::sync::Arc<crate::client::Handle>,
61 inner: crate::operation::head_bucket::builders::HeadBucketInputBuilder,
62 config_override: ::std::option::Option<crate::config::Builder>,
63}
64impl
65 crate::client::customize::internal::CustomizableSend<
66 crate::operation::head_bucket::HeadBucketOutput,
67 crate::operation::head_bucket::HeadBucketError,
68 > for HeadBucketFluentBuilder
69{
70 fn send(
71 self,
72 config_override: crate::config::Builder,
73 ) -> crate::client::customize::internal::BoxFuture<
74 crate::client::customize::internal::SendResult<
75 crate::operation::head_bucket::HeadBucketOutput,
76 crate::operation::head_bucket::HeadBucketError,
77 >,
78 > {
79 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
80 }
81}
82impl HeadBucketFluentBuilder {
83 /// Creates a new `HeadBucket`.
84 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
85 Self {
86 handle,
87 inner: ::std::default::Default::default(),
88 config_override: ::std::option::Option::None,
89 }
90 }
91 /// Access the HeadBucket as a reference.
92 pub fn as_input(&self) -> &crate::operation::head_bucket::builders::HeadBucketInputBuilder {
93 &self.inner
94 }
95 /// Sends the request and returns the response.
96 ///
97 /// If an error occurs, an `SdkError` will be returned with additional details that
98 /// can be matched against.
99 ///
100 /// By default, any retryable failures will be retried twice. Retry behavior
101 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
102 /// set when configuring the client.
103 pub async fn send(
104 self,
105 ) -> ::std::result::Result<
106 crate::operation::head_bucket::HeadBucketOutput,
107 ::aws_smithy_runtime_api::client::result::SdkError<
108 crate::operation::head_bucket::HeadBucketError,
109 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
110 >,
111 > {
112 let input = self
113 .inner
114 .build()
115 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
116 let runtime_plugins = crate::operation::head_bucket::HeadBucket::operation_runtime_plugins(
117 self.handle.runtime_plugins.clone(),
118 &self.handle.conf,
119 self.config_override,
120 );
121 crate::operation::head_bucket::HeadBucket::orchestrate(&runtime_plugins, input).await
122 }
123
124 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
125 pub fn customize(
126 self,
127 ) -> crate::client::customize::CustomizableOperation<
128 crate::operation::head_bucket::HeadBucketOutput,
129 crate::operation::head_bucket::HeadBucketError,
130 Self,
131 > {
132 crate::client::customize::CustomizableOperation::new(self)
133 }
134 pub(crate) fn config_override(mut self, config_override: impl Into<crate::config::Builder>) -> Self {
135 self.set_config_override(Some(config_override.into()));
136 self
137 }
138
139 pub(crate) fn set_config_override(&mut self, config_override: Option<crate::config::Builder>) -> &mut Self {
140 self.config_override = config_override;
141 self
142 }
143 /// <p>The bucket name.</p>
144 /// <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>az_id</i>.<i>region</i>.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the format <code> <i>bucket_base_name</i>--<i>az-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-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>
145 /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. 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>
146 /// <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>
147 /// <p>Access points and Object Lambda access points are not supported by directory buckets.</p>
148 /// </note>
149 /// <p><b>S3 on Outposts</b> - When you use this action with Amazon 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 through the Amazon Web Services SDKs, you provide the Outposts access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, 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>
150 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151 self.inner = self.inner.bucket(input.into());
152 self
153 }
154 /// <p>The bucket name.</p>
155 /// <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>az_id</i>.<i>region</i>.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the format <code> <i>bucket_base_name</i>--<i>az-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-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>
156 /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. 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>
157 /// <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>
158 /// <p>Access points and Object Lambda access points are not supported by directory buckets.</p>
159 /// </note>
160 /// <p><b>S3 on Outposts</b> - When you use this action with Amazon 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 through the Amazon Web Services SDKs, you provide the Outposts access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, 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>
161 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162 self.inner = self.inner.set_bucket(input);
163 self
164 }
165 /// <p>The bucket name.</p>
166 /// <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>az_id</i>.<i>region</i>.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the format <code> <i>bucket_base_name</i>--<i>az-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-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>
167 /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. 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>
168 /// <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>
169 /// <p>Access points and Object Lambda access points are not supported by directory buckets.</p>
170 /// </note>
171 /// <p><b>S3 on Outposts</b> - When you use this action with Amazon 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 through the Amazon Web Services SDKs, you provide the Outposts access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, 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>
172 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
173 self.inner.get_bucket()
174 }
175 /// <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>
176 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177 self.inner = self.inner.expected_bucket_owner(input.into());
178 self
179 }
180 /// <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>
181 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.inner = self.inner.set_expected_bucket_owner(input);
183 self
184 }
185 /// <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>
186 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
187 self.inner.get_expected_bucket_owner()
188 }
189}