diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2017-09-04 10:05:38 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2017-09-04 10:05:38 -0700 |
commit | cbf149af1f07bb98c1f856948a79dcf3fb0c43b3 (patch) | |
tree | 7901334e10e181ba2c79c09b3a9a32f16c1abc42 /src/main/java/com/p4square/grow/backend/dynamo | |
parent | 72ee0f10ddca0d880e50d13446f9ac0269e542eb (diff) |
SESNotificationService to accept multiple destinations.20170904
notificationEmail is now a comma separated list of addresses.
Adding unit tests for SESNotificationService.
Refactored AWS credential selection into ConfigCredentialProvider.
Diffstat (limited to 'src/main/java/com/p4square/grow/backend/dynamo')
-rw-r--r-- | src/main/java/com/p4square/grow/backend/dynamo/DynamoDatabase.java | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/main/java/com/p4square/grow/backend/dynamo/DynamoDatabase.java b/src/main/java/com/p4square/grow/backend/dynamo/DynamoDatabase.java index 68a165d..e04933f 100644 --- a/src/main/java/com/p4square/grow/backend/dynamo/DynamoDatabase.java +++ b/src/main/java/com/p4square/grow/backend/dynamo/DynamoDatabase.java @@ -4,14 +4,11 @@ package com.p4square.grow.backend.dynamo; -import java.util.Arrays; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -import com.amazonaws.auth.AWSCredentials; -import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; @@ -40,6 +37,7 @@ import com.amazonaws.services.dynamodbv2.model.UpdateTableRequest; import com.amazonaws.services.dynamodbv2.model.UpdateTableResult; import com.p4square.grow.config.Config; +import com.p4square.grow.config.ConfigCredentialProvider; /** * A wrapper around the Dynamo API. @@ -49,25 +47,7 @@ public class DynamoDatabase { private final String mTablePrefix; public DynamoDatabase(final Config config) { - AWSCredentials creds; - - String awsAccessKey = config.getString("awsAccessKey"); - if (awsAccessKey != null) { - creds = new AWSCredentials() { - @Override - public String getAWSAccessKeyId() { - return config.getString("awsAccessKey"); - } - @Override - public String getAWSSecretKey() { - return config.getString("awsSecretKey"); - } - }; - } else { - creds = new DefaultAWSCredentialsProviderChain().getCredentials(); - } - - mClient = new AmazonDynamoDBClient(creds); + mClient = new AmazonDynamoDBClient(new ConfigCredentialProvider(config)); String endpoint = config.getString("dynamoEndpoint"); if (endpoint != null) { |