aws_sdk_s3/operation/get_bucket_policy/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_bucket_policy::_get_bucket_policy_output::GetBucketPolicyOutputBuilder;
3
4pub use crate::operation::get_bucket_policy::_get_bucket_policy_input::GetBucketPolicyInputBuilder;
5
6impl crate::operation::get_bucket_policy::builders::GetBucketPolicyInputBuilder {
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::get_bucket_policy::GetBucketPolicyOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::get_bucket_policy::GetBucketPolicyError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.get_bucket_policy();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `GetBucketPolicy`.
24///
25/// <p>Returns the policy of a specified bucket.</p><note>
26/// <p><b>Directory buckets </b> - For directory buckets, you must make requests for this API operation to the Regional endpoint. These endpoints support path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't 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>
27/// </note>
28/// <dl>
29/// <dt>
30/// Permissions
31/// </dt>
32/// <dd>
33/// <p>If you are using an identity other than the root user of the Amazon Web Services account that owns the bucket, the calling identity must both have the <code>GetBucketPolicy</code> permissions on the specified bucket and belong to the bucket owner's account in order to use this operation.</p>
34/// <p>If you don't have <code>GetBucketPolicy</code> permissions, Amazon S3 returns a <code>403 Access Denied</code> error. If you have the correct permissions, but you're not using an identity that belongs to the bucket owner's account, Amazon S3 returns a <code>405 Method Not Allowed</code> error.</p><important>
35/// <p>To ensure that bucket owners don't inadvertently lock themselves out of their own buckets, the root principal in a bucket owner's Amazon Web Services account can perform the <code>GetBucketPolicy</code>, <code>PutBucketPolicy</code>, and <code>DeleteBucketPolicy</code> API actions, even if their bucket policy explicitly denies the root principal's access. Bucket owner root principals can only be blocked from performing these API actions by VPC endpoint policies and Amazon Web Services Organizations policies.</p>
36/// </important>
37/// <ul>
38/// <li>
39/// <p><b>General purpose bucket permissions</b> - The <code>s3:GetBucketPolicy</code> permission is required in a policy. For more information about general purpose buckets bucket policies, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html">Using Bucket Policies and User Policies</a> in the <i>Amazon S3 User Guide</i>.</p></li>
40/// <li>
41/// <p><b>Directory bucket permissions</b> - To grant access to this API operation, you must have the <code>s3express:GetBucketPolicy</code> permission in an IAM identity-based policy instead of a bucket policy. Cross-account access to this API operation isn't supported. This operation can only be performed by the Amazon Web Services account that owns the resource. For more information about directory bucket policies and permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-security-iam.html">Amazon Web Services Identity and Access Management (IAM) for S3 Express One Zone</a> in the <i>Amazon S3 User Guide</i>.</p></li>
42/// </ul>
43/// </dd>
44/// <dt>
45/// Example bucket policies
46/// </dt>
47/// <dd>
48/// <p><b>General purpose buckets example bucket policies</b> - See <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html">Bucket policy examples</a> in the <i>Amazon S3 User Guide</i>.</p>
49/// <p><b>Directory bucket example bucket policies</b> - 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> in the <i>Amazon S3 User Guide</i>.</p>
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>s3express-control.<i>region-code</i>.amazonaws.com</code>.</p>
56/// </dd>
57/// </dl>
58/// <p>The following action is related to <code>GetBucketPolicy</code>:</p>
59/// <ul>
60/// <li>
61/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html">GetObject</a></p></li>
62/// </ul><important>
63/// <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>
64/// </important>
65#[derive(::std::clone::Clone, ::std::fmt::Debug)]
66pub struct GetBucketPolicyFluentBuilder {
67 handle: ::std::sync::Arc<crate::client::Handle>,
68 inner: crate::operation::get_bucket_policy::builders::GetBucketPolicyInputBuilder,
69 config_override: ::std::option::Option<crate::config::Builder>,
70}
71impl
72 crate::client::customize::internal::CustomizableSend<
73 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
74 crate::operation::get_bucket_policy::GetBucketPolicyError,
75 > for GetBucketPolicyFluentBuilder
76{
77 fn send(
78 self,
79 config_override: crate::config::Builder,
80 ) -> crate::client::customize::internal::BoxFuture<
81 crate::client::customize::internal::SendResult<
82 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
83 crate::operation::get_bucket_policy::GetBucketPolicyError,
84 >,
85 > {
86 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
87 }
88}
89impl GetBucketPolicyFluentBuilder {
90 /// Creates a new `GetBucketPolicyFluentBuilder`.
91 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
92 Self {
93 handle,
94 inner: ::std::default::Default::default(),
95 config_override: ::std::option::Option::None,
96 }
97 }
98 /// Access the GetBucketPolicy as a reference.
99 pub fn as_input(&self) -> &crate::operation::get_bucket_policy::builders::GetBucketPolicyInputBuilder {
100 &self.inner
101 }
102 /// Sends the request and returns the response.
103 ///
104 /// If an error occurs, an `SdkError` will be returned with additional details that
105 /// can be matched against.
106 ///
107 /// By default, any retryable failures will be retried twice. Retry behavior
108 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
109 /// set when configuring the client.
110 pub async fn send(
111 self,
112 ) -> ::std::result::Result<
113 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
114 ::aws_smithy_runtime_api::client::result::SdkError<
115 crate::operation::get_bucket_policy::GetBucketPolicyError,
116 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
117 >,
118 > {
119 let input = self
120 .inner
121 .build()
122 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
123 let runtime_plugins = crate::operation::get_bucket_policy::GetBucketPolicy::operation_runtime_plugins(
124 self.handle.runtime_plugins.clone(),
125 &self.handle.conf,
126 self.config_override,
127 );
128 crate::operation::get_bucket_policy::GetBucketPolicy::orchestrate(&runtime_plugins, input).await
129 }
130
131 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
132 pub fn customize(
133 self,
134 ) -> crate::client::customize::CustomizableOperation<
135 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
136 crate::operation::get_bucket_policy::GetBucketPolicyError,
137 Self,
138 > {
139 crate::client::customize::CustomizableOperation::new(self)
140 }
141 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
142 self.set_config_override(::std::option::Option::Some(config_override.into()));
143 self
144 }
145
146 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
147 self.config_override = config_override;
148 self
149 }
150 /// <p>The bucket name to get the bucket policy for.</p>
151 /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-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>
152 /// <p><b>Access points</b> - When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.</p>
153 /// <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>
154 /// <p>Object Lambda access points are not supported by directory buckets.</p>
155 /// </note>
156 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157 self.inner = self.inner.bucket(input.into());
158 self
159 }
160 /// <p>The bucket name to get the bucket policy for.</p>
161 /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-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>
162 /// <p><b>Access points</b> - When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.</p>
163 /// <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>
164 /// <p>Object Lambda access points are not supported by directory buckets.</p>
165 /// </note>
166 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167 self.inner = self.inner.set_bucket(input);
168 self
169 }
170 /// <p>The bucket name to get the bucket policy for.</p>
171 /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-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>
172 /// <p><b>Access points</b> - When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.</p>
173 /// <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>
174 /// <p>Object Lambda access points are not supported by directory buckets.</p>
175 /// </note>
176 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
177 self.inner.get_bucket()
178 }
179 /// <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><note>
180 /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
181 /// </note>
182 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183 self.inner = self.inner.expected_bucket_owner(input.into());
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><note>
187 /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
188 /// </note>
189 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190 self.inner = self.inner.set_expected_bucket_owner(input);
191 self
192 }
193 /// <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><note>
194 /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
195 /// </note>
196 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
197 self.inner.get_expected_bucket_owner()
198 }
199}