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/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <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>
29/// <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>
30/// <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>
31/// </important>
32/// <dl>
33/// <dt>
34/// Grantee Values
35/// </dt>
36/// <dd>
37/// <p>You can specify the person (grantee) to whom you're assigning access rights (by using request elements) in the following ways:</p>
38/// <ul>
39/// <li>
40/// <p>By the person's ID:</p>
41/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
42/// <id>
43/// &lt;&gt;ID&lt;&gt;
44/// </id>
45/// <displayname>
46/// &lt;&gt;GranteesEmail&lt;&gt;
47/// </displayname>
48/// </grantee></code></p>
49/// <p><code>DisplayName</code> is optional and ignored in the request.</p></li>
50/// <li>
51/// <p>By Email address:</p>
52/// <p><code> <grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail">
53/// <emailaddress>
54/// &lt;&gt;Grantees@email.com&lt;&gt;
55/// </emailaddress>
56/// </grantee></code></p>
57/// <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>
58/// <li>
59/// <p>By URI:</p>
60/// <p><code><grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
61/// <uri>
62/// &lt;&gt;http://acs.amazonaws.com/groups/global/AuthenticatedUsers&lt;&gt;
63/// </uri>
64/// </grantee></code></p></li>
65/// </ul>
66/// </dd>
67/// </dl>
68/// <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>
69/// <p><code><bucketloggingstatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" /></code></p>
70/// <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>
71/// <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>
72/// <p>The following operations are related to <code>PutBucketLogging</code>:</p>
73/// <ul>
74/// <li>
75/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a></p></li>
76/// <li>
77/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html">DeleteBucket</a></p></li>
78/// <li>
79/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html">CreateBucket</a></p></li>
80/// <li>
81/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLogging.html">GetBucketLogging</a></p></li>
82/// </ul>
83#[derive(::std::clone::Clone, ::std::fmt::Debug)]
84pub struct PutBucketLoggingFluentBuilder {
85    handle: ::std::sync::Arc<crate::client::Handle>,
86    inner: crate::operation::put_bucket_logging::builders::PutBucketLoggingInputBuilder,
87    config_override: ::std::option::Option<crate::config::Builder>,
88}
89impl
90    crate::client::customize::internal::CustomizableSend<
91        crate::operation::put_bucket_logging::PutBucketLoggingOutput,
92        crate::operation::put_bucket_logging::PutBucketLoggingError,
93    > for PutBucketLoggingFluentBuilder
94{
95    fn send(
96        self,
97        config_override: crate::config::Builder,
98    ) -> crate::client::customize::internal::BoxFuture<
99        crate::client::customize::internal::SendResult<
100            crate::operation::put_bucket_logging::PutBucketLoggingOutput,
101            crate::operation::put_bucket_logging::PutBucketLoggingError,
102        >,
103    > {
104        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
105    }
106}
107impl PutBucketLoggingFluentBuilder {
108    /// Creates a new `PutBucketLoggingFluentBuilder`.
109    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
110        Self {
111            handle,
112            inner: ::std::default::Default::default(),
113            config_override: ::std::option::Option::None,
114        }
115    }
116    /// Access the PutBucketLogging as a reference.
117    pub fn as_input(&self) -> &crate::operation::put_bucket_logging::builders::PutBucketLoggingInputBuilder {
118        &self.inner
119    }
120    /// Sends the request and returns the response.
121    ///
122    /// If an error occurs, an `SdkError` will be returned with additional details that
123    /// can be matched against.
124    ///
125    /// By default, any retryable failures will be retried twice. Retry behavior
126    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
127    /// set when configuring the client.
128    pub async fn send(
129        self,
130    ) -> ::std::result::Result<
131        crate::operation::put_bucket_logging::PutBucketLoggingOutput,
132        ::aws_smithy_runtime_api::client::result::SdkError<
133            crate::operation::put_bucket_logging::PutBucketLoggingError,
134            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
135        >,
136    > {
137        let input = self
138            .inner
139            .build()
140            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
141        let runtime_plugins = crate::operation::put_bucket_logging::PutBucketLogging::operation_runtime_plugins(
142            self.handle.runtime_plugins.clone(),
143            &self.handle.conf,
144            self.config_override,
145        );
146        crate::operation::put_bucket_logging::PutBucketLogging::orchestrate(&runtime_plugins, input).await
147    }
148
149    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
150    pub fn customize(
151        self,
152    ) -> crate::client::customize::CustomizableOperation<
153        crate::operation::put_bucket_logging::PutBucketLoggingOutput,
154        crate::operation::put_bucket_logging::PutBucketLoggingError,
155        Self,
156    > {
157        crate::client::customize::CustomizableOperation::new(self)
158    }
159    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
160        self.set_config_override(::std::option::Option::Some(config_override.into()));
161        self
162    }
163
164    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
165        self.config_override = config_override;
166        self
167    }
168    /// <p>The name of the bucket for which to set the logging parameters.</p>
169    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170        self.inner = self.inner.bucket(input.into());
171        self
172    }
173    /// <p>The name of the bucket for which to set the logging parameters.</p>
174    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.inner = self.inner.set_bucket(input);
176        self
177    }
178    /// <p>The name of the bucket for which to set the logging parameters.</p>
179    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
180        self.inner.get_bucket()
181    }
182    /// <p>Container for logging status information.</p>
183    pub fn bucket_logging_status(mut self, input: crate::types::BucketLoggingStatus) -> Self {
184        self.inner = self.inner.bucket_logging_status(input);
185        self
186    }
187    /// <p>Container for logging status information.</p>
188    pub fn set_bucket_logging_status(mut self, input: ::std::option::Option<crate::types::BucketLoggingStatus>) -> Self {
189        self.inner = self.inner.set_bucket_logging_status(input);
190        self
191    }
192    /// <p>Container for logging status information.</p>
193    pub fn get_bucket_logging_status(&self) -> &::std::option::Option<crate::types::BucketLoggingStatus> {
194        self.inner.get_bucket_logging_status()
195    }
196    /// <p>The MD5 hash of the <code>PutBucketLogging</code> request body.</p>
197    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
198    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199        self.inner = self.inner.content_md5(input.into());
200        self
201    }
202    /// <p>The MD5 hash of the <code>PutBucketLogging</code> request body.</p>
203    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
204    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
205        self.inner = self.inner.set_content_md5(input);
206        self
207    }
208    /// <p>The MD5 hash of the <code>PutBucketLogging</code> request body.</p>
209    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
210    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
211        self.inner.get_content_md5()
212    }
213    /// <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>
214    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
215    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
216        self.inner = self.inner.checksum_algorithm(input);
217        self
218    }
219    /// <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>
220    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
221    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
222        self.inner = self.inner.set_checksum_algorithm(input);
223        self
224    }
225    /// <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>
226    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
227    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
228        self.inner.get_checksum_algorithm()
229    }
230    /// <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>
231    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232        self.inner = self.inner.expected_bucket_owner(input.into());
233        self
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 set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
237        self.inner = self.inner.set_expected_bucket_owner(input);
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 get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
242        self.inner.get_expected_bucket_owner()
243    }
244}