refactor(ses): split the configuration-set endpoints into SesConfigurationSetController (#3795)

The fifteen /v2/email/configuration-sets endpoints, event destinations
included, and their six option parsers move byte-for-byte out of
SesController into SesConfigurationSetController. Eleven of them call
SesConfigurationSetService directly and so do the v1 handler's eight
matching actions, so SesService drops twelve delegations and reads the
store through the service internally. Create, the tracking and delivery
option setters and delete stay on the facade, which supplies the
verified-domain and dedicated-pool probes and guards the delete against
tenant associations. The new class is registered on the SES descriptor.
No wire behavior changes.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-09-17 07:54:52 -05:00
1 parent b3d46d5024
commit d0d787d8a3
8 files changed
+575 -550

No files matched your search

@@ -40,6 +40,9 @@ class SesConfigurationSetSuppressionOptionsV2IntegrationTest {
@Inject
SesSuppressionService suppressionService;
@Inject
SesConfigurationSetService configSetService;
@Test
@Order(1)
void createConfigurationSet() {
@@ -234,7 +237,7 @@ class SesConfigurationSetSuppressionOptionsV2IntegrationTest {
.then()
.statusCode(200);
sesService.putConfigurationSetSuppressionOptions(csBounceOnly, List.of("BOUNCE"), REGION);
configSetService.putSuppressionOptions(csBounceOnly, List.of("BOUNCE"), REGION);
List<String> effective = sesService.getEffectiveSuppressedReasons(csBounceOnly, REGION);
assertEquals(List.of("BOUNCE"), effective);
@@ -253,7 +256,7 @@ class SesConfigurationSetSuppressionOptionsV2IntegrationTest {
.then()
.statusCode(200);
sesService.putConfigurationSetSuppressionOptions(csEmpty, List.of(), REGION);
configSetService.putSuppressionOptions(csEmpty, List.of(), REGION);
List<String> effective = sesService.getEffectiveSuppressedReasons(csEmpty, REGION);
assertTrue(effective.isEmpty(),
@@ -22,6 +22,7 @@ class SesServiceSmtpTest {
@Mock SmtpRelay smtpRelay;
private SesService service;
private SesConfigurationSetService configSets;
private InMemoryStorage<String, SentEmail> emailStore;
@BeforeEach
@@ -29,6 +30,7 @@ class SesServiceSmtpTest {
SesServiceTestBuilder builder = SesServiceTestBuilder.create().smtpRelay(smtpRelay);
emailStore = builder.emailStore();
service = builder.build();
configSets = builder.configSetService();
}
private SentEmail storedEmail(String messageId) {
@@ -233,7 +235,7 @@ class SesServiceSmtpTest {
// suppression list with reason=BOUNCE should still reach the SMTP relay.
service.putSuppressedDestination("us-east-1", "to@example.com", "BOUNCE");
service.createConfigurationSet(new ConfigurationSet("cs-no-suppression"), "us-east-1");
service.putConfigurationSetSuppressionOptions("cs-no-suppression", List.of(), "us-east-1");
configSets.putSuppressionOptions("cs-no-suppression", List.of(), "us-east-1");
service.sendEmail("from@example.com",
List.of("to@example.com"), null, null, null, null,
@@ -249,7 +251,7 @@ class SesServiceSmtpTest {
// suppressed for COMPLAINT is NOT filtered when sending through this CS.
service.putSuppressedDestination("us-east-1", "complainer@example.com", "COMPLAINT");
service.createConfigurationSet(new ConfigurationSet("cs-bounce-only"), "us-east-1");
service.putConfigurationSetSuppressionOptions("cs-bounce-only", List.of("BOUNCE"), "us-east-1");
configSets.putSuppressionOptions("cs-bounce-only", List.of("BOUNCE"), "us-east-1");
service.sendEmail("from@example.com",
List.of("complainer@example.com"), null, null, null, null,
@@ -277,7 +279,7 @@ class SesServiceSmtpTest {
void sendRawEmail_csOverridesAccountToEmptyList_suppressionListIsIgnored() {
service.putSuppressedDestination("us-east-1", "to@example.com", "BOUNCE");
service.createConfigurationSet(new ConfigurationSet("cs-no-suppression-raw"), "us-east-1");
service.putConfigurationSetSuppressionOptions("cs-no-suppression-raw", List.of(), "us-east-1");
configSets.putSuppressionOptions("cs-no-suppression-raw", List.of(), "us-east-1");
service.sendRawEmail("from@example.com",
List.of("to@example.com"), "raw MIME", null, "cs-no-suppression-raw", List.of(), null,
@@ -52,10 +52,11 @@ final class SesServiceTestBuilder {
private Route53Service route53Service = null;
private ObjectMapper objectMapper = new ObjectMapper();
private Clock clock = Clock.systemUTC();
// Built by build(); exposed so tests can seed contacts and account suppression through the domain
// services now that the facade no longer forwards those operations.
// Built by build(); exposed so tests can seed contacts, account suppression and configuration-set
// options through the domain services now that the facade no longer forwards those operations.
private SesContactService contactService;
private SesSuppressionService suppressionService;
private SesConfigurationSetService configSetService;
static SesServiceTestBuilder create() {
return new SesServiceTestBuilder();
@@ -125,15 +126,23 @@ final class SesServiceTestBuilder {
return suppressionService;
}
SesConfigurationSetService configSetService() {
if (configSetService == null) {
throw new IllegalStateException("call build() first");
}
return configSetService;
}
SesService build() {
contactService = new SesContactService(contactListStore, contactStore, clock);
suppressionService = new SesSuppressionService(suppressionStore, accountSuppressionStore,
new InMemoryStorage<>());
configSetService = new SesConfigurationSetService(configSetStore);
return new SesService(
new SesIdentityService(identityStore, route53Service, clock),
new SesSentEmailService(emailStore),
new SesTemplateService(templateStore, objectMapper, new SecureRandom()),
new SesConfigurationSetService(configSetStore),
configSetService,
suppressionService,
new SesDedicatedIpService(dedicatedIpPoolStore),
contactService,