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