Skip to content

Commit

Permalink
feat(dynamodb): add ability to enable contributor insights on Table (#…
Browse files Browse the repository at this point in the history
…14742)

Resolve #11626

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
sudo-ryan authored May 19, 2021
1 parent f50f230 commit 3c7a89d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ export interface TableOptions {
* @default Duration.minutes(30)
*/
readonly replicationTimeout?: Duration;

/**
* Whether CloudWatch contributor insights is enabled.
*
* @default false
*/
readonly contributorInsightsEnabled?: boolean;
}

/**
Expand Down Expand Up @@ -1114,6 +1121,7 @@ export class Table extends TableBase {
sseSpecification,
streamSpecification,
timeToLiveSpecification: props.timeToLiveAttribute ? { attributeName: props.timeToLiveAttribute, enabled: true } : undefined,
contributorInsightsSpecification: props.contributorInsightsEnabled !== undefined ? { enabled: props.contributorInsightsEnabled } : undefined,
});
this.table.applyRemovalPolicy(props.removalPolicy);

Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ test('when specifying every property', () => {
timeToLiveAttribute: 'timeToLive',
partitionKey: TABLE_PARTITION_KEY,
sortKey: TABLE_SORT_KEY,
contributorInsightsEnabled: true,
});
Tags.of(table).add('Environment', 'Production');

Expand All @@ -353,6 +354,7 @@ test('when specifying every property', () => {
TableName: 'MyTable',
Tags: [{ Key: 'Environment', Value: 'Production' }],
TimeToLiveSpecification: { AttributeName: 'timeToLive', Enabled: true },
ContributorInsightsSpecification: { Enabled: true },
},
);
});
Expand Down

0 comments on commit 3c7a89d

Please sign in to comment.