Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dynamodb): allow setting TableClass for a Table #18719

Merged
merged 8 commits into from
Feb 1, 2022
Merged

feat(dynamodb): allow setting TableClass for a Table #18719

merged 8 commits into from
Feb 1, 2022

Conversation

arjanschaaf
Copy link
Contributor

@arjanschaaf arjanschaaf commented Jan 28, 2022

Support already exists in CloudFormation, but hasn't been implemented in CDK.

Closes #18718


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Jan 28, 2022

@github-actions github-actions bot added the @aws-cdk/aws-dynamodb Related to Amazon DynamoDB label Jan 28, 2022
@nathanagez
Copy link

Is everything good ? Any idea on when this feature will be merged ?

Copy link
Contributor

@madeline-k madeline-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR - @arjanschaaf! Here's my feedback.

@skinny85, the dynamodb owner, might also take a look as well.

packages/@aws-cdk/aws-dynamodb/lib/table.ts Outdated Show resolved Hide resolved
@@ -193,6 +193,12 @@ export interface TableOptions extends SchemaOptions {
*/
readonly serverSideEncryption?: boolean;

/**
* Specifiy the table class.
* @default STANDARD else STANDARD_INFREQUENT_ACCESS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the else part necessary here?

Suggested change
* @default STANDARD else STANDARD_INFREQUENT_ACCESS
* @default STANDARD

packages/@aws-cdk/aws-dynamodb/lib/table.ts Show resolved Hide resolved
packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts Outdated Show resolved Hide resolved
partitionKey: TABLE_PARTITION_KEY,
});

Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::Table',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test, we should also verify that a TableClass property is not present in the resulting template:

  Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::Table', Match.not(
    {
      TableClass: Match.anyValue(),
    }),
  );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, however I did implement it slightly different with Match.absent().

@mergify mergify bot dismissed madeline-k’s stale review January 31, 2022 08:11

Pull request has been modified.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @arjanschaaf, thanks so much for the contribution!

Minor comments, mainly around docs and tests.

packages/@aws-cdk/aws-dynamodb/lib/table.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-dynamodb/lib/table.ts Show resolved Hide resolved
* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.TableClasses.html
*/
export enum TableClass {
/** Default table class for DynamoDB */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full-stop please:

Suggested change
/** Default table class for DynamoDB */
/** Default table class for DynamoDB. */

packages/@aws-cdk/aws-dynamodb/lib/table.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts Outdated Show resolved Hide resolved
test('when specifying STANDARD table class', () => {
const stack = new Stack();
new Table(stack, CONSTRUCT_NAME, {
tableName: TABLE_NAME,
Copy link
Contributor

@skinny85 skinny85 Jan 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here (we don't need this property).

packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts Outdated Show resolved Hide resolved
@skinny85 skinny85 changed the title feat(dynamodb): add support for table class in table construct feat(dynamodb): allow setting TableClass for a Table Jan 31, 2022
@mergify mergify bot dismissed skinny85’s stale review February 1, 2022 07:53

Pull request has been modified.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @arjanschaaf!

@mergify
Copy link
Contributor

mergify bot commented Feb 1, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 6ba2f28
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 73a889e into aws:master Feb 1, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 1, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
Support already exists in CloudFormation, but hasn't been implemented in CDK.

Closes aws#18718

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-dynamodb Related to Amazon DynamoDB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(dynamodb): add support for Table Class in Table construct
5 participants