diff --git a/lib/facade/MonitoringFacade.d.ts.map b/lib/facade/MonitoringFacade.d.ts.map index ccae1c69..b7ebb8be 100644 --- a/lib/facade/MonitoringFacade.d.ts.map +++ b/lib/facade/MonitoringFacade.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"MonitoringFacade.d.ts","sourceRoot":"","sources":["MonitoringFacade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAKL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,iCAAiC,EAElC,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,yBAAyB,EAEzB,kCAAkC,EAElC,sBAAsB,EAEtB,+BAA+B,EAE/B,sBAAsB,EAEtB,iCAAiC,EAEjC,qCAAqC,EAErC,+BAA+B,EAE/B,qBAAqB,EAErB,8CAA8C,EAE9C,0BAA0B,EAC1B,yCAAyC,EAEzC,kBAAkB,EAClB,qCAAqC,EAErC,yBAAyB,EAEzB,iCAAiC,EACjC,6CAA6C,EAC7C,yCAAyC,EAEzC,6BAA6B,EAI7B,sBAAsB,EAEtB,mCAAmC,EAEnC,gCAAgC,EAEhC,8BAA8B,EAE9B,6BAA6B,EAE7B,kBAAkB,EAElB,kCAAkC,EAElC,gCAAgC,EAChC,wCAAwC,EACxC,4CAA4C,EAE5C,yBAAyB,EAEzB,8BAA8B,EAE9B,uBAAuB,EAEvB,mCAAmC,EACnC,+BAA+B,EAC/B,mCAAmC,EAEnC,uBAAuB,EAEvB,uBAAuB,EAEvB,8BAA8B,EAE9B,mCAAmC,EAEnC,4CAA4C,EAE5C,2B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IAOtD,eAAe,CAAC,KAAK,EAAE,uBAAuB;IAM9C,UAAU,CAAC,KAAK,EAAE,kBAAkB;IAMpC,uBAAuB,CAAC,KAAK,EAAE,+BAA+B;IAM9D,kCAAkC,CAAC,KAAK,EAAE,oBAAoB;IAM9D,cAAc,CAAC,KAAK,CAAC,EAAE,sBAAsB;IAM7C,aAAa,CAAC,KAAK,EAAE,qBAAqB;IAM1C;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,qBAAqB;CAInE"} \ No newline at end of file +{"version":3,"file":"MonitoringFacade.d.ts","sourceRoot":"","sources":["MonitoringFacade.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAKL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,iCAAiC,EAElC,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,yBAAyB,EAEzB,kCAAkC,EAElC,sBAAsB,EAEtB,+BAA+B,EAE/B,sBAAsB,EAEtB,iCAAiC,EAEjC,qCAAqC,EAErC,+BAA+B,EAE/B,qBAAqB,EAErB,8CAA8C,EAE9C,0BAA0B,EAC1B,yCAAyC,EAEzC,kBAAkB,EAClB,qCAAqC,EAErC,yBAAyB,EAEzB,iCAAiC,EACjC,6CAA6C,EAC7C,yCAAyC,EAEzC,6BAA6B,EAI7B,sBAAsB,EAEtB,mCAAmC,EAEnC,gCAAgC,EAEhC,8BAA8B,EAE9B,6BAA6B,EAE7B,kBAAkB,EAElB,kCAAkC,EAElC,gCAAgC,EAChC,wCAAwC,E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CAAC,KAAK,EAAE,8BAA8B;IAM5D,mBAAmB,CAAC,KAAK,EAAE,2BAA2B;IAMtD,2BAA2B,CAAC,KAAK,EAAE,mCAAmC;IAMtE,oCAAoC,CAClC,KAAK,EAAE,4CAA4C;IAOrD,qCAAqC,CACnC,KAAK,EAAE,6CAA6C;IAOtD,eAAe,CAAC,KAAK,EAAE,uBAAuB;IAM9C,UAAU,CAAC,KAAK,EAAE,kBAAkB;IAMpC,uBAAuB,CAAC,KAAK,EAAE,+BAA+B;IAM9D,kCAAkC,CAAC,KAAK,EAAE,oBAAoB;IAM9D,cAAc,CAAC,KAAK,CAAC,EAAE,sBAAsB;IAM7C,aAAa,CAAC,KAAK,EAAE,qBAAqB;IAM1C;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,qBAAqB;CAInE"} \ No newline at end of file diff --git a/lib/facade/MonitoringFacade.ts b/lib/facade/MonitoringFacade.ts index 2c7e2a69..7e323fc9 100644 --- a/lib/facade/MonitoringFacade.ts +++ b/lib/facade/MonitoringFacade.ts @@ -116,11 +116,13 @@ export interface MonitoringFacadeProps { * @default empty (no preferences) */ readonly metricFactoryDefaults?: MetricFactoryDefaults; + /** * Defaults for alarm factory. * @default actions enabled, facade logical ID used as default alarm name prefix */ readonly alarmFactoryDefaults?: AlarmFactoryDefaults; + /** * Defaults for dashboard factory. * @default `DefaultDashboardFactory`; facade logical ID used as default name @@ -170,7 +172,7 @@ export class MonitoringFacade extends MonitoringScope { scope: Construct, defaultName: string ): IDashboardFactory { - return new DefaultDashboardFactory(scope, "Dashboards", { + return new DefaultDashboardFactory(scope, `${defaultName}-Dashboards`, { dashboardNamePrefix: defaultName, }); } diff --git a/test/facade/MonitoringFacade.test.ts b/test/facade/MonitoringFacade.test.ts index 30f934cc..a737d82d 100644 --- a/test/facade/MonitoringFacade.test.ts +++ b/test/facade/MonitoringFacade.test.ts @@ -3,15 +3,31 @@ import { Template } from "aws-cdk-lib/assertions"; import { MonitoringFacade } from "../../lib"; describe("test of defaults", () => { - const stack = new Stack(); - new MonitoringFacade(stack, "Test"); - const result = Template.fromStack(stack); - test("only default dashboard gets created by default", () => { + const stack = new Stack(); + new MonitoringFacade(stack, "Test"); + const result = Template.fromStack(stack); + result.resourceCountIs("AWS::CloudWatch::Dashboard", 1); result.hasResourceProperties("AWS::CloudWatch::Dashboard", { DashboardName: "Test", }); }); + + test("handles multiple facades", () => { + const stack = new Stack(); + new MonitoringFacade(stack, "Test1"); + new MonitoringFacade(stack, "Test2"); + const result = Template.fromStack(stack); + + result.resourceCountIs("AWS::CloudWatch::Dashboard", 2); + + result.hasResourceProperties("AWS::CloudWatch::Dashboard", { + DashboardName: "Test1", + }); + result.hasResourceProperties("AWS::CloudWatch::Dashboard", { + DashboardName: "Test2", + }); + }); });