aws_sdk_s3control/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/// <note>
26/// <p>This action gets a bucket policy for an Amazon S3 on Outposts bucket. To get a policy for an S3 bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketPolicy.html">GetBucketPolicy</a> in the <i>Amazon S3 API Reference</i>.</p>
27/// </note>
28/// <p>Returns the policy of a specified Outposts bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">Using Amazon S3 on Outposts</a> in the <i>Amazon S3 User Guide</i>.</p>
29/// <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 have the <code>GetBucketPolicy</code> permissions on the specified bucket and belong to the bucket owner's account in order to use this action.</p>
30/// <p>Only users from Outposts bucket owner account with the right permissions can perform actions on an Outposts bucket. If you don't have <code>s3-outposts:GetBucketPolicy</code> permissions or you're not using an identity that belongs to the bucket owner's account, Amazon S3 returns a <code>403 Access Denied</code> error.</p><important>
31/// <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>
32/// </important>
33/// <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>
34/// <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_GetBucketPolicy.html#API_control_GetBucketPolicy_Examples">Examples</a> section.</p>
35/// <p>The following actions are related to <code>GetBucketPolicy</code>:</p>
36/// <ul>
37/// <li>
38/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html">GetObject</a></p></li>
39/// <li>
40/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketPolicy.html">PutBucketPolicy</a></p></li>
41/// <li>
42/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketPolicy.html">DeleteBucketPolicy</a></p></li>
43/// </ul>
44#[derive(::std::clone::Clone, ::std::fmt::Debug)]
45pub struct GetBucketPolicyFluentBuilder {
46 handle: ::std::sync::Arc<crate::client::Handle>,
47 inner: crate::operation::get_bucket_policy::builders::GetBucketPolicyInputBuilder,
48 config_override: ::std::option::Option<crate::config::Builder>,
49}
50impl
51 crate::client::customize::internal::CustomizableSend<
52 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
53 crate::operation::get_bucket_policy::GetBucketPolicyError,
54 > for GetBucketPolicyFluentBuilder
55{
56 fn send(
57 self,
58 config_override: crate::config::Builder,
59 ) -> crate::client::customize::internal::BoxFuture<
60 crate::client::customize::internal::SendResult<
61 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
62 crate::operation::get_bucket_policy::GetBucketPolicyError,
63 >,
64 > {
65 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
66 }
67}
68impl GetBucketPolicyFluentBuilder {
69 /// Creates a new `GetBucketPolicyFluentBuilder`.
70 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
71 Self {
72 handle,
73 inner: ::std::default::Default::default(),
74 config_override: ::std::option::Option::None,
75 }
76 }
77 /// Access the GetBucketPolicy as a reference.
78 pub fn as_input(&self) -> &crate::operation::get_bucket_policy::builders::GetBucketPolicyInputBuilder {
79 &self.inner
80 }
81 /// Sends the request and returns the response.
82 ///
83 /// If an error occurs, an `SdkError` will be returned with additional details that
84 /// can be matched against.
85 ///
86 /// By default, any retryable failures will be retried twice. Retry behavior
87 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
88 /// set when configuring the client.
89 pub async fn send(
90 self,
91 ) -> ::std::result::Result<
92 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
93 ::aws_smithy_runtime_api::client::result::SdkError<
94 crate::operation::get_bucket_policy::GetBucketPolicyError,
95 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
96 >,
97 > {
98 let input = self
99 .inner
100 .build()
101 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
102 let runtime_plugins = crate::operation::get_bucket_policy::GetBucketPolicy::operation_runtime_plugins(
103 self.handle.runtime_plugins.clone(),
104 &self.handle.conf,
105 self.config_override,
106 );
107 crate::operation::get_bucket_policy::GetBucketPolicy::orchestrate(&runtime_plugins, input).await
108 }
109
110 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
111 pub fn customize(
112 self,
113 ) -> crate::client::customize::CustomizableOperation<
114 crate::operation::get_bucket_policy::GetBucketPolicyOutput,
115 crate::operation::get_bucket_policy::GetBucketPolicyError,
116 Self,
117 > {
118 crate::client::customize::CustomizableOperation::new(self)
119 }
120 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
121 self.set_config_override(::std::option::Option::Some(config_override.into()));
122 self
123 }
124
125 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
126 self.config_override = config_override;
127 self
128 }
129 /// <p>The Amazon Web Services account ID of the Outposts bucket.</p>
130 pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.account_id(input.into());
132 self
133 }
134 /// <p>The Amazon Web Services account ID of the Outposts bucket.</p>
135 pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.inner = self.inner.set_account_id(input);
137 self
138 }
139 /// <p>The Amazon Web Services account ID of the Outposts bucket.</p>
140 pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
141 self.inner.get_account_id()
142 }
143 /// <p>Specifies the bucket.</p>
144 /// <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>
145 /// <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>
146 /// :
147 /// <account-id>
148 /// :outpost/
149 /// <outpost-id>
150 /// /bucket/
151 /// <my-bucket-name></my-bucket-name>
152 /// </outpost-id>
153 /// </account-id>
154 /// </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>
155 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156 self.inner = self.inner.bucket(input.into());
157 self
158 }
159 /// <p>Specifies the bucket.</p>
160 /// <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>
161 /// <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>
162 /// :
163 /// <account-id>
164 /// :outpost/
165 /// <outpost-id>
166 /// /bucket/
167 /// <my-bucket-name></my-bucket-name>
168 /// </outpost-id>
169 /// </account-id>
170 /// </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>
171 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172 self.inner = self.inner.set_bucket(input);
173 self
174 }
175 /// <p>Specifies the bucket.</p>
176 /// <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>
177 /// <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>
178 /// :
179 /// <account-id>
180 /// :outpost/
181 /// <outpost-id>
182 /// /bucket/
183 /// <my-bucket-name></my-bucket-name>
184 /// </outpost-id>
185 /// </account-id>
186 /// </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>
187 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
188 self.inner.get_bucket()
189 }
190}