in DynamoDbEncryption/runtimes/java/src/main/java/software/amazon/cryptography/dbencryptionsdk/dynamodb/enhancedclient/DynamoDbEnhancedClientEncryption.java [345:397]
private static DynamoDbTableEncryptionConfig getTableConfig(
final DynamoDbEnhancedTableEncryptionConfig configWithSchema,
final String tableName
) {
List<Map<String, CryptoAction>> actionList = new ArrayList<>();
for (TableSchema<?> schema : configWithSchema.schemaOnEncrypt()) {
actionList.add(getActionsFromSchema(tableName, schema));
}
Map<String, CryptoAction> actions = mergeActions(actionList);
DynamoDbTableEncryptionConfig.Builder builder =
DynamoDbTableEncryptionConfig.builder();
String partitionName = getPartitionKeyName(
configWithSchema.schemaOnEncrypt()
);
builder = builder.partitionKeyName(partitionName);
Optional<String> sortName = getSortKeyName(
configWithSchema.schemaOnEncrypt()
);
if (sortName.isPresent()) {
builder = builder.sortKeyName(sortName.get());
}
if (!Objects.isNull(configWithSchema.keyring())) {
builder = builder.keyring(configWithSchema.keyring());
}
if (!Objects.isNull(configWithSchema.cmm())) {
builder = builder.cmm(configWithSchema.cmm());
}
if (!Objects.isNull(configWithSchema.logicalTableName())) {
builder = builder.logicalTableName(configWithSchema.logicalTableName());
}
if (!Objects.isNull(configWithSchema.plaintextOverride())) {
builder = builder.plaintextOverride(configWithSchema.plaintextOverride());
}
if (!Objects.isNull(configWithSchema.algorithmSuiteId())) {
builder = builder.algorithmSuiteId(configWithSchema.algorithmSuiteId());
}
return builder
.allowedUnsignedAttributePrefix(
configWithSchema.allowedUnsignedAttributePrefix()
)
.allowedUnsignedAttributes(configWithSchema.allowedUnsignedAttributes())
.attributeActionsOnEncrypt(actions)
.legacyOverride(configWithSchema.legacyOverride())
.build();
}