mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
refactor(ses): rename SesController to SesSendController (#3837)
The controller kept its generic name while it held every v2 endpoint. After the per-domain split it serves only the three /v2/email/outbound-* routes, so the name now says what it holds. Pure rename: no endpoint, path, status or body changes. Drop two leftovers from the days when this was the only SES v2 controller. The ten domain controllers opened their Javadoc with "split out of SesController", which the rename would have made misleading, since those endpoints were never send endpoints, and which documented history git already records while coupling ten files to one class for nothing else. This class claimed to follow LambdaController in throwing AwsExceptions directly, but it catches and remaps them in three places, LambdaController documents no such pattern, and AwsExceptionMapper is a global provider that covers every JAX-RS resource anyway. Add the class Javadoc the split left missing. SesSendController records which three endpoints it keeps and why the send path stayed behind the facade. SesService had no class Javadoc at all; it now states the survival rule that decides what lives on the facade, the categories that rule leaves behind, and that its name is historical rather than a claim to own SES as a whole.
This commit is contained in:
1 parent
00e94d84f0
commit
1d009b9614
14 files changed
+68
-41
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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}.
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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.
|
||||
|
||||
+10
-11
@@ -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;
|
||||
@@ -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.
|
||||
*
|
||||
* <p>What that leaves, by category:
|
||||
* <ul>
|
||||
* <li>the send path, which assembles a message, applies the account, tenant and
|
||||
* configuration-set gates, filters suppressed recipients, relays and records it, then
|
||||
* publishes the send events;</li>
|
||||
* <li>delete guards, where a tenant association or a policy cascade has to run around another
|
||||
* domain's delete;</li>
|
||||
* <li>configuration-set option validation, which probes the identity and dedicated-IP domains
|
||||
* through injected callbacks;</li>
|
||||
* <li>the tenant to resource associations and the tenant delete cascade;</li>
|
||||
* <li>the ARN dispatch behind the tag operations, which routes one ARN to one of seven
|
||||
* domains;</li>
|
||||
* <li>the tenant-scoped suppression routing, which picks the tenant store or the account-wide
|
||||
* one from a {@code TenantName};</li>
|
||||
* <li>the inspection reads over recorded mail.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>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 {
|
||||
|
||||
|
||||
@@ -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}.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user