aws_sdk_cloudwatch/operation/list_metrics/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_metrics::_list_metrics_output::ListMetricsOutputBuilder;
3
4pub use crate::operation::list_metrics::_list_metrics_input::ListMetricsInputBuilder;
5
6impl crate::operation::list_metrics::builders::ListMetricsInputBuilder {
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::list_metrics::ListMetricsOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::list_metrics::ListMetricsError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.list_metrics();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ListMetrics`.
24///
25/// <p>List the specified metrics. You can use the returned metrics with <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html">GetMetricData</a> or <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html">GetMetricStatistics</a> to get statistical data.</p>
26/// <p>Up to 500 results are returned for any one call. To retrieve additional results, use the returned token with subsequent calls.</p>
27/// <p>After you create a metric, allow up to 15 minutes for the metric to appear. To see metric statistics sooner, use <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html">GetMetricData</a> or <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html">GetMetricStatistics</a>.</p>
28/// <p>If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view metrics from the linked source accounts. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html">CloudWatch cross-account observability</a>.</p>
29/// <p><code>ListMetrics</code> doesn't return information about metrics if those metrics haven't reported data in the past two weeks. To retrieve those metrics, use <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html">GetMetricData</a> or <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html">GetMetricStatistics</a>.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct ListMetricsFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::list_metrics::builders::ListMetricsInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::list_metrics::ListMetricsOutput,
39 crate::operation::list_metrics::ListMetricsError,
40 > for ListMetricsFluentBuilder
41{
42 fn send(
43 self,
44 config_override: crate::config::Builder,
45 ) -> crate::client::customize::internal::BoxFuture<
46 crate::client::customize::internal::SendResult<
47 crate::operation::list_metrics::ListMetricsOutput,
48 crate::operation::list_metrics::ListMetricsError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl ListMetricsFluentBuilder {
55 /// Creates a new `ListMetricsFluentBuilder`.
56 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57 Self {
58 handle,
59 inner: ::std::default::Default::default(),
60 config_override: ::std::option::Option::None,
61 }
62 }
63 /// Access the ListMetrics as a reference.
64 pub fn as_input(&self) -> &crate::operation::list_metrics::builders::ListMetricsInputBuilder {
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::list_metrics::ListMetricsOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::list_metrics::ListMetricsError,
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 = crate::operation::list_metrics::ListMetrics::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::list_metrics::ListMetrics::orchestrate(&runtime_plugins, input).await
94 }
95
96 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97 pub fn customize(
98 self,
99 ) -> crate::client::customize::CustomizableOperation<
100 crate::operation::list_metrics::ListMetricsOutput,
101 crate::operation::list_metrics::ListMetricsError,
102 Self,
103 > {
104 crate::client::customize::CustomizableOperation::new(self)
105 }
106 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107 self.set_config_override(::std::option::Option::Some(config_override.into()));
108 self
109 }
110
111 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112 self.config_override = config_override;
113 self
114 }
115 /// Create a paginator for this request
116 ///
117 /// Paginators are used by calling [`send().await`](crate::operation::list_metrics::paginator::ListMetricsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
118 pub fn into_paginator(self) -> crate::operation::list_metrics::paginator::ListMetricsPaginator {
119 crate::operation::list_metrics::paginator::ListMetricsPaginator::new(self.handle, self.inner)
120 }
121 /// <p>The metric namespace to filter against. Only the namespace that matches exactly will be returned.</p>
122 pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123 self.inner = self.inner.namespace(input.into());
124 self
125 }
126 /// <p>The metric namespace to filter against. Only the namespace that matches exactly will be returned.</p>
127 pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128 self.inner = self.inner.set_namespace(input);
129 self
130 }
131 /// <p>The metric namespace to filter against. Only the namespace that matches exactly will be returned.</p>
132 pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
133 self.inner.get_namespace()
134 }
135 /// <p>The name of the metric to filter against. Only the metrics with names that match exactly will be returned.</p>
136 pub fn metric_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137 self.inner = self.inner.metric_name(input.into());
138 self
139 }
140 /// <p>The name of the metric to filter against. Only the metrics with names that match exactly will be returned.</p>
141 pub fn set_metric_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142 self.inner = self.inner.set_metric_name(input);
143 self
144 }
145 /// <p>The name of the metric to filter against. Only the metrics with names that match exactly will be returned.</p>
146 pub fn get_metric_name(&self) -> &::std::option::Option<::std::string::String> {
147 self.inner.get_metric_name()
148 }
149 ///
150 /// Appends an item to `Dimensions`.
151 ///
152 /// To override the contents of this collection use [`set_dimensions`](Self::set_dimensions).
153 ///
154 /// <p>The dimensions to filter against. Only the dimension with names that match exactly will be returned. If you specify one dimension name and a metric has that dimension and also other dimensions, it will be returned.</p>
155 pub fn dimensions(mut self, input: crate::types::DimensionFilter) -> Self {
156 self.inner = self.inner.dimensions(input);
157 self
158 }
159 /// <p>The dimensions to filter against. Only the dimension with names that match exactly will be returned. If you specify one dimension name and a metric has that dimension and also other dimensions, it will be returned.</p>
160 pub fn set_dimensions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DimensionFilter>>) -> Self {
161 self.inner = self.inner.set_dimensions(input);
162 self
163 }
164 /// <p>The dimensions to filter against. Only the dimension with names that match exactly will be returned. If you specify one dimension name and a metric has that dimension and also other dimensions, it will be returned.</p>
165 pub fn get_dimensions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DimensionFilter>> {
166 self.inner.get_dimensions()
167 }
168 /// <p>The token returned by a previous call to indicate that there is more data available.</p>
169 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.next_token(input.into());
171 self
172 }
173 /// <p>The token returned by a previous call to indicate that there is more data available.</p>
174 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175 self.inner = self.inner.set_next_token(input);
176 self
177 }
178 /// <p>The token returned by a previous call to indicate that there is more data available.</p>
179 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
180 self.inner.get_next_token()
181 }
182 /// <p>To filter the results to show only metrics that have had data points published in the past three hours, specify this parameter with a value of <code>PT3H</code>. This is the only valid value for this parameter.</p>
183 /// <p>The results that are returned are an approximation of the value you specify. There is a low probability that the returned results include metrics with last published data as much as 50 minutes more than the specified time interval.</p>
184 pub fn recently_active(mut self, input: crate::types::RecentlyActive) -> Self {
185 self.inner = self.inner.recently_active(input);
186 self
187 }
188 /// <p>To filter the results to show only metrics that have had data points published in the past three hours, specify this parameter with a value of <code>PT3H</code>. This is the only valid value for this parameter.</p>
189 /// <p>The results that are returned are an approximation of the value you specify. There is a low probability that the returned results include metrics with last published data as much as 50 minutes more than the specified time interval.</p>
190 pub fn set_recently_active(mut self, input: ::std::option::Option<crate::types::RecentlyActive>) -> Self {
191 self.inner = self.inner.set_recently_active(input);
192 self
193 }
194 /// <p>To filter the results to show only metrics that have had data points published in the past three hours, specify this parameter with a value of <code>PT3H</code>. This is the only valid value for this parameter.</p>
195 /// <p>The results that are returned are an approximation of the value you specify. There is a low probability that the returned results include metrics with last published data as much as 50 minutes more than the specified time interval.</p>
196 pub fn get_recently_active(&self) -> &::std::option::Option<crate::types::RecentlyActive> {
197 self.inner.get_recently_active()
198 }
199 /// <p>If you are using this operation in a monitoring account, specify <code>true</code> to include metrics from source accounts in the returned data.</p>
200 /// <p>The default is <code>false</code>.</p>
201 pub fn include_linked_accounts(mut self, input: bool) -> Self {
202 self.inner = self.inner.include_linked_accounts(input);
203 self
204 }
205 /// <p>If you are using this operation in a monitoring account, specify <code>true</code> to include metrics from source accounts in the returned data.</p>
206 /// <p>The default is <code>false</code>.</p>
207 pub fn set_include_linked_accounts(mut self, input: ::std::option::Option<bool>) -> Self {
208 self.inner = self.inner.set_include_linked_accounts(input);
209 self
210 }
211 /// <p>If you are using this operation in a monitoring account, specify <code>true</code> to include metrics from source accounts in the returned data.</p>
212 /// <p>The default is <code>false</code>.</p>
213 pub fn get_include_linked_accounts(&self) -> &::std::option::Option<bool> {
214 self.inner.get_include_linked_accounts()
215 }
216 /// <p>When you use this operation in a monitoring account, use this field to return metrics only from one source account. To do so, specify that source account ID in this field, and also specify <code>true</code> for <code>IncludeLinkedAccounts</code>.</p>
217 pub fn owning_account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218 self.inner = self.inner.owning_account(input.into());
219 self
220 }
221 /// <p>When you use this operation in a monitoring account, use this field to return metrics only from one source account. To do so, specify that source account ID in this field, and also specify <code>true</code> for <code>IncludeLinkedAccounts</code>.</p>
222 pub fn set_owning_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223 self.inner = self.inner.set_owning_account(input);
224 self
225 }
226 /// <p>When you use this operation in a monitoring account, use this field to return metrics only from one source account. To do so, specify that source account ID in this field, and also specify <code>true</code> for <code>IncludeLinkedAccounts</code>.</p>
227 pub fn get_owning_account(&self) -> &::std::option::Option<::std::string::String> {
228 self.inner.get_owning_account()
229 }
230}