@@ -162,10 +162,12 @@ func TestEncryptedClient_PutItem(t *testing.T) {
162
162
nil ,
163
163
), nil )
164
164
165
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
166
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
165
+ clientConfig := NewClientConfig (
166
+ WithDefaultEncryption (EncryptNone ),
167
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
168
+ )
167
169
168
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
170
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
169
171
170
172
item := map [string ]types.AttributeValue {
171
173
"PK" : & types.AttributeValueMemberS {Value : "123" },
@@ -189,10 +191,12 @@ func TestEncryptedClient_PutItem(t *testing.T) {
189
191
func TestEncryptedClient_PutItem_Failure (t * testing.T ) {
190
192
mockDynamoDBClient := new (MockDynamoDBClient )
191
193
mockCMProvider := new (MockCryptographicMaterialsProvider )
192
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
193
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
194
+ clientConfig := NewClientConfig (
195
+ WithDefaultEncryption (EncryptNone ),
196
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
197
+ )
194
198
195
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
199
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
196
200
197
201
// Mock the DescribeTable call to simulate fetching table primary key schema.
198
202
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
@@ -235,10 +239,12 @@ func TestEncryptedClient_PutItem_Failure(t *testing.T) {
235
239
func TestEncryptedClient_GetItem_Success (t * testing.T ) {
236
240
mockDynamoDBClient := new (MockDynamoDBClient )
237
241
mockCMProvider := new (MockCryptographicMaterialsProvider )
238
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
239
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
242
+ clientConfig := NewClientConfig (
243
+ WithDefaultEncryption (EncryptNone ),
244
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
245
+ )
240
246
241
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
247
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
242
248
243
249
// Mock DescribeTable call to simulate fetching table primary key schema.
244
250
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
@@ -264,7 +270,6 @@ func TestEncryptedClient_GetItem_Success(t *testing.T) {
264
270
mockCMProvider .On ("DecryptionMaterials" , mock .Anything , mock .Anything , mock .Anything ).Return (materials .NewDecryptionMaterials (
265
271
map [string ]string {"mock" : "data" },
266
272
& MockDelegatedKey {},
267
- nil ,
268
273
), nil )
269
274
270
275
// Test GetItem
@@ -286,9 +291,12 @@ func TestEncryptedClient_GetItem_Success(t *testing.T) {
286
291
func TestEncryptedClient_Query (t * testing.T ) {
287
292
mockDynamoDBClient := new (MockDynamoDBClient )
288
293
mockCMProvider := new (MockCryptographicMaterialsProvider )
289
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
290
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
291
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
294
+ clientConfig := NewClientConfig (
295
+ WithDefaultEncryption (EncryptNone ),
296
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
297
+ )
298
+
299
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
292
300
293
301
// Mock DescribeTable call to simulate fetching table primary key schema.
294
302
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
@@ -320,7 +328,6 @@ func TestEncryptedClient_Query(t *testing.T) {
320
328
mockCMProvider .On ("DecryptionMaterials" , mock .Anything , mock .Anything , mock .Anything ).Return (materials .NewDecryptionMaterials (
321
329
map [string ]string {"mock" : "data" },
322
330
& MockDelegatedKey {},
323
- nil ,
324
331
), nil )
325
332
326
333
// Test Query
@@ -342,9 +349,12 @@ func TestEncryptedClient_Query(t *testing.T) {
342
349
func TestEncryptedClient_Scan (t * testing.T ) {
343
350
mockDynamoDBClient := new (MockDynamoDBClient )
344
351
mockCMProvider := new (MockCryptographicMaterialsProvider )
345
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
346
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
347
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
352
+ clientConfig := NewClientConfig (
353
+ WithDefaultEncryption (EncryptNone ),
354
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
355
+ )
356
+
357
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
348
358
349
359
// Mock DescribeTable call to simulate fetching table primary key schema.
350
360
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
@@ -376,7 +386,6 @@ func TestEncryptedClient_Scan(t *testing.T) {
376
386
mockCMProvider .On ("DecryptionMaterials" , mock .Anything , mock .Anything , mock .Anything ).Return (materials .NewDecryptionMaterials (
377
387
map [string ]string {"mock" : "data" },
378
388
& MockDelegatedKey {},
379
- nil ,
380
389
), nil )
381
390
382
391
// Test Scan
@@ -394,9 +403,12 @@ func TestEncryptedClient_Scan(t *testing.T) {
394
403
func TestEncryptedClient_BatchGetItem (t * testing.T ) {
395
404
mockDynamoDBClient := new (MockDynamoDBClient )
396
405
mockCMProvider := new (MockCryptographicMaterialsProvider )
397
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
398
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
399
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
406
+ clientConfig := NewClientConfig (
407
+ WithDefaultEncryption (EncryptNone ),
408
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
409
+ )
410
+
411
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
400
412
401
413
// Mock DescribeTable call to simulate fetching table primary key schema.
402
414
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
@@ -430,7 +442,6 @@ func TestEncryptedClient_BatchGetItem(t *testing.T) {
430
442
mockCMProvider .On ("DecryptionMaterials" , mock .Anything , mock .Anything , mock .Anything ).Return (materials .NewDecryptionMaterials (
431
443
map [string ]string {"mock" : "data" },
432
444
& MockDelegatedKey {},
433
- nil ,
434
445
), nil )
435
446
436
447
// Test BatchGetItem
@@ -461,9 +472,12 @@ func TestEncryptedClient_BatchGetItem(t *testing.T) {
461
472
func TestEncryptedClient_BatchWriteItem (t * testing.T ) {
462
473
mockDynamoDBClient := new (MockDynamoDBClient )
463
474
mockCMProvider := new (MockCryptographicMaterialsProvider )
464
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
465
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
466
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
475
+ clientConfig := NewClientConfig (
476
+ WithDefaultEncryption (EncryptNone ),
477
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
478
+ )
479
+
480
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
467
481
468
482
// Mock DescribeTable call to simulate fetching table primary key schema.
469
483
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
@@ -520,9 +534,12 @@ func TestEncryptedClient_BatchWriteItem(t *testing.T) {
520
534
func TestEncryptedClient_DeleteItem (t * testing.T ) {
521
535
mockDynamoDBClient := new (MockDynamoDBClient )
522
536
mockCMProvider := new (MockCryptographicMaterialsProvider )
523
- attributeActions := NewAttributeActions (AttributeActionDoNothing )
524
- attributeActions .SetAttributeAction ("SensitiveAttribute" , AttributeActionEncrypt )
525
- encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , attributeActions )
537
+ clientConfig := NewClientConfig (
538
+ WithDefaultEncryption (EncryptNone ),
539
+ WithEncryption ("SensitiveAttribute" , EncryptStandard ),
540
+ )
541
+
542
+ encryptedClient := NewEncryptedClient (mockDynamoDBClient , mockCMProvider , clientConfig )
526
543
527
544
// Mock DescribeTable call to simulate fetching table primary key schema.
528
545
mockDynamoDBClient .On ("DescribeTable" , mock .Anything , mock .AnythingOfType ("*dynamodb.DescribeTableInput" ), mock .Anything ).Return (& dynamodb.DescribeTableOutput {
0 commit comments