Skip to content

Commit 8779b31

Browse files
author
Lucas McDonald
committed
m
1 parent bb290e7 commit 8779b31

File tree

1 file changed

+27
-27
lines changed
  • Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples

1 file changed

+27
-27
lines changed

Examples/runtimes/java/DynamoDbEncryption/src/main/java/software/amazon/cryptography/examples/BasicPutGetExample.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -136,40 +136,40 @@ public static void PutItemGetItem(String kmsKeyId, String ddbTableName) {
136136
)
137137
.build();
138138

139-
// // 7. Put an item into our table using the above client.
140-
// // Before the item gets sent to DynamoDb, it will be encrypted
141-
// // client-side, according to our configuration.
142-
// final HashMap<String, AttributeValue> item = new HashMap<>();
143-
// item.put(
144-
// "partition_key",
145-
// AttributeValue.builder().s("LucasTesting").build()
146-
// s
147-
// item.put("sort_key", AttributeValue.builder().n("0").build());
148-
// item.put(
149-
// "attribute1",
150-
// AttributeValue.builder().s("encrypt and sign me!").build()
151-
// );
152-
// item.put("attribute2", AttributeValue.builder().s("sign me!").build());
153-
// item.put(":attribute3", AttributeValue.builder().s("ignore me!").build());
154-
//
155-
// final PutItemRequest putRequest = PutItemRequest
156-
// .builder()
157-
// .tableName(ddbTableName)
158-
// .item(item)
159-
// .build();
160-
//
161-
// final PutItemResponse putResponse = ddb.putItem(putRequest);
162-
//
163-
// // Demonstrate that PutItem succeeded
164-
// assert 200 == putResponse.sdkHttpResponse().statusCode();
139+
// 7. Put an item into our table using the above client.
140+
// Before the item gets sent to DynamoDb, it will be encrypted
141+
// client-side, according to our configuration.
142+
final HashMap<String, AttributeValue> item = new HashMap<>();
143+
item.put(
144+
"partition_key",
145+
AttributeValue.builder().s("BasicPutGetExample").build()
146+
);
147+
item.put("sort_key", AttributeValue.builder().n("0").build());
148+
item.put(
149+
"attribute1",
150+
AttributeValue.builder().s("encrypt and sign me!").build()
151+
);
152+
item.put("attribute2", AttributeValue.builder().s("sign me!").build());
153+
item.put(":attribute3", AttributeValue.builder().s("ignore me!").build());
154+
155+
final PutItemRequest putRequest = PutItemRequest
156+
.builder()
157+
.tableName(ddbTableName)
158+
.item(item)
159+
.build();
160+
161+
final PutItemResponse putResponse = ddb.putItem(putRequest);
162+
163+
// Demonstrate that PutItem succeeded
164+
assert 200 == putResponse.sdkHttpResponse().statusCode();
165165

166166
// 8. Get the item back from our table using the same client.
167167
// The client will decrypt the item client-side, and return
168168
// back the original item.
169169
final HashMap<String, AttributeValue> keyToGet = new HashMap<>();
170170
keyToGet.put(
171171
"partition_key",
172-
AttributeValue.builder().s("LucasTesting").build()
172+
AttributeValue.builder().s("BasicPutGetExample").build()
173173
);
174174
keyToGet.put("sort_key", AttributeValue.builder().n("0").build());
175175

0 commit comments

Comments
 (0)