|
1 | 1 | import { Construct, Token } from '@aws-cdk/cdk';
|
2 | 2 | import { CfnAlarm } from './cloudwatch.generated';
|
3 | 3 | import { HorizontalAnnotation } from './graph';
|
4 |
| -import { Dimension, Metric, Statistic, Unit } from './metric'; |
| 4 | +import { Dimension, Metric, MetricAarmProps, Statistic, Unit } from './metric'; |
5 | 5 | import { parseStatistic } from './util.statistic';
|
6 | 6 |
|
7 | 7 | /**
|
8 | 8 | * Properties for Alarms
|
9 | 9 | */
|
10 |
| -export interface AlarmProps { |
| 10 | +export interface AlarmProps extends MetricAarmProps { |
11 | 11 | /**
|
12 | 12 | * The metric to add the alarm on
|
13 | 13 | *
|
14 | 14 | * Metric objects can be obtained from most resources, or you can construct
|
15 | 15 | * custom Metric objects by instantiating one.
|
16 | 16 | */
|
17 | 17 | metric: Metric;
|
18 |
| - |
19 |
| - /** |
20 |
| - * Name of the alarm |
21 |
| - * |
22 |
| - * @default Automatically generated name |
23 |
| - */ |
24 |
| - alarmName?: string; |
25 |
| - |
26 |
| - /** |
27 |
| - * Description for the alarm |
28 |
| - * |
29 |
| - * @default No description |
30 |
| - */ |
31 |
| - alarmDescription?: string; |
32 |
| - |
33 |
| - /** |
34 |
| - * Comparison to use to check if metric is breaching |
35 |
| - * |
36 |
| - * @default GreaterThanOrEqualToThreshold |
37 |
| - */ |
38 |
| - comparisonOperator?: ComparisonOperator; |
39 |
| - |
40 |
| - /** |
41 |
| - * The value against which the specified statistic is compared. |
42 |
| - */ |
43 |
| - threshold: number; |
44 |
| - |
45 |
| - /** |
46 |
| - * The number of periods over which data is compared to the specified threshold. |
47 |
| - */ |
48 |
| - evaluationPeriods: number; |
49 |
| - |
50 |
| - /** |
51 |
| - * Specifies whether to evaluate the data and potentially change the alarm |
52 |
| - * state if there are too few data points to be statistically significant. |
53 |
| - * |
54 |
| - * Used only for alarms that are based on percentiles. |
55 |
| - */ |
56 |
| - evaluateLowSampleCountPercentile?: string; |
57 |
| - |
58 |
| - /** |
59 |
| - * Sets how this alarm is to handle missing data points. |
60 |
| - * |
61 |
| - * @default TreatMissingData.Missing |
62 |
| - */ |
63 |
| - treatMissingData?: TreatMissingData; |
64 |
| - |
65 |
| - /** |
66 |
| - * Whether the actions for this alarm are enabled |
67 |
| - * |
68 |
| - * @default true |
69 |
| - */ |
70 |
| - actionsEnabled?: boolean; |
71 | 18 | }
|
72 | 19 |
|
73 | 20 | /**
|
@@ -153,6 +100,7 @@ export class Alarm extends Construct {
|
153 | 100 | // Evaluation
|
154 | 101 | comparisonOperator,
|
155 | 102 | threshold: props.threshold,
|
| 103 | + datapointsToAlarm: props.datapointsToAlarm, |
156 | 104 | evaluateLowSampleCountPercentile: props.evaluateLowSampleCountPercentile,
|
157 | 105 | evaluationPeriods: props.evaluationPeriods,
|
158 | 106 | treatMissingData: props.treatMissingData,
|
|
0 commit comments