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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreateAlertInput {
/// The unique ID of the space to create the alert in.
pub space_id: ::std::option::Option<::std::string::String>,
/// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
pub profile_id: ::std::option::Option<::std::string::String>,
/// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
pub name: ::std::option::Option<::std::string::String>,
/// An optional description of the alert.
pub description: ::std::option::Option<::std::string::String>,
/// The rule that defines how the alert is evaluated.
pub rule: ::std::option::Option<crate::types::Rule>,
/// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
pub notifications_enabled: ::std::option::Option<bool>,
/// The tags to associate with the alert.
pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
/// The notification rules that determine when and where notifications are sent.
pub notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
/// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
pub client_token: ::std::option::Option<::std::string::String>,
}
impl CreateAlertInput {
/// The unique ID of the space to create the alert in.
pub fn space_id(&self) -> ::std::option::Option<&str> {
self.space_id.as_deref()
}
/// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
pub fn profile_id(&self) -> ::std::option::Option<&str> {
self.profile_id.as_deref()
}
/// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
pub fn name(&self) -> ::std::option::Option<&str> {
self.name.as_deref()
}
/// An optional description of the alert.
pub fn description(&self) -> ::std::option::Option<&str> {
self.description.as_deref()
}
/// The rule that defines how the alert is evaluated.
pub fn rule(&self) -> ::std::option::Option<&crate::types::Rule> {
self.rule.as_ref()
}
/// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
pub fn notifications_enabled(&self) -> ::std::option::Option<bool> {
self.notifications_enabled
}
/// The tags to associate with the alert.
pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.tags.as_ref()
}
/// The notification rules that determine when and where notifications are sent.
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.notification_rules.is_none()`.
pub fn notification_rules(&self) -> &[crate::types::NotificationRule] {
self.notification_rules.as_deref().unwrap_or_default()
}
/// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
pub fn client_token(&self) -> ::std::option::Option<&str> {
self.client_token.as_deref()
}
}
impl CreateAlertInput {
/// Creates a new builder-style object to manufacture [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
pub fn builder() -> crate::operation::create_alert::builders::CreateAlertInputBuilder {
crate::operation::create_alert::builders::CreateAlertInputBuilder::default()
}
}
/// A builder for [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreateAlertInputBuilder {
pub(crate) space_id: ::std::option::Option<::std::string::String>,
pub(crate) profile_id: ::std::option::Option<::std::string::String>,
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) description: ::std::option::Option<::std::string::String>,
pub(crate) rule: ::std::option::Option<crate::types::Rule>,
pub(crate) notifications_enabled: ::std::option::Option<bool>,
pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub(crate) notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
pub(crate) client_token: ::std::option::Option<::std::string::String>,
}
impl CreateAlertInputBuilder {
/// The unique ID of the space to create the alert in.
/// This field is required.
pub fn space_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.space_id = ::std::option::Option::Some(input.into());
self
}
/// The unique ID of the space to create the alert in.
pub fn set_space_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.space_id = input;
self
}
/// The unique ID of the space to create the alert in.
pub fn get_space_id(&self) -> &::std::option::Option<::std::string::String> {
&self.space_id
}
/// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
/// This field is required.
pub fn profile_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.profile_id = ::std::option::Option::Some(input.into());
self
}
/// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
pub fn set_profile_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.profile_id = input;
self
}
/// The ID of the access profile the alert uses to evaluate its query and execute notifications. The caller supplies it: there is no managed alert profile, and the service does not pick one on the caller's behalf.
pub fn get_profile_id(&self) -> &::std::option::Option<::std::string::String> {
&self.profile_id
}
/// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
/// This field is required.
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
/// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
/// Alert name, for display. Max 256 (the AlarmName budget). Not the alert's identity: the backend mints a separate uuid as the {@link AlertId}, so the name need not be unique within a space and addressing an alert never depends on it. UpdateAlert accepts a new name to rename the alert.
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
/// An optional description of the alert.
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.description = ::std::option::Option::Some(input.into());
self
}
/// An optional description of the alert.
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.description = input;
self
}
/// An optional description of the alert.
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
&self.description
}
/// The rule that defines how the alert is evaluated.
/// This field is required.
pub fn rule(mut self, input: crate::types::Rule) -> Self {
self.rule = ::std::option::Option::Some(input);
self
}
/// The rule that defines how the alert is evaluated.
pub fn set_rule(mut self, input: ::std::option::Option<crate::types::Rule>) -> Self {
self.rule = input;
self
}
/// The rule that defines how the alert is evaluated.
pub fn get_rule(&self) -> &::std::option::Option<crate::types::Rule> {
&self.rule
}
/// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
pub fn notifications_enabled(mut self, input: bool) -> Self {
self.notifications_enabled = ::std::option::Option::Some(input);
self
}
/// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
pub fn set_notifications_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
self.notifications_enabled = input;
self
}
/// Whether actions (notifications) are enabled for this alert. Defaults to true when omitted.
pub fn get_notifications_enabled(&self) -> &::std::option::Option<bool> {
&self.notifications_enabled
}
/// Adds a key-value pair to `tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
///
/// The tags to associate with the alert.
pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = ::std::option::Option::Some(hash_map);
self
}
/// The tags to associate with the alert.
pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
self.tags = input;
self
}
/// The tags to associate with the alert.
pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.tags
}
/// Appends an item to `notification_rules`.
///
/// To override the contents of this collection use [`set_notification_rules`](Self::set_notification_rules).
///
/// The notification rules that determine when and where notifications are sent.
pub fn notification_rules(mut self, input: crate::types::NotificationRule) -> Self {
let mut v = self.notification_rules.unwrap_or_default();
v.push(input);
self.notification_rules = ::std::option::Option::Some(v);
self
}
/// The notification rules that determine when and where notifications are sent.
pub fn set_notification_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>) -> Self {
self.notification_rules = input;
self
}
/// The notification rules that determine when and where notifications are sent.
pub fn get_notification_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>> {
&self.notification_rules
}
/// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.client_token = ::std::option::Option::Some(input.into());
self
}
/// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.client_token = input;
self
}
/// Idempotency token for safe retries. Retrying with the same token within the idempotency window returns the original alert instead of creating a duplicate.
pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
&self.client_token
}
/// Consumes the builder and constructs a [`CreateAlertInput`](crate::operation::create_alert::CreateAlertInput).
pub fn build(self) -> ::std::result::Result<crate::operation::create_alert::CreateAlertInput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::create_alert::CreateAlertInput {
space_id: self.space_id,
profile_id: self.profile_id,
name: self.name,
description: self.description,
rule: self.rule,
notifications_enabled: self.notifications_enabled,
tags: self.tags,
notification_rules: self.notification_rules,
client_token: self.client_token,
})
}
}