aws_sdk_lookoutmetrics/operation/create_alert/
_create_alert_input.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateAlertInput {
6 pub alert_name: ::std::option::Option<::std::string::String>,
8 pub alert_sensitivity_threshold: ::std::option::Option<i32>,
10 pub alert_description: ::std::option::Option<::std::string::String>,
12 pub anomaly_detector_arn: ::std::option::Option<::std::string::String>,
14 pub action: ::std::option::Option<crate::types::Action>,
16 pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18 pub alert_filters: ::std::option::Option<crate::types::AlertFilters>,
20}
21impl CreateAlertInput {
22 pub fn alert_name(&self) -> ::std::option::Option<&str> {
24 self.alert_name.as_deref()
25 }
26 pub fn alert_sensitivity_threshold(&self) -> ::std::option::Option<i32> {
28 self.alert_sensitivity_threshold
29 }
30 pub fn alert_description(&self) -> ::std::option::Option<&str> {
32 self.alert_description.as_deref()
33 }
34 pub fn anomaly_detector_arn(&self) -> ::std::option::Option<&str> {
36 self.anomaly_detector_arn.as_deref()
37 }
38 pub fn action(&self) -> ::std::option::Option<&crate::types::Action> {
40 self.action.as_ref()
41 }
42 pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
44 self.tags.as_ref()
45 }
46 pub fn alert_filters(&self) -> ::std::option::Option<&crate::types::AlertFilters> {
48 self.alert_filters.as_ref()
49 }
50}
51impl CreateAlertInput {
52 pub fn builder() -> crate::operation::create_alert::builders::CreateAlertInputBuilder {
54 crate::operation::create_alert::builders::CreateAlertInputBuilder::default()
55 }
56}
57
58#[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 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 pub fn set_alert_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79 self.alert_name = input;
80 self
81 }
82 pub fn get_alert_name(&self) -> &::std::option::Option<::std::string::String> {
84 &self.alert_name
85 }
86 pub fn alert_sensitivity_threshold(mut self, input: i32) -> Self {
88 self.alert_sensitivity_threshold = ::std::option::Option::Some(input);
89 self
90 }
91 pub fn set_alert_sensitivity_threshold(mut self, input: ::std::option::Option<i32>) -> Self {
93 self.alert_sensitivity_threshold = input;
94 self
95 }
96 pub fn get_alert_sensitivity_threshold(&self) -> &::std::option::Option<i32> {
98 &self.alert_sensitivity_threshold
99 }
100 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 pub fn set_alert_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107 self.alert_description = input;
108 self
109 }
110 pub fn get_alert_description(&self) -> &::std::option::Option<::std::string::String> {
112 &self.alert_description
113 }
114 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 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 pub fn get_anomaly_detector_arn(&self) -> &::std::option::Option<::std::string::String> {
127 &self.anomaly_detector_arn
128 }
129 pub fn action(mut self, input: crate::types::Action) -> Self {
132 self.action = ::std::option::Option::Some(input);
133 self
134 }
135 pub fn set_action(mut self, input: ::std::option::Option<crate::types::Action>) -> Self {
137 self.action = input;
138 self
139 }
140 pub fn get_action(&self) -> &::std::option::Option<crate::types::Action> {
142 &self.action
143 }
144 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 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 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
162 &self.tags
163 }
164 pub fn alert_filters(mut self, input: crate::types::AlertFilters) -> Self {
166 self.alert_filters = ::std::option::Option::Some(input);
167 self
168 }
169 pub fn set_alert_filters(mut self, input: ::std::option::Option<crate::types::AlertFilters>) -> Self {
171 self.alert_filters = input;
172 self
173 }
174 pub fn get_alert_filters(&self) -> &::std::option::Option<crate::types::AlertFilters> {
176 &self.alert_filters
177 }
178 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}