diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java index 6c4fd4aa96..60508da9cd 100644 --- a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java +++ b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java @@ -36,10 +36,10 @@ import io.github.hectorvent.floci.services.route53.Route53Controller; import io.github.hectorvent.floci.services.ses.SesAccountController; import io.github.hectorvent.floci.services.ses.SesConfigurationSetController; import io.github.hectorvent.floci.services.ses.SesContactController; -import io.github.hectorvent.floci.services.ses.SesController; import io.github.hectorvent.floci.services.ses.SesCvetController; import io.github.hectorvent.floci.services.ses.SesDedicatedIpController; import io.github.hectorvent.floci.services.ses.SesIdentityController; +import io.github.hectorvent.floci.services.ses.SesSendController; import io.github.hectorvent.floci.services.ses.SesSuppressionController; import io.github.hectorvent.floci.services.ses.SesTagController; import io.github.hectorvent.floci.services.ses.SesTemplateController; @@ -296,12 +296,12 @@ public class ResolvedServiceCatalog { "ses", config.storage().mode(), 5000L, AwsNamespaces.SES, ServiceProtocol.REST_JSON, protocols(ServiceProtocol.REST_JSON, ServiceProtocol.QUERY), Set.of(), Set.of("email", "ses", "sesv2"), Set.of(), - Set.of(SesController.class, SesAccountController.class, - SesConfigurationSetController.class, SesContactController.class, - SesCvetController.class, SesDedicatedIpController.class, - SesIdentityController.class, SesSuppressionController.class, - SesTagController.class, - SesTemplateController.class, SesTenantController.class)), + Set.of(SesAccountController.class, SesConfigurationSetController.class, + SesContactController.class, SesCvetController.class, + SesDedicatedIpController.class, SesIdentityController.class, + SesSendController.class, SesSuppressionController.class, + SesTagController.class, SesTemplateController.class, + SesTenantController.class)), descriptor("es", "opensearch", config.services().opensearch().enabled(), true, "opensearch", storageMode(config.storage().services().opensearch().mode(), config.storage().mode()), config.storage().services().opensearch().flushIntervalMs(), null, ServiceProtocol.REST_JSON, diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java index 2f98a05210..827bf50bdd 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesAccountController.java @@ -33,8 +33,8 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireObjectOrA import static io.github.hectorvent.floci.services.ses.SesV2Json.stringMemberOrAbsent; /** - * SES V2 account-level endpoints ({@code /v2/email/account}), split out of {@link SesController}. - * The settings live in {@link SesAccountService}; {@code GetAccount} also reads the account + * SES V2 account-level endpoints ({@code /v2/email/account}). The settings live in + * {@link SesAccountService}; {@code GetAccount} also reads the account * suppression attributes from {@link SesSuppressionService} and the sent-mail count from * {@link SesSentEmailService}, a read-only composition that needs no facade orchestration, so this * controller does not depend on {@link SesService}. diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetController.java index b1fad82285..2ba352efe0 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetController.java @@ -44,7 +44,7 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireJsonObjec /** * SES V2 configuration-set endpoints ({@code /v2/email/configuration-sets}), including the event - * destinations, split out of {@link SesController}. Most operations call + * destinations. Most operations call * {@link SesConfigurationSetService} directly; create, the tracking and delivery option setters * and delete go through the {@link SesService} facade, which supplies the verified-domain and * dedicated-pool probes those validations need and guards the delete against tenant associations. diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesContactController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesContactController.java index b9ccf0475d..acffcfe60b 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesContactController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesContactController.java @@ -37,10 +37,10 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireJsonObjec import static io.github.hectorvent.floci.services.ses.SesV2Json.unexpectedStartError; /** - * SES V2 contact-list and contact endpoints ({@code /v2/email/contact-lists}), split out of - * {@link SesController}. Every operation is a single-domain call on {@link SesContactService}, so - * this controller does not touch the {@link SesService} facade at all; the send-path opt-out - * collection that also reads contacts stays behind the facade. + * SES V2 contact-list and contact endpoints ({@code /v2/email/contact-lists}). Every operation + * is a single-domain call on {@link SesContactService}, so this controller does not touch the + * {@link SesService} facade at all; the send-path opt-out collection that also reads contacts + * stays behind the facade. */ @Path("/v2/email") @Produces(MediaType.APPLICATION_JSON) diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesCvetController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesCvetController.java index 847b79a684..31a771569c 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesCvetController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesCvetController.java @@ -31,7 +31,7 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireJsonObjec /** * SES V2 custom verification email template endpoints - * ({@code /v2/email/custom-verification-email-templates}), split out of {@link SesController}. + * ({@code /v2/email/custom-verification-email-templates}). * Get, list and delete call {@link SesCvetService} directly; create and update go through the * {@link SesService} facade, which validates the template (including the From-address verified * check against the identity domain) before the store write. Sending one of these templates stays diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesDedicatedIpController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesDedicatedIpController.java index 9b81463f96..0bfdbb7223 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesDedicatedIpController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesDedicatedIpController.java @@ -35,8 +35,8 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireJsonObjec /** * SES V2 dedicated IP pool and dedicated IP endpoints ({@code /v2/email/dedicated-ip-pools} and - * {@code /v2/email/dedicated-ips}), split out of {@link SesController}. Every operation is a - * single-domain call on {@link SesDedicatedIpService}, so this controller does not touch the + * {@code /v2/email/dedicated-ips}). Every operation is a single-domain call on + * {@link SesDedicatedIpService}, so this controller does not touch the * {@link SesService} facade; the account-level auto-warmup setting stays under {@code /account}. */ @Path("/v2/email") diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesIdentityController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesIdentityController.java index ecd317a9fc..2baee52557 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesIdentityController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesIdentityController.java @@ -34,8 +34,8 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireObjectOrA /** * SES V2 email-identity endpoints ({@code /v2/email/identities}), including the sending - * authorization policies, DKIM, MAIL FROM, feedback and default configuration set, split out of - * {@link SesController}. Reads and the single-domain attribute writes call + * authorization policies, DKIM, MAIL FROM, feedback and default configuration set. + * Reads and the single-domain attribute writes call * {@link SesIdentityService} directly; create, delete, the policy operations and the default * configuration set go through the {@link SesService} facade, which checks the configuration set * exists, guards the delete against tenant associations and cascades the identity's policies. diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesSendController.java similarity index 97% rename from src/main/java/io/github/hectorvent/floci/services/ses/SesController.java rename to src/main/java/io/github/hectorvent/floci/services/ses/SesSendController.java index 8d1bc257b3..0e454f3fe1 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesController.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesSendController.java @@ -39,21 +39,20 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireObjectOrA import static io.github.hectorvent.floci.services.ses.SesV2Json.stringMemberOrAbsent; /** - * REST JSON controller for the AWS SES V2 API. - * Implements the AWS SES V2 wire protocol at /v2/email/* for the operations - * exposed by this controller. - * Reuses the shared {@link SesService} for business logic shared with other SES - * protocol handlers. - * - * Follows the same pattern as {@code LambdaController}: AwsExceptions are thrown - * directly and converted by the global {@code AwsExceptionMapper}. + * REST JSON controller for the three SES V2 send endpoints: + * {@code /v2/email/outbound-emails}, {@code /v2/email/outbound-bulk-emails} and + * {@code /v2/email/outbound-custom-verification-emails}. Every other v2 URL group has its own + * controller in this package; the send path stays here because it is the one group that reads + * across several domains. It goes through the {@link SesService} facade for that reason, and + * through {@link SesTemplateService} and {@link SesAccountService} for the stored template and + * the account-level sending switch. */ @Path("/v2/email") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public class SesController { +public class SesSendController { - private static final Logger LOG = Logger.getLogger(SesController.class); + private static final Logger LOG = Logger.getLogger(SesSendController.class); private final SesService sesService; // The bulk send resolves a stored template's content before handing the entries to the facade. @@ -64,7 +63,7 @@ public class SesController { private final ObjectMapper objectMapper; @Inject - public SesController(SesService sesService, SesTemplateService templateService, + public SesSendController(SesService sesService, SesTemplateService templateService, SesAccountService accountService, RegionResolver regionResolver, ObjectMapper objectMapper) { this.sesService = sesService; diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java index eb1a417b48..e9e8d95a95 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java @@ -48,6 +48,34 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +/** + * What is left of the original single SES service after the store-based domain split and the + * per-domain controller split that followed it: the flows that no one domain service can own. A + * method belongs here only if it touches two or more domains or the send path, which is the + * survival rule the store split established. Everything else lives in the domain service that + * owns its store, and this class owns no store of its own. + * + *
What that leaves, by category: + *
The name is historical. This is not the service for SES as a whole: SES is served by the
+ * domain services in this package, with this class above them and
+ * {@link SesSendController} and {@link SesQueryHandler} in front.
+ */
@ApplicationScoped
public class SesService {
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesSuppressionController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesSuppressionController.java
index e6a313cc82..9c79c6b121 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesSuppressionController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesSuppressionController.java
@@ -31,8 +31,8 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.requireJsonObjec
import static io.github.hectorvent.floci.services.ses.SesV2Json.stringMemberOrAbsent;
/**
- * SES V2 suppression-list endpoints ({@code /v2/email/suppression/addresses}), split out of
- * {@link SesController}. Every operation keeps going through the {@link SesService} facade,
+ * SES V2 suppression-list endpoints ({@code /v2/email/suppression/addresses}). Every operation
+ * keeps going through the {@link SesService} facade,
* because an optional {@code TenantName} routes it to that tenant's own list, which spans the
* suppression and tenant domains; the account-level suppression attributes live under
* {@code /account}.
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesTagController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesTagController.java
index 4aa1ccc033..6661338fdb 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesTagController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesTagController.java
@@ -28,7 +28,7 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.parseTagsArray;
import static io.github.hectorvent.floci.services.ses.SesV2Json.remapV1Exception;
/**
- * SES V2 resource-tag endpoints ({@code /v2/email/tags}), split out of {@link SesController}.
+ * SES V2 resource-tag endpoints ({@code /v2/email/tags}).
* Every operation keeps going through the {@link SesService} facade, which parses the resource
* ARN and dispatches to whichever of the seven taggable domains owns it; that cross-domain
* dispatch is the facade's job by the survival rule, so this class is a pure size split like
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateController.java
index 0aae97c062..436bcde4cf 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateController.java
@@ -31,8 +31,8 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.remapV1Exception
import static io.github.hectorvent.floci.services.ses.SesV2Json.requireJsonObject;
/**
- * SES V2 email-template endpoints ({@code /v2/email/templates}), split out of
- * {@link SesController}. Talks to {@link SesTemplateService} directly; only
+ * SES V2 email-template endpoints ({@code /v2/email/templates}). Talks to
+ * {@link SesTemplateService} directly; only
* {@code DeleteEmailTemplate} goes through the {@link SesService} facade, which wraps the delete in
* the tenant-association guard.
*/
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesTenantController.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesTenantController.java
index 6cbd13363b..ab11c59eea 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesTenantController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesTenantController.java
@@ -32,8 +32,8 @@ import static io.github.hectorvent.floci.services.ses.SesV2Json.stringMemberOrAb
/**
* SES V2 tenant endpoints ({@code /v2/email/tenants}, {@code /v2/email/tenant} and
- * {@code /v2/email/resources/tenants}), split out of {@link SesController}. Tenant create, get,
- * list and suppression attributes call {@link SesTenantService} directly; the resource
+ * {@code /v2/email/resources/tenants}). Tenant create, get, list and suppression attributes
+ * call {@link SesTenantService} directly; the resource
* associations and tenant delete go through the {@link SesService} facade, which checks the
* associated identity, configuration set or template exists and cascades the tenant's
* suppression entries, work that spans several domains.
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesV2ControllerRegistrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesV2ControllerRegistrationTest.java
index 2350934e5b..982774e365 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesV2ControllerRegistrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesV2ControllerRegistrationTest.java
@@ -39,8 +39,8 @@ class SesV2ControllerRegistrationTest {
@Test
void everyV2EmailResourceClassIsRegisteredOnTheSesDescriptor() throws Exception {
List