Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloudwatch): AlarmWidget takes IAlarm #3219

Merged
merged 2 commits into from
Jul 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudwatch/lib/graph.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cdk = require('@aws-cdk/core');
import { Alarm } from "./alarm";
import { IAlarm } from "./alarm";
import { IMetric } from "./metric-types";
import { ConcreteWidget } from "./widget";

Expand Down Expand Up @@ -74,7 +74,7 @@ export interface AlarmWidgetProps extends MetricWidgetProps {
/**
* The alarm to show
*/
readonly alarm: Alarm;
readonly alarm: IAlarm;

/**
* Left Y axis
Expand Down
18 changes: 17 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Stack } from '@aws-cdk/core';
import { Test } from 'nodeunit';
import { AlarmWidget, GraphWidget, Metric, Shading, SingleValueWidget } from '../lib';
import { Alarm, AlarmWidget, GraphWidget, Metric, Shading, SingleValueWidget } from '../lib';

export = {
'add metrics to graphs on either axis'(test: Test) {
Expand Down Expand Up @@ -250,4 +250,20 @@ export = {

test.done();
},

'can use imported alarm with graph'(test: Test) {
// GIVEN
const stack = new Stack();
const alarm = Alarm.fromAlarmArn(stack, 'Alarm', 'arn:aws:cloudwatch:region:account-id:alarm:alarm-name');

// WHEN
new AlarmWidget({
title: 'My fancy graph',
alarm
});

// THEN: Compiles

test.done();
},
};