aws_sdk_applicationautoscaling/types/_target_tracking_metric_data_query.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The metric data to return. Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.</p>
4/// <p>For more information and examples, see <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking-metric-math.html">Create a target tracking scaling policy for Application Auto Scaling using metric math</a> in the <i>Application Auto Scaling User Guide</i>.</p>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct TargetTrackingMetricDataQuery {
8 /// <p>The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the <code>Id</code> of the other metrics to refer to those metrics, and can also use the <code>Id</code> of other expressions to use the result of those expressions.</p>
9 /// <p>Conditional: Within each <code>TargetTrackingMetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
10 pub expression: ::std::option::Option<::std::string::String>,
11 /// <p>A short name that identifies the object's results in the response. This name must be unique among all <code>MetricDataQuery</code> objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.</p>
12 pub id: ::std::string::String,
13 /// <p>A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.</p>
14 pub label: ::std::option::Option<::std::string::String>,
15 /// <p>Information about the metric data to return.</p>
16 /// <p>Conditional: Within each <code>MetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
17 pub metric_stat: ::std::option::Option<crate::types::TargetTrackingMetricStat>,
18 /// <p>Indicates whether to return the timestamps and raw data values of this metric.</p>
19 /// <p>If you use any math expressions, specify <code>true</code> for this value for only the final math expression that the metric specification is based on. You must specify <code>false</code> for <code>ReturnData</code> for all the other metrics and expressions used in the metric specification.</p>
20 /// <p>If you are only retrieving metrics and not performing any math expressions, do not specify anything for <code>ReturnData</code>. This sets it to its default (<code>true</code>).</p>
21 pub return_data: ::std::option::Option<bool>,
22}
23impl TargetTrackingMetricDataQuery {
24 /// <p>The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the <code>Id</code> of the other metrics to refer to those metrics, and can also use the <code>Id</code> of other expressions to use the result of those expressions.</p>
25 /// <p>Conditional: Within each <code>TargetTrackingMetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
26 pub fn expression(&self) -> ::std::option::Option<&str> {
27 self.expression.as_deref()
28 }
29 /// <p>A short name that identifies the object's results in the response. This name must be unique among all <code>MetricDataQuery</code> objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.</p>
30 pub fn id(&self) -> &str {
31 use std::ops::Deref;
32 self.id.deref()
33 }
34 /// <p>A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.</p>
35 pub fn label(&self) -> ::std::option::Option<&str> {
36 self.label.as_deref()
37 }
38 /// <p>Information about the metric data to return.</p>
39 /// <p>Conditional: Within each <code>MetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
40 pub fn metric_stat(&self) -> ::std::option::Option<&crate::types::TargetTrackingMetricStat> {
41 self.metric_stat.as_ref()
42 }
43 /// <p>Indicates whether to return the timestamps and raw data values of this metric.</p>
44 /// <p>If you use any math expressions, specify <code>true</code> for this value for only the final math expression that the metric specification is based on. You must specify <code>false</code> for <code>ReturnData</code> for all the other metrics and expressions used in the metric specification.</p>
45 /// <p>If you are only retrieving metrics and not performing any math expressions, do not specify anything for <code>ReturnData</code>. This sets it to its default (<code>true</code>).</p>
46 pub fn return_data(&self) -> ::std::option::Option<bool> {
47 self.return_data
48 }
49}
50impl TargetTrackingMetricDataQuery {
51 /// Creates a new builder-style object to manufacture [`TargetTrackingMetricDataQuery`](crate::types::TargetTrackingMetricDataQuery).
52 pub fn builder() -> crate::types::builders::TargetTrackingMetricDataQueryBuilder {
53 crate::types::builders::TargetTrackingMetricDataQueryBuilder::default()
54 }
55}
56
57/// A builder for [`TargetTrackingMetricDataQuery`](crate::types::TargetTrackingMetricDataQuery).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct TargetTrackingMetricDataQueryBuilder {
61 pub(crate) expression: ::std::option::Option<::std::string::String>,
62 pub(crate) id: ::std::option::Option<::std::string::String>,
63 pub(crate) label: ::std::option::Option<::std::string::String>,
64 pub(crate) metric_stat: ::std::option::Option<crate::types::TargetTrackingMetricStat>,
65 pub(crate) return_data: ::std::option::Option<bool>,
66}
67impl TargetTrackingMetricDataQueryBuilder {
68 /// <p>The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the <code>Id</code> of the other metrics to refer to those metrics, and can also use the <code>Id</code> of other expressions to use the result of those expressions.</p>
69 /// <p>Conditional: Within each <code>TargetTrackingMetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
70 pub fn expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71 self.expression = ::std::option::Option::Some(input.into());
72 self
73 }
74 /// <p>The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the <code>Id</code> of the other metrics to refer to those metrics, and can also use the <code>Id</code> of other expressions to use the result of those expressions.</p>
75 /// <p>Conditional: Within each <code>TargetTrackingMetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
76 pub fn set_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77 self.expression = input;
78 self
79 }
80 /// <p>The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the <code>Id</code> of the other metrics to refer to those metrics, and can also use the <code>Id</code> of other expressions to use the result of those expressions.</p>
81 /// <p>Conditional: Within each <code>TargetTrackingMetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
82 pub fn get_expression(&self) -> &::std::option::Option<::std::string::String> {
83 &self.expression
84 }
85 /// <p>A short name that identifies the object's results in the response. This name must be unique among all <code>MetricDataQuery</code> objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.</p>
86 /// This field is required.
87 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
88 self.id = ::std::option::Option::Some(input.into());
89 self
90 }
91 /// <p>A short name that identifies the object's results in the response. This name must be unique among all <code>MetricDataQuery</code> objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.</p>
92 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
93 self.id = input;
94 self
95 }
96 /// <p>A short name that identifies the object's results in the response. This name must be unique among all <code>MetricDataQuery</code> objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.</p>
97 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
98 &self.id
99 }
100 /// <p>A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.</p>
101 pub fn label(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102 self.label = ::std::option::Option::Some(input.into());
103 self
104 }
105 /// <p>A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.</p>
106 pub fn set_label(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107 self.label = input;
108 self
109 }
110 /// <p>A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.</p>
111 pub fn get_label(&self) -> &::std::option::Option<::std::string::String> {
112 &self.label
113 }
114 /// <p>Information about the metric data to return.</p>
115 /// <p>Conditional: Within each <code>MetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
116 pub fn metric_stat(mut self, input: crate::types::TargetTrackingMetricStat) -> Self {
117 self.metric_stat = ::std::option::Option::Some(input);
118 self
119 }
120 /// <p>Information about the metric data to return.</p>
121 /// <p>Conditional: Within each <code>MetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
122 pub fn set_metric_stat(mut self, input: ::std::option::Option<crate::types::TargetTrackingMetricStat>) -> Self {
123 self.metric_stat = input;
124 self
125 }
126 /// <p>Information about the metric data to return.</p>
127 /// <p>Conditional: Within each <code>MetricDataQuery</code> object, you must specify either <code>Expression</code> or <code>MetricStat</code>, but not both.</p>
128 pub fn get_metric_stat(&self) -> &::std::option::Option<crate::types::TargetTrackingMetricStat> {
129 &self.metric_stat
130 }
131 /// <p>Indicates whether to return the timestamps and raw data values of this metric.</p>
132 /// <p>If you use any math expressions, specify <code>true</code> for this value for only the final math expression that the metric specification is based on. You must specify <code>false</code> for <code>ReturnData</code> for all the other metrics and expressions used in the metric specification.</p>
133 /// <p>If you are only retrieving metrics and not performing any math expressions, do not specify anything for <code>ReturnData</code>. This sets it to its default (<code>true</code>).</p>
134 pub fn return_data(mut self, input: bool) -> Self {
135 self.return_data = ::std::option::Option::Some(input);
136 self
137 }
138 /// <p>Indicates whether to return the timestamps and raw data values of this metric.</p>
139 /// <p>If you use any math expressions, specify <code>true</code> for this value for only the final math expression that the metric specification is based on. You must specify <code>false</code> for <code>ReturnData</code> for all the other metrics and expressions used in the metric specification.</p>
140 /// <p>If you are only retrieving metrics and not performing any math expressions, do not specify anything for <code>ReturnData</code>. This sets it to its default (<code>true</code>).</p>
141 pub fn set_return_data(mut self, input: ::std::option::Option<bool>) -> Self {
142 self.return_data = input;
143 self
144 }
145 /// <p>Indicates whether to return the timestamps and raw data values of this metric.</p>
146 /// <p>If you use any math expressions, specify <code>true</code> for this value for only the final math expression that the metric specification is based on. You must specify <code>false</code> for <code>ReturnData</code> for all the other metrics and expressions used in the metric specification.</p>
147 /// <p>If you are only retrieving metrics and not performing any math expressions, do not specify anything for <code>ReturnData</code>. This sets it to its default (<code>true</code>).</p>
148 pub fn get_return_data(&self) -> &::std::option::Option<bool> {
149 &self.return_data
150 }
151 /// Consumes the builder and constructs a [`TargetTrackingMetricDataQuery`](crate::types::TargetTrackingMetricDataQuery).
152 /// This method will fail if any of the following fields are not set:
153 /// - [`id`](crate::types::builders::TargetTrackingMetricDataQueryBuilder::id)
154 pub fn build(self) -> ::std::result::Result<crate::types::TargetTrackingMetricDataQuery, ::aws_smithy_types::error::operation::BuildError> {
155 ::std::result::Result::Ok(crate::types::TargetTrackingMetricDataQuery {
156 expression: self.expression,
157 id: self.id.ok_or_else(|| {
158 ::aws_smithy_types::error::operation::BuildError::missing_field(
159 "id",
160 "id was not specified but it is required when building TargetTrackingMetricDataQuery",
161 )
162 })?,
163 label: self.label,
164 metric_stat: self.metric_stat,
165 return_data: self.return_data,
166 })
167 }
168}