aws_lite_rs/types/cloudwatch.rs
1//! Types for the Amazon CloudWatch API (v1).
2//!
3//! Auto-generated from the AWS Botocore Model.
4//! **Do not edit manually** — modify the manifest and re-run codegen.
5
6use serde::{Deserialize, Serialize};
7
8/// Possible values for `cloudwatch.Datapoint.Unit`.
9///
10/// **AWS API**: `cloudwatch.Datapoint.Unit`
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
12pub enum StandardUnit {
13 #[serde(rename = "Seconds")]
14 Seconds,
15
16 #[serde(rename = "Microseconds")]
17 Microseconds,
18
19 #[serde(rename = "Milliseconds")]
20 Milliseconds,
21
22 #[serde(rename = "Bytes")]
23 Bytes,
24
25 #[serde(rename = "Kilobytes")]
26 Kilobytes,
27
28 #[serde(rename = "Megabytes")]
29 Megabytes,
30
31 #[serde(rename = "Gigabytes")]
32 Gigabytes,
33
34 #[serde(rename = "Terabytes")]
35 Terabytes,
36
37 #[serde(rename = "Bits")]
38 Bits,
39
40 #[serde(rename = "Kilobits")]
41 Kilobits,
42
43 #[serde(rename = "Megabits")]
44 Megabits,
45
46 #[serde(rename = "Gigabits")]
47 Gigabits,
48
49 #[serde(rename = "Terabits")]
50 Terabits,
51
52 #[serde(rename = "Percent")]
53 Percent,
54
55 #[serde(rename = "Count")]
56 Count,
57
58 #[serde(rename = "Bytes/Second")]
59 BytesPerSecond,
60
61 #[serde(rename = "Kilobytes/Second")]
62 KilobytesPerSecond,
63
64 #[serde(rename = "Megabytes/Second")]
65 MegabytesPerSecond,
66
67 #[serde(rename = "Gigabytes/Second")]
68 GigabytesPerSecond,
69
70 #[serde(rename = "Terabytes/Second")]
71 TerabytesPerSecond,
72
73 #[serde(rename = "Bits/Second")]
74 BitsPerSecond,
75
76 #[serde(rename = "Kilobits/Second")]
77 KilobitsPerSecond,
78
79 #[serde(rename = "Megabits/Second")]
80 MegabitsPerSecond,
81
82 #[serde(rename = "Gigabits/Second")]
83 GigabitsPerSecond,
84
85 #[serde(rename = "Terabits/Second")]
86 TerabitsPerSecond,
87
88 #[serde(rename = "Count/Second")]
89 CountPerSecond,
90
91 #[serde(rename = "None")]
92 None,
93
94 /// Unknown or future value not yet represented.
95 #[serde(other)]
96 Unknown,
97}
98
99/// Possible values for `cloudwatch.GetMetricStatisticsInput.Statistics`.
100///
101/// **AWS API**: `cloudwatch.GetMetricStatisticsInput.Statistics`
102#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
103pub enum Statistic {
104 #[serde(rename = "SampleCount")]
105 SampleCount,
106
107 #[serde(rename = "Average")]
108 Average,
109
110 #[serde(rename = "Sum")]
111 Sum,
112
113 #[serde(rename = "Minimum")]
114 Minimum,
115
116 #[serde(rename = "Maximum")]
117 Maximum,
118
119 /// Unknown or future value not yet represented.
120 #[serde(other)]
121 Unknown,
122}
123
124/// Possible values for `cloudwatch.MetricAlarm.ComparisonOperator`.
125///
126/// **AWS API**: `cloudwatch.MetricAlarm.ComparisonOperator`
127#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
128pub enum ComparisonOperator {
129 #[serde(rename = "GreaterThanOrEqualToThreshold")]
130 GreaterThanOrEqualToThreshold,
131
132 #[serde(rename = "GreaterThanThreshold")]
133 GreaterThanThreshold,
134
135 #[serde(rename = "LessThanThreshold")]
136 LessThanThreshold,
137
138 #[serde(rename = "LessThanOrEqualToThreshold")]
139 LessThanOrEqualToThreshold,
140
141 #[serde(rename = "LessThanLowerOrGreaterThanUpperThreshold")]
142 LessThanLowerOrGreaterThanUpperThreshold,
143
144 #[serde(rename = "LessThanLowerThreshold")]
145 LessThanLowerThreshold,
146
147 #[serde(rename = "GreaterThanUpperThreshold")]
148 GreaterThanUpperThreshold,
149
150 /// Unknown or future value not yet represented.
151 #[serde(other)]
152 Unknown,
153}
154
155/// Possible values for `cloudwatch.GetMetricDataInput.ScanBy`.
156///
157/// **AWS API**: `cloudwatch.GetMetricDataInput.ScanBy`
158#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
159pub enum ScanBy {
160 #[serde(rename = "TimestampDescending")]
161 TimestampDescending,
162
163 #[serde(rename = "TimestampAscending")]
164 TimestampAscending,
165
166 /// Unknown or future value not yet represented.
167 #[serde(other)]
168 Unknown,
169}
170
171/// Possible values for `cloudwatch.MetricDataResult.StatusCode`.
172///
173/// **AWS API**: `cloudwatch.MetricDataResult.StatusCode`
174#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
175pub enum StatusCode {
176 #[serde(rename = "Complete")]
177 Complete,
178
179 #[serde(rename = "InternalError")]
180 InternalError,
181
182 #[serde(rename = "PartialData")]
183 PartialData,
184
185 #[serde(rename = "Forbidden")]
186 Forbidden,
187
188 /// Unknown or future value not yet represented.
189 #[serde(other)]
190 Unknown,
191}
192
193///
194/// **AWS API**: `cloudwatch.v1.GetMetricStatisticsOutput`
195/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//GetMetricStatisticsOutput>
196#[derive(Debug, Clone, Default, Serialize, Deserialize)]
197#[serde(rename_all = "PascalCase")]
198pub struct GetMetricStatisticsResponse {
199 /// A label for the specified metric.
200 #[serde(skip_serializing_if = "Option::is_none")]
201 pub label: Option<String>,
202
203 /// The data points for the specified metric.
204 #[serde(default)]
205 #[serde(skip_serializing_if = "Vec::is_empty")]
206 pub datapoints: Vec<Datapoint>,
207}
208
209impl GetMetricStatisticsResponse {
210 #[cfg(any(test, feature = "test-support"))]
211 /// Create a fixture instance for testing.
212 pub fn fixture() -> Self {
213 Self {
214 label: Some("test-label".into()),
215 datapoints: vec![],
216 }
217 }
218}
219
220/// Encapsulates the statistical data that CloudWatch computes from metric data.
221///
222/// **AWS API**: `cloudwatch.v1.Datapoint`
223/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//Datapoint>
224///
225/// ## Coverage
226/// 7 of 8 fields included.
227/// Omitted fields:
228/// - `ExtendedStatistics` — not selected in manifest
229#[derive(Debug, Clone, Default, Serialize, Deserialize)]
230#[serde(rename_all = "PascalCase")]
231pub struct Datapoint {
232 /// The time stamp used for the data point.
233 #[serde(skip_serializing_if = "Option::is_none")]
234 pub timestamp: Option<String>,
235
236 /// The average of the metric values that correspond to the data point.
237 #[serde(skip_serializing_if = "Option::is_none")]
238 pub average: Option<f64>,
239
240 /// The sum of the metric values for the data point.
241 #[serde(skip_serializing_if = "Option::is_none")]
242 pub sum: Option<f64>,
243
244 /// The minimum metric value for the data point.
245 #[serde(skip_serializing_if = "Option::is_none")]
246 pub minimum: Option<f64>,
247
248 /// The maximum metric value for the data point.
249 #[serde(skip_serializing_if = "Option::is_none")]
250 pub maximum: Option<f64>,
251
252 /// The number of metric values that contributed to the aggregate value of this data point.
253 #[serde(skip_serializing_if = "Option::is_none")]
254 pub sample_count: Option<f64>,
255
256 /// The standard unit for the data point.
257 #[serde(skip_serializing_if = "Option::is_none")]
258 pub unit: Option<StandardUnit>,
259}
260
261impl Datapoint {
262 #[cfg(any(test, feature = "test-support"))]
263 /// Create a fixture instance for testing.
264 pub fn fixture() -> Self {
265 Self {
266 timestamp: Some("test-timestamp".into()),
267 ..Default::default()
268 }
269 }
270}
271
272/// A dimension is a name/value pair that is part of the identity of a metric. Because
273/// dimensions are part of the unique identifier for a metric, whenever you add a unique
274/// name/value pair to one of your metrics, you are creating a new variation of that metric. For
275/// example, many Amazon EC2 metrics publish InstanceId as a dimension name, and the actual
276/// instance ID as the value for that dimension. You can assign up to 30 dimensions to a metric.
277///
278/// **AWS API**: `cloudwatch.v1.Dimension`
279/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//Dimension>
280#[derive(Debug, Clone, Default, Serialize, Deserialize)]
281#[serde(rename_all = "PascalCase")]
282pub struct Dimension {
283 /// The name of the dimension. Dimension names must contain only ASCII characters, must
284 /// include at least one non-whitespace character, and cannot start with a colon (:). ASCII
285 /// control characters are not supported as part of dimension names.
286 pub name: String,
287
288 /// The value of the dimension. Dimension values must contain only ASCII characters and must
289 /// include at least one non-whitespace character. ASCII control characters are not
290 /// supported as part of dimension values.
291 pub value: String,
292}
293
294impl Dimension {
295 #[cfg(any(test, feature = "test-support"))]
296 /// Create a fixture instance for testing.
297 pub fn fixture() -> Self {
298 Self {
299 name: "test-name".into(),
300 value: "test-value".into(),
301 }
302 }
303}
304
305///
306/// **AWS API**: `cloudwatch.v1.GetMetricStatisticsInput`
307/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//GetMetricStatisticsInput>
308#[derive(Debug, Clone, Default, Serialize, Deserialize)]
309#[serde(rename_all = "PascalCase")]
310pub struct GetMetricStatisticsInput {
311 /// The namespace of the metric, with or without spaces.
312 pub namespace: String,
313
314 /// The name of the metric, with or without spaces.
315 pub metric_name: String,
316
317 /// The dimensions. If the metric contains multiple dimensions, you must include a value for
318 /// each dimension. CloudWatch treats each unique combination of dimensions as a separate
319 /// metric. If a specific combination of dimensions was not published, you can't retrieve
320 /// statistics for it. You must specify the same dimensions that were used when the metrics
321 /// were created. For an example, see Dimension Combinations in the Amazon CloudWatch User
322 /// Guide. For more information about specifying dimensions, see Publishing Metrics in the
323 /// Amazon CloudWatch User Guide.
324 #[serde(default)]
325 #[serde(skip_serializing_if = "Vec::is_empty")]
326 pub dimensions: Vec<Dimension>,
327
328 /// The time stamp that determines the first data point to return. Start times are evaluated
329 /// relative to the time that CloudWatch receives the request. The value specified is
330 /// inclusive; results include data points with the specified time stamp. In a raw HTTP
331 /// query, the time stamp must be in ISO 8601 UTC format (for example,
332 /// 2016-10-03T23:00:00Z). CloudWatch rounds the specified time stamp as follows: Start time
333 /// less than 15 days ago
334 /// - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to
335 /// 12:32:00. Start time between 15 and 63 days ago
336 /// - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded
337 /// down to 12:30:00. Start time greater than 63 days ago
338 /// - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down
339 /// to 12:00:00. If you set Period to 5, 10, 20, or 30, the start time of your request is
340 /// rounded down to the nearest time that corresponds to even 5-, 10-, 20-, or 30-second
341 /// divisions of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for the
342 /// previous 10-second period, the start time of your request is rounded down and you
343 /// receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the
344 /// previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped
345 /// between 15:02:15 and 15:07:15.
346 pub start_time: String,
347
348 /// The time stamp that determines the last data point to return. The value specified is
349 /// exclusive; results include data points up to the specified time stamp. In a raw HTTP
350 /// query, the time stamp must be in ISO 8601 UTC format (for example,
351 /// 2016-10-10T23:00:00Z).
352 pub end_time: String,
353
354 /// The granularity, in seconds, of the returned data points. For metrics with regular
355 /// resolution, a period can be as short as one minute (60 seconds) and must be a multiple
356 /// of 60. For high-resolution metrics that are collected at intervals of less than one
357 /// minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution
358 /// metrics are those metrics stored by a PutMetricData call that includes a
359 /// StorageResolution of 1 second. If the StartTime parameter specifies a time stamp that is
360 /// greater than 3 hours ago, you must specify the period as follows or no data points in
361 /// that time range is returned: Start time between 3 hours and 15 days ago
362 /// - Use a multiple of 60 seconds (1 minute). Start time between 15 and 63 days ago
363 /// - Use a multiple of 300 seconds (5 minutes). Start time greater than 63 days ago
364 /// - Use a multiple of 3600 seconds (1 hour).
365 pub period: i32,
366
367 /// The metric statistics, other than percentile. For percentile statistics, use
368 /// ExtendedStatistics. When calling GetMetricStatistics, you must specify either Statistics
369 /// or ExtendedStatistics, but not both.
370 #[serde(default)]
371 #[serde(skip_serializing_if = "Vec::is_empty")]
372 pub statistics: Vec<Statistic>,
373
374 /// The percentile statistics. Specify values between p0.0 and p100. When calling
375 /// GetMetricStatistics, you must specify either Statistics or ExtendedStatistics, but not
376 /// both. Percentile statistics are not available for metrics when any of the metric values
377 /// are negative numbers.
378 #[serde(default)]
379 #[serde(skip_serializing_if = "Vec::is_empty")]
380 pub extended_statistics: Vec<String>,
381
382 /// The unit for a given metric. If you omit Unit, all data that was collected with any unit
383 /// is returned, along with the corresponding units that were specified when the data was
384 /// reported to CloudWatch. If you specify a unit, the operation returns only data that was
385 /// collected with that unit specified. If you specify a unit that does not match the data
386 /// collected, the results of the operation are null. CloudWatch does not perform unit
387 /// conversions.
388 #[serde(skip_serializing_if = "Option::is_none")]
389 pub unit: Option<StandardUnit>,
390}
391
392impl GetMetricStatisticsInput {
393 #[cfg(any(test, feature = "test-support"))]
394 /// Create a fixture instance for testing.
395 pub fn fixture() -> Self {
396 Self {
397 namespace: "test-namespace".into(),
398 metric_name: "test-metric_name".into(),
399 dimensions: vec![],
400 start_time: "test-start_time".into(),
401 end_time: "test-end_time".into(),
402 period: 100,
403 statistics: vec![],
404 extended_statistics: vec![],
405 ..Default::default()
406 }
407 }
408}
409
410///
411/// **AWS API**: `cloudwatch.v1.ListMetricsInput`
412/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//ListMetricsInput>
413///
414/// ## Coverage
415/// 4 of 7 fields included.
416/// Omitted fields:
417/// - `RecentlyActive` — not selected in manifest
418/// - `IncludeLinkedAccounts` — not selected in manifest
419/// - `OwningAccount` — not selected in manifest
420#[derive(Debug, Clone, Default, Serialize, Deserialize)]
421#[serde(rename_all = "PascalCase")]
422pub struct ListMetricsInput {
423 /// The metric namespace to filter against. Only the namespace that matches exactly will be
424 /// returned.
425 #[serde(skip_serializing_if = "Option::is_none")]
426 pub namespace: Option<String>,
427
428 /// The name of the metric to filter against. Only the metrics with names that match exactly
429 /// will be returned.
430 #[serde(skip_serializing_if = "Option::is_none")]
431 pub metric_name: Option<String>,
432
433 /// The dimensions to filter against. Only the dimension with names that match exactly will
434 /// be returned. If you specify one dimension name and a metric has that dimension and also
435 /// other dimensions, it will be returned.
436 #[serde(default)]
437 #[serde(skip_serializing_if = "Vec::is_empty")]
438 pub dimensions: Vec<DimensionFilter>,
439
440 /// The token returned by a previous call to indicate that there is more data available.
441 #[serde(skip_serializing_if = "Option::is_none")]
442 pub next_token: Option<String>,
443}
444
445impl ListMetricsInput {
446 #[cfg(any(test, feature = "test-support"))]
447 /// Create a fixture instance for testing.
448 pub fn fixture() -> Self {
449 Self {
450 namespace: Some("test-namespace".into()),
451 metric_name: Some("test-metric_name".into()),
452 dimensions: vec![],
453 next_token: Some("test-next_token".into()),
454 }
455 }
456}
457
458///
459/// **AWS API**: `cloudwatch.v1.ListMetricsOutput`
460/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//ListMetricsOutput>
461///
462/// ## Coverage
463/// 2 of 3 fields included.
464/// Omitted fields:
465/// - `OwningAccounts` — not selected in manifest
466#[derive(Debug, Clone, Default, Serialize, Deserialize)]
467#[serde(rename_all = "PascalCase")]
468pub struct ListMetricsResponse {
469 /// The metrics that match your request.
470 #[serde(default)]
471 #[serde(skip_serializing_if = "Vec::is_empty")]
472 pub metrics: Vec<Metric>,
473
474 /// The token that marks the start of the next batch of returned results.
475 #[serde(skip_serializing_if = "Option::is_none")]
476 pub next_token: Option<String>,
477}
478
479impl ListMetricsResponse {
480 #[cfg(any(test, feature = "test-support"))]
481 /// Create a fixture instance for testing.
482 pub fn fixture() -> Self {
483 Self {
484 metrics: vec![],
485 next_token: Some("test-next_token".into()),
486 }
487 }
488}
489
490/// Represents a specific metric.
491///
492/// **AWS API**: `cloudwatch.v1.Metric`
493/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//Metric>
494#[derive(Debug, Clone, Default, Serialize, Deserialize)]
495#[serde(rename_all = "PascalCase")]
496pub struct Metric {
497 /// The namespace of the metric.
498 #[serde(skip_serializing_if = "Option::is_none")]
499 pub namespace: Option<String>,
500
501 /// The name of the metric. This is a required field.
502 #[serde(skip_serializing_if = "Option::is_none")]
503 pub metric_name: Option<String>,
504
505 /// The dimensions for the metric.
506 #[serde(default)]
507 #[serde(skip_serializing_if = "Vec::is_empty")]
508 pub dimensions: Vec<Dimension>,
509}
510
511impl Metric {
512 #[cfg(any(test, feature = "test-support"))]
513 /// Create a fixture instance for testing.
514 pub fn fixture() -> Self {
515 Self {
516 namespace: Some("test-namespace".into()),
517 metric_name: Some("test-metric_name".into()),
518 dimensions: vec![],
519 }
520 }
521}
522
523/// Represents filters for a dimension.
524///
525/// **AWS API**: `cloudwatch.v1.DimensionFilter`
526/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//DimensionFilter>
527#[derive(Debug, Clone, Default, Serialize, Deserialize)]
528#[serde(rename_all = "PascalCase")]
529pub struct DimensionFilter {
530 /// The dimension name to be matched.
531 pub name: String,
532
533 /// The value of the dimension to be matched.
534 #[serde(skip_serializing_if = "Option::is_none")]
535 pub value: Option<String>,
536}
537
538impl DimensionFilter {
539 #[cfg(any(test, feature = "test-support"))]
540 /// Create a fixture instance for testing.
541 pub fn fixture() -> Self {
542 Self {
543 name: "test-name".into(),
544 value: Some("test-value".into()),
545 }
546 }
547}
548
549///
550/// **AWS API**: `cloudwatch.v1.DescribeAlarmsInput`
551/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//DescribeAlarmsInput>
552///
553/// ## Coverage
554/// 5 of 9 fields included.
555/// Omitted fields:
556/// - `AlarmTypes` — not selected in manifest
557/// - `ChildrenOfAlarmName` — not selected in manifest
558/// - `ParentsOfAlarmName` — not selected in manifest
559/// - `ActionPrefix` — not selected in manifest
560#[derive(Debug, Clone, Default, Serialize, Deserialize)]
561#[serde(rename_all = "PascalCase")]
562pub struct DescribeAlarmsInput {
563 /// The names of the alarms to retrieve information about.
564 #[serde(default)]
565 #[serde(skip_serializing_if = "Vec::is_empty")]
566 pub alarm_names: Vec<String>,
567
568 /// An alarm name prefix. If you specify this parameter, you receive information about all
569 /// alarms that have names that start with this prefix. If this parameter is specified, you
570 /// cannot specify AlarmNames.
571 #[serde(skip_serializing_if = "Option::is_none")]
572 pub alarm_name_prefix: Option<String>,
573
574 /// Specify this parameter to receive information only about alarms that are currently in
575 /// the state that you specify.
576 #[serde(skip_serializing_if = "Option::is_none")]
577 pub state_value: Option<String>,
578
579 /// The maximum number of alarm descriptions to retrieve.
580 #[serde(skip_serializing_if = "Option::is_none")]
581 pub max_records: Option<i32>,
582
583 /// The token returned by a previous call to indicate that there is more data available.
584 #[serde(skip_serializing_if = "Option::is_none")]
585 pub next_token: Option<String>,
586}
587
588impl DescribeAlarmsInput {
589 #[cfg(any(test, feature = "test-support"))]
590 /// Create a fixture instance for testing.
591 pub fn fixture() -> Self {
592 Self {
593 alarm_names: vec![],
594 alarm_name_prefix: Some("test-alarm_name_prefix".into()),
595 state_value: Some("test-state_value".into()),
596 max_records: Some(100),
597 next_token: Some("test-next_token".into()),
598 }
599 }
600}
601
602///
603/// **AWS API**: `cloudwatch.v1.DescribeAlarmsOutput`
604/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//DescribeAlarmsOutput>
605///
606/// ## Coverage
607/// 2 of 3 fields included.
608/// Omitted fields:
609/// - `CompositeAlarms` — not selected in manifest
610#[derive(Debug, Clone, Default, Serialize, Deserialize)]
611#[serde(rename_all = "PascalCase")]
612pub struct DescribeAlarmsResponse {
613 /// The information about any metric alarms returned by the operation.
614 #[serde(default)]
615 #[serde(skip_serializing_if = "Vec::is_empty")]
616 pub metric_alarms: Vec<MetricAlarm>,
617
618 /// The token that marks the start of the next batch of returned results.
619 #[serde(skip_serializing_if = "Option::is_none")]
620 pub next_token: Option<String>,
621}
622
623impl DescribeAlarmsResponse {
624 #[cfg(any(test, feature = "test-support"))]
625 /// Create a fixture instance for testing.
626 pub fn fixture() -> Self {
627 Self {
628 metric_alarms: vec![],
629 next_token: Some("test-next_token".into()),
630 }
631 }
632}
633
634/// The details about a metric alarm.
635///
636/// **AWS API**: `cloudwatch.v1.MetricAlarm`
637/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//MetricAlarm>
638///
639/// ## Coverage
640/// 19 of 29 fields included.
641/// Omitted fields:
642/// - `AlarmConfigurationUpdatedTimestamp` — not selected in manifest
643/// - `StateReasonData` — not selected in manifest
644/// - `StateUpdatedTimestamp` — not selected in manifest
645/// - `ExtendedStatistic` — not selected in manifest
646/// - `Unit` — not selected in manifest
647/// - `EvaluateLowSampleCountPercentile` — not selected in manifest
648/// - `Metrics` — not selected in manifest
649/// - `ThresholdMetricId` — not selected in manifest
650/// - `EvaluationState` — not selected in manifest
651/// - `StateTransitionedTimestamp` — not selected in manifest
652#[derive(Debug, Clone, Default, Serialize, Deserialize)]
653#[serde(rename_all = "PascalCase")]
654pub struct MetricAlarm {
655 /// The name of the alarm.
656 #[serde(skip_serializing_if = "Option::is_none")]
657 pub alarm_name: Option<String>,
658
659 /// The Amazon Resource Name (ARN) of the alarm.
660 #[serde(skip_serializing_if = "Option::is_none")]
661 pub alarm_arn: Option<String>,
662
663 /// The description of the alarm.
664 #[serde(skip_serializing_if = "Option::is_none")]
665 pub alarm_description: Option<String>,
666
667 /// Indicates whether actions should be executed during any changes to the alarm state.
668 #[serde(skip_serializing_if = "Option::is_none")]
669 pub actions_enabled: Option<bool>,
670
671 /// The actions to execute when this alarm transitions to the OK state from any other state.
672 /// Each action is specified as an Amazon Resource Name (ARN).
673 #[serde(default)]
674 #[serde(skip_serializing_if = "Vec::is_empty")]
675 pub ok_actions: Vec<String>,
676
677 /// The actions to execute when this alarm transitions to the ALARM state from any other
678 /// state. Each action is specified as an Amazon Resource Name (ARN).
679 #[serde(default)]
680 #[serde(skip_serializing_if = "Vec::is_empty")]
681 pub alarm_actions: Vec<String>,
682
683 /// The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from
684 /// any other state. Each action is specified as an Amazon Resource Name (ARN).
685 #[serde(default)]
686 #[serde(skip_serializing_if = "Vec::is_empty")]
687 pub insufficient_data_actions: Vec<String>,
688
689 /// The state value for the alarm.
690 #[serde(skip_serializing_if = "Option::is_none")]
691 pub state_value: Option<String>,
692
693 /// An explanation for the alarm state, in text format.
694 #[serde(skip_serializing_if = "Option::is_none")]
695 pub state_reason: Option<String>,
696
697 /// The name of the metric associated with the alarm, if this is an alarm based on a single
698 /// metric.
699 #[serde(skip_serializing_if = "Option::is_none")]
700 pub metric_name: Option<String>,
701
702 /// The namespace of the metric associated with the alarm.
703 #[serde(skip_serializing_if = "Option::is_none")]
704 pub namespace: Option<String>,
705
706 /// The statistic for the metric associated with the alarm, other than percentile. For
707 /// percentile statistics, use ExtendedStatistic.
708 #[serde(skip_serializing_if = "Option::is_none")]
709 pub statistic: Option<Statistic>,
710
711 /// The dimensions for the metric associated with the alarm.
712 #[serde(default)]
713 #[serde(skip_serializing_if = "Vec::is_empty")]
714 pub dimensions: Vec<Dimension>,
715
716 /// The period, in seconds, over which the statistic is applied.
717 #[serde(skip_serializing_if = "Option::is_none")]
718 pub period: Option<i32>,
719
720 /// The number of periods over which data is compared to the specified threshold.
721 #[serde(skip_serializing_if = "Option::is_none")]
722 pub evaluation_periods: Option<i32>,
723
724 /// The number of data points that must be breaching to trigger the alarm.
725 #[serde(skip_serializing_if = "Option::is_none")]
726 pub datapoints_to_alarm: Option<i32>,
727
728 /// The value to compare with the specified statistic.
729 #[serde(skip_serializing_if = "Option::is_none")]
730 pub threshold: Option<f64>,
731
732 /// The arithmetic operation to use when comparing the specified statistic and threshold.
733 /// The specified statistic value is used as the first operand.
734 #[serde(skip_serializing_if = "Option::is_none")]
735 pub comparison_operator: Option<ComparisonOperator>,
736
737 /// Sets how this alarm is to handle missing data points. The valid values are breaching,
738 /// notBreaching, ignore, and missing. For more information, see Configuring how CloudWatch
739 /// alarms treat missing data. If this parameter is omitted, the default behavior of missing
740 /// is used.
741 #[serde(skip_serializing_if = "Option::is_none")]
742 pub treat_missing_data: Option<String>,
743}
744
745impl MetricAlarm {
746 #[cfg(any(test, feature = "test-support"))]
747 /// Create a fixture instance for testing.
748 pub fn fixture() -> Self {
749 Self {
750 alarm_name: Some("test-alarm_name".into()),
751 alarm_arn: Some("test-alarm_arn".into()),
752 alarm_description: Some("test-alarm_description".into()),
753 actions_enabled: Some(false),
754 ok_actions: vec![],
755 alarm_actions: vec![],
756 insufficient_data_actions: vec![],
757 state_value: Some("test-state_value".into()),
758 state_reason: Some("test-state_reason".into()),
759 metric_name: Some("test-metric_name".into()),
760 namespace: Some("test-namespace".into()),
761 dimensions: vec![],
762 period: Some(100),
763 evaluation_periods: Some(100),
764 datapoints_to_alarm: Some(100),
765 treat_missing_data: Some("test-treat_missing_data".into()),
766 ..Default::default()
767 }
768 }
769}
770
771///
772/// **AWS API**: `cloudwatch.v1.PutMetricAlarmInput`
773/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//PutMetricAlarmInput>
774///
775/// ## Coverage
776/// 17 of 22 fields included.
777/// Omitted fields:
778/// - `ExtendedStatistic` — not selected in manifest
779/// - `EvaluateLowSampleCountPercentile` — not selected in manifest
780/// - `Metrics` — not selected in manifest
781/// - `Tags` — not selected in manifest
782/// - `ThresholdMetricId` — not selected in manifest
783#[derive(Debug, Clone, Default, Serialize, Deserialize)]
784#[serde(rename_all = "PascalCase")]
785pub struct PutMetricAlarmInput {
786 /// The name for the alarm. This name must be unique within the Region. The name must
787 /// contain only UTF-8 characters, and can't contain ASCII control characters
788 pub alarm_name: String,
789
790 /// The description for the alarm.
791 #[serde(skip_serializing_if = "Option::is_none")]
792 pub alarm_description: Option<String>,
793
794 /// Indicates whether actions should be executed during any changes to the alarm state. The
795 /// default is TRUE.
796 #[serde(skip_serializing_if = "Option::is_none")]
797 pub actions_enabled: Option<bool>,
798
799 /// The actions to execute when this alarm transitions to an OK state from any other state.
800 /// Each action is specified as an Amazon Resource Name (ARN). Valid values: EC2 actions:
801 /// arn:aws:automate:region:ec2:stop arn:aws:automate:region:ec2:terminate
802 /// arn:aws:automate:region:ec2:reboot arn:aws:automate:region:ec2:recover
803 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0
804 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0
805 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0
806 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0 Autoscaling
807 /// action: arn:aws:autoscaling:region:account-id:scalingPolicy:policy-
808 /// id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name Lambda
809 /// actions: Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-
810 /// id:function:function-name Invoke a specific version of a Lambda function:
811 /// arn:aws:lambda:region:account-id:function:function-name:version-number Invoke a function
812 /// by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-
813 /// name:alias-name SNS notification action: arn:aws:sns:region:account-id:sns-topic-name
814 /// SSM integration actions: arn:aws:ssm:region:account-
815 /// id:opsitem:severity#CATEGORY=category-name arn:aws:ssm-incidents::account-
816 /// id:responseplan/response-plan-name
817 #[serde(default)]
818 #[serde(skip_serializing_if = "Vec::is_empty")]
819 pub ok_actions: Vec<String>,
820
821 /// The actions to execute when this alarm transitions to the ALARM state from any other
822 /// state. Each action is specified as an Amazon Resource Name (ARN). Valid values: EC2
823 /// actions: arn:aws:automate:region:ec2:stop arn:aws:automate:region:ec2:terminate
824 /// arn:aws:automate:region:ec2:reboot arn:aws:automate:region:ec2:recover
825 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0
826 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0
827 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0
828 /// arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0 Autoscaling
829 /// action: arn:aws:autoscaling:region:account-id:scalingPolicy:policy-
830 /// id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name Lambda
831 /// actions: Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-
832 /// id:function:function-name Invoke a specific version of a Lambda function:
833 /// arn:aws:lambda:region:account-id:function:function-name:version-number Invoke a function
834 /// by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-
835 /// name:alias-name SNS notification action: arn:aws:sns:region:account-id:sns-topic-name
836 /// SSM integration actions: arn:aws:ssm:region:account-
837 /// id:opsitem:severity#CATEGORY=category-name arn:aws:ssm-incidents::account-
838 /// id:responseplan/response-plan-name Start a Amazon Q Developer operational investigation
839 /// arn:aws:aiops:region:account-id:investigation-group:investigation-group-id
840 #[serde(default)]
841 #[serde(skip_serializing_if = "Vec::is_empty")]
842 pub alarm_actions: Vec<String>,
843
844 /// The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from
845 /// any other state. Each action is specified as an Amazon Resource Name (ARN). Valid
846 /// values: EC2 actions: arn:aws:automate:region:ec2:stop
847 /// arn:aws:automate:region:ec2:terminate arn:aws:automate:region:ec2:reboot
848 /// arn:aws:automate:region:ec2:recover arn:aws:swf:region:account-
849 /// id:action/actions/AWS_EC2.InstanceId.Stop/1.0 arn:aws:swf:region:account-
850 /// id:action/actions/AWS_EC2.InstanceId.Terminate/1.0 arn:aws:swf:region:account-
851 /// id:action/actions/AWS_EC2.InstanceId.Reboot/1.0 arn:aws:swf:region:account-
852 /// id:action/actions/AWS_EC2.InstanceId.Recover/1.0 Autoscaling action:
853 /// arn:aws:autoscaling:region:account-id:scalingPolicy:policy-
854 /// id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name Lambda
855 /// actions: Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-
856 /// id:function:function-name Invoke a specific version of a Lambda function:
857 /// arn:aws:lambda:region:account-id:function:function-name:version-number Invoke a function
858 /// by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-
859 /// name:alias-name SNS notification action: arn:aws:sns:region:account-id:sns-topic-name
860 /// SSM integration actions: arn:aws:ssm:region:account-
861 /// id:opsitem:severity#CATEGORY=category-name arn:aws:ssm-incidents::account-
862 /// id:responseplan/response-plan-name
863 #[serde(default)]
864 #[serde(skip_serializing_if = "Vec::is_empty")]
865 pub insufficient_data_actions: Vec<String>,
866
867 /// The name for the metric associated with the alarm. For each PutMetricAlarm operation,
868 /// you must specify either MetricName or a Metrics array. If you are creating an alarm
869 /// based on a math expression, you cannot specify this parameter, or any of the Namespace,
870 /// Dimensions, Period, Unit, Statistic, or ExtendedStatistic parameters. Instead, you
871 /// specify all this information in the Metrics array.
872 #[serde(skip_serializing_if = "Option::is_none")]
873 pub metric_name: Option<String>,
874
875 /// The namespace for the metric associated specified in MetricName.
876 #[serde(skip_serializing_if = "Option::is_none")]
877 pub namespace: Option<String>,
878
879 /// The statistic for the metric specified in MetricName, other than percentile. For
880 /// percentile statistics, use ExtendedStatistic. When you call PutMetricAlarm and specify a
881 /// MetricName, you must specify either Statistic or ExtendedStatistic, but not both.
882 #[serde(skip_serializing_if = "Option::is_none")]
883 pub statistic: Option<Statistic>,
884
885 /// The dimensions for the metric specified in MetricName.
886 #[serde(default)]
887 #[serde(skip_serializing_if = "Vec::is_empty")]
888 pub dimensions: Vec<Dimension>,
889
890 /// The length, in seconds, used each time the metric specified in MetricName is evaluated.
891 /// Valid values are 10, 20, 30, and any multiple of 60. Period is required for alarms based
892 /// on static thresholds. If you are creating an alarm based on a metric math expression,
893 /// you specify the period for each metric within the objects in the Metrics array. Be sure
894 /// to specify 10, 20, or 30 only for metrics that are stored by a PutMetricData call with a
895 /// StorageResolution of 1. If you specify a period of 10, 20, or 30 for a metric that does
896 /// not have sub-minute resolution, the alarm still attempts to gather data at the period
897 /// rate that you specify. In this case, it does not receive data for the attempts that do
898 /// not correspond to a one-minute data resolution, and the alarm might often lapse into
899 /// INSUFFICENT_DATA status. Specifying 10, 20, or 30 also sets this alarm as a high-
900 /// resolution alarm, which has a higher charge than other alarms. For more information
901 /// about pricing, see Amazon CloudWatch Pricing. An alarm's total current evaluation period
902 /// can be no longer than seven days, so Period multiplied by EvaluationPeriods can't be
903 /// more than 604,800 seconds. For alarms with a period of less than one hour (3,600
904 /// seconds), the total evaluation period can't be longer than one day (86,400 seconds).
905 #[serde(skip_serializing_if = "Option::is_none")]
906 pub period: Option<i32>,
907
908 /// The unit of measure for the statistic. For example, the units for the Amazon EC2
909 /// NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that an instance
910 /// receives on all network interfaces. You can also specify a unit when you create a custom
911 /// metric. Units help provide conceptual meaning to your data. Metric data points that
912 /// specify a unit of measure, such as Percent, are aggregated separately. If you are
913 /// creating an alarm based on a metric math expression, you can specify the unit for each
914 /// metric (if needed) within the objects in the Metrics array. If you don't specify Unit,
915 /// CloudWatch retrieves all unit types that have been published for the metric and attempts
916 /// to evaluate the alarm. Usually, metrics are published with only one unit, so the alarm
917 /// works as intended. However, if the metric is published with multiple types of units and
918 /// you don't specify a unit, the alarm's behavior is not defined and it behaves
919 /// unpredictably. We recommend omitting Unit so that you don't inadvertently specify an
920 /// incorrect unit that is not published for this metric. Doing so causes the alarm to be
921 /// stuck in the INSUFFICIENT DATA state.
922 #[serde(skip_serializing_if = "Option::is_none")]
923 pub unit: Option<StandardUnit>,
924
925 /// The number of periods over which data is compared to the specified threshold. If you are
926 /// setting an alarm that requires that a number of consecutive data points be breaching to
927 /// trigger the alarm, this value specifies that number. If you are setting an "M out of N"
928 /// alarm, this value is the N.
929 pub evaluation_periods: i32,
930
931 /// The number of data points that must be breaching to trigger the alarm. This is used only
932 /// if you are setting an "M out of N" alarm. In that case, this value is the M. For more
933 /// information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
934 #[serde(skip_serializing_if = "Option::is_none")]
935 pub datapoints_to_alarm: Option<i32>,
936
937 /// The value against which the specified statistic is compared. This parameter is required
938 /// for alarms based on static thresholds, but should not be used for alarms based on
939 /// anomaly detection models.
940 #[serde(skip_serializing_if = "Option::is_none")]
941 pub threshold: Option<f64>,
942
943 /// The arithmetic operation to use when comparing the specified statistic and threshold.
944 /// The specified statistic value is used as the first operand. The values
945 /// LessThanLowerOrGreaterThanUpperThreshold, LessThanLowerThreshold, and
946 /// GreaterThanUpperThreshold are used only for alarms based on anomaly detection models.
947 #[serde(skip_serializing_if = "Option::is_none")]
948 pub comparison_operator: Option<ComparisonOperator>,
949
950 /// Sets how this alarm is to handle missing data points. If TreatMissingData is omitted,
951 /// the default behavior of missing is used. For more information, see Configuring How
952 /// CloudWatch Alarms Treats Missing Data. Valid Values: breaching | notBreaching | ignore |
953 /// missing Alarms that evaluate metrics in the AWS/DynamoDB namespace always ignore missing
954 /// data even if you choose a different option for TreatMissingData. When an AWS/DynamoDB
955 /// metric has missing data, alarms that evaluate that metric remain in their current state.
956 #[serde(skip_serializing_if = "Option::is_none")]
957 pub treat_missing_data: Option<String>,
958}
959
960impl PutMetricAlarmInput {
961 #[cfg(any(test, feature = "test-support"))]
962 /// Create a fixture instance for testing.
963 pub fn fixture() -> Self {
964 Self {
965 alarm_name: "test-alarm_name".into(),
966 alarm_description: Some("test-alarm_description".into()),
967 actions_enabled: Some(false),
968 ok_actions: vec![],
969 alarm_actions: vec![],
970 insufficient_data_actions: vec![],
971 metric_name: Some("test-metric_name".into()),
972 namespace: Some("test-namespace".into()),
973 dimensions: vec![],
974 period: Some(100),
975 evaluation_periods: 100,
976 datapoints_to_alarm: Some(100),
977 treat_missing_data: Some("test-treat_missing_data".into()),
978 ..Default::default()
979 }
980 }
981}
982
983///
984/// **AWS API**: `cloudwatch.v1.DeleteAlarmsInput`
985/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//DeleteAlarmsInput>
986#[derive(Debug, Clone, Default, Serialize, Deserialize)]
987#[serde(rename_all = "PascalCase")]
988pub struct DeleteAlarmsInput {
989 /// The alarms to be deleted. Do not enclose the alarm names in quote marks.
990 #[serde(default)]
991 pub alarm_names: Vec<String>,
992}
993
994impl DeleteAlarmsInput {
995 #[cfg(any(test, feature = "test-support"))]
996 /// Create a fixture instance for testing.
997 pub fn fixture() -> Self {
998 Self {
999 alarm_names: vec![],
1000 }
1001 }
1002}
1003
1004///
1005/// **AWS API**: `cloudwatch.v1.GetMetricDataInput`
1006/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//GetMetricDataInput>
1007#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1008#[serde(rename_all = "PascalCase")]
1009pub struct GetMetricDataInput {
1010 /// The metric queries to be returned. A single GetMetricData call can include as many as
1011 /// 500 MetricDataQuery structures. Each of these structures can specify either a metric to
1012 /// retrieve, a Metrics Insights query, or a math expression to perform on retrieved data.
1013 #[serde(default)]
1014 pub metric_data_queries: Vec<MetricDataQuery>,
1015
1016 /// The time stamp indicating the earliest data to be returned. The value specified is
1017 /// inclusive; results include data points with the specified time stamp. CloudWatch rounds
1018 /// the specified time stamp as follows: Start time less than 15 days ago
1019 /// - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to
1020 /// 12:32:00. Start time between 15 and 63 days ago
1021 /// - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded
1022 /// down to 12:30:00. Start time greater than 63 days ago
1023 /// - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down
1024 /// to 12:00:00. If you set Period to 5, 10, 20, or 30, the start time of your request is
1025 /// rounded down to the nearest time that corresponds to even 5-, 10-, 20-, or 30-second
1026 /// divisions of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for the
1027 /// previous 10-second period, the start time of your request is rounded down and you
1028 /// receive data from 01:05:10 to 01:05:20. If you make a query at 15:07:17 for the
1029 /// previous 5 minutes of data, using a period of 5 seconds, you receive data timestamped
1030 /// between 15:02:15 and 15:07:15. For better performance, specify StartTime and EndTime
1031 /// values that align with the value of the metric's Period and sync up with the beginning
1032 /// and end of an hour. For example, if the Period of a metric is 5 minutes, specifying
1033 /// 12:05 or 12:30 as StartTime can get a faster response from CloudWatch than setting
1034 /// 12:07 or 12:29 as the StartTime.
1035 pub start_time: String,
1036
1037 /// The time stamp indicating the latest data to be returned. The value specified is
1038 /// exclusive; results include data points up to the specified time stamp. For better
1039 /// performance, specify StartTime and EndTime values that align with the value of the
1040 /// metric's Period and sync up with the beginning and end of an hour. For example, if the
1041 /// Period of a metric is 5 minutes, specifying 12:05 or 12:30 as EndTime can get a faster
1042 /// response from CloudWatch than setting 12:07 or 12:29 as the EndTime.
1043 pub end_time: String,
1044
1045 /// Include this value, if it was returned by the previous GetMetricData operation, to get
1046 /// the next set of data points.
1047 #[serde(skip_serializing_if = "Option::is_none")]
1048 pub next_token: Option<String>,
1049
1050 /// The order in which data points should be returned. TimestampDescending returns the
1051 /// newest data first and paginates when the MaxDatapoints limit is reached.
1052 /// TimestampAscending returns the oldest data first and paginates when the MaxDatapoints
1053 /// limit is reached. If you omit this parameter, the default of TimestampDescending is
1054 /// used.
1055 #[serde(skip_serializing_if = "Option::is_none")]
1056 pub scan_by: Option<ScanBy>,
1057
1058 /// The maximum number of data points the request should return before paginating. If you
1059 /// omit this, the default of 100,800 is used.
1060 #[serde(skip_serializing_if = "Option::is_none")]
1061 pub max_datapoints: Option<i32>,
1062
1063 /// This structure includes the Timezone parameter, which you can use to specify your time
1064 /// zone so that the labels of returned data display the correct time for your time zone.
1065 #[serde(skip_serializing_if = "Option::is_none")]
1066 pub label_options: Option<LabelOptions>,
1067}
1068
1069impl GetMetricDataInput {
1070 #[cfg(any(test, feature = "test-support"))]
1071 /// Create a fixture instance for testing.
1072 pub fn fixture() -> Self {
1073 Self {
1074 metric_data_queries: vec![],
1075 start_time: "test-start_time".into(),
1076 end_time: "test-end_time".into(),
1077 next_token: Some("test-next_token".into()),
1078 max_datapoints: Some(100),
1079 label_options: Some(LabelOptions::fixture()),
1080 ..Default::default()
1081 }
1082 }
1083}
1084
1085///
1086/// **AWS API**: `cloudwatch.v1.GetMetricDataOutput`
1087/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//GetMetricDataOutput>
1088#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1089#[serde(rename_all = "PascalCase")]
1090pub struct GetMetricDataResponse {
1091 /// The metrics that are returned, including the metric name, namespace, and dimensions.
1092 #[serde(default)]
1093 #[serde(skip_serializing_if = "Vec::is_empty")]
1094 pub metric_data_results: Vec<MetricDataResult>,
1095
1096 /// A token that marks the next batch of returned results.
1097 #[serde(skip_serializing_if = "Option::is_none")]
1098 pub next_token: Option<String>,
1099
1100 /// Contains a message about this GetMetricData operation, if the operation results in such
1101 /// a message. An example of a message that might be returned is Maximum number of allowed
1102 /// metrics exceeded. If there is a message, as much of the operation as possible is still
1103 /// executed. A message appears here only if it is related to the global GetMetricData
1104 /// operation. Any message about a specific metric returned by the operation appears in the
1105 /// MetricDataResult object returned for that metric.
1106 #[serde(default)]
1107 #[serde(skip_serializing_if = "Vec::is_empty")]
1108 pub messages: Vec<MessageData>,
1109}
1110
1111impl GetMetricDataResponse {
1112 #[cfg(any(test, feature = "test-support"))]
1113 /// Create a fixture instance for testing.
1114 pub fn fixture() -> Self {
1115 Self {
1116 metric_data_results: vec![],
1117 next_token: Some("test-next_token".into()),
1118 messages: vec![],
1119 }
1120 }
1121}
1122
1123/// This structure is used in both GetMetricData and PutMetricAlarm. The supported use of this
1124/// structure is different for those two operations. When used in GetMetricData, it indicates
1125/// the metric data to return, and whether this call is just retrieving a batch set of data for
1126/// one metric, or is performing a Metrics Insights query or a math expression. A single
1127/// GetMetricData call can include up to 500 MetricDataQuery structures. When used in
1128/// PutMetricAlarm, it enables you to create an alarm based on a metric math expression. Each
1129/// MetricDataQuery in the array specifies either a metric to retrieve, or a math expression to
1130/// be performed on retrieved metrics. A single PutMetricAlarm call can include up to 20
1131/// MetricDataQuery structures in the array. The 20 structures can include as many as 10
1132/// structures that contain a MetricStat parameter to retrieve a metric, and as many as 10
1133/// structures that contain the Expression parameter to perform a math expression. Of those
1134/// Expression structures, one must have true as the value for ReturnData. The result of this
1135/// expression is the value the alarm watches. Any expression used in a PutMetricAlarm operation
1136/// must return a single time series. For more information, see Metric Math Syntax and Functions
1137/// in the Amazon CloudWatch User Guide. Some of the parameters of this structure also have
1138/// different uses whether you are using this structure in a GetMetricData operation or a
1139/// PutMetricAlarm operation. These differences are explained in the following parameter list.
1140///
1141/// **AWS API**: `cloudwatch.v1.MetricDataQuery`
1142/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//MetricDataQuery>
1143#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1144#[serde(rename_all = "PascalCase")]
1145pub struct MetricDataQuery {
1146 /// A short name used to tie this object to the results in the response. This name must be
1147 /// unique within a single call to GetMetricData. If you are performing math expressions on
1148 /// this set of data, this name represents that data and can serve as a variable in the
1149 /// mathematical expression. The valid characters are letters, numbers, and underscore. The
1150 /// first character must be a lowercase letter.
1151 pub id: String,
1152
1153 /// The metric to be returned, along with statistics, period, and units. Use this parameter
1154 /// only if this object is retrieving a metric and not performing a math expression on
1155 /// returned data. Within one MetricDataQuery object, you must specify either Expression or
1156 /// MetricStat but not both.
1157 #[serde(skip_serializing_if = "Option::is_none")]
1158 pub metric_stat: Option<MetricStat>,
1159
1160 /// This field can contain either a Metrics Insights query, or a metric math expression to
1161 /// be performed on the returned data. For more information about Metrics Insights queries,
1162 /// see Metrics Insights query components and syntax in the Amazon CloudWatch User Guide. A
1163 /// math expression can use the Id of the other metrics or queries to refer to those
1164 /// metrics, and can also use the Id of other expressions to use the result of those
1165 /// expressions. For more information about metric math expressions, see Metric Math Syntax
1166 /// and Functions in the Amazon CloudWatch User Guide. Within each MetricDataQuery object,
1167 /// you must specify either Expression or MetricStat but not both.
1168 #[serde(skip_serializing_if = "Option::is_none")]
1169 pub expression: Option<String>,
1170
1171 /// A human-readable label for this metric or expression. This is especially useful if this
1172 /// is an expression, so that you know what the value represents. If the metric or
1173 /// expression is shown in a CloudWatch dashboard widget, the label is shown. If Label is
1174 /// omitted, CloudWatch generates a default. You can put dynamic expressions into a label,
1175 /// so that it is more descriptive. For more information, see Using Dynamic Labels.
1176 #[serde(skip_serializing_if = "Option::is_none")]
1177 pub label: Option<String>,
1178
1179 /// When used in GetMetricData, this option indicates whether to return the timestamps and
1180 /// raw data values of this metric. If you are performing this call just to do math
1181 /// expressions and do not also need the raw data returned, you can specify false. If you
1182 /// omit this, the default of true is used. When used in PutMetricAlarm, specify true for
1183 /// the one expression result to use as the alarm. For all other metrics and expressions in
1184 /// the same PutMetricAlarm operation, specify ReturnData as False.
1185 #[serde(skip_serializing_if = "Option::is_none")]
1186 pub return_data: Option<bool>,
1187
1188 /// The granularity, in seconds, of the returned data points. For metrics with regular
1189 /// resolution, a period can be as short as one minute (60 seconds) and must be a multiple
1190 /// of 60. For high-resolution metrics that are collected at intervals of less than one
1191 /// minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution
1192 /// metrics are those metrics stored by a PutMetricData operation that includes a
1193 /// StorageResolution of 1 second.
1194 #[serde(skip_serializing_if = "Option::is_none")]
1195 pub period: Option<i32>,
1196
1197 /// The ID of the account where the metrics are located. If you are performing a
1198 /// GetMetricData operation in a monitoring account, use this to specify which account to
1199 /// retrieve this metric from. If you are performing a PutMetricAlarm operation, use this to
1200 /// specify which account contains the metric that the alarm is watching.
1201 #[serde(skip_serializing_if = "Option::is_none")]
1202 pub account_id: Option<String>,
1203}
1204
1205impl MetricDataQuery {
1206 #[cfg(any(test, feature = "test-support"))]
1207 /// Create a fixture instance for testing.
1208 pub fn fixture() -> Self {
1209 Self {
1210 id: "test-id".into(),
1211 metric_stat: Some(MetricStat::fixture()),
1212 expression: Some("test-expression".into()),
1213 label: Some("test-label".into()),
1214 return_data: Some(false),
1215 period: Some(100),
1216 account_id: Some("test-account_id".into()),
1217 }
1218 }
1219}
1220
1221/// A GetMetricData call returns an array of MetricDataResult structures. Each of these
1222/// structures includes the data points for that metric, along with the timestamps of those data
1223/// points and other identifying information.
1224///
1225/// **AWS API**: `cloudwatch.v1.MetricDataResult`
1226/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//MetricDataResult>
1227#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1228#[serde(rename_all = "PascalCase")]
1229pub struct MetricDataResult {
1230 /// The short name you specified to represent this metric.
1231 #[serde(skip_serializing_if = "Option::is_none")]
1232 pub id: Option<String>,
1233
1234 /// The human-readable label associated with the data.
1235 #[serde(skip_serializing_if = "Option::is_none")]
1236 pub label: Option<String>,
1237
1238 /// The timestamps for the data points, formatted in Unix timestamp format. The number of
1239 /// timestamps always matches the number of values and the value for Timestamps[x] is
1240 /// Values[x].
1241 #[serde(default)]
1242 #[serde(skip_serializing_if = "Vec::is_empty")]
1243 pub timestamps: Vec<String>,
1244
1245 /// The data points for the metric corresponding to Timestamps. The number of values always
1246 /// matches the number of timestamps and the timestamp for Values[x] is Timestamps[x].
1247 #[serde(default)]
1248 #[serde(skip_serializing_if = "Vec::is_empty")]
1249 pub values: Vec<f64>,
1250
1251 /// The status of the returned data. Complete indicates that all data points in the
1252 /// requested time range were returned. PartialData means that an incomplete set of data
1253 /// points were returned. You can use the NextToken value that was returned and repeat your
1254 /// request to get more data points. NextToken is not returned if you are performing a math
1255 /// expression. InternalError indicates that an error occurred. Retry your request using
1256 /// NextToken, if present.
1257 #[serde(skip_serializing_if = "Option::is_none")]
1258 pub status_code: Option<StatusCode>,
1259
1260 /// A list of messages with additional information about the data returned.
1261 #[serde(default)]
1262 #[serde(skip_serializing_if = "Vec::is_empty")]
1263 pub messages: Vec<MessageData>,
1264}
1265
1266impl MetricDataResult {
1267 #[cfg(any(test, feature = "test-support"))]
1268 /// Create a fixture instance for testing.
1269 pub fn fixture() -> Self {
1270 Self {
1271 id: Some("test-id".into()),
1272 label: Some("test-label".into()),
1273 timestamps: vec![],
1274 values: vec![],
1275 messages: vec![],
1276 ..Default::default()
1277 }
1278 }
1279}
1280
1281/// This structure defines the metric to be returned, along with the statistics, period, and
1282/// units.
1283///
1284/// **AWS API**: `cloudwatch.v1.MetricStat`
1285/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//MetricStat>
1286#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1287#[serde(rename_all = "PascalCase")]
1288pub struct MetricStat {
1289 /// The metric to return, including the metric name, namespace, and dimensions.
1290 pub metric: Metric,
1291
1292 /// The granularity, in seconds, of the returned data points. For metrics with regular
1293 /// resolution, a period can be as short as one minute (60 seconds) and must be a multiple
1294 /// of 60. For high-resolution metrics that are collected at intervals of less than one
1295 /// minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution
1296 /// metrics are those metrics stored by a PutMetricData call that includes a
1297 /// StorageResolution of 1 second. If the StartTime parameter specifies a time stamp that is
1298 /// greater than 3 hours ago, you must specify the period as follows or no data points in
1299 /// that time range is returned: Start time between 3 hours and 15 days ago
1300 /// - Use a multiple of 60 seconds (1 minute). Start time between 15 and 63 days ago
1301 /// - Use a multiple of 300 seconds (5 minutes). Start time greater than 63 days ago
1302 /// - Use a multiple of 3600 seconds (1 hour).
1303 pub period: i32,
1304
1305 /// The statistic to return. It can include any CloudWatch statistic or extended statistic.
1306 pub stat: String,
1307
1308 /// When you are using a Put operation, this defines what unit you want to use when storing
1309 /// the metric. In a Get operation, if you omit Unit then all data that was collected with
1310 /// any unit is returned, along with the corresponding units that were specified when the
1311 /// data was reported to CloudWatch. If you specify a unit, the operation returns only data
1312 /// that was collected with that unit specified. If you specify a unit that does not match
1313 /// the data collected, the results of the operation are null. CloudWatch does not perform
1314 /// unit conversions.
1315 #[serde(skip_serializing_if = "Option::is_none")]
1316 pub unit: Option<StandardUnit>,
1317}
1318
1319impl MetricStat {
1320 #[cfg(any(test, feature = "test-support"))]
1321 /// Create a fixture instance for testing.
1322 pub fn fixture() -> Self {
1323 Self {
1324 metric: Metric::fixture(),
1325 period: 100,
1326 stat: "test-stat".into(),
1327 ..Default::default()
1328 }
1329 }
1330}
1331
1332/// This structure includes the Timezone parameter, which you can use to specify your time zone
1333/// so that the labels that are associated with returned metrics display the correct time for
1334/// your time zone. The Timezone value affects a label only if you have a time-based dynamic
1335/// expression in the label. For more information about dynamic expressions in labels, see Using
1336/// Dynamic Labels.
1337///
1338/// **AWS API**: `cloudwatch.v1.LabelOptions`
1339/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//LabelOptions>
1340#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1341#[serde(rename_all = "PascalCase")]
1342pub struct LabelOptions {
1343 /// The time zone to use for metric data return in this operation. The format is + or
1344 /// - followed by four digits. The first two digits indicate the number of hours ahead or
1345 /// behind of UTC, and the final two digits are the number of minutes. For example, +0130
1346 /// indicates a time zone that is 1 hour and 30 minutes ahead of UTC. The default is
1347 /// +0000.
1348 #[serde(skip_serializing_if = "Option::is_none")]
1349 pub timezone: Option<String>,
1350}
1351
1352impl LabelOptions {
1353 #[cfg(any(test, feature = "test-support"))]
1354 /// Create a fixture instance for testing.
1355 pub fn fixture() -> Self {
1356 Self {
1357 timezone: Some("test-timezone".into()),
1358 }
1359 }
1360}
1361
1362/// A message returned by the GetMetricDataAPI, including a code and a description. If a cross-
1363/// Region GetMetricData operation fails with a code of Forbidden and a value of Authentication
1364/// too complex to retrieve cross region data, you can correct the problem by running the
1365/// GetMetricData operation in the same Region where the metric data is.
1366///
1367/// **AWS API**: `cloudwatch.v1.MessageData`
1368/// **Reference**: <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference//MessageData>
1369#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1370#[serde(rename_all = "PascalCase")]
1371pub struct MessageData {
1372 /// The error code or status code associated with the message.
1373 #[serde(skip_serializing_if = "Option::is_none")]
1374 pub code: Option<String>,
1375
1376 /// The message text.
1377 #[serde(skip_serializing_if = "Option::is_none")]
1378 pub value: Option<String>,
1379}
1380
1381impl MessageData {
1382 #[cfg(any(test, feature = "test-support"))]
1383 /// Create a fixture instance for testing.
1384 pub fn fixture() -> Self {
1385 Self {
1386 code: Some("test-code".into()),
1387 value: Some("test-value".into()),
1388 }
1389 }
1390}