|
1 | 1 | package awsdbe
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - // Standard imports |
5 | 4 | "context"
|
6 | 5 | "reflect"
|
7 | 6 |
|
8 |
| - // AWS SDK imports |
9 |
| - |
10 | 7 | "github.com/aws/aws-sdk-go-v2/aws"
|
11 | 8 | "github.com/aws/aws-sdk-go-v2/config"
|
12 | 9 | "github.com/aws/aws-sdk-go-v2/service/dynamodb"
|
13 | 10 | "github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
|
14 | 11 |
|
15 | 12 | "github.com/aws/aws-database-encryption-sdk-dynamodb/releases/go/dynamodb-esdk/dbesdkmiddleware"
|
16 | 13 | "github.com/aws/aws-database-encryption-sdk-dynamodb/releases/go/dynamodb-esdk/examples/utils"
|
| 14 | + |
| 15 | + dbesdkdynamodbencryptiontypes "github.com/aws/aws-database-encryption-sdk-dynamodb/releases/go/dynamodb-esdk/awscryptographydbencryptionsdkdynamodbsmithygeneratedtypes" |
17 | 16 | )
|
18 | 17 |
|
19 | 18 | /*
|
@@ -43,7 +42,20 @@ func MigrationStep1(kmsKeyID, ddbTableName, partitionKeyValue, sortKeyValue stri
|
43 | 42 | // 1. Configure your Keyring, attribute actions,
|
44 | 43 | // allowedUnsignedAttributes, and encryption configuration for table.
|
45 | 44 | // This is common across all the steps.
|
46 |
| - listOfTableConfigs := configureTable(kmsKeyID, ddbTableName) |
| 45 | + |
| 46 | + // Note that while we still are not writing encrypted items, |
| 47 | + // and our key will not be used to encrypt items in this example, |
| 48 | + // our configuration specifies that we may read encrypted items, |
| 49 | + // and we should expect to be able to decrypt and process any encrypted items. |
| 50 | + // To that end, we must fully define our encryption configuration in |
| 51 | + // this step. |
| 52 | + |
| 53 | + // This `PlaintextOverrideForcePlaintextWriteAllowPlaintextRead` means: |
| 54 | + // - Write: Items are forced to be written as plaintext. |
| 55 | + // Items may not be written as encrypted items. |
| 56 | + // - Read: Items are allowed to be read as plaintext. |
| 57 | + // Items are allowed to be read as encrypted items. |
| 58 | + listOfTableConfigs := configureTable(kmsKeyID, ddbTableName, dbesdkdynamodbencryptiontypes.PlaintextOverrideForcePlaintextWriteAllowPlaintextRead) |
47 | 59 |
|
48 | 60 | // 2. Create DynamoDB client with dbEsdkMiddleware
|
49 | 61 | dbEsdkMiddleware, err := dbesdkmiddleware.NewDBEsdkMiddleware(listOfTableConfigs)
|
|
0 commit comments