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
103
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The metric you want to retain. Dimensions are optional.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct MetricToRetain {
    /// <p>What is measured by the behavior.</p>
    pub metric: ::std::string::String,
    /// <p>The dimension of a metric. This can't be used with custom metrics.</p>
    pub metric_dimension: ::std::option::Option<crate::types::MetricDimension>,
    /// <p>The value indicates exporting metrics related to the <code>MetricToRetain </code> when it's true.</p>
    pub export_metric: ::std::option::Option<bool>,
}
impl MetricToRetain {
    /// <p>What is measured by the behavior.</p>
    pub fn metric(&self) -> &str {
        use std::ops::Deref;
        self.metric.deref()
    }
    /// <p>The dimension of a metric. This can't be used with custom metrics.</p>
    pub fn metric_dimension(&self) -> ::std::option::Option<&crate::types::MetricDimension> {
        self.metric_dimension.as_ref()
    }
    /// <p>The value indicates exporting metrics related to the <code>MetricToRetain </code> when it's true.</p>
    pub fn export_metric(&self) -> ::std::option::Option<bool> {
        self.export_metric
    }
}
impl MetricToRetain {
    /// Creates a new builder-style object to manufacture [`MetricToRetain`](crate::types::MetricToRetain).
    pub fn builder() -> crate::types::builders::MetricToRetainBuilder {
        crate::types::builders::MetricToRetainBuilder::default()
    }
}

/// A builder for [`MetricToRetain`](crate::types::MetricToRetain).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct MetricToRetainBuilder {
    pub(crate) metric: ::std::option::Option<::std::string::String>,
    pub(crate) metric_dimension: ::std::option::Option<crate::types::MetricDimension>,
    pub(crate) export_metric: ::std::option::Option<bool>,
}
impl MetricToRetainBuilder {
    /// <p>What is measured by the behavior.</p>
    /// This field is required.
    pub fn metric(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.metric = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>What is measured by the behavior.</p>
    pub fn set_metric(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.metric = input;
        self
    }
    /// <p>What is measured by the behavior.</p>
    pub fn get_metric(&self) -> &::std::option::Option<::std::string::String> {
        &self.metric
    }
    /// <p>The dimension of a metric. This can't be used with custom metrics.</p>
    pub fn metric_dimension(mut self, input: crate::types::MetricDimension) -> Self {
        self.metric_dimension = ::std::option::Option::Some(input);
        self
    }
    /// <p>The dimension of a metric. This can't be used with custom metrics.</p>
    pub fn set_metric_dimension(mut self, input: ::std::option::Option<crate::types::MetricDimension>) -> Self {
        self.metric_dimension = input;
        self
    }
    /// <p>The dimension of a metric. This can't be used with custom metrics.</p>
    pub fn get_metric_dimension(&self) -> &::std::option::Option<crate::types::MetricDimension> {
        &self.metric_dimension
    }
    /// <p>The value indicates exporting metrics related to the <code>MetricToRetain </code> when it's true.</p>
    pub fn export_metric(mut self, input: bool) -> Self {
        self.export_metric = ::std::option::Option::Some(input);
        self
    }
    /// <p>The value indicates exporting metrics related to the <code>MetricToRetain </code> when it's true.</p>
    pub fn set_export_metric(mut self, input: ::std::option::Option<bool>) -> Self {
        self.export_metric = input;
        self
    }
    /// <p>The value indicates exporting metrics related to the <code>MetricToRetain </code> when it's true.</p>
    pub fn get_export_metric(&self) -> &::std::option::Option<bool> {
        &self.export_metric
    }
    /// Consumes the builder and constructs a [`MetricToRetain`](crate::types::MetricToRetain).
    /// This method will fail if any of the following fields are not set:
    /// - [`metric`](crate::types::builders::MetricToRetainBuilder::metric)
    pub fn build(self) -> ::std::result::Result<crate::types::MetricToRetain, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::MetricToRetain {
            metric: self.metric.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "metric",
                    "metric was not specified but it is required when building MetricToRetain",
                )
            })?,
            metric_dimension: self.metric_dimension,
            export_metric: self.export_metric,
        })
    }
}