aws_sdk_computeoptimizer/operation/get_ec2_recommendation_projected_metrics/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_ec2_recommendation_projected_metrics::_get_ec2_recommendation_projected_metrics_output::GetEc2RecommendationProjectedMetricsOutputBuilder;
3
4pub use crate::operation::get_ec2_recommendation_projected_metrics::_get_ec2_recommendation_projected_metrics_input::GetEc2RecommendationProjectedMetricsInputBuilder;
5
6impl crate::operation::get_ec2_recommendation_projected_metrics::builders::GetEc2RecommendationProjectedMetricsInputBuilder {
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_ec2_recommendation_projected_metrics::GetEc2RecommendationProjectedMetricsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetricsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_ec2_recommendation_projected_metrics();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetEC2RecommendationProjectedMetrics`.
24///
25/// <p>Returns the projected utilization metrics of Amazon EC2 instance recommendations.</p><note>
26/// <p>The <code>Cpu</code> and <code>Memory</code> metrics are the only projected utilization metrics returned when you run this action. Additionally, the <code>Memory</code> metric is returned only for resources that have the unified CloudWatch agent installed on them. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html#cw-agent">Enabling Memory Utilization with the CloudWatch Agent</a>.</p>
27/// </note>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct GetEC2RecommendationProjectedMetricsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::get_ec2_recommendation_projected_metrics::builders::GetEc2RecommendationProjectedMetricsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::get_ec2_recommendation_projected_metrics::GetEc2RecommendationProjectedMetricsOutput,
37        crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetricsError,
38    > for GetEC2RecommendationProjectedMetricsFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::get_ec2_recommendation_projected_metrics::GetEc2RecommendationProjectedMetricsOutput,
46            crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetricsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl GetEC2RecommendationProjectedMetricsFluentBuilder {
53    /// Creates a new `GetEC2RecommendationProjectedMetricsFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the GetEC2RecommendationProjectedMetrics as a reference.
62    pub fn as_input(
63        &self,
64    ) -> &crate::operation::get_ec2_recommendation_projected_metrics::builders::GetEc2RecommendationProjectedMetricsInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::get_ec2_recommendation_projected_metrics::GetEc2RecommendationProjectedMetricsOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetricsError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins =
89            crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetrics::operation_runtime_plugins(
90                self.handle.runtime_plugins.clone(),
91                &self.handle.conf,
92                self.config_override,
93            );
94        crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetrics::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::get_ec2_recommendation_projected_metrics::GetEc2RecommendationProjectedMetricsOutput,
102        crate::operation::get_ec2_recommendation_projected_metrics::GetEC2RecommendationProjectedMetricsError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    /// <p>The Amazon Resource Name (ARN) of the instances for which to return recommendation projected metrics.</p>
117    pub fn instance_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.instance_arn(input.into());
119        self
120    }
121    /// <p>The Amazon Resource Name (ARN) of the instances for which to return recommendation projected metrics.</p>
122    pub fn set_instance_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_instance_arn(input);
124        self
125    }
126    /// <p>The Amazon Resource Name (ARN) of the instances for which to return recommendation projected metrics.</p>
127    pub fn get_instance_arn(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_instance_arn()
129    }
130    /// <p>The statistic of the projected metrics.</p>
131    pub fn stat(mut self, input: crate::types::MetricStatistic) -> Self {
132        self.inner = self.inner.stat(input);
133        self
134    }
135    /// <p>The statistic of the projected metrics.</p>
136    pub fn set_stat(mut self, input: ::std::option::Option<crate::types::MetricStatistic>) -> Self {
137        self.inner = self.inner.set_stat(input);
138        self
139    }
140    /// <p>The statistic of the projected metrics.</p>
141    pub fn get_stat(&self) -> &::std::option::Option<crate::types::MetricStatistic> {
142        self.inner.get_stat()
143    }
144    /// <p>The granularity, in seconds, of the projected metrics data points.</p>
145    pub fn period(mut self, input: i32) -> Self {
146        self.inner = self.inner.period(input);
147        self
148    }
149    /// <p>The granularity, in seconds, of the projected metrics data points.</p>
150    pub fn set_period(mut self, input: ::std::option::Option<i32>) -> Self {
151        self.inner = self.inner.set_period(input);
152        self
153    }
154    /// <p>The granularity, in seconds, of the projected metrics data points.</p>
155    pub fn get_period(&self) -> &::std::option::Option<i32> {
156        self.inner.get_period()
157    }
158    /// <p>The timestamp of the first projected metrics data point to return.</p>
159    pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
160        self.inner = self.inner.start_time(input);
161        self
162    }
163    /// <p>The timestamp of the first projected metrics data point to return.</p>
164    pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
165        self.inner = self.inner.set_start_time(input);
166        self
167    }
168    /// <p>The timestamp of the first projected metrics data point to return.</p>
169    pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
170        self.inner.get_start_time()
171    }
172    /// <p>The timestamp of the last projected metrics data point to return.</p>
173    pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
174        self.inner = self.inner.end_time(input);
175        self
176    }
177    /// <p>The timestamp of the last projected metrics data point to return.</p>
178    pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
179        self.inner = self.inner.set_end_time(input);
180        self
181    }
182    /// <p>The timestamp of the last projected metrics data point to return.</p>
183    pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
184        self.inner.get_end_time()
185    }
186    /// <p>An object to specify the preferences for the Amazon EC2 recommendation projected metrics to return in the response.</p>
187    pub fn recommendation_preferences(mut self, input: crate::types::RecommendationPreferences) -> Self {
188        self.inner = self.inner.recommendation_preferences(input);
189        self
190    }
191    /// <p>An object to specify the preferences for the Amazon EC2 recommendation projected metrics to return in the response.</p>
192    pub fn set_recommendation_preferences(mut self, input: ::std::option::Option<crate::types::RecommendationPreferences>) -> Self {
193        self.inner = self.inner.set_recommendation_preferences(input);
194        self
195    }
196    /// <p>An object to specify the preferences for the Amazon EC2 recommendation projected metrics to return in the response.</p>
197    pub fn get_recommendation_preferences(&self) -> &::std::option::Option<crate::types::RecommendationPreferences> {
198        self.inner.get_recommendation_preferences()
199    }
200}