Skip to content

Commit df9814f

Browse files
authored
feat(cloudwatch): expose dashboardArn for CloudWatch dashboard L2 construct (#20059)
This change will expose dashboardArn from CloudWatch dashboard L2 construct, and close issue: #18744 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent dacc9ab commit df9814f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ export interface DashboardProps {
7575
* A CloudWatch dashboard
7676
*/
7777
export class Dashboard extends Resource {
78+
/**
79+
* ARN of this dashboard
80+
*
81+
* @attribute
82+
*/
83+
public readonly dashboardArn: string;
84+
7885
private readonly rows: IWidget[] = [];
7986

8087
constructor(scope: Construct, id: string, props: DashboardProps = {}) {
@@ -111,6 +118,12 @@ export class Dashboard extends Resource {
111118
(props.widgets || []).forEach(row => {
112119
this.addWidgets(...row);
113120
});
121+
122+
this.dashboardArn = Stack.of(this).formatArn({
123+
service: 'cloudwatch',
124+
resource: 'dashboard',
125+
resourceName: this.physicalName,
126+
});
114127
}
115128

116129
/**

0 commit comments

Comments
 (0)