Skip to content

Commit 8cb5dff

Browse files
authored
feat(cloudwatch): expose dashboardName property on the L2 Dashboard construct (#17721)
Exposes `dashboardName` property on `Dashboard` construct. closes issue #17648 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 4764591 commit 8cb5dff

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ export interface DashboardProps {
7575
* A CloudWatch dashboard
7676
*/
7777
export class Dashboard extends Resource {
78+
79+
/**
80+
* The name of this dashboard
81+
*
82+
* @attribute
83+
*/
84+
public readonly dashboardName: string;
85+
7886
/**
7987
* ARN of this dashboard
8088
*
@@ -99,7 +107,7 @@ export class Dashboard extends Resource {
99107
}
100108
}
101109

102-
new CfnDashboard(this, 'Resource', {
110+
const dashboard = new CfnDashboard(this, 'Resource', {
103111
dashboardName: this.physicalName,
104112
dashboardBody: Lazy.string({
105113
produce: () => {
@@ -115,6 +123,8 @@ export class Dashboard extends Resource {
115123
}),
116124
});
117125

126+
this.dashboardName = this.getResourceNameAttribute(dashboard.ref);
127+
118128
(props.widgets || []).forEach(row => {
119129
this.addWidgets(...row);
120130
});

0 commit comments

Comments
 (0)