Skip to content

Conversation

mamsterdam11
Copy link

Add the option to set the SSESpecification field when creating a table.

AWS reference: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_SSESpecification.html

createtable.go Outdated
@@ -216,6 +217,18 @@ func (ct *CreateTable) Tag(key, value string) *CreateTable {
return ct
}

// SSEEncryption specifies the server side encryption for this table.
// Encryption is disabled by default. The valid values for sseType are {AES256, KMS}.
func (ct *CreateTable) SSEEncryption(enabled bool, keyID, sseType string) *CreateTable {
Copy link
Owner

Choose a reason for hiding this comment

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

Let's define a type for SSEType instead of taking any string.

Something like this:

dynamo/keys.go

Lines 3 to 12 in a59ef6b

// KeyType is used to specify the type of hash and range keys for tables and indexes.
type KeyType string
// Key types for table and index hash/range keys.
const (
BinaryType KeyType = "B"
StringType KeyType = "S"
NumberType KeyType = "N"
NoneType KeyType = ""
)

A lot of constants in this library are named ThingCategory instead of CategoryThing which is less than ideal, if that makes any sense. So maybe naming constants for the SSE stuff should have SSE as a prefix like SSETypeAES256 and SSETypeKMS.

@guregu
Copy link
Owner

guregu commented Feb 14, 2022

Thanks for the PR, I left one comment. If you take care of that then I'll merge this.

@guregu
Copy link
Owner

guregu commented Feb 14, 2022

Oh yeah, you might want to look at DescribeTable and add the relevant SSE stuff to that as well.

@mamsterdam11
Copy link
Author

Hey @guregu , thanks for the quick reply here!

I've updated the PR to reflect your comments. Can you take another look and merge if you're happy with this state?

Thanks again!

@guregu
Copy link
Owner

guregu commented Feb 19, 2022

@TigerToof looks great! Thank you!

@guregu guregu merged commit 44ffb32 into guregu:master Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants