aws_sdk_s3/operation/put_bucket_logging/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_logging::_put_bucket_logging_output::PutBucketLoggingOutputBuilder;
3
4pub use crate::operation::put_bucket_logging::_put_bucket_logging_input::PutBucketLoggingInputBuilder;
5
6impl crate::operation::put_bucket_logging::builders::PutBucketLoggingInputBuilder {
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::put_bucket_logging::PutBucketLoggingOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_bucket_logging::PutBucketLoggingError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_bucket_logging();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutBucketLogging`.
24///
25/// <important>
26/// <p>End of support notice: As of October 1, 2025, Amazon S3 has discontinued support for Email Grantee Access Control Lists (ACLs). If you attempt to use an Email Grantee ACL in a request after October 1, 2025, the request will receive an <code>HTTP 405</code> (Method Not Allowed) error.</p>
27/// <p>This change affects the following Amazon Web Services Regions: US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Europe (Ireland), and South America (São Paulo).</p>
28/// </important> <note>
29/// <p>This operation is not supported for directory buckets.</p>
30/// </note>
31/// <p>Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters. All logs are saved to buckets in the same Amazon Web Services Region as the source bucket. To set the logging status of a bucket, you must be the bucket owner.</p>
32/// <p>The bucket owner is automatically granted FULL_CONTROL to all logs. You use the <code>Grantee</code> request element to grant access to other people. The <code>Permissions</code> request element specifies the kind of access the grantee has to the logs.</p><important>
33/// <p>If the target bucket for log delivery uses the bucket owner enforced setting for S3 Object Ownership, you can't use the <code>Grantee</code> request element to grant access to others. Permissions can only be granted using policies. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-general">Permissions for server access log delivery</a> in the <i>Amazon S3 User Guide</i>.</p>
34/// </important>
35/// <dl>
36/// <dt>
37/// Grantee Values
38/// </dt>
39/// <dd>
40/// <p>You can specify the person (grantee) to whom you're assigning access rights (by using request elements) in the following ways. For examples of how to specify these grantee values in JSON format, see the Amazon Web Services CLI example in <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html"> Enabling Amazon S3 server access logging</a> in the <i>Amazon S3 User Guide</i>.</p>
41/// <ul>
42/// <li>
43/// <p>By the person's ID:</p>
44/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
45/// <id>
46/// <>ID<>
47/// </id>
48/// <displayname>
49/// <>GranteesEmail<>
50/// </displayname>
51/// </grantee></code></p>
52/// <p><code>DisplayName</code> is optional and ignored in the request.</p></li>
53/// <li>
54/// <p>By Email address:</p>
55/// <p><code> <grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail">
56/// <emailaddress>
57/// <>Grantees@email.com<>
58/// </emailaddress>
59/// </grantee></code></p>
60/// <p>The grantee is resolved to the <code>CanonicalUser</code> and, in a response to a <code>GETObjectAcl</code> request, appears as the CanonicalUser.</p></li>
61/// <li>
62/// <p>By URI:</p>
63/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
64/// <uri>
65/// <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<>
66/// </uri>
67/// </grantee></code></p></li>
68/// </ul>
69/// </dd>
70/// </dl>
71/// <p>To enable logging, you use <code>LoggingEnabled</code> and its children request elements. To disable logging, you use an empty <code>BucketLoggingStatus</code> request element:</p>
72/// <p><code><bucketloggingstatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" /></code></p>
73/// <p>For more information about server access logging, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html">Server Access Logging</a> in the <i>Amazon S3 User Guide</i>.</p>
74/// <p>For more information about creating a bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html">CreateBucket</a>. For more information about returning the logging status of a bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLogging.html">GetBucketLogging</a>.</p>
75/// <p>The following operations are related to <code>PutBucketLogging</code>:</p>
76/// <ul>
77/// <li>
78/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a></p></li>
79/// <li>
80/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html">DeleteBucket</a></p></li>
81/// <li>
82/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html">CreateBucket</a></p></li>
83/// <li>
84/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLogging.html">GetBucketLogging</a></p></li>
85/// </ul><important>
86/// <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>
87/// </important>
88#[derive(::std::clone::Clone, ::std::fmt::Debug)]
89pub struct PutBucketLoggingFluentBuilder {
90 handle: ::std::sync::Arc<crate::client::Handle>,
91 inner: crate::operation::put_bucket_logging::builders::PutBucketLoggingInputBuilder,
92 config_override: ::std::option::Option<crate::config::Builder>,
93}
94impl
95 crate::client::customize::internal::CustomizableSend<
96 crate::operation::put_bucket_logging::PutBucketLoggingOutput,
97 crate::operation::put_bucket_logging::PutBucketLoggingError,
98 > for PutBucketLoggingFluentBuilder
99{
100 fn send(
101 self,
102 config_override: crate::config::Builder,
103 ) -> crate::client::customize::internal::BoxFuture<
104 crate::client::customize::internal::SendResult<
105 crate::operation::put_bucket_logging::PutBucketLoggingOutput,
106 crate::operation::put_bucket_logging::PutBucketLoggingError,
107 >,
108 > {
109 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
110 }
111}
112impl PutBucketLoggingFluentBuilder {
113 /// Creates a new `PutBucketLoggingFluentBuilder`.
114 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
115 Self {
116 handle,
117 inner: ::std::default::Default::default(),
118 config_override: ::std::option::Option::None,
119 }
120 }
121 /// Access the PutBucketLogging as a reference.
122 pub fn as_input(&self) -> &crate::operation::put_bucket_logging::builders::PutBucketLoggingInputBuilder {
123 &self.inner
124 }
125 /// Sends the request and returns the response.
126 ///
127 /// If an error occurs, an `SdkError` will be returned with additional details that
128 /// can be matched against.
129 ///
130 /// By default, any retryable failures will be retried twice. Retry behavior
131 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
132 /// set when configuring the client.
133 pub async fn send(
134 self,
135 ) -> ::std::result::Result<
136 crate::operation::put_bucket_logging::PutBucketLoggingOutput,
137 ::aws_smithy_runtime_api::client::result::SdkError<
138 crate::operation::put_bucket_logging::PutBucketLoggingError,
139 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
140 >,
141 > {
142 let input = self
143 .inner
144 .build()
145 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
146 let runtime_plugins = crate::operation::put_bucket_logging::PutBucketLogging::operation_runtime_plugins(
147 self.handle.runtime_plugins.clone(),
148 &self.handle.conf,
149 self.config_override,
150 );
151 crate::operation::put_bucket_logging::PutBucketLogging::orchestrate(&runtime_plugins, input).await
152 }
153
154 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
155 pub fn customize(
156 self,
157 ) -> crate::client::customize::CustomizableOperation<
158 crate::operation::put_bucket_logging::PutBucketLoggingOutput,
159 crate::operation::put_bucket_logging::PutBucketLoggingError,
160 Self,
161 > {
162 crate::client::customize::CustomizableOperation::new(self)
163 }
164 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
165 self.set_config_override(::std::option::Option::Some(config_override.into()));
166 self
167 }
168
169 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
170 self.config_override = config_override;
171 self
172 }
173 /// <p>The name of the bucket for which to set the logging parameters.</p>
174 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.bucket(input.into());
176 self
177 }
178 /// <p>The name of the bucket for which to set the logging parameters.</p>
179 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180 self.inner = self.inner.set_bucket(input);
181 self
182 }
183 /// <p>The name of the bucket for which to set the logging parameters.</p>
184 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
185 self.inner.get_bucket()
186 }
187 /// <p>Container for logging status information.</p>
188 pub fn bucket_logging_status(mut self, input: crate::types::BucketLoggingStatus) -> Self {
189 self.inner = self.inner.bucket_logging_status(input);
190 self
191 }
192 /// <p>Container for logging status information.</p>
193 pub fn set_bucket_logging_status(mut self, input: ::std::option::Option<crate::types::BucketLoggingStatus>) -> Self {
194 self.inner = self.inner.set_bucket_logging_status(input);
195 self
196 }
197 /// <p>Container for logging status information.</p>
198 pub fn get_bucket_logging_status(&self) -> &::std::option::Option<crate::types::BucketLoggingStatus> {
199 self.inner.get_bucket_logging_status()
200 }
201 /// <p>The MD5 hash of the <code>PutBucketLogging</code> request body.</p>
202 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
203 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
204 self.inner = self.inner.content_md5(input.into());
205 self
206 }
207 /// <p>The MD5 hash of the <code>PutBucketLogging</code> request body.</p>
208 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
209 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210 self.inner = self.inner.set_content_md5(input);
211 self
212 }
213 /// <p>The MD5 hash of the <code>PutBucketLogging</code> request body.</p>
214 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
215 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
216 self.inner.get_content_md5()
217 }
218 /// <p>Indicates the algorithm used to create the checksum for the request when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
219 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
220 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
221 self.inner = self.inner.checksum_algorithm(input);
222 self
223 }
224 /// <p>Indicates the algorithm used to create the checksum for the request when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
225 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
226 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
227 self.inner = self.inner.set_checksum_algorithm(input);
228 self
229 }
230 /// <p>Indicates the algorithm used to create the checksum for the request when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
231 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
232 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
233 self.inner.get_checksum_algorithm()
234 }
235 /// <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>
236 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
237 self.inner = self.inner.expected_bucket_owner(input.into());
238 self
239 }
240 /// <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>
241 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
242 self.inner = self.inner.set_expected_bucket_owner(input);
243 self
244 }
245 /// <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>
246 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
247 self.inner.get_expected_bucket_owner()
248 }
249}