Skip to content

Commit

Permalink
[MGDCTRS-1568] Add system-x-aws-ses
Browse files Browse the repository at this point in the history
  • Loading branch information
avano committed Oct 18, 2022
1 parent 9390ace commit 4795cbd
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 2 deletions.
5 changes: 3 additions & 2 deletions system-x/services/aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
<module>kinesis-firehose</module>
<module>lambda</module>
<module>redshift</module>
<module>s3</module>
<module>sqs</module>
<module>ses</module>
<module>sns</module>
<module>sqs</module>
<module>s3</module>
</modules>
</project>
28 changes: 28 additions & 0 deletions system-x/services/aws/ses/pom.xml
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>
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;
}
}
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());
}
}
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;
}
}

0 comments on commit 4795cbd

Please sign in to comment.