aws_sdk_cloudwatch/client/
get_metric_data.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`GetMetricData`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder) operation.
4    /// This operation supports pagination; See [`into_paginator()`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::into_paginator).
5    ///
6    /// - The fluent builder is configurable:
7    ///   - [`metric_data_queries(MetricDataQuery)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::metric_data_queries) / [`set_metric_data_queries(Option<Vec::<MetricDataQuery>>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_metric_data_queries):<br>required: **true**<br><p>The metric queries to be returned. A single <code>GetMetricData</code> call can include as many as 500 <code>MetricDataQuery</code> structures. Each of these structures can specify either a metric to retrieve, a Metrics Insights query, or a math expression to perform on retrieved data.</p><br>
8    ///   - [`start_time(DateTime)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::start_time) / [`set_start_time(Option<DateTime>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_start_time):<br>required: **true**<br><p>The time stamp indicating the earliest data to be returned.</p> <p>The value specified is inclusive; results include data points with the specified time stamp.</p> <p>CloudWatch rounds the specified time stamp as follows:</p> <ul>  <li>   <p>Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to 12:32:00.</p></li>  <li>   <p>Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded down to 12:30:00.</p></li>  <li>   <p>Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down to 12:00:00.</p></li> </ul> <p>If you set <code>Period</code> to 5, 10, 20, or 30, the start time of your request is rounded down to the nearest time that corresponds to even 5-, 10-, 20-, or 30-second divisions of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for the previous 10-second period, the start time of your request is rounded down and you receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped between 15:02:15 and 15:07:15.</p> <p>For better performance, specify <code>StartTime</code> and <code>EndTime</code> values that align with the value of the metric's <code>Period</code> and sync up with the beginning and end of an hour. For example, if the <code>Period</code> of a metric is 5 minutes, specifying 12:05 or 12:30 as <code>StartTime</code> can get a faster response from CloudWatch than setting 12:07 or 12:29 as the <code>StartTime</code>.</p><br>
9    ///   - [`end_time(DateTime)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::end_time) / [`set_end_time(Option<DateTime>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_end_time):<br>required: **true**<br><p>The time stamp indicating the latest data to be returned.</p> <p>The value specified is exclusive; results include data points up to the specified time stamp.</p> <p>For better performance, specify <code>StartTime</code> and <code>EndTime</code> values that align with the value of the metric's <code>Period</code> and sync up with the beginning and end of an hour. For example, if the <code>Period</code> of a metric is 5 minutes, specifying 12:05 or 12:30 as <code>EndTime</code> can get a faster response from CloudWatch than setting 12:07 or 12:29 as the <code>EndTime</code>.</p><br>
10    ///   - [`next_token(impl Into<String>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::next_token) / [`set_next_token(Option<String>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_next_token):<br>required: **false**<br><p>Include this value, if it was returned by the previous <code>GetMetricData</code> operation, to get the next set of data points.</p><br>
11    ///   - [`scan_by(ScanBy)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::scan_by) / [`set_scan_by(Option<ScanBy>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_scan_by):<br>required: **false**<br><p>The order in which data points should be returned. <code>TimestampDescending</code> returns the newest data first and paginates when the <code>MaxDatapoints</code> limit is reached. <code>TimestampAscending</code> returns the oldest data first and paginates when the <code>MaxDatapoints</code> limit is reached.</p> <p>If you omit this parameter, the default of <code>TimestampDescending</code> is used.</p><br>
12    ///   - [`max_datapoints(i32)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::max_datapoints) / [`set_max_datapoints(Option<i32>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_max_datapoints):<br>required: **false**<br><p>The maximum number of data points the request should return before paginating. If you omit this, the default of 100,800 is used.</p><br>
13    ///   - [`label_options(LabelOptions)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::label_options) / [`set_label_options(Option<LabelOptions>)`](crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::set_label_options):<br>required: **false**<br><p>This structure includes the <code>Timezone</code> parameter, which you can use to specify your time zone so that the labels of returned data display the correct time for your time zone.</p><br>
14    /// - On success, responds with [`GetMetricDataOutput`](crate::operation::get_metric_data::GetMetricDataOutput) with field(s):
15    ///   - [`metric_data_results(Option<Vec::<MetricDataResult>>)`](crate::operation::get_metric_data::GetMetricDataOutput::metric_data_results): <p>The metrics that are returned, including the metric name, namespace, and dimensions.</p>
16    ///   - [`next_token(Option<String>)`](crate::operation::get_metric_data::GetMetricDataOutput::next_token): <p>A token that marks the next batch of returned results.</p>
17    ///   - [`messages(Option<Vec::<MessageData>>)`](crate::operation::get_metric_data::GetMetricDataOutput::messages): <p>Contains a message about this <code>GetMetricData</code> operation, if the operation results in such a message. An example of a message that might be returned is <code>Maximum number of allowed metrics exceeded</code>. If there is a message, as much of the operation as possible is still executed.</p> <p>A message appears here only if it is related to the global <code>GetMetricData</code> operation. Any message about a specific metric returned by the operation appears in the <code>MetricDataResult</code> object returned for that metric.</p>
18    /// - On failure, responds with [`SdkError<GetMetricDataError>`](crate::operation::get_metric_data::GetMetricDataError)
19    pub fn get_metric_data(&self) -> crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder {
20        crate::operation::get_metric_data::builders::GetMetricDataFluentBuilder::new(self.handle.clone())
21    }
22}