aws_sdk_s3/operation/get_bucket_metrics_configuration/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_bucket_metrics_configuration::_get_bucket_metrics_configuration_output::GetBucketMetricsConfigurationOutputBuilder;
3
4pub use crate::operation::get_bucket_metrics_configuration::_get_bucket_metrics_configuration_input::GetBucketMetricsConfigurationInputBuilder;
5
6impl crate::operation::get_bucket_metrics_configuration::builders::GetBucketMetricsConfigurationInputBuilder {
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::get_bucket_metrics_configuration::GetBucketMetricsConfigurationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_bucket_metrics_configuration();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetBucketMetricsConfiguration`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Gets a metrics configuration (specified by the metrics configuration ID) from the bucket. Note that this doesn't include the daily storage metrics.</p>
29/// <p>To use this operation, you must have permissions to perform the <code>s3:GetMetricsConfiguration</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>GetBucketMetricsConfiguration</code>:</p>
32/// <ul>
33/// <li>
34/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketMetricsConfiguration.html">PutBucketMetricsConfiguration</a></p></li>
35/// <li>
36/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetricsConfiguration.html">DeleteBucketMetricsConfiguration</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/// <li>
40/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html">Monitoring Metrics with Amazon CloudWatch</a></p></li>
41/// </ul><important>
42/// <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>
43/// </important>
44#[derive(::std::clone::Clone, ::std::fmt::Debug)]
45pub struct GetBucketMetricsConfigurationFluentBuilder {
46    handle: ::std::sync::Arc<crate::client::Handle>,
47    inner: crate::operation::get_bucket_metrics_configuration::builders::GetBucketMetricsConfigurationInputBuilder,
48    config_override: ::std::option::Option<crate::config::Builder>,
49}
50impl
51    crate::client::customize::internal::CustomizableSend<
52        crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationOutput,
53        crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationError,
54    > for GetBucketMetricsConfigurationFluentBuilder
55{
56    fn send(
57        self,
58        config_override: crate::config::Builder,
59    ) -> crate::client::customize::internal::BoxFuture<
60        crate::client::customize::internal::SendResult<
61            crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationOutput,
62            crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationError,
63        >,
64    > {
65        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
66    }
67}
68impl GetBucketMetricsConfigurationFluentBuilder {
69    /// Creates a new `GetBucketMetricsConfigurationFluentBuilder`.
70    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
71        Self {
72            handle,
73            inner: ::std::default::Default::default(),
74            config_override: ::std::option::Option::None,
75        }
76    }
77    /// Access the GetBucketMetricsConfiguration as a reference.
78    pub fn as_input(&self) -> &crate::operation::get_bucket_metrics_configuration::builders::GetBucketMetricsConfigurationInputBuilder {
79        &self.inner
80    }
81    /// Sends the request and returns the response.
82    ///
83    /// If an error occurs, an `SdkError` will be returned with additional details that
84    /// can be matched against.
85    ///
86    /// By default, any retryable failures will be retried twice. Retry behavior
87    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
88    /// set when configuring the client.
89    pub async fn send(
90        self,
91    ) -> ::std::result::Result<
92        crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationOutput,
93        ::aws_smithy_runtime_api::client::result::SdkError<
94            crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationError,
95            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
96        >,
97    > {
98        let input = self
99            .inner
100            .build()
101            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
102        let runtime_plugins = crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfiguration::operation_runtime_plugins(
103            self.handle.runtime_plugins.clone(),
104            &self.handle.conf,
105            self.config_override,
106        );
107        crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfiguration::orchestrate(&runtime_plugins, input).await
108    }
109
110    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
111    pub fn customize(
112        self,
113    ) -> crate::client::customize::CustomizableOperation<
114        crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationOutput,
115        crate::operation::get_bucket_metrics_configuration::GetBucketMetricsConfigurationError,
116        Self,
117    > {
118        crate::client::customize::CustomizableOperation::new(self)
119    }
120    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
121        self.set_config_override(::std::option::Option::Some(config_override.into()));
122        self
123    }
124
125    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
126        self.config_override = config_override;
127        self
128    }
129    /// <p>The name of the bucket containing the metrics configuration to retrieve.</p>
130    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.bucket(input.into());
132        self
133    }
134    /// <p>The name of the bucket containing the metrics configuration to retrieve.</p>
135    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_bucket(input);
137        self
138    }
139    /// <p>The name of the bucket containing the metrics configuration to retrieve.</p>
140    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_bucket()
142    }
143    /// <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>
144    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.id(input.into());
146        self
147    }
148    /// <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>
149    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_id(input);
151        self
152    }
153    /// <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>
154    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_id()
156    }
157    /// <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>
158    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159        self.inner = self.inner.expected_bucket_owner(input.into());
160        self
161    }
162    /// <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>
163    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164        self.inner = self.inner.set_expected_bucket_owner(input);
165        self
166    }
167    /// <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>
168    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
169        self.inner.get_expected_bucket_owner()
170    }
171}