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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Describes an alarm.</p>
/// <p>An alarm is a way to monitor your Lightsail resource metrics. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-alarms">Alarms in Amazon Lightsail</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Alarm {
/// <p>The name of the alarm.</p>
pub name: ::std::option::Option<::std::string::String>,
/// <p>The Amazon Resource Name (ARN) of the alarm.</p>
pub arn: ::std::option::Option<::std::string::String>,
/// <p>The timestamp when the alarm was created.</p>
pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
/// <p>An object that lists information about the location of the alarm.</p>
pub location: ::std::option::Option<crate::types::ResourceLocation>,
/// <p>The Lightsail resource type of the alarm.</p>
pub resource_type: ::std::option::Option<crate::types::ResourceType>,
/// <p>The support code. Include this code in your email to support when you have questions about your Lightsail alarm. This code enables our support team to look up your Lightsail information more easily.</p>
pub support_code: ::std::option::Option<::std::string::String>,
/// <p>An object that lists information about the resource monitored by the alarm.</p>
pub monitored_resource_info: ::std::option::Option<crate::types::MonitoredResourceInfo>,
/// <p>The arithmetic operation used when comparing the specified statistic and threshold.</p>
pub comparison_operator: ::std::option::Option<crate::types::ComparisonOperator>,
/// <p>The number of periods over which data is compared to the specified threshold.</p>
pub evaluation_periods: ::std::option::Option<i32>,
/// <p>The period, in seconds, over which the statistic is applied.</p>
pub period: ::std::option::Option<i32>,
/// <p>The value against which the specified statistic is compared.</p>
pub threshold: ::std::option::Option<f64>,
/// <p>The number of data points that must not within the specified threshold to trigger the alarm.</p>
pub datapoints_to_alarm: ::std::option::Option<i32>,
/// <p>Specifies how the alarm handles missing data points.</p>
/// <p>An alarm can treat missing data in the following ways:</p>
/// <ul>
/// <li>
/// <p><code>breaching</code> - Assume the missing data is not within the threshold. Missing data counts towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>notBreaching</code> - Assume the missing data is within the threshold. Missing data does not count towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>ignore</code> - Ignore the missing data. Maintains the current alarm state.</p></li>
/// <li>
/// <p><code>missing</code> - Missing data is treated as missing.</p></li>
/// </ul>
pub treat_missing_data: ::std::option::Option<crate::types::TreatMissingData>,
/// <p>The statistic for the metric associated with the alarm.</p>
/// <p>The following statistics are available:</p>
/// <ul>
/// <li>
/// <p><code>Minimum</code> - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Maximum</code> - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Sum</code> - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.</p></li>
/// <li>
/// <p><code>Average</code> - The value of Sum / SampleCount during the specified period. By comparing this statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your resources.</p></li>
/// <li>
/// <p><code>SampleCount</code> - The count, or number, of data points used for the statistical calculation.</p></li>
/// </ul>
pub statistic: ::std::option::Option<crate::types::MetricStatistic>,
/// <p>The name of the metric associated with the alarm.</p>
pub metric_name: ::std::option::Option<crate::types::MetricName>,
/// <p>The current state of the alarm.</p>
/// <p>An alarm has the following possible states:</p>
/// <ul>
/// <li>
/// <p><code>ALARM</code> - The metric is outside of the defined threshold.</p></li>
/// <li>
/// <p><code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.</p></li>
/// <li>
/// <p><code>OK</code> - The metric is within the defined threshold.</p></li>
/// </ul>
pub state: ::std::option::Option<crate::types::AlarmState>,
/// <p>The unit of the metric associated with the alarm.</p>
pub unit: ::std::option::Option<crate::types::MetricUnit>,
/// <p>The contact protocols for the alarm, such as <code>Email</code>, <code>SMS</code> (text messaging), or both.</p>
pub contact_protocols: ::std::option::Option<::std::vec::Vec<crate::types::ContactProtocol>>,
/// <p>The alarm states that trigger a notification.</p>
pub notification_triggers: ::std::option::Option<::std::vec::Vec<crate::types::AlarmState>>,
/// <p>Indicates whether the alarm is enabled.</p>
pub notification_enabled: ::std::option::Option<bool>,
/// <p>The tag keys and optional values for the resource. For more information about tags in Lightsail, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tags">Amazon Lightsail Developer Guide</a>.</p>
pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
}
impl Alarm {
/// <p>The name of the alarm.</p>
pub fn name(&self) -> ::std::option::Option<&str> {
self.name.as_deref()
}
/// <p>The Amazon Resource Name (ARN) of the alarm.</p>
pub fn arn(&self) -> ::std::option::Option<&str> {
self.arn.as_deref()
}
/// <p>The timestamp when the alarm was created.</p>
pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
self.created_at.as_ref()
}
/// <p>An object that lists information about the location of the alarm.</p>
pub fn location(&self) -> ::std::option::Option<&crate::types::ResourceLocation> {
self.location.as_ref()
}
/// <p>The Lightsail resource type of the alarm.</p>
pub fn resource_type(&self) -> ::std::option::Option<&crate::types::ResourceType> {
self.resource_type.as_ref()
}
/// <p>The support code. Include this code in your email to support when you have questions about your Lightsail alarm. This code enables our support team to look up your Lightsail information more easily.</p>
pub fn support_code(&self) -> ::std::option::Option<&str> {
self.support_code.as_deref()
}
/// <p>An object that lists information about the resource monitored by the alarm.</p>
pub fn monitored_resource_info(&self) -> ::std::option::Option<&crate::types::MonitoredResourceInfo> {
self.monitored_resource_info.as_ref()
}
/// <p>The arithmetic operation used when comparing the specified statistic and threshold.</p>
pub fn comparison_operator(&self) -> ::std::option::Option<&crate::types::ComparisonOperator> {
self.comparison_operator.as_ref()
}
/// <p>The number of periods over which data is compared to the specified threshold.</p>
pub fn evaluation_periods(&self) -> ::std::option::Option<i32> {
self.evaluation_periods
}
/// <p>The period, in seconds, over which the statistic is applied.</p>
pub fn period(&self) -> ::std::option::Option<i32> {
self.period
}
/// <p>The value against which the specified statistic is compared.</p>
pub fn threshold(&self) -> ::std::option::Option<f64> {
self.threshold
}
/// <p>The number of data points that must not within the specified threshold to trigger the alarm.</p>
pub fn datapoints_to_alarm(&self) -> ::std::option::Option<i32> {
self.datapoints_to_alarm
}
/// <p>Specifies how the alarm handles missing data points.</p>
/// <p>An alarm can treat missing data in the following ways:</p>
/// <ul>
/// <li>
/// <p><code>breaching</code> - Assume the missing data is not within the threshold. Missing data counts towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>notBreaching</code> - Assume the missing data is within the threshold. Missing data does not count towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>ignore</code> - Ignore the missing data. Maintains the current alarm state.</p></li>
/// <li>
/// <p><code>missing</code> - Missing data is treated as missing.</p></li>
/// </ul>
pub fn treat_missing_data(&self) -> ::std::option::Option<&crate::types::TreatMissingData> {
self.treat_missing_data.as_ref()
}
/// <p>The statistic for the metric associated with the alarm.</p>
/// <p>The following statistics are available:</p>
/// <ul>
/// <li>
/// <p><code>Minimum</code> - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Maximum</code> - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Sum</code> - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.</p></li>
/// <li>
/// <p><code>Average</code> - The value of Sum / SampleCount during the specified period. By comparing this statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your resources.</p></li>
/// <li>
/// <p><code>SampleCount</code> - The count, or number, of data points used for the statistical calculation.</p></li>
/// </ul>
pub fn statistic(&self) -> ::std::option::Option<&crate::types::MetricStatistic> {
self.statistic.as_ref()
}
/// <p>The name of the metric associated with the alarm.</p>
pub fn metric_name(&self) -> ::std::option::Option<&crate::types::MetricName> {
self.metric_name.as_ref()
}
/// <p>The current state of the alarm.</p>
/// <p>An alarm has the following possible states:</p>
/// <ul>
/// <li>
/// <p><code>ALARM</code> - The metric is outside of the defined threshold.</p></li>
/// <li>
/// <p><code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.</p></li>
/// <li>
/// <p><code>OK</code> - The metric is within the defined threshold.</p></li>
/// </ul>
pub fn state(&self) -> ::std::option::Option<&crate::types::AlarmState> {
self.state.as_ref()
}
/// <p>The unit of the metric associated with the alarm.</p>
pub fn unit(&self) -> ::std::option::Option<&crate::types::MetricUnit> {
self.unit.as_ref()
}
/// <p>The contact protocols for the alarm, such as <code>Email</code>, <code>SMS</code> (text messaging), or both.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.contact_protocols.is_none()`.
pub fn contact_protocols(&self) -> &[crate::types::ContactProtocol] {
self.contact_protocols.as_deref().unwrap_or_default()
}
/// <p>The alarm states that trigger a notification.</p>
///
/// 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_triggers.is_none()`.
pub fn notification_triggers(&self) -> &[crate::types::AlarmState] {
self.notification_triggers.as_deref().unwrap_or_default()
}
/// <p>Indicates whether the alarm is enabled.</p>
pub fn notification_enabled(&self) -> ::std::option::Option<bool> {
self.notification_enabled
}
/// <p>The tag keys and optional values for the resource. For more information about tags in Lightsail, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tags">Amazon Lightsail Developer Guide</a>.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
pub fn tags(&self) -> &[crate::types::Tag] {
self.tags.as_deref().unwrap_or_default()
}
}
impl Alarm {
/// Creates a new builder-style object to manufacture [`Alarm`](crate::types::Alarm).
pub fn builder() -> crate::types::builders::AlarmBuilder {
crate::types::builders::AlarmBuilder::default()
}
}
/// A builder for [`Alarm`](crate::types::Alarm).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AlarmBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) arn: ::std::option::Option<::std::string::String>,
pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) location: ::std::option::Option<crate::types::ResourceLocation>,
pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
pub(crate) support_code: ::std::option::Option<::std::string::String>,
pub(crate) monitored_resource_info: ::std::option::Option<crate::types::MonitoredResourceInfo>,
pub(crate) comparison_operator: ::std::option::Option<crate::types::ComparisonOperator>,
pub(crate) evaluation_periods: ::std::option::Option<i32>,
pub(crate) period: ::std::option::Option<i32>,
pub(crate) threshold: ::std::option::Option<f64>,
pub(crate) datapoints_to_alarm: ::std::option::Option<i32>,
pub(crate) treat_missing_data: ::std::option::Option<crate::types::TreatMissingData>,
pub(crate) statistic: ::std::option::Option<crate::types::MetricStatistic>,
pub(crate) metric_name: ::std::option::Option<crate::types::MetricName>,
pub(crate) state: ::std::option::Option<crate::types::AlarmState>,
pub(crate) unit: ::std::option::Option<crate::types::MetricUnit>,
pub(crate) contact_protocols: ::std::option::Option<::std::vec::Vec<crate::types::ContactProtocol>>,
pub(crate) notification_triggers: ::std::option::Option<::std::vec::Vec<crate::types::AlarmState>>,
pub(crate) notification_enabled: ::std::option::Option<bool>,
pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
}
impl AlarmBuilder {
/// <p>The name of the alarm.</p>
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the alarm.</p>
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
/// <p>The name of the alarm.</p>
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
/// <p>The Amazon Resource Name (ARN) of the alarm.</p>
pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.arn = ::std::option::Option::Some(input.into());
self
}
/// <p>The Amazon Resource Name (ARN) of the alarm.</p>
pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.arn = input;
self
}
/// <p>The Amazon Resource Name (ARN) of the alarm.</p>
pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.arn
}
/// <p>The timestamp when the alarm was created.</p>
pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.created_at = ::std::option::Option::Some(input);
self
}
/// <p>The timestamp when the alarm was created.</p>
pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.created_at = input;
self
}
/// <p>The timestamp when the alarm was created.</p>
pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.created_at
}
/// <p>An object that lists information about the location of the alarm.</p>
pub fn location(mut self, input: crate::types::ResourceLocation) -> Self {
self.location = ::std::option::Option::Some(input);
self
}
/// <p>An object that lists information about the location of the alarm.</p>
pub fn set_location(mut self, input: ::std::option::Option<crate::types::ResourceLocation>) -> Self {
self.location = input;
self
}
/// <p>An object that lists information about the location of the alarm.</p>
pub fn get_location(&self) -> &::std::option::Option<crate::types::ResourceLocation> {
&self.location
}
/// <p>The Lightsail resource type of the alarm.</p>
pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
self.resource_type = ::std::option::Option::Some(input);
self
}
/// <p>The Lightsail resource type of the alarm.</p>
pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
self.resource_type = input;
self
}
/// <p>The Lightsail resource type of the alarm.</p>
pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
&self.resource_type
}
/// <p>The support code. Include this code in your email to support when you have questions about your Lightsail alarm. This code enables our support team to look up your Lightsail information more easily.</p>
pub fn support_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.support_code = ::std::option::Option::Some(input.into());
self
}
/// <p>The support code. Include this code in your email to support when you have questions about your Lightsail alarm. This code enables our support team to look up your Lightsail information more easily.</p>
pub fn set_support_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.support_code = input;
self
}
/// <p>The support code. Include this code in your email to support when you have questions about your Lightsail alarm. This code enables our support team to look up your Lightsail information more easily.</p>
pub fn get_support_code(&self) -> &::std::option::Option<::std::string::String> {
&self.support_code
}
/// <p>An object that lists information about the resource monitored by the alarm.</p>
pub fn monitored_resource_info(mut self, input: crate::types::MonitoredResourceInfo) -> Self {
self.monitored_resource_info = ::std::option::Option::Some(input);
self
}
/// <p>An object that lists information about the resource monitored by the alarm.</p>
pub fn set_monitored_resource_info(mut self, input: ::std::option::Option<crate::types::MonitoredResourceInfo>) -> Self {
self.monitored_resource_info = input;
self
}
/// <p>An object that lists information about the resource monitored by the alarm.</p>
pub fn get_monitored_resource_info(&self) -> &::std::option::Option<crate::types::MonitoredResourceInfo> {
&self.monitored_resource_info
}
/// <p>The arithmetic operation used when comparing the specified statistic and threshold.</p>
pub fn comparison_operator(mut self, input: crate::types::ComparisonOperator) -> Self {
self.comparison_operator = ::std::option::Option::Some(input);
self
}
/// <p>The arithmetic operation used when comparing the specified statistic and threshold.</p>
pub fn set_comparison_operator(mut self, input: ::std::option::Option<crate::types::ComparisonOperator>) -> Self {
self.comparison_operator = input;
self
}
/// <p>The arithmetic operation used when comparing the specified statistic and threshold.</p>
pub fn get_comparison_operator(&self) -> &::std::option::Option<crate::types::ComparisonOperator> {
&self.comparison_operator
}
/// <p>The number of periods over which data is compared to the specified threshold.</p>
pub fn evaluation_periods(mut self, input: i32) -> Self {
self.evaluation_periods = ::std::option::Option::Some(input);
self
}
/// <p>The number of periods over which data is compared to the specified threshold.</p>
pub fn set_evaluation_periods(mut self, input: ::std::option::Option<i32>) -> Self {
self.evaluation_periods = input;
self
}
/// <p>The number of periods over which data is compared to the specified threshold.</p>
pub fn get_evaluation_periods(&self) -> &::std::option::Option<i32> {
&self.evaluation_periods
}
/// <p>The period, in seconds, over which the statistic is applied.</p>
pub fn period(mut self, input: i32) -> Self {
self.period = ::std::option::Option::Some(input);
self
}
/// <p>The period, in seconds, over which the statistic is applied.</p>
pub fn set_period(mut self, input: ::std::option::Option<i32>) -> Self {
self.period = input;
self
}
/// <p>The period, in seconds, over which the statistic is applied.</p>
pub fn get_period(&self) -> &::std::option::Option<i32> {
&self.period
}
/// <p>The value against which the specified statistic is compared.</p>
pub fn threshold(mut self, input: f64) -> Self {
self.threshold = ::std::option::Option::Some(input);
self
}
/// <p>The value against which the specified statistic is compared.</p>
pub fn set_threshold(mut self, input: ::std::option::Option<f64>) -> Self {
self.threshold = input;
self
}
/// <p>The value against which the specified statistic is compared.</p>
pub fn get_threshold(&self) -> &::std::option::Option<f64> {
&self.threshold
}
/// <p>The number of data points that must not within the specified threshold to trigger the alarm.</p>
pub fn datapoints_to_alarm(mut self, input: i32) -> Self {
self.datapoints_to_alarm = ::std::option::Option::Some(input);
self
}
/// <p>The number of data points that must not within the specified threshold to trigger the alarm.</p>
pub fn set_datapoints_to_alarm(mut self, input: ::std::option::Option<i32>) -> Self {
self.datapoints_to_alarm = input;
self
}
/// <p>The number of data points that must not within the specified threshold to trigger the alarm.</p>
pub fn get_datapoints_to_alarm(&self) -> &::std::option::Option<i32> {
&self.datapoints_to_alarm
}
/// <p>Specifies how the alarm handles missing data points.</p>
/// <p>An alarm can treat missing data in the following ways:</p>
/// <ul>
/// <li>
/// <p><code>breaching</code> - Assume the missing data is not within the threshold. Missing data counts towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>notBreaching</code> - Assume the missing data is within the threshold. Missing data does not count towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>ignore</code> - Ignore the missing data. Maintains the current alarm state.</p></li>
/// <li>
/// <p><code>missing</code> - Missing data is treated as missing.</p></li>
/// </ul>
pub fn treat_missing_data(mut self, input: crate::types::TreatMissingData) -> Self {
self.treat_missing_data = ::std::option::Option::Some(input);
self
}
/// <p>Specifies how the alarm handles missing data points.</p>
/// <p>An alarm can treat missing data in the following ways:</p>
/// <ul>
/// <li>
/// <p><code>breaching</code> - Assume the missing data is not within the threshold. Missing data counts towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>notBreaching</code> - Assume the missing data is within the threshold. Missing data does not count towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>ignore</code> - Ignore the missing data. Maintains the current alarm state.</p></li>
/// <li>
/// <p><code>missing</code> - Missing data is treated as missing.</p></li>
/// </ul>
pub fn set_treat_missing_data(mut self, input: ::std::option::Option<crate::types::TreatMissingData>) -> Self {
self.treat_missing_data = input;
self
}
/// <p>Specifies how the alarm handles missing data points.</p>
/// <p>An alarm can treat missing data in the following ways:</p>
/// <ul>
/// <li>
/// <p><code>breaching</code> - Assume the missing data is not within the threshold. Missing data counts towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>notBreaching</code> - Assume the missing data is within the threshold. Missing data does not count towards the number of times the metric is not within the threshold.</p></li>
/// <li>
/// <p><code>ignore</code> - Ignore the missing data. Maintains the current alarm state.</p></li>
/// <li>
/// <p><code>missing</code> - Missing data is treated as missing.</p></li>
/// </ul>
pub fn get_treat_missing_data(&self) -> &::std::option::Option<crate::types::TreatMissingData> {
&self.treat_missing_data
}
/// <p>The statistic for the metric associated with the alarm.</p>
/// <p>The following statistics are available:</p>
/// <ul>
/// <li>
/// <p><code>Minimum</code> - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Maximum</code> - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Sum</code> - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.</p></li>
/// <li>
/// <p><code>Average</code> - The value of Sum / SampleCount during the specified period. By comparing this statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your resources.</p></li>
/// <li>
/// <p><code>SampleCount</code> - The count, or number, of data points used for the statistical calculation.</p></li>
/// </ul>
pub fn statistic(mut self, input: crate::types::MetricStatistic) -> Self {
self.statistic = ::std::option::Option::Some(input);
self
}
/// <p>The statistic for the metric associated with the alarm.</p>
/// <p>The following statistics are available:</p>
/// <ul>
/// <li>
/// <p><code>Minimum</code> - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Maximum</code> - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Sum</code> - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.</p></li>
/// <li>
/// <p><code>Average</code> - The value of Sum / SampleCount during the specified period. By comparing this statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your resources.</p></li>
/// <li>
/// <p><code>SampleCount</code> - The count, or number, of data points used for the statistical calculation.</p></li>
/// </ul>
pub fn set_statistic(mut self, input: ::std::option::Option<crate::types::MetricStatistic>) -> Self {
self.statistic = input;
self
}
/// <p>The statistic for the metric associated with the alarm.</p>
/// <p>The following statistics are available:</p>
/// <ul>
/// <li>
/// <p><code>Minimum</code> - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Maximum</code> - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.</p></li>
/// <li>
/// <p><code>Sum</code> - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.</p></li>
/// <li>
/// <p><code>Average</code> - The value of Sum / SampleCount during the specified period. By comparing this statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your resources.</p></li>
/// <li>
/// <p><code>SampleCount</code> - The count, or number, of data points used for the statistical calculation.</p></li>
/// </ul>
pub fn get_statistic(&self) -> &::std::option::Option<crate::types::MetricStatistic> {
&self.statistic
}
/// <p>The name of the metric associated with the alarm.</p>
pub fn metric_name(mut self, input: crate::types::MetricName) -> Self {
self.metric_name = ::std::option::Option::Some(input);
self
}
/// <p>The name of the metric associated with the alarm.</p>
pub fn set_metric_name(mut self, input: ::std::option::Option<crate::types::MetricName>) -> Self {
self.metric_name = input;
self
}
/// <p>The name of the metric associated with the alarm.</p>
pub fn get_metric_name(&self) -> &::std::option::Option<crate::types::MetricName> {
&self.metric_name
}
/// <p>The current state of the alarm.</p>
/// <p>An alarm has the following possible states:</p>
/// <ul>
/// <li>
/// <p><code>ALARM</code> - The metric is outside of the defined threshold.</p></li>
/// <li>
/// <p><code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.</p></li>
/// <li>
/// <p><code>OK</code> - The metric is within the defined threshold.</p></li>
/// </ul>
pub fn state(mut self, input: crate::types::AlarmState) -> Self {
self.state = ::std::option::Option::Some(input);
self
}
/// <p>The current state of the alarm.</p>
/// <p>An alarm has the following possible states:</p>
/// <ul>
/// <li>
/// <p><code>ALARM</code> - The metric is outside of the defined threshold.</p></li>
/// <li>
/// <p><code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.</p></li>
/// <li>
/// <p><code>OK</code> - The metric is within the defined threshold.</p></li>
/// </ul>
pub fn set_state(mut self, input: ::std::option::Option<crate::types::AlarmState>) -> Self {
self.state = input;
self
}
/// <p>The current state of the alarm.</p>
/// <p>An alarm has the following possible states:</p>
/// <ul>
/// <li>
/// <p><code>ALARM</code> - The metric is outside of the defined threshold.</p></li>
/// <li>
/// <p><code>INSUFFICIENT_DATA</code> - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.</p></li>
/// <li>
/// <p><code>OK</code> - The metric is within the defined threshold.</p></li>
/// </ul>
pub fn get_state(&self) -> &::std::option::Option<crate::types::AlarmState> {
&self.state
}
/// <p>The unit of the metric associated with the alarm.</p>
pub fn unit(mut self, input: crate::types::MetricUnit) -> Self {
self.unit = ::std::option::Option::Some(input);
self
}
/// <p>The unit of the metric associated with the alarm.</p>
pub fn set_unit(mut self, input: ::std::option::Option<crate::types::MetricUnit>) -> Self {
self.unit = input;
self
}
/// <p>The unit of the metric associated with the alarm.</p>
pub fn get_unit(&self) -> &::std::option::Option<crate::types::MetricUnit> {
&self.unit
}
/// Appends an item to `contact_protocols`.
///
/// To override the contents of this collection use [`set_contact_protocols`](Self::set_contact_protocols).
///
/// <p>The contact protocols for the alarm, such as <code>Email</code>, <code>SMS</code> (text messaging), or both.</p>
pub fn contact_protocols(mut self, input: crate::types::ContactProtocol) -> Self {
let mut v = self.contact_protocols.unwrap_or_default();
v.push(input);
self.contact_protocols = ::std::option::Option::Some(v);
self
}
/// <p>The contact protocols for the alarm, such as <code>Email</code>, <code>SMS</code> (text messaging), or both.</p>
pub fn set_contact_protocols(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ContactProtocol>>) -> Self {
self.contact_protocols = input;
self
}
/// <p>The contact protocols for the alarm, such as <code>Email</code>, <code>SMS</code> (text messaging), or both.</p>
pub fn get_contact_protocols(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ContactProtocol>> {
&self.contact_protocols
}
/// Appends an item to `notification_triggers`.
///
/// To override the contents of this collection use [`set_notification_triggers`](Self::set_notification_triggers).
///
/// <p>The alarm states that trigger a notification.</p>
pub fn notification_triggers(mut self, input: crate::types::AlarmState) -> Self {
let mut v = self.notification_triggers.unwrap_or_default();
v.push(input);
self.notification_triggers = ::std::option::Option::Some(v);
self
}
/// <p>The alarm states that trigger a notification.</p>
pub fn set_notification_triggers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AlarmState>>) -> Self {
self.notification_triggers = input;
self
}
/// <p>The alarm states that trigger a notification.</p>
pub fn get_notification_triggers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AlarmState>> {
&self.notification_triggers
}
/// <p>Indicates whether the alarm is enabled.</p>
pub fn notification_enabled(mut self, input: bool) -> Self {
self.notification_enabled = ::std::option::Option::Some(input);
self
}
/// <p>Indicates whether the alarm is enabled.</p>
pub fn set_notification_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
self.notification_enabled = input;
self
}
/// <p>Indicates whether the alarm is enabled.</p>
pub fn get_notification_enabled(&self) -> &::std::option::Option<bool> {
&self.notification_enabled
}
/// Appends an item to `tags`.
///
/// To override the contents of this collection use [`set_tags`](Self::set_tags).
///
/// <p>The tag keys and optional values for the resource. For more information about tags in Lightsail, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tags">Amazon Lightsail Developer Guide</a>.</p>
pub fn tags(mut self, input: crate::types::Tag) -> Self {
let mut v = self.tags.unwrap_or_default();
v.push(input);
self.tags = ::std::option::Option::Some(v);
self
}
/// <p>The tag keys and optional values for the resource. For more information about tags in Lightsail, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tags">Amazon Lightsail Developer Guide</a>.</p>
pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
self.tags = input;
self
}
/// <p>The tag keys and optional values for the resource. For more information about tags in Lightsail, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tags">Amazon Lightsail Developer Guide</a>.</p>
pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
&self.tags
}
/// Consumes the builder and constructs a [`Alarm`](crate::types::Alarm).
pub fn build(self) -> crate::types::Alarm {
crate::types::Alarm {
name: self.name,
arn: self.arn,
created_at: self.created_at,
location: self.location,
resource_type: self.resource_type,
support_code: self.support_code,
monitored_resource_info: self.monitored_resource_info,
comparison_operator: self.comparison_operator,
evaluation_periods: self.evaluation_periods,
period: self.period,
threshold: self.threshold,
datapoints_to_alarm: self.datapoints_to_alarm,
treat_missing_data: self.treat_missing_data,
statistic: self.statistic,
metric_name: self.metric_name,
state: self.state,
unit: self.unit,
contact_protocols: self.contact_protocols,
notification_triggers: self.notification_triggers,
notification_enabled: self.notification_enabled,
tags: self.tags,
}
}
}