aws_sdk_lookoutmetrics/operation/create_alert/
_create_alert_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateAlertInput {
6    /// <p>The name of the alert.</p>
7    pub alert_name: ::std::option::Option<::std::string::String>,
8    /// <p>An integer from 0 to 100 specifying the alert sensitivity threshold.</p>
9    pub alert_sensitivity_threshold: ::std::option::Option<i32>,
10    /// <p>A description of the alert.</p>
11    pub alert_description: ::std::option::Option<::std::string::String>,
12    /// <p>The ARN of the detector to which the alert is attached.</p>
13    pub anomaly_detector_arn: ::std::option::Option<::std::string::String>,
14    /// <p>Action that will be triggered when there is an alert.</p>
15    pub action: ::std::option::Option<crate::types::Action>,
16    /// <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the alert.</p>
17    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18    /// <p>The configuration of the alert filters, containing MetricList and DimensionFilterList.</p>
19    pub alert_filters: ::std::option::Option<crate::types::AlertFilters>,
20}
21impl CreateAlertInput {
22    /// <p>The name of the alert.</p>
23    pub fn alert_name(&self) -> ::std::option::Option<&str> {
24        self.alert_name.as_deref()
25    }
26    /// <p>An integer from 0 to 100 specifying the alert sensitivity threshold.</p>
27    pub fn alert_sensitivity_threshold(&self) -> ::std::option::Option<i32> {
28        self.alert_sensitivity_threshold
29    }
30    /// <p>A description of the alert.</p>
31    pub fn alert_description(&self) -> ::std::option::Option<&str> {
32        self.alert_description.as_deref()
33    }
34    /// <p>The ARN of the detector to which the alert is attached.</p>
35    pub fn anomaly_detector_arn(&self) -> ::std::option::Option<&str> {
36        self.anomaly_detector_arn.as_deref()
37    }
38    /// <p>Action that will be triggered when there is an alert.</p>
39    pub fn action(&self) -> ::std::option::Option<&crate::types::Action> {
40        self.action.as_ref()
41    }
42    /// <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the alert.</p>
43    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
44        self.tags.as_ref()
45    }
46    /// <p>The configuration of the alert filters, containing MetricList and DimensionFilterList.</p>
47    pub fn alert_filters(&self) -> ::std::option::Option<&crate::types::AlertFilters> {
48        self.alert_filters.as_ref()
49    }
50}
51impl CreateAlertInput {
52    /// Creates a new builder-style object to manufacture [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
53    pub fn builder() -> crate::operation::create_alert::builders::CreateAlertInputBuilder {
54        crate::operation::create_alert::builders::CreateAlertInputBuilder::default()
55    }
56}
57
58/// A builder for [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct CreateAlertInputBuilder {
62    pub(crate) alert_name: ::std::option::Option<::std::string::String>,
63    pub(crate) alert_sensitivity_threshold: ::std::option::Option<i32>,
64    pub(crate) alert_description: ::std::option::Option<::std::string::String>,
65    pub(crate) anomaly_detector_arn: ::std::option::Option<::std::string::String>,
66    pub(crate) action: ::std::option::Option<crate::types::Action>,
67    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
68    pub(crate) alert_filters: ::std::option::Option<crate::types::AlertFilters>,
69}
70impl CreateAlertInputBuilder {
71    /// <p>The name of the alert.</p>
72    /// This field is required.
73    pub fn alert_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.alert_name = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>The name of the alert.</p>
78    pub fn set_alert_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.alert_name = input;
80        self
81    }
82    /// <p>The name of the alert.</p>
83    pub fn get_alert_name(&self) -> &::std::option::Option<::std::string::String> {
84        &self.alert_name
85    }
86    /// <p>An integer from 0 to 100 specifying the alert sensitivity threshold.</p>
87    pub fn alert_sensitivity_threshold(mut self, input: i32) -> Self {
88        self.alert_sensitivity_threshold = ::std::option::Option::Some(input);
89        self
90    }
91    /// <p>An integer from 0 to 100 specifying the alert sensitivity threshold.</p>
92    pub fn set_alert_sensitivity_threshold(mut self, input: ::std::option::Option<i32>) -> Self {
93        self.alert_sensitivity_threshold = input;
94        self
95    }
96    /// <p>An integer from 0 to 100 specifying the alert sensitivity threshold.</p>
97    pub fn get_alert_sensitivity_threshold(&self) -> &::std::option::Option<i32> {
98        &self.alert_sensitivity_threshold
99    }
100    /// <p>A description of the alert.</p>
101    pub fn alert_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        self.alert_description = ::std::option::Option::Some(input.into());
103        self
104    }
105    /// <p>A description of the alert.</p>
106    pub fn set_alert_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107        self.alert_description = input;
108        self
109    }
110    /// <p>A description of the alert.</p>
111    pub fn get_alert_description(&self) -> &::std::option::Option<::std::string::String> {
112        &self.alert_description
113    }
114    /// <p>The ARN of the detector to which the alert is attached.</p>
115    /// This field is required.
116    pub fn anomaly_detector_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.anomaly_detector_arn = ::std::option::Option::Some(input.into());
118        self
119    }
120    /// <p>The ARN of the detector to which the alert is attached.</p>
121    pub fn set_anomaly_detector_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.anomaly_detector_arn = input;
123        self
124    }
125    /// <p>The ARN of the detector to which the alert is attached.</p>
126    pub fn get_anomaly_detector_arn(&self) -> &::std::option::Option<::std::string::String> {
127        &self.anomaly_detector_arn
128    }
129    /// <p>Action that will be triggered when there is an alert.</p>
130    /// This field is required.
131    pub fn action(mut self, input: crate::types::Action) -> Self {
132        self.action = ::std::option::Option::Some(input);
133        self
134    }
135    /// <p>Action that will be triggered when there is an alert.</p>
136    pub fn set_action(mut self, input: ::std::option::Option<crate::types::Action>) -> Self {
137        self.action = input;
138        self
139    }
140    /// <p>Action that will be triggered when there is an alert.</p>
141    pub fn get_action(&self) -> &::std::option::Option<crate::types::Action> {
142        &self.action
143    }
144    /// Adds a key-value pair to `tags`.
145    ///
146    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
147    ///
148    /// <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the alert.</p>
149    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
150        let mut hash_map = self.tags.unwrap_or_default();
151        hash_map.insert(k.into(), v.into());
152        self.tags = ::std::option::Option::Some(hash_map);
153        self
154    }
155    /// <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the alert.</p>
156    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
157        self.tags = input;
158        self
159    }
160    /// <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the alert.</p>
161    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
162        &self.tags
163    }
164    /// <p>The configuration of the alert filters, containing MetricList and DimensionFilterList.</p>
165    pub fn alert_filters(mut self, input: crate::types::AlertFilters) -> Self {
166        self.alert_filters = ::std::option::Option::Some(input);
167        self
168    }
169    /// <p>The configuration of the alert filters, containing MetricList and DimensionFilterList.</p>
170    pub fn set_alert_filters(mut self, input: ::std::option::Option<crate::types::AlertFilters>) -> Self {
171        self.alert_filters = input;
172        self
173    }
174    /// <p>The configuration of the alert filters, containing MetricList and DimensionFilterList.</p>
175    pub fn get_alert_filters(&self) -> &::std::option::Option<crate::types::AlertFilters> {
176        &self.alert_filters
177    }
178    /// Consumes the builder and constructs a [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
179    pub fn build(self) -> ::std::result::Result<crate::operation::create_alert::CreateAlertInput, ::aws_smithy_types::error::operation::BuildError> {
180        ::std::result::Result::Ok(crate::operation::create_alert::CreateAlertInput {
181            alert_name: self.alert_name,
182            alert_sensitivity_threshold: self.alert_sensitivity_threshold,
183            alert_description: self.alert_description,
184            anomaly_detector_arn: self.anomaly_detector_arn,
185            action: self.action,
186            tags: self.tags,
187            alert_filters: self.alert_filters,
188        })
189    }
190}