Skip to content
Merged
Changes from 5 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
9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export interface DashboardProps {
* A CloudWatch dashboard
*/
export class Dashboard extends Resource {
/**
* The name of this dashboard
* @attribute
Comment thread
pedrosola marked this conversation as resolved.
*/
public readonly dashboardName: string;
private readonly rows: IWidget[] = [];

constructor(scope: Construct, id: string, props: DashboardProps = {}) {
Expand All @@ -92,7 +97,7 @@ export class Dashboard extends Resource {
}
}

new CfnDashboard(this, 'Resource', {
const dashboard = new CfnDashboard(this, 'Resource', {
dashboardName: this.physicalName,
dashboardBody: Lazy.string({
produce: () => {
Expand All @@ -108,6 +113,8 @@ export class Dashboard extends Resource {
}),
});

this.dashboardName = this.getResourceNameAttribute(dashboard.ref);

(props.widgets || []).forEach(row => {
this.addWidgets(...row);
});
Expand Down