aws_sdk_lookoutmetrics/types/
_alert_filters.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The configuration of the alert filters.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AlertFilters {
7    /// <p>The list of measures that you want to get alerts for.</p>
8    pub metric_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
9    /// <p>The list of DimensionFilter objects that are used for dimension-based filtering.</p>
10    pub dimension_filter_list: ::std::option::Option<::std::vec::Vec<crate::types::DimensionFilter>>,
11}
12impl AlertFilters {
13    /// <p>The list of measures that you want to get alerts for.</p>
14    ///
15    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.metric_list.is_none()`.
16    pub fn metric_list(&self) -> &[::std::string::String] {
17        self.metric_list.as_deref().unwrap_or_default()
18    }
19    /// <p>The list of DimensionFilter objects that are used for dimension-based filtering.</p>
20    ///
21    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.dimension_filter_list.is_none()`.
22    pub fn dimension_filter_list(&self) -> &[crate::types::DimensionFilter] {
23        self.dimension_filter_list.as_deref().unwrap_or_default()
24    }
25}
26impl AlertFilters {
27    /// Creates a new builder-style object to manufacture [`AlertFilters`](crate::types::AlertFilters).
28    pub fn builder() -> crate::types::builders::AlertFiltersBuilder {
29        crate::types::builders::AlertFiltersBuilder::default()
30    }
31}
32
33/// A builder for [`AlertFilters`](crate::types::AlertFilters).
34#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
35#[non_exhaustive]
36pub struct AlertFiltersBuilder {
37    pub(crate) metric_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
38    pub(crate) dimension_filter_list: ::std::option::Option<::std::vec::Vec<crate::types::DimensionFilter>>,
39}
40impl AlertFiltersBuilder {
41    /// Appends an item to `metric_list`.
42    ///
43    /// To override the contents of this collection use [`set_metric_list`](Self::set_metric_list).
44    ///
45    /// <p>The list of measures that you want to get alerts for.</p>
46    pub fn metric_list(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
47        let mut v = self.metric_list.unwrap_or_default();
48        v.push(input.into());
49        self.metric_list = ::std::option::Option::Some(v);
50        self
51    }
52    /// <p>The list of measures that you want to get alerts for.</p>
53    pub fn set_metric_list(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
54        self.metric_list = input;
55        self
56    }
57    /// <p>The list of measures that you want to get alerts for.</p>
58    pub fn get_metric_list(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
59        &self.metric_list
60    }
61    /// Appends an item to `dimension_filter_list`.
62    ///
63    /// To override the contents of this collection use [`set_dimension_filter_list`](Self::set_dimension_filter_list).
64    ///
65    /// <p>The list of DimensionFilter objects that are used for dimension-based filtering.</p>
66    pub fn dimension_filter_list(mut self, input: crate::types::DimensionFilter) -> Self {
67        let mut v = self.dimension_filter_list.unwrap_or_default();
68        v.push(input);
69        self.dimension_filter_list = ::std::option::Option::Some(v);
70        self
71    }
72    /// <p>The list of DimensionFilter objects that are used for dimension-based filtering.</p>
73    pub fn set_dimension_filter_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DimensionFilter>>) -> Self {
74        self.dimension_filter_list = input;
75        self
76    }
77    /// <p>The list of DimensionFilter objects that are used for dimension-based filtering.</p>
78    pub fn get_dimension_filter_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DimensionFilter>> {
79        &self.dimension_filter_list
80    }
81    /// Consumes the builder and constructs a [`AlertFilters`](crate::types::AlertFilters).
82    pub fn build(self) -> crate::types::AlertFilters {
83        crate::types::AlertFilters {
84            metric_list: self.metric_list,
85            dimension_filter_list: self.dimension_filter_list,
86        }
87    }
88}