Skip to content

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

Merged
mergify[bot] merged 8 commits intoaws:masterfrom
arjanschaaf:master
Feb 1, 2022
Merged

feat(dynamodb): allow setting TableClass for a Table#18719
mergify[bot] merged 8 commits intoaws:masterfrom
arjanschaaf:master

Conversation

@arjanschaaf
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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

Copy link
Copy Markdown
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.


/**
* Specifiy the table class.
* @default STANDARD else STANDARD_INFREQUENT_ACCESS
Copy link
Copy Markdown
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

partitionKey: TABLE_PARTITION_KEY,
});

Template.fromStack(stack).hasResourceProperties('AWS::DynamoDB::Table',
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

* @see https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.TableClasses.html
*/
export enum TableClass {
/** Default table class for DynamoDB */
Copy link
Copy Markdown
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. */

test('when specifying STANDARD table class', () => {
const stack = new Stack();
new Table(stack, CONSTRUCT_NAME, {
tableName: TABLE_NAME,
Copy link
Copy Markdown
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).

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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