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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// Full alert entity, returned by both CreateAlert and GetAlert. A create and a read of the same alert describe it identically except for {@code state}, which only the read paths populate. UpdateAlert returns an empty response.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Alert {
/// The name of the alert.
pub name: ::std::string::String,
/// The stable alert identifier (see {@link AlertId}), minted on create and immutable across updates. Use it (not {@code name}) to address the alert on GetAlert/UpdateAlert/DeleteAlert; it is also the ARN's resource id.
pub alert_id: ::std::option::Option<::std::string::String>,
/// An optional description of the alert.
pub description: ::std::option::Option<::std::string::String>,
/// The AWS account ID that owns the alert.
pub account_id: ::std::string::String,
/// The ID of the space the alert belongs to.
pub space_id: ::std::option::Option<::std::string::String>,
/// The ID of the access profile associated with the alert.
pub profile_id: ::std::option::Option<::std::string::String>,
/// The rule that defines how the alert is evaluated.
pub rule: ::std::option::Option<crate::types::Rule>,
/// Whether notifications are enabled.
pub notification_status: ::std::option::Option<crate::types::NotificationStatus>,
/// Live evaluation state (read-only, system-managed). Populated by GetAlert. ListAlerts reports state on `AlertSummary` instead, where it stays required. Absent on CreateAlert: a newly created alert has never been evaluated, so any state reported there would be a default rather than an observation. Call GetAlert for live state. Not @required for that reason — GetAlert always populates it. `contributorSummary` is nested inside this member, so it too is absent on CreateAlert.
pub state: ::std::option::Option<crate::types::AlertStateInfo>,
/// The notification rules for the alert.
pub notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
/// The timestamp when the alert was created.
pub created_at: ::aws_smithy_types::DateTime,
/// The timestamp when the alert was last updated.
pub updated_at: ::aws_smithy_types::DateTime,
/// The Amazon Resource Name (ARN) of the alert.
pub alert_arn: ::std::string::String,
}
impl Alert {
/// The name of the alert.
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
/// The stable alert identifier (see {@link AlertId}), minted on create and immutable across updates. Use it (not {@code name}) to address the alert on GetAlert/UpdateAlert/DeleteAlert; it is also the ARN's resource id.
pub fn alert_id(&self) -> ::std::option::Option<&str> {
self.alert_id.as_deref()
}
/// An optional description of the alert.
pub fn description(&self) -> ::std::option::Option<&str> {
self.description.as_deref()
}
/// The AWS account ID that owns the alert.
pub fn account_id(&self) -> &str {
use std::ops::Deref;
self.account_id.deref()
}
/// The ID of the space the alert belongs to.
pub fn space_id(&self) -> ::std::option::Option<&str> {
self.space_id.as_deref()
}
/// The ID of the access profile associated with the alert.
pub fn profile_id(&self) -> ::std::option::Option<&str> {
self.profile_id.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 notifications are enabled.
pub fn notification_status(&self) -> ::std::option::Option<&crate::types::NotificationStatus> {
self.notification_status.as_ref()
}
/// Live evaluation state (read-only, system-managed). Populated by GetAlert. ListAlerts reports state on `AlertSummary` instead, where it stays required. Absent on CreateAlert: a newly created alert has never been evaluated, so any state reported there would be a default rather than an observation. Call GetAlert for live state. Not @required for that reason — GetAlert always populates it. `contributorSummary` is nested inside this member, so it too is absent on CreateAlert.
pub fn state(&self) -> ::std::option::Option<&crate::types::AlertStateInfo> {
self.state.as_ref()
}
/// The notification rules for the alert.
///
/// 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()
}
/// The timestamp when the alert was created.
pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
&self.created_at
}
/// The timestamp when the alert was last updated.
pub fn updated_at(&self) -> &::aws_smithy_types::DateTime {
&self.updated_at
}
/// The Amazon Resource Name (ARN) of the alert.
pub fn alert_arn(&self) -> &str {
use std::ops::Deref;
self.alert_arn.deref()
}
}
impl Alert {
/// Creates a new builder-style object to manufacture [`Alert`](crate::types::Alert).
pub fn builder() -> crate::types::builders::AlertBuilder {
crate::types::builders::AlertBuilder::default()
}
}
/// A builder for [`Alert`](crate::types::Alert).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AlertBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) alert_id: ::std::option::Option<::std::string::String>,
pub(crate) description: ::std::option::Option<::std::string::String>,
pub(crate) account_id: ::std::option::Option<::std::string::String>,
pub(crate) space_id: ::std::option::Option<::std::string::String>,
pub(crate) profile_id: ::std::option::Option<::std::string::String>,
pub(crate) rule: ::std::option::Option<crate::types::Rule>,
pub(crate) notification_status: ::std::option::Option<crate::types::NotificationStatus>,
pub(crate) state: ::std::option::Option<crate::types::AlertStateInfo>,
pub(crate) notification_rules: ::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>>,
pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) alert_arn: ::std::option::Option<::std::string::String>,
}
impl AlertBuilder {
/// The name of 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
}
/// The name of the alert.
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
/// The name of the alert.
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
/// The stable alert identifier (see {@link AlertId}), minted on create and immutable across updates. Use it (not {@code name}) to address the alert on GetAlert/UpdateAlert/DeleteAlert; it is also the ARN's resource id.
pub fn alert_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.alert_id = ::std::option::Option::Some(input.into());
self
}
/// The stable alert identifier (see {@link AlertId}), minted on create and immutable across updates. Use it (not {@code name}) to address the alert on GetAlert/UpdateAlert/DeleteAlert; it is also the ARN's resource id.
pub fn set_alert_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.alert_id = input;
self
}
/// The stable alert identifier (see {@link AlertId}), minted on create and immutable across updates. Use it (not {@code name}) to address the alert on GetAlert/UpdateAlert/DeleteAlert; it is also the ARN's resource id.
pub fn get_alert_id(&self) -> &::std::option::Option<::std::string::String> {
&self.alert_id
}
/// 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 AWS account ID that owns the alert.
/// This field is required.
pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.account_id = ::std::option::Option::Some(input.into());
self
}
/// The AWS account ID that owns the alert.
pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.account_id = input;
self
}
/// The AWS account ID that owns the alert.
pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
&self.account_id
}
/// The ID of the space the alert belongs to.
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 ID of the space the alert belongs to.
pub fn set_space_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.space_id = input;
self
}
/// The ID of the space the alert belongs to.
pub fn get_space_id(&self) -> &::std::option::Option<::std::string::String> {
&self.space_id
}
/// The ID of the access profile associated with the alert.
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 associated with the alert.
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 associated with the alert.
pub fn get_profile_id(&self) -> &::std::option::Option<::std::string::String> {
&self.profile_id
}
/// 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 notifications are enabled.
pub fn notification_status(mut self, input: crate::types::NotificationStatus) -> Self {
self.notification_status = ::std::option::Option::Some(input);
self
}
/// Whether notifications are enabled.
pub fn set_notification_status(mut self, input: ::std::option::Option<crate::types::NotificationStatus>) -> Self {
self.notification_status = input;
self
}
/// Whether notifications are enabled.
pub fn get_notification_status(&self) -> &::std::option::Option<crate::types::NotificationStatus> {
&self.notification_status
}
/// Live evaluation state (read-only, system-managed). Populated by GetAlert. ListAlerts reports state on `AlertSummary` instead, where it stays required. Absent on CreateAlert: a newly created alert has never been evaluated, so any state reported there would be a default rather than an observation. Call GetAlert for live state. Not @required for that reason — GetAlert always populates it. `contributorSummary` is nested inside this member, so it too is absent on CreateAlert.
pub fn state(mut self, input: crate::types::AlertStateInfo) -> Self {
self.state = ::std::option::Option::Some(input);
self
}
/// Live evaluation state (read-only, system-managed). Populated by GetAlert. ListAlerts reports state on `AlertSummary` instead, where it stays required. Absent on CreateAlert: a newly created alert has never been evaluated, so any state reported there would be a default rather than an observation. Call GetAlert for live state. Not @required for that reason — GetAlert always populates it. `contributorSummary` is nested inside this member, so it too is absent on CreateAlert.
pub fn set_state(mut self, input: ::std::option::Option<crate::types::AlertStateInfo>) -> Self {
self.state = input;
self
}
/// Live evaluation state (read-only, system-managed). Populated by GetAlert. ListAlerts reports state on `AlertSummary` instead, where it stays required. Absent on CreateAlert: a newly created alert has never been evaluated, so any state reported there would be a default rather than an observation. Call GetAlert for live state. Not @required for that reason — GetAlert always populates it. `contributorSummary` is nested inside this member, so it too is absent on CreateAlert.
pub fn get_state(&self) -> &::std::option::Option<crate::types::AlertStateInfo> {
&self.state
}
/// Appends an item to `notification_rules`.
///
/// To override the contents of this collection use [`set_notification_rules`](Self::set_notification_rules).
///
/// The notification rules for the alert.
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 for the alert.
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 for the alert.
pub fn get_notification_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NotificationRule>> {
&self.notification_rules
}
/// The timestamp when the alert was created.
/// This field is required.
pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.created_at = ::std::option::Option::Some(input);
self
}
/// The timestamp when the alert was created.
pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.created_at = input;
self
}
/// The timestamp when the alert was created.
pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.created_at
}
/// The timestamp when the alert was last updated.
/// This field is required.
pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.updated_at = ::std::option::Option::Some(input);
self
}
/// The timestamp when the alert was last updated.
pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.updated_at = input;
self
}
/// The timestamp when the alert was last updated.
pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.updated_at
}
/// The Amazon Resource Name (ARN) of the alert.
/// This field is required.
pub fn alert_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.alert_arn = ::std::option::Option::Some(input.into());
self
}
/// The Amazon Resource Name (ARN) of the alert.
pub fn set_alert_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.alert_arn = input;
self
}
/// The Amazon Resource Name (ARN) of the alert.
pub fn get_alert_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.alert_arn
}
/// Consumes the builder and constructs a [`Alert`](crate::types::Alert).
/// This method will fail if any of the following fields are not set:
/// - [`name`](crate::types::builders::AlertBuilder::name)
/// - [`account_id`](crate::types::builders::AlertBuilder::account_id)
/// - [`created_at`](crate::types::builders::AlertBuilder::created_at)
/// - [`updated_at`](crate::types::builders::AlertBuilder::updated_at)
/// - [`alert_arn`](crate::types::builders::AlertBuilder::alert_arn)
pub fn build(self) -> ::std::result::Result<crate::types::Alert, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Alert {
name: self.name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"name",
"name was not specified but it is required when building Alert",
)
})?,
alert_id: self.alert_id,
description: self.description,
account_id: self.account_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"account_id",
"account_id was not specified but it is required when building Alert",
)
})?,
space_id: self.space_id,
profile_id: self.profile_id,
rule: self.rule,
notification_status: self.notification_status,
state: self.state,
notification_rules: self.notification_rules,
created_at: self.created_at.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"created_at",
"created_at was not specified but it is required when building Alert",
)
})?,
updated_at: self.updated_at.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"updated_at",
"updated_at was not specified but it is required when building Alert",
)
})?,
alert_arn: self.alert_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"alert_arn",
"alert_arn was not specified but it is required when building Alert",
)
})?,
})
}
}