aws_sdk_pi/operation/get_resource_metrics/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_resource_metrics::_get_resource_metrics_output::GetResourceMetricsOutputBuilder;
3
4pub use crate::operation::get_resource_metrics::_get_resource_metrics_input::GetResourceMetricsInputBuilder;
5
6impl crate::operation::get_resource_metrics::builders::GetResourceMetricsInputBuilder {
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_resource_metrics::GetResourceMetricsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_resource_metrics::GetResourceMetricsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_resource_metrics();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetResourceMetrics`.
24///
25/// <p>Retrieve Performance Insights metrics for a set of data sources over a time period. You can provide specific dimension groups and dimensions, and provide filtering criteria for each group. You must specify an aggregate function for each metric.</p><note>
26/// <p>Each response element returns a maximum of 500 bytes. For larger elements, such as SQL statements, only the first 500 bytes are returned.</p>
27/// </note>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct GetResourceMetricsFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::get_resource_metrics::builders::GetResourceMetricsInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::get_resource_metrics::GetResourceMetricsOutput,
37        crate::operation::get_resource_metrics::GetResourceMetricsError,
38    > for GetResourceMetricsFluentBuilder
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_resource_metrics::GetResourceMetricsOutput,
46            crate::operation::get_resource_metrics::GetResourceMetricsError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl GetResourceMetricsFluentBuilder {
53    /// Creates a new `GetResourceMetricsFluentBuilder`.
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 GetResourceMetrics as a reference.
62    pub fn as_input(&self) -> &crate::operation::get_resource_metrics::builders::GetResourceMetricsInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::get_resource_metrics::GetResourceMetricsOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::get_resource_metrics::GetResourceMetricsError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::get_resource_metrics::GetResourceMetrics::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::get_resource_metrics::GetResourceMetrics::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::get_resource_metrics::GetResourceMetricsOutput,
99        crate::operation::get_resource_metrics::GetResourceMetricsError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// Create a paginator for this request
114    ///
115    /// Paginators are used by calling [`send().await`](crate::operation::get_resource_metrics::paginator::GetResourceMetricsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
116    pub fn into_paginator(self) -> crate::operation::get_resource_metrics::paginator::GetResourceMetricsPaginator {
117        crate::operation::get_resource_metrics::paginator::GetResourceMetricsPaginator::new(self.handle, self.inner)
118    }
119    /// <p>The Amazon Web Services service for which Performance Insights returns metrics. Valid values are as follows:</p>
120    /// <ul>
121    /// <li>
122    /// <p><code>RDS</code></p></li>
123    /// <li>
124    /// <p><code>DOCDB</code></p></li>
125    /// </ul>
126    pub fn service_type(mut self, input: crate::types::ServiceType) -> Self {
127        self.inner = self.inner.service_type(input);
128        self
129    }
130    /// <p>The Amazon Web Services service for which Performance Insights returns metrics. Valid values are as follows:</p>
131    /// <ul>
132    /// <li>
133    /// <p><code>RDS</code></p></li>
134    /// <li>
135    /// <p><code>DOCDB</code></p></li>
136    /// </ul>
137    pub fn set_service_type(mut self, input: ::std::option::Option<crate::types::ServiceType>) -> Self {
138        self.inner = self.inner.set_service_type(input);
139        self
140    }
141    /// <p>The Amazon Web Services service for which Performance Insights returns metrics. Valid values are as follows:</p>
142    /// <ul>
143    /// <li>
144    /// <p><code>RDS</code></p></li>
145    /// <li>
146    /// <p><code>DOCDB</code></p></li>
147    /// </ul>
148    pub fn get_service_type(&self) -> &::std::option::Option<crate::types::ServiceType> {
149        self.inner.get_service_type()
150    }
151    /// <p>An immutable identifier for a data source that is unique for an Amazon Web Services Region. Performance Insights gathers metrics from this data source. In the console, the identifier is shown as <i>ResourceID</i>. When you call <code>DescribeDBInstances</code>, the identifier is returned as <code>DbiResourceId</code>.</p>
152    /// <p>To use a DB instance as a data source, specify its <code>DbiResourceId</code> value. For example, specify <code>db-ABCDEFGHIJKLMNOPQRSTU1VW2X</code>.</p>
153    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154        self.inner = self.inner.identifier(input.into());
155        self
156    }
157    /// <p>An immutable identifier for a data source that is unique for an Amazon Web Services Region. Performance Insights gathers metrics from this data source. In the console, the identifier is shown as <i>ResourceID</i>. When you call <code>DescribeDBInstances</code>, the identifier is returned as <code>DbiResourceId</code>.</p>
158    /// <p>To use a DB instance as a data source, specify its <code>DbiResourceId</code> value. For example, specify <code>db-ABCDEFGHIJKLMNOPQRSTU1VW2X</code>.</p>
159    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_identifier(input);
161        self
162    }
163    /// <p>An immutable identifier for a data source that is unique for an Amazon Web Services Region. Performance Insights gathers metrics from this data source. In the console, the identifier is shown as <i>ResourceID</i>. When you call <code>DescribeDBInstances</code>, the identifier is returned as <code>DbiResourceId</code>.</p>
164    /// <p>To use a DB instance as a data source, specify its <code>DbiResourceId</code> value. For example, specify <code>db-ABCDEFGHIJKLMNOPQRSTU1VW2X</code>.</p>
165    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_identifier()
167    }
168    ///
169    /// Appends an item to `MetricQueries`.
170    ///
171    /// To override the contents of this collection use [`set_metric_queries`](Self::set_metric_queries).
172    ///
173    /// <p>An array of one or more queries to perform. Each query must specify a Performance Insights metric and specify an aggregate function, and you can provide filtering criteria. You must append the aggregate function to the metric. For example, to find the average for the metric <code>db.load</code> you must use <code>db.load.avg</code>. Valid values for aggregate functions include <code>.avg</code>, <code>.min</code>, <code>.max</code>, and <code>.sum</code>.</p>
174    pub fn metric_queries(mut self, input: crate::types::MetricQuery) -> Self {
175        self.inner = self.inner.metric_queries(input);
176        self
177    }
178    /// <p>An array of one or more queries to perform. Each query must specify a Performance Insights metric and specify an aggregate function, and you can provide filtering criteria. You must append the aggregate function to the metric. For example, to find the average for the metric <code>db.load</code> you must use <code>db.load.avg</code>. Valid values for aggregate functions include <code>.avg</code>, <code>.min</code>, <code>.max</code>, and <code>.sum</code>.</p>
179    pub fn set_metric_queries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MetricQuery>>) -> Self {
180        self.inner = self.inner.set_metric_queries(input);
181        self
182    }
183    /// <p>An array of one or more queries to perform. Each query must specify a Performance Insights metric and specify an aggregate function, and you can provide filtering criteria. You must append the aggregate function to the metric. For example, to find the average for the metric <code>db.load</code> you must use <code>db.load.avg</code>. Valid values for aggregate functions include <code>.avg</code>, <code>.min</code>, <code>.max</code>, and <code>.sum</code>.</p>
184    pub fn get_metric_queries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MetricQuery>> {
185        self.inner.get_metric_queries()
186    }
187    /// <p>The date and time specifying the beginning of the requested time series query range. You can't specify a <code>StartTime</code> that is earlier than 7 days ago. By default, Performance Insights has 7 days of retention, but you can extend this range up to 2 years. The value specified is <i>inclusive</i>. Thus, the command returns data points equal to or greater than <code>StartTime</code>.</p>
188    /// <p>The value for <code>StartTime</code> must be earlier than the value for <code>EndTime</code>.</p>
189    pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
190        self.inner = self.inner.start_time(input);
191        self
192    }
193    /// <p>The date and time specifying the beginning of the requested time series query range. You can't specify a <code>StartTime</code> that is earlier than 7 days ago. By default, Performance Insights has 7 days of retention, but you can extend this range up to 2 years. The value specified is <i>inclusive</i>. Thus, the command returns data points equal to or greater than <code>StartTime</code>.</p>
194    /// <p>The value for <code>StartTime</code> must be earlier than the value for <code>EndTime</code>.</p>
195    pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
196        self.inner = self.inner.set_start_time(input);
197        self
198    }
199    /// <p>The date and time specifying the beginning of the requested time series query range. You can't specify a <code>StartTime</code> that is earlier than 7 days ago. By default, Performance Insights has 7 days of retention, but you can extend this range up to 2 years. The value specified is <i>inclusive</i>. Thus, the command returns data points equal to or greater than <code>StartTime</code>.</p>
200    /// <p>The value for <code>StartTime</code> must be earlier than the value for <code>EndTime</code>.</p>
201    pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
202        self.inner.get_start_time()
203    }
204    /// <p>The date and time specifying the end of the requested time series query range. The value specified is <i>exclusive</i>. Thus, the command returns data points less than (but not equal to) <code>EndTime</code>.</p>
205    /// <p>The value for <code>EndTime</code> must be later than the value for <code>StartTime</code>.</p>
206    pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
207        self.inner = self.inner.end_time(input);
208        self
209    }
210    /// <p>The date and time specifying the end of the requested time series query range. The value specified is <i>exclusive</i>. Thus, the command returns data points less than (but not equal to) <code>EndTime</code>.</p>
211    /// <p>The value for <code>EndTime</code> must be later than the value for <code>StartTime</code>.</p>
212    pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
213        self.inner = self.inner.set_end_time(input);
214        self
215    }
216    /// <p>The date and time specifying the end of the requested time series query range. The value specified is <i>exclusive</i>. Thus, the command returns data points less than (but not equal to) <code>EndTime</code>.</p>
217    /// <p>The value for <code>EndTime</code> must be later than the value for <code>StartTime</code>.</p>
218    pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
219        self.inner.get_end_time()
220    }
221    /// <p>The granularity, in seconds, of the data points returned from Performance Insights. A period can be as short as one second, or as long as one day (86400 seconds). Valid values are:</p>
222    /// <ul>
223    /// <li>
224    /// <p><code>1</code> (one second)</p></li>
225    /// <li>
226    /// <p><code>60</code> (one minute)</p></li>
227    /// <li>
228    /// <p><code>300</code> (five minutes)</p></li>
229    /// <li>
230    /// <p><code>3600</code> (one hour)</p></li>
231    /// <li>
232    /// <p><code>86400</code> (twenty-four hours)</p></li>
233    /// </ul>
234    /// <p>If you don't specify <code>PeriodInSeconds</code>, then Performance Insights will choose a value for you, with a goal of returning roughly 100-200 data points in the response.</p>
235    pub fn period_in_seconds(mut self, input: i32) -> Self {
236        self.inner = self.inner.period_in_seconds(input);
237        self
238    }
239    /// <p>The granularity, in seconds, of the data points returned from Performance Insights. A period can be as short as one second, or as long as one day (86400 seconds). Valid values are:</p>
240    /// <ul>
241    /// <li>
242    /// <p><code>1</code> (one second)</p></li>
243    /// <li>
244    /// <p><code>60</code> (one minute)</p></li>
245    /// <li>
246    /// <p><code>300</code> (five minutes)</p></li>
247    /// <li>
248    /// <p><code>3600</code> (one hour)</p></li>
249    /// <li>
250    /// <p><code>86400</code> (twenty-four hours)</p></li>
251    /// </ul>
252    /// <p>If you don't specify <code>PeriodInSeconds</code>, then Performance Insights will choose a value for you, with a goal of returning roughly 100-200 data points in the response.</p>
253    pub fn set_period_in_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
254        self.inner = self.inner.set_period_in_seconds(input);
255        self
256    }
257    /// <p>The granularity, in seconds, of the data points returned from Performance Insights. A period can be as short as one second, or as long as one day (86400 seconds). Valid values are:</p>
258    /// <ul>
259    /// <li>
260    /// <p><code>1</code> (one second)</p></li>
261    /// <li>
262    /// <p><code>60</code> (one minute)</p></li>
263    /// <li>
264    /// <p><code>300</code> (five minutes)</p></li>
265    /// <li>
266    /// <p><code>3600</code> (one hour)</p></li>
267    /// <li>
268    /// <p><code>86400</code> (twenty-four hours)</p></li>
269    /// </ul>
270    /// <p>If you don't specify <code>PeriodInSeconds</code>, then Performance Insights will choose a value for you, with a goal of returning roughly 100-200 data points in the response.</p>
271    pub fn get_period_in_seconds(&self) -> &::std::option::Option<i32> {
272        self.inner.get_period_in_seconds()
273    }
274    /// <p>The maximum number of items to return in the response.</p>
275    pub fn max_results(mut self, input: i32) -> Self {
276        self.inner = self.inner.max_results(input);
277        self
278    }
279    /// <p>The maximum number of items to return in the response.</p>
280    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
281        self.inner = self.inner.set_max_results(input);
282        self
283    }
284    /// <p>The maximum number of items to return in the response.</p>
285    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
286        self.inner.get_max_results()
287    }
288    /// <p>An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the token, up to the value specified by <code>MaxRecords</code>.</p>
289    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
290        self.inner = self.inner.next_token(input.into());
291        self
292    }
293    /// <p>An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the token, up to the value specified by <code>MaxRecords</code>.</p>
294    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
295        self.inner = self.inner.set_next_token(input);
296        self
297    }
298    /// <p>An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the token, up to the value specified by <code>MaxRecords</code>.</p>
299    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
300        self.inner.get_next_token()
301    }
302    /// <p>The returned timestamp which is the start or end time of the time periods. The default value is <code>END_TIME</code>.</p>
303    pub fn period_alignment(mut self, input: crate::types::PeriodAlignment) -> Self {
304        self.inner = self.inner.period_alignment(input);
305        self
306    }
307    /// <p>The returned timestamp which is the start or end time of the time periods. The default value is <code>END_TIME</code>.</p>
308    pub fn set_period_alignment(mut self, input: ::std::option::Option<crate::types::PeriodAlignment>) -> Self {
309        self.inner = self.inner.set_period_alignment(input);
310        self
311    }
312    /// <p>The returned timestamp which is the start or end time of the time periods. The default value is <code>END_TIME</code>.</p>
313    pub fn get_period_alignment(&self) -> &::std::option::Option<crate::types::PeriodAlignment> {
314        self.inner.get_period_alignment()
315    }
316}