@@ -136,40 +136,40 @@ public static void PutItemGetItem(String kmsKeyId, String ddbTableName) {
136
136
)
137
137
.build ();
138
138
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 ();
165
165
166
166
// 8. Get the item back from our table using the same client.
167
167
// The client will decrypt the item client-side, and return
168
168
// back the original item.
169
169
final HashMap <String , AttributeValue > keyToGet = new HashMap <>();
170
170
keyToGet .put (
171
171
"partition_key" ,
172
- AttributeValue .builder ().s ("LucasTesting " ).build ()
172
+ AttributeValue .builder ().s ("BasicPutGetExample " ).build ()
173
173
);
174
174
keyToGet .put ("sort_key" , AttributeValue .builder ().n ("0" ).build ());
175
175
0 commit comments