aws_sdk_s3control/operation/delete_bucket_policy/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::delete_bucket_policy::_delete_bucket_policy_output::DeleteBucketPolicyOutputBuilder;
3
4pub use crate::operation::delete_bucket_policy::_delete_bucket_policy_input::DeleteBucketPolicyInputBuilder;
5
6impl crate::operation::delete_bucket_policy::builders::DeleteBucketPolicyInputBuilder {
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::delete_bucket_policy::DeleteBucketPolicyOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::delete_bucket_policy::DeleteBucketPolicyError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.delete_bucket_policy();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `DeleteBucketPolicy`.
24///
25/// <note>
26/// <p>This action deletes an Amazon S3 on Outposts bucket policy. To delete an S3 bucket policy, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketPolicy.html">DeleteBucketPolicy</a> in the <i>Amazon S3 API Reference</i>.</p>
27/// </note>
28/// <p>This implementation of the DELETE action uses the policy subresource to delete the policy of a specified Amazon S3 on Outposts bucket. 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 have the <code>s3-outposts:DeleteBucketPolicy</code> permissions on the specified Outposts bucket and belong to the bucket owner's account to use this action. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">Using Amazon S3 on Outposts</a> in <i>Amazon S3 User Guide</i>.</p>
29/// <p>If you don't have <code>DeleteBucketPolicy</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>
30/// <p>As a security precaution, the root user of the Amazon Web Services account that owns a bucket can always use this action, even if the policy explicitly denies the root user the ability to perform this action.</p>
31/// </important>
32/// <p>For more information about bucket policies, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html">Using Bucket Policies and User Policies</a>.</p>
33/// <p>All Amazon S3 on Outposts REST API requests for this action require an additional parameter of <code>x-amz-outpost-id</code> to be passed with the request. In addition, you must use an S3 on Outposts endpoint hostname prefix instead of <code>s3-control</code>. For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the <code>x-amz-outpost-id</code> derived by using the access point ARN, see the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketPolicy.html#API_control_DeleteBucketPolicy_Examples">Examples</a> section.</p>
34/// <p>The following actions are related to <code>DeleteBucketPolicy</code>:</p>
35/// <ul>
36/// <li>
37/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketPolicy.html">GetBucketPolicy</a></p></li>
38/// <li>
39/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketPolicy.html">PutBucketPolicy</a></p></li>
40/// </ul><important>
41/// <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>
42/// </important>
43#[derive(::std::clone::Clone, ::std::fmt::Debug)]
44pub struct DeleteBucketPolicyFluentBuilder {
45 handle: ::std::sync::Arc<crate::client::Handle>,
46 inner: crate::operation::delete_bucket_policy::builders::DeleteBucketPolicyInputBuilder,
47 config_override: ::std::option::Option<crate::config::Builder>,
48}
49impl
50 crate::client::customize::internal::CustomizableSend<
51 crate::operation::delete_bucket_policy::DeleteBucketPolicyOutput,
52 crate::operation::delete_bucket_policy::DeleteBucketPolicyError,
53 > for DeleteBucketPolicyFluentBuilder
54{
55 fn send(
56 self,
57 config_override: crate::config::Builder,
58 ) -> crate::client::customize::internal::BoxFuture<
59 crate::client::customize::internal::SendResult<
60 crate::operation::delete_bucket_policy::DeleteBucketPolicyOutput,
61 crate::operation::delete_bucket_policy::DeleteBucketPolicyError,
62 >,
63 > {
64 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
65 }
66}
67impl DeleteBucketPolicyFluentBuilder {
68 /// Creates a new `DeleteBucketPolicyFluentBuilder`.
69 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
70 Self {
71 handle,
72 inner: ::std::default::Default::default(),
73 config_override: ::std::option::Option::None,
74 }
75 }
76 /// Access the DeleteBucketPolicy as a reference.
77 pub fn as_input(&self) -> &crate::operation::delete_bucket_policy::builders::DeleteBucketPolicyInputBuilder {
78 &self.inner
79 }
80 /// Sends the request and returns the response.
81 ///
82 /// If an error occurs, an `SdkError` will be returned with additional details that
83 /// can be matched against.
84 ///
85 /// By default, any retryable failures will be retried twice. Retry behavior
86 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
87 /// set when configuring the client.
88 pub async fn send(
89 self,
90 ) -> ::std::result::Result<
91 crate::operation::delete_bucket_policy::DeleteBucketPolicyOutput,
92 ::aws_smithy_runtime_api::client::result::SdkError<
93 crate::operation::delete_bucket_policy::DeleteBucketPolicyError,
94 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
95 >,
96 > {
97 let input = self
98 .inner
99 .build()
100 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
101 let runtime_plugins = crate::operation::delete_bucket_policy::DeleteBucketPolicy::operation_runtime_plugins(
102 self.handle.runtime_plugins.clone(),
103 &self.handle.conf,
104 self.config_override,
105 );
106 crate::operation::delete_bucket_policy::DeleteBucketPolicy::orchestrate(&runtime_plugins, input).await
107 }
108
109 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
110 pub fn customize(
111 self,
112 ) -> crate::client::customize::CustomizableOperation<
113 crate::operation::delete_bucket_policy::DeleteBucketPolicyOutput,
114 crate::operation::delete_bucket_policy::DeleteBucketPolicyError,
115 Self,
116 > {
117 crate::client::customize::CustomizableOperation::new(self)
118 }
119 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
120 self.set_config_override(::std::option::Option::Some(config_override.into()));
121 self
122 }
123
124 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
125 self.config_override = config_override;
126 self
127 }
128 /// <p>The account ID of the Outposts bucket.</p>
129 pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.account_id(input.into());
131 self
132 }
133 /// <p>The account ID of the Outposts bucket.</p>
134 pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_account_id(input);
136 self
137 }
138 /// <p>The account ID of the Outposts bucket.</p>
139 pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_account_id()
141 }
142 /// <p>Specifies the bucket.</p>
143 /// <p>For using this parameter with Amazon S3 on Outposts with the REST API, you must specify the name and the x-amz-outpost-id as well.</p>
144 /// <p>For using this parameter with S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN of the bucket accessed in the format <code>arn:aws:s3-outposts:<region>
145 /// :
146 /// <account-id>
147 /// :outpost/
148 /// <outpost-id>
149 /// /bucket/
150 /// <my-bucket-name></my-bucket-name>
151 /// </outpost-id>
152 /// </account-id>
153 /// </region></code>. For example, to access the bucket <code>reports</code> through Outpost <code>my-outpost</code> owned by account <code>123456789012</code> in Region <code>us-west-2</code>, use the URL encoding of <code>arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports</code>. The value must be URL encoded.</p>
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>Specifies the bucket.</p>
159 /// <p>For using this parameter with Amazon S3 on Outposts with the REST API, you must specify the name and the x-amz-outpost-id as well.</p>
160 /// <p>For using this parameter with S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN of the bucket accessed in the format <code>arn:aws:s3-outposts:<region>
161 /// :
162 /// <account-id>
163 /// :outpost/
164 /// <outpost-id>
165 /// /bucket/
166 /// <my-bucket-name></my-bucket-name>
167 /// </outpost-id>
168 /// </account-id>
169 /// </region></code>. For example, to access the bucket <code>reports</code> through Outpost <code>my-outpost</code> owned by account <code>123456789012</code> in Region <code>us-west-2</code>, use the URL encoding of <code>arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports</code>. The value must be URL encoded.</p>
170 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171 self.inner = self.inner.set_bucket(input);
172 self
173 }
174 /// <p>Specifies the bucket.</p>
175 /// <p>For using this parameter with Amazon S3 on Outposts with the REST API, you must specify the name and the x-amz-outpost-id as well.</p>
176 /// <p>For using this parameter with S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN of the bucket accessed in the format <code>arn:aws:s3-outposts:<region>
177 /// :
178 /// <account-id>
179 /// :outpost/
180 /// <outpost-id>
181 /// /bucket/
182 /// <my-bucket-name></my-bucket-name>
183 /// </outpost-id>
184 /// </account-id>
185 /// </region></code>. For example, to access the bucket <code>reports</code> through Outpost <code>my-outpost</code> owned by account <code>123456789012</code> in Region <code>us-west-2</code>, use the URL encoding of <code>arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports</code>. The value must be URL encoded.</p>
186 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
187 self.inner.get_bucket()
188 }
189}