1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>This structure defines the metric used for a service level indicator, including the metric name, namespace, and dimensions</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Metric {
/// <p>The namespace of the metric. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace">Namespaces</a>.</p>
pub namespace: ::std::option::Option<::std::string::String>,
/// <p>The name of the metric to use.</p>
pub metric_name: ::std::option::Option<::std::string::String>,
/// <p>An array of one or more dimensions to use to define the metric that you want to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension">Dimensions</a>.</p>
pub dimensions: ::std::option::Option<::std::vec::Vec<crate::types::Dimension>>,
}
impl Metric {
/// <p>The namespace of the metric. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace">Namespaces</a>.</p>
pub fn namespace(&self) -> ::std::option::Option<&str> {
self.namespace.as_deref()
}
/// <p>The name of the metric to use.</p>
pub fn metric_name(&self) -> ::std::option::Option<&str> {
self.metric_name.as_deref()
}
/// <p>An array of one or more dimensions to use to define the metric that you want to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension">Dimensions</a>.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.dimensions.is_none()`.
pub fn dimensions(&self) -> &[crate::types::Dimension] {
self.dimensions.as_deref().unwrap_or_default()
}
}
impl Metric {
/// Creates a new builder-style object to manufacture [`Metric`](crate::types::Metric).
pub fn builder() -> crate::types::builders::MetricBuilder {
crate::types::builders::MetricBuilder::default()
}
}
/// A builder for [`Metric`](crate::types::Metric).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct MetricBuilder {
pub(crate) namespace: ::std::option::Option<::std::string::String>,
pub(crate) metric_name: ::std::option::Option<::std::string::String>,
pub(crate) dimensions: ::std::option::Option<::std::vec::Vec<crate::types::Dimension>>,
}
impl MetricBuilder {
/// <p>The namespace of the metric. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace">Namespaces</a>.</p>
pub fn namespace(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.namespace = ::std::option::Option::Some(input.into());
self
}
/// <p>The namespace of the metric. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace">Namespaces</a>.</p>
pub fn set_namespace(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.namespace = input;
self
}
/// <p>The namespace of the metric. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace">Namespaces</a>.</p>
pub fn get_namespace(&self) -> &::std::option::Option<::std::string::String> {
&self.namespace
}
/// <p>The name of the metric to use.</p>
pub fn metric_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.metric_name = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the metric to use.</p>
pub fn set_metric_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.metric_name = input;
self
}
/// <p>The name of the metric to use.</p>
pub fn get_metric_name(&self) -> &::std::option::Option<::std::string::String> {
&self.metric_name
}
/// Appends an item to `dimensions`.
///
/// To override the contents of this collection use [`set_dimensions`](Self::set_dimensions).
///
/// <p>An array of one or more dimensions to use to define the metric that you want to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension">Dimensions</a>.</p>
pub fn dimensions(mut self, input: crate::types::Dimension) -> Self {
let mut v = self.dimensions.unwrap_or_default();
v.push(input);
self.dimensions = ::std::option::Option::Some(v);
self
}
/// <p>An array of one or more dimensions to use to define the metric that you want to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension">Dimensions</a>.</p>
pub fn set_dimensions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Dimension>>) -> Self {
self.dimensions = input;
self
}
/// <p>An array of one or more dimensions to use to define the metric that you want to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension">Dimensions</a>.</p>
pub fn get_dimensions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Dimension>> {
&self.dimensions
}
/// Consumes the builder and constructs a [`Metric`](crate::types::Metric).
pub fn build(self) -> crate::types::Metric {
crate::types::Metric {
namespace: self.namespace,
metric_name: self.metric_name,
dimensions: self.dimensions,
}
}
}