Skip to content

Commit 879afd6

Browse files
feat(cloudwatch): add id and visible properties for CloudWatch Metric (#34870)
### Issue # (if applicable) Closes #19876 ### Reason for this change Allows setting id and visible for Cloudwatch Metric ### Description of changes Add id and visible in Cloudwatch Metric ### Describe any new or updated permissions being added ### Description of how you validated changes Add unit tests and integ test ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 8328c79 commit 879afd6

24 files changed

+2024
-299
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-metric-id-and-visible.js.snapshot/DashboardWithMetricIdAndVisibleIntegrationTest.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"Resources": {
3+
"DashCCD7F836": {
4+
"Type": "AWS::CloudWatch::Dashboard",
5+
"Properties": {
6+
"DashboardBody": {
7+
"Fn::Join": [
8+
"",
9+
[
10+
"{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"title\":\"Lambda Metrics with ID and Visible Properties\",\"region\":\"",
11+
{
12+
"Ref": "AWS::Region"
13+
},
14+
"\",\"metrics\":[[\"AWS/Lambda\",\"Invocations\",\"FunctionName\",\"test-function\",{\"label\":\"Lambda Invocations\",\"id\":\"lambda_invocations\",\"visible\":true}],[\"AWS/Lambda\",\"Errors\",\"FunctionName\",\"test-function\",{\"label\":\"Lambda Errors (Hidden for calculation)\",\"id\":\"lambda_errors\",\"visible\":false}],[\"AWS/Lambda\",\"Duration\",\"FunctionName\",\"test-function\",{\"label\":\"Lambda Duration\",\"id\":\"lambda_duration\",\"visible\":true}],[\"AWS/Lambda\",\"Throttles\",\"FunctionName\",\"test-function\",{\"label\":\"Lambda Throttles (Hidden)\",\"id\":\"lambda_throttles\",\"visible\":false}],[{\"label\":\"Error Rate (%)\",\"expression\":\"lambda_errors / lambda_invocations * 100\"}]],\"yAxis\":{}}}]}"
15+
]
16+
]
17+
}
18+
}
19+
}
20+
},
21+
"Parameters": {
22+
"BootstrapVersion": {
23+
"Type": "AWS::SSM::Parameter::Value<String>",
24+
"Default": "/cdk-bootstrap/hnb659fds/version",
25+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
26+
}
27+
},
28+
"Rules": {
29+
"CheckBootstrapVersion": {
30+
"Assertions": [
31+
{
32+
"Assert": {
33+
"Fn::Not": [
34+
{
35+
"Fn::Contains": [
36+
[
37+
"1",
38+
"2",
39+
"3",
40+
"4",
41+
"5"
42+
],
43+
{
44+
"Ref": "BootstrapVersion"
45+
}
46+
]
47+
}
48+
]
49+
},
50+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
51+
}
52+
]
53+
}
54+
}
55+
}

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-metric-id-and-visible.js.snapshot/cdk.out

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-metric-id-and-visible.js.snapshot/cdkintegdashboardwithmetricidandvisibleDefaultTestDeployAssert34BC1A62.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-metric-id-and-visible.js.snapshot/cdkintegdashboardwithmetricidandvisibleDefaultTestDeployAssert34BC1A62.template.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-metric-id-and-visible.js.snapshot/integ.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)