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> if the bucket exists and you have permission to access it.</p><note>
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>
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>
59#[derive(::std::clone::Clone, ::std::fmt::Debug)]
60pub struct HeadBucketFluentBuilder {
61    handle: ::std::sync::Arc<crate::client::Handle>,
62    inner: crate::operation::head_bucket::builders::HeadBucketInputBuilder,
63    config_override: ::std::option::Option<crate::config::Builder>,
64}
65impl
66    crate::client::customize::internal::CustomizableSend<
67        crate::operation::head_bucket::HeadBucketOutput,
68        crate::operation::head_bucket::HeadBucketError,
69    > for HeadBucketFluentBuilder
70{
71    fn send(
72        self,
73        config_override: crate::config::Builder,
74    ) -> crate::client::customize::internal::BoxFuture<
75        crate::client::customize::internal::SendResult<
76            crate::operation::head_bucket::HeadBucketOutput,
77            crate::operation::head_bucket::HeadBucketError,
78        >,
79    > {
80        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
81    }
82}
83impl HeadBucketFluentBuilder {
84    /// Creates a new `HeadBucketFluentBuilder`.
85    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
86        Self {
87            handle,
88            inner: ::std::default::Default::default(),
89            config_override: ::std::option::Option::None,
90        }
91    }
92    /// Access the HeadBucket as a reference.
93    pub fn as_input(&self) -> &crate::operation::head_bucket::builders::HeadBucketInputBuilder {
94        &self.inner
95    }
96    /// Sends the request and returns the response.
97    ///
98    /// If an error occurs, an `SdkError` will be returned with additional details that
99    /// can be matched against.
100    ///
101    /// By default, any retryable failures will be retried twice. Retry behavior
102    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
103    /// set when configuring the client.
104    pub async fn send(
105        self,
106    ) -> ::std::result::Result<
107        crate::operation::head_bucket::HeadBucketOutput,
108        ::aws_smithy_runtime_api::client::result::SdkError<
109            crate::operation::head_bucket::HeadBucketError,
110            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
111        >,
112    > {
113        let input = self
114            .inner
115            .build()
116            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
117        let runtime_plugins = crate::operation::head_bucket::HeadBucket::operation_runtime_plugins(
118            self.handle.runtime_plugins.clone(),
119            &self.handle.conf,
120            self.config_override,
121        );
122        crate::operation::head_bucket::HeadBucket::orchestrate(&runtime_plugins, input).await
123    }
124
125    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
126    pub fn customize(
127        self,
128    ) -> crate::client::customize::CustomizableOperation<
129        crate::operation::head_bucket::HeadBucketOutput,
130        crate::operation::head_bucket::HeadBucketError,
131        Self,
132    > {
133        crate::client::customize::CustomizableOperation::new(self)
134    }
135    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
136        self.set_config_override(::std::option::Option::Some(config_override.into()));
137        self
138    }
139
140    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
141        self.config_override = config_override;
142        self
143    }
144    /// <p>The bucket name.</p>
145    /// <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>
146    /// <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>
147    /// <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>
148    /// <p>Access points and Object Lambda access points are not supported by directory buckets.</p>
149    /// </note>
150    /// <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>
151    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.inner = self.inner.bucket(input.into());
153        self
154    }
155    /// <p>The bucket name.</p>
156    /// <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>
157    /// <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>
158    /// <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>
159    /// <p>Access points and Object Lambda access points are not supported by directory buckets.</p>
160    /// </note>
161    /// <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>
162    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.inner = self.inner.set_bucket(input);
164        self
165    }
166    /// <p>The bucket name.</p>
167    /// <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>
168    /// <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>
169    /// <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>
170    /// <p>Access points and Object Lambda access points are not supported by directory buckets.</p>
171    /// </note>
172    /// <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>
173    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_bucket()
175    }
176    /// <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>
177    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178        self.inner = self.inner.expected_bucket_owner(input.into());
179        self
180    }
181    /// <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>
182    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.inner = self.inner.set_expected_bucket_owner(input);
184        self
185    }
186    /// <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>
187    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
188        self.inner.get_expected_bucket_owner()
189    }
190}