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><important>
72/// <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>
73/// </important>
74#[derive(::std::clone::Clone, ::std::fmt::Debug)]
75pub struct PutBucketAnalyticsConfigurationFluentBuilder {
76 handle: ::std::sync::Arc<crate::client::Handle>,
77 inner: crate::operation::put_bucket_analytics_configuration::builders::PutBucketAnalyticsConfigurationInputBuilder,
78 config_override: ::std::option::Option<crate::config::Builder>,
79}
80impl
81 crate::client::customize::internal::CustomizableSend<
82 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
83 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
84 > for PutBucketAnalyticsConfigurationFluentBuilder
85{
86 fn send(
87 self,
88 config_override: crate::config::Builder,
89 ) -> crate::client::customize::internal::BoxFuture<
90 crate::client::customize::internal::SendResult<
91 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
92 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
93 >,
94 > {
95 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
96 }
97}
98impl PutBucketAnalyticsConfigurationFluentBuilder {
99 /// Creates a new `PutBucketAnalyticsConfigurationFluentBuilder`.
100 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
101 Self {
102 handle,
103 inner: ::std::default::Default::default(),
104 config_override: ::std::option::Option::None,
105 }
106 }
107 /// Access the PutBucketAnalyticsConfiguration as a reference.
108 pub fn as_input(&self) -> &crate::operation::put_bucket_analytics_configuration::builders::PutBucketAnalyticsConfigurationInputBuilder {
109 &self.inner
110 }
111 /// Sends the request and returns the response.
112 ///
113 /// If an error occurs, an `SdkError` will be returned with additional details that
114 /// can be matched against.
115 ///
116 /// By default, any retryable failures will be retried twice. Retry behavior
117 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
118 /// set when configuring the client.
119 pub async fn send(
120 self,
121 ) -> ::std::result::Result<
122 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
123 ::aws_smithy_runtime_api::client::result::SdkError<
124 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
125 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
126 >,
127 > {
128 let input = self
129 .inner
130 .build()
131 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
132 let runtime_plugins = crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfiguration::operation_runtime_plugins(
133 self.handle.runtime_plugins.clone(),
134 &self.handle.conf,
135 self.config_override,
136 );
137 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfiguration::orchestrate(&runtime_plugins, input).await
138 }
139
140 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
141 pub fn customize(
142 self,
143 ) -> crate::client::customize::CustomizableOperation<
144 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationOutput,
145 crate::operation::put_bucket_analytics_configuration::PutBucketAnalyticsConfigurationError,
146 Self,
147 > {
148 crate::client::customize::CustomizableOperation::new(self)
149 }
150 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
151 self.set_config_override(::std::option::Option::Some(config_override.into()));
152 self
153 }
154
155 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
156 self.config_override = config_override;
157 self
158 }
159 /// <p>The name of the bucket to which an analytics configuration is stored.</p>
160 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.bucket(input.into());
162 self
163 }
164 /// <p>The name of the bucket to which an analytics configuration is stored.</p>
165 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_bucket(input);
167 self
168 }
169 /// <p>The name of the bucket to which an analytics configuration is stored.</p>
170 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_bucket()
172 }
173 /// <p>The ID that identifies the analytics configuration.</p>
174 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.id(input.into());
176 self
177 }
178 /// <p>The ID that identifies the analytics configuration.</p>
179 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180 self.inner = self.inner.set_id(input);
181 self
182 }
183 /// <p>The ID that identifies the analytics configuration.</p>
184 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
185 self.inner.get_id()
186 }
187 /// <p>The configuration and any analyses for the analytics filter.</p>
188 pub fn analytics_configuration(mut self, input: crate::types::AnalyticsConfiguration) -> Self {
189 self.inner = self.inner.analytics_configuration(input);
190 self
191 }
192 /// <p>The configuration and any analyses for the analytics filter.</p>
193 pub fn set_analytics_configuration(mut self, input: ::std::option::Option<crate::types::AnalyticsConfiguration>) -> Self {
194 self.inner = self.inner.set_analytics_configuration(input);
195 self
196 }
197 /// <p>The configuration and any analyses for the analytics filter.</p>
198 pub fn get_analytics_configuration(&self) -> &::std::option::Option<crate::types::AnalyticsConfiguration> {
199 self.inner.get_analytics_configuration()
200 }
201 /// <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>
202 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
203 self.inner = self.inner.expected_bucket_owner(input.into());
204 self
205 }
206 /// <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>
207 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
208 self.inner = self.inner.set_expected_bucket_owner(input);
209 self
210 }
211 /// <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>
212 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
213 self.inner.get_expected_bucket_owner()
214 }
215}