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