forked from tnb-software/TNB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>system-x-aws</artifactId> | ||
<groupId>software.tnb</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>system-x-aws-ses</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>TNB :: System-X :: Services :: AWS :: SES</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>software.tnb</groupId> | ||
<artifactId>system-x-aws-common</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>ses</artifactId> | ||
<version>${aws.clients.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
20 changes: 20 additions & 0 deletions
20
system-x/services/aws/ses/src/main/java/software/tnb/aws/ses/account/SESAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package software.tnb.aws.ses.account; | ||
|
||
import software.tnb.aws.common.account.AWSAccount; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* You need to verify that you own either a domain or an email address, so the identities need to be pre-configured in SES | ||
*/ | ||
public class SESAccount extends AWSAccount { | ||
private Map<String, String> identities; | ||
|
||
public String identity(String key) { | ||
return identities.get(key); | ||
} | ||
|
||
public void setIdentities(Map<String, String> identities) { | ||
this.identities = identities; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
system-x/services/aws/ses/src/main/java/software/tnb/aws/ses/service/SES.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package software.tnb.aws.ses.service; | ||
|
||
import software.tnb.aws.common.service.AWSService; | ||
import software.tnb.aws.ses.account.SESAccount; | ||
import software.tnb.aws.ses.validation.SESValidation; | ||
import software.tnb.common.account.Accounts; | ||
|
||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
import com.google.auto.service.AutoService; | ||
|
||
import software.amazon.awssdk.services.ses.SesClient; | ||
|
||
@AutoService(SES.class) | ||
public class SES extends AWSService<SESAccount, SesClient, SESValidation> { | ||
@Override | ||
public SESAccount account() { | ||
if (account == null) { | ||
LOG.debug("Creating new SES account"); | ||
account = Accounts.get(SESAccount.class); | ||
} | ||
return account; | ||
} | ||
|
||
@Override | ||
public void beforeAll(ExtensionContext extensionContext) throws Exception { | ||
LOG.debug("Creating new SQS validation"); | ||
validation = new SESValidation(client(SesClient.class), account()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
system-x/services/aws/ses/src/main/java/software/tnb/aws/ses/validation/SESValidation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package software.tnb.aws.ses.validation; | ||
|
||
import software.tnb.aws.ses.account.SESAccount; | ||
import software.tnb.common.service.Validation; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import software.amazon.awssdk.services.ses.SesClient; | ||
|
||
public class SESValidation implements Validation { | ||
private static final Logger LOG = LoggerFactory.getLogger(SESValidation.class); | ||
|
||
private final SesClient client; | ||
private final SESAccount account; | ||
|
||
public SESValidation(SesClient client, SESAccount account) { | ||
this.client = client; | ||
this.account = account; | ||
} | ||
} |