aws_sdk_s3/operation/put_bucket_analytics_configuration/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_analytics_configuration::_put_bucket_analytics_configuration_output::PutBucketAnalyticsConfigurationOutputBuilder;
3
4pub use crate::operation::put_bucket_analytics_configuration::_put_bucket_analytics_configuration_input::PutBucketAnalyticsConfigurationInputBuilder;
5
6impl crate::operation::put_bucket_analytics_configuration::builders::PutBucketAnalyticsConfigurationInputBuilder {
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_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_bucket_analytics_configuration();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutBucketAnalyticsConfiguration`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Sets an analytics configuration for the bucket (specified by the analytics configuration ID). You can have up to 1,000 analytics configurations per bucket.</p>
29/// <p>You can choose to have storage class analysis export analysis reports sent to a comma-separated values (CSV) flat file. See the <code>DataExport</code> request element. Reports are updated daily and are based on the object filters that you configure. When selecting data export, you specify a destination bucket and an optional destination prefix where the file is written. You can export the data to a destination bucket in a different account. However, the destination bucket must be in the same Region as the bucket that you are making the PUT analytics configuration to. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html">Amazon S3 Analytics – Storage Class Analysis</a>.</p><important>
30/// <p>You must create a bucket policy on the destination bucket where the exported file is written to grant permissions to Amazon S3 to write objects to the bucket. For an example policy, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-9">Granting Permissions for Amazon S3 Inventory and Storage Class Analysis</a>.</p>
31/// </important>
32/// <p>To use this operation, you must have permissions to perform the <code>s3:PutAnalyticsConfiguration</code> action. The bucket owner has this permission by default. The bucket owner can grant this permission to others. For more information about permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources">Permissions Related to Bucket Subresource Operations</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html">Managing Access Permissions to Your Amazon S3 Resources</a>.</p>
33/// <p><code>PutBucketAnalyticsConfiguration</code> has the following special errors:</p>
34/// <ul>
35/// <li>
36/// <ul>
37/// <li>
38/// <p><i>HTTP Error: HTTP 400 Bad Request</i></p></li>
39/// <li>
40/// <p><i>Code: InvalidArgument</i></p></li>
41/// <li>
42/// <p><i>Cause: Invalid argument.</i></p></li>
43/// </ul></li>
44/// <li>
45/// <ul>
46/// <li>
47/// <p><i>HTTP Error: HTTP 400 Bad Request</i></p></li>
48/// <li>
49/// <p><i>Code: TooManyConfigurations</i></p></li>
50/// <li>
51/// <p><i>Cause: You are attempting to create a new configuration but have already reached the 1,000-configuration limit.</i></p></li>
52/// </ul></li>
53/// <li>
54/// <ul>
55/// <li>
56/// <p><i>HTTP Error: HTTP 403 Forbidden</i></p></li>
57/// <li>
58/// <p><i>Code: AccessDenied</i></p></li>
59/// <li>
60/// <p><i>Cause: You are not the owner of the specified bucket, or you do not have the s3:PutAnalyticsConfiguration bucket permission to set the configuration on the bucket.</i></p></li>
61/// </ul></li>
62/// </ul>
63/// <p>The following operations are related to <code>PutBucketAnalyticsConfiguration</code>:</p>
64/// <ul>
65/// <li>
66/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketAnalyticsConfiguration.html">GetBucketAnalyticsConfiguration</a></p></li>
67/// <li>
68/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketAnalyticsConfiguration.html">DeleteBucketAnalyticsConfiguration</a></p></li>
69/// <li>
70/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketAnalyticsConfigurations.html">ListBucketAnalyticsConfigurations</a></p></li>
71/// </ul>
72#[derive(::std::clone::Clone, ::std::fmt::Debug)]
73pub struct PutBucketAnalyticsConfigurationFluentBuilder {
74 handle: ::std::sync::Arc<crate::client::Handle>,
75 inner: crate::operation::put_bucket_analytics_configuration::builders::PutBucketAnalyticsConfigurationInputBuilder,
76 config_override: ::std::option::Option<crate::config::Builder>,
77}
78impl
79 crate::client::customize::internal::CustomizableSend<
80 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
81 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
82 > for PutBucketAnalyticsConfigurationFluentBuilder
83{
84 fn send(
85 self,
86 config_override: crate::config::Builder,
87 ) -> crate::client::customize::internal::BoxFuture<
88 crate::client::customize::internal::SendResult<
89 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
90 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
91 >,
92 > {
93 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
94 }
95}
96impl PutBucketAnalyticsConfigurationFluentBuilder {
97 /// Creates a new `PutBucketAnalyticsConfigurationFluentBuilder`.
98 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
99 Self {
100 handle,
101 inner: ::std::default::Default::default(),
102 config_override: ::std::option::Option::None,
103 }
104 }
105 /// Access the PutBucketAnalyticsConfiguration as a reference.
106 pub fn as_input(&self) -> &crate::operation::put_bucket_analytics_configuration::builders::PutBucketAnalyticsConfigurationInputBuilder {
107 &self.inner
108 }
109 /// Sends the request and returns the response.
110 ///
111 /// If an error occurs, an `SdkError` will be returned with additional details that
112 /// can be matched against.
113 ///
114 /// By default, any retryable failures will be retried twice. Retry behavior
115 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
116 /// set when configuring the client.
117 pub async fn send(
118 self,
119 ) -> ::std::result::Result<
120 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
121 ::aws_smithy_runtime_api::client::result::SdkError<
122 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
123 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
124 >,
125 > {
126 let input = self
127 .inner
128 .build()
129 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
130 let runtime_plugins = crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfiguration::operation_runtime_plugins(
131 self.handle.runtime_plugins.clone(),
132 &self.handle.conf,
133 self.config_override,
134 );
135 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfiguration::orchestrate(&runtime_plugins, input).await
136 }
137
138 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
139 pub fn customize(
140 self,
141 ) -> crate::client::customize::CustomizableOperation<
142 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
143 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
144 Self,
145 > {
146 crate::client::customize::CustomizableOperation::new(self)
147 }
148 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
149 self.set_config_override(::std::option::Option::Some(config_override.into()));
150 self
151 }
152
153 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
154 self.config_override = config_override;
155 self
156 }
157 /// <p>The name of the bucket to which an analytics configuration is stored.</p>
158 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159 self.inner = self.inner.bucket(input.into());
160 self
161 }
162 /// <p>The name of the bucket to which an analytics configuration is stored.</p>
163 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164 self.inner = self.inner.set_bucket(input);
165 self
166 }
167 /// <p>The name of the bucket to which an analytics configuration is stored.</p>
168 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
169 self.inner.get_bucket()
170 }
171 /// <p>The ID that identifies the analytics configuration.</p>
172 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
173 self.inner = self.inner.id(input.into());
174 self
175 }
176 /// <p>The ID that identifies the analytics configuration.</p>
177 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
178 self.inner = self.inner.set_id(input);
179 self
180 }
181 /// <p>The ID that identifies the analytics configuration.</p>
182 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
183 self.inner.get_id()
184 }
185 /// <p>The configuration and any analyses for the analytics filter.</p>
186 pub fn analytics_configuration(mut self, input: crate::types::AnalyticsConfiguration) -> Self {
187 self.inner = self.inner.analytics_configuration(input);
188 self
189 }
190 /// <p>The configuration and any analyses for the analytics filter.</p>
191 pub fn set_analytics_configuration(mut self, input: ::std::option::Option<crate::types::AnalyticsConfiguration>) -> Self {
192 self.inner = self.inner.set_analytics_configuration(input);
193 self
194 }
195 /// <p>The configuration and any analyses for the analytics filter.</p>
196 pub fn get_analytics_configuration(&self) -> &::std::option::Option<crate::types::AnalyticsConfiguration> {
197 self.inner.get_analytics_configuration()
198 }
199 /// <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>
200 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201 self.inner = self.inner.expected_bucket_owner(input.into());
202 self
203 }
204 /// <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>
205 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
206 self.inner = self.inner.set_expected_bucket_owner(input);
207 self
208 }
209 /// <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>
210 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
211 self.inner.get_expected_bucket_owner()
212 }
213}