Skip to content

Commit 7e4de93

Browse files
committed
changes.md
1 parent 6571759 commit 7e4de93

File tree

1 file changed

+35
-0
lines changed
  • specification/changes/2024-02-29-encryption-context

1 file changed

+35
-0
lines changed

specification/changes/2024-02-29-encryption-context/change.md

+35
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,38 @@ Then Structured Encryption adds all of the appropriate values to the encryption
8787
which includes at least the primary hash and sort keys, possibly others,
8888
and wraps the RequiredEncryptionContextCMM passed in from the Item Encryptor in
8989
another layer of RequiredEncryptionContextCMM to include those value.
90+
91+
# Java Enhanced Client
92+
93+
To use this new functionality with the DynamoDB Enhanced Client in Java,
94+
tag your attribute with `@DynamoDbEncryptionSignAndIncludeInEncryptionContext`
95+
96+
### Single Table Design
97+
98+
To better handle [Single-Table Design](https://aws.amazon.com/blogs/compute/creating-a-single-table-design-with-amazon-dynamodb/),
99+
one can now specify multiple schemas when building a DynamoDbEnhancedTableEncryptionConfig
100+
as shown below.
101+
102+
```
103+
TableSchema<SimpleClass> tableSchema1 = TableSchema.fromBean(Class1.class);
104+
TableSchema<SimpleClass2> tableSchema2 = TableSchema.fromBean(Class2.class);
105+
TableSchema<SimpleClass3> tableSchema3 = TableSchema.fromBean(Class3.class);
106+
107+
DynamoDbEnhancedTableEncryptionConfig.builder()
108+
.logicalTableName(MyTableName)
109+
.schemaOnEncrypt(tableSchema1)
110+
.schemaOnEncrypt(tableSchema2)
111+
.schemaOnEncrypt(tableSchema3)
112+
...
113+
.build());
114+
115+
DynamoDbTable<Class1> table1 = enhancedClient.table(MyTableName, tableSchema1);
116+
DynamoDbTable<Class2> table2 = enhancedClient.table(MyTableName, tableSchema2);
117+
DynamoDbTable<Class3> table3 = enhancedClient.table(MyTableName, tableSchema3);
118+
119+
TransactWriteItemsEnhancedRequest.builder()
120+
.addPutItem(table1, item1)
121+
.addPutItem(table2, item2)
122+
.addPutItem(table3, item3)
123+
.build();
124+
```

0 commit comments

Comments
 (0)