1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_metrics_configuration::_put_bucket_metrics_configuration_output::PutBucketMetricsConfigurationOutputBuilder;
34pub use crate::operation::put_bucket_metrics_configuration::_put_bucket_metrics_configuration_input::PutBucketMetricsConfigurationInputBuilder;
56impl crate::operation::put_bucket_metrics_configuration::builders::PutBucketMetricsConfigurationInputBuilder {
7/// Sends a request with this input using the given client.
8pub async fn send_with(
9self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18let mut fluent_builder = client.put_bucket_metrics_configuration();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21}
22}
23/// Fluent builder constructing a request to `PutBucketMetricsConfiguration`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Sets a metrics configuration (specified by the metrics configuration ID) for the bucket. You can have up to 1,000 metrics configurations per bucket. If you're updating an existing metrics configuration, note that this is a full replacement of the existing metrics configuration. If you don't include the elements you want to keep, they are erased.</p>
29/// <p>To use this operation, you must have permissions to perform the <code>s3:PutMetricsConfiguration</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>
30/// <p>For information about CloudWatch request metrics for Amazon S3, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html">Monitoring Metrics with Amazon CloudWatch</a>.</p>
31/// <p>The following operations are related to <code>PutBucketMetricsConfiguration</code>:</p>
32/// <ul>
33/// <li>
34/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetricsConfiguration.html">DeleteBucketMetricsConfiguration</a></p></li>
35/// <li>
36/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketMetricsConfiguration.html">GetBucketMetricsConfiguration</a></p></li>
37/// <li>
38/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketMetricsConfigurations.html">ListBucketMetricsConfigurations</a></p></li>
39/// </ul>
40/// <p><code>PutBucketMetricsConfiguration</code> has the following special error:</p>
41/// <ul>
42/// <li>
43/// <p>Error code: <code>TooManyConfigurations</code></p>
44/// <ul>
45/// <li>
46/// <p>Description: You are attempting to create a new configuration but have already reached the 1,000-configuration limit.</p></li>
47/// <li>
48/// <p>HTTP Status Code: HTTP 400 Bad Request</p></li>
49/// </ul></li>
50/// </ul>
51#[derive(::std::clone::Clone, ::std::fmt::Debug)]
52pub struct PutBucketMetricsConfigurationFluentBuilder {
53 handle: ::std::sync::Arc<crate::client::Handle>,
54 inner: crate::operation::put_bucket_metrics_configuration::builders::PutBucketMetricsConfigurationInputBuilder,
55 config_override: ::std::option::Option<crate::config::Builder>,
56}
57impl
58crate::client::customize::internal::CustomizableSend<
59crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationOutput,
60crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationError,
61 > for PutBucketMetricsConfigurationFluentBuilder
62{
63fn send(
64self,
65 config_override: crate::config::Builder,
66 ) -> crate::client::customize::internal::BoxFuture<
67crate::client::customize::internal::SendResult<
68crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationOutput,
69crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationError,
70 >,
71 > {
72 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
73 }
74}
75impl PutBucketMetricsConfigurationFluentBuilder {
76/// Creates a new `PutBucketMetricsConfigurationFluentBuilder`.
77pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
78Self {
79 handle,
80 inner: ::std::default::Default::default(),
81 config_override: ::std::option::Option::None,
82 }
83 }
84/// Access the PutBucketMetricsConfiguration as a reference.
85pub fn as_input(&self) -> &crate::operation::put_bucket_metrics_configuration::builders::PutBucketMetricsConfigurationInputBuilder {
86&self.inner
87 }
88/// Sends the request and returns the response.
89 ///
90 /// If an error occurs, an `SdkError` will be returned with additional details that
91 /// can be matched against.
92 ///
93 /// By default, any retryable failures will be retried twice. Retry behavior
94 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
95 /// set when configuring the client.
96pub async fn send(
97self,
98 ) -> ::std::result::Result<
99crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationOutput,
100 ::aws_smithy_runtime_api::client::result::SdkError<
101crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationError,
102 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
103 >,
104 > {
105let input = self
106.inner
107 .build()
108 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
109let runtime_plugins = crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfiguration::operation_runtime_plugins(
110self.handle.runtime_plugins.clone(),
111&self.handle.conf,
112self.config_override,
113 );
114crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfiguration::orchestrate(&runtime_plugins, input).await
115}
116117/// Consumes this builder, creating a customizable operation that can be modified before being sent.
118pub fn customize(
119self,
120 ) -> crate::client::customize::CustomizableOperation<
121crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationOutput,
122crate::operation::put_bucket_metrics_configuration::PutBucketMetricsConfigurationError,
123Self,
124 > {
125crate::client::customize::CustomizableOperation::new(self)
126 }
127pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
128self.set_config_override(::std::option::Option::Some(config_override.into()));
129self
130}
131132pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
133self.config_override = config_override;
134self
135}
136/// <p>The name of the bucket for which the metrics configuration is set.</p>
137pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138self.inner = self.inner.bucket(input.into());
139self
140}
141/// <p>The name of the bucket for which the metrics configuration is set.</p>
142pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143self.inner = self.inner.set_bucket(input);
144self
145}
146/// <p>The name of the bucket for which the metrics configuration is set.</p>
147pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
148self.inner.get_bucket()
149 }
150/// <p>The ID used to identify the metrics configuration. The ID has a 64 character limit and can only contain letters, numbers, periods, dashes, and underscores.</p>
151pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152self.inner = self.inner.id(input.into());
153self
154}
155/// <p>The ID used to identify the metrics configuration. The ID has a 64 character limit and can only contain letters, numbers, periods, dashes, and underscores.</p>
156pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157self.inner = self.inner.set_id(input);
158self
159}
160/// <p>The ID used to identify the metrics configuration. The ID has a 64 character limit and can only contain letters, numbers, periods, dashes, and underscores.</p>
161pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
162self.inner.get_id()
163 }
164/// <p>Specifies the metrics configuration.</p>
165pub fn metrics_configuration(mut self, input: crate::types::MetricsConfiguration) -> Self {
166self.inner = self.inner.metrics_configuration(input);
167self
168}
169/// <p>Specifies the metrics configuration.</p>
170pub fn set_metrics_configuration(mut self, input: ::std::option::Option<crate::types::MetricsConfiguration>) -> Self {
171self.inner = self.inner.set_metrics_configuration(input);
172self
173}
174/// <p>Specifies the metrics configuration.</p>
175pub fn get_metrics_configuration(&self) -> &::std::option::Option<crate::types::MetricsConfiguration> {
176self.inner.get_metrics_configuration()
177 }
178/// <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>
179pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180self.inner = self.inner.expected_bucket_owner(input.into());
181self
182}
183/// <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>
184pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
185self.inner = self.inner.set_expected_bucket_owner(input);
186self
187}
188/// <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>
189pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
190self.inner.get_expected_bucket_owner()
191 }
192}