diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts b/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts index 6c017e15265ab..e72741607c0b2 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts +++ b/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts @@ -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"; @@ -74,7 +74,7 @@ export interface AlarmWidgetProps extends MetricWidgetProps { /** * The alarm to show */ - readonly alarm: Alarm; + readonly alarm: IAlarm; /** * Left Y axis diff --git a/packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts b/packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts index 1f20e81db8103..7850b35867da7 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts +++ b/packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts @@ -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) { @@ -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(); + }, };