Skip to content

Commit 799b541

Browse files
authored
feat(dynamodb): enable contributor insights for global secondary index (#30560)
### Issue # (if applicable) Closes #15671 . ### Reason for this change To enable contributor insights for a specific global secondary index. This feature is supported in [CFn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-globalsecondaryindex.html#cfn-dynamodb-contributorinsightsspecification-enabled). ### Description of changes Add `contributorInsightsEnabled` property to the `GlobalSecondaryIndexProps` in `Table`. In [AWS::DynamoDB::GlobalTable GlobalSecondaryIndex](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-globaltable-globalsecondaryindex.html), `ContributorInsightsSpecification` does not exist. So I didn't change `TableV2`. ### Description of how you validated changes Add unit test and integ tests. ### 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 108737d commit 799b541

12 files changed

+605
-5
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.contirubtor-insights-for-gsi.js.snapshot/aws-cdk-dynamodb-contributor-insights-for-gsi.assets.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"Resources": {
3+
"TableWithGlobalSecondaryIndexCC8E841E": {
4+
"Type": "AWS::DynamoDB::Table",
5+
"Properties": {
6+
"AttributeDefinitions": [
7+
{
8+
"AttributeName": "hashKey",
9+
"AttributeType": "S"
10+
},
11+
{
12+
"AttributeName": "gsiHashKey",
13+
"AttributeType": "S"
14+
}
15+
],
16+
"GlobalSecondaryIndexes": [
17+
{
18+
"ContributorInsightsSpecification": {
19+
"Enabled": true
20+
},
21+
"IndexName": "GSI-ContributorInsightsEnabled",
22+
"KeySchema": [
23+
{
24+
"AttributeName": "gsiHashKey",
25+
"KeyType": "HASH"
26+
}
27+
],
28+
"Projection": {
29+
"ProjectionType": "ALL"
30+
},
31+
"ProvisionedThroughput": {
32+
"ReadCapacityUnits": 5,
33+
"WriteCapacityUnits": 5
34+
}
35+
},
36+
{
37+
"ContributorInsightsSpecification": {
38+
"Enabled": false
39+
},
40+
"IndexName": "GSI-ContributorInsightsDisabled",
41+
"KeySchema": [
42+
{
43+
"AttributeName": "gsiHashKey",
44+
"KeyType": "HASH"
45+
}
46+
],
47+
"Projection": {
48+
"ProjectionType": "ALL"
49+
},
50+
"ProvisionedThroughput": {
51+
"ReadCapacityUnits": 5,
52+
"WriteCapacityUnits": 5
53+
}
54+
}
55+
],
56+
"KeySchema": [
57+
{
58+
"AttributeName": "hashKey",
59+
"KeyType": "HASH"
60+
}
61+
],
62+
"ProvisionedThroughput": {
63+
"ReadCapacityUnits": 5,
64+
"WriteCapacityUnits": 5
65+
}
66+
},
67+
"UpdateReplacePolicy": "Delete",
68+
"DeletionPolicy": "Delete"
69+
}
70+
},
71+
"Parameters": {
72+
"BootstrapVersion": {
73+
"Type": "AWS::SSM::Parameter::Value<String>",
74+
"Default": "/cdk-bootstrap/hnb659fds/version",
75+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
76+
}
77+
},
78+
"Rules": {
79+
"CheckBootstrapVersion": {
80+
"Assertions": [
81+
{
82+
"Assert": {
83+
"Fn::Not": [
84+
{
85+
"Fn::Contains": [
86+
[
87+
"1",
88+
"2",
89+
"3",
90+
"4",
91+
"5"
92+
],
93+
{
94+
"Ref": "BootstrapVersion"
95+
}
96+
]
97+
}
98+
]
99+
},
100+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
101+
}
102+
]
103+
}
104+
}
105+
}

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.contirubtor-insights-for-gsi.js.snapshot/awscdkdynamodbcontributorinsightsforgsitestDefaultTestDeployAssert9D8EC318.assets.json

Lines changed: 19 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-dynamodb/test/integ.dynamodb.contirubtor-insights-for-gsi.js.snapshot/awscdkdynamodbcontributorinsightsforgsitestDefaultTestDeployAssert9D8EC318.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-dynamodb/test/integ.dynamodb.contirubtor-insights-for-gsi.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-dynamodb/test/integ.dynamodb.contirubtor-insights-for-gsi.js.snapshot/integ.json

Lines changed: 12 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-dynamodb/test/integ.dynamodb.contirubtor-insights-for-gsi.js.snapshot/manifest.json

Lines changed: 113 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)