feat(ses): support v2 dedicated IP pools and configuration-set option groups (#1412)

* feat(ses): support v2 dedicated IP pool APIs

Add SES v2 dedicated IP pool management — CreateDedicatedIpPool,
GetDedicatedIpPool, ListDedicatedIpPools and DeleteDedicatedIpPool — backed by
a per-region store.

Validation matches real AWS SES V2 (verified 2026-06-18): ScalingMode defaults
to STANDARD and must be STANDARD or MANAGED; a duplicate pool returns
AlreadyExistsException; an unknown pool returns NotFoundException.

Add integration tests, an AWS SDK v2 compatibility test, and document the
endpoints.

* feat(ses): support v2 configuration-set option groups

Add SES v2 ConfigurationSet support for the ReputationOptions, TrackingOptions,
DeliveryOptions, ArchivingOptions, and VdmOptions option groups. Each group can
be set through its dedicated Put...Options endpoint or supplied inline to
CreateConfigurationSet (validated before the set is stored), and is read back
through GetConfigurationSet.

Validation matches real AWS SES V2:

- TrackingOptions: HttpsPolicy enum; a present CustomRedirectDomain must be
  non-blank and a verified domain identity, is required when HttpsPolicy is set,
  and is checked before the enum.
- DeliveryOptions: TlsPolicy enum; MaxDeliverySeconds must be an integer in
  [300, 50400]; any SendingPoolName is rejected since Floci models no
  dedicated-IP pools, with distinct blank vs non-existent messages.
- ArchivingOptions: ArchiveArn must match the Mail Manager archive ARN pattern
  (existence/ownership not modelled).
- ReputationOptions: always returned by GetConfigurationSet (enabled by
  default); an empty-body PUT disables it.
- VdmOptions: nested DashboardOptions/GuardianOptions [ENABLED, DISABLED] enums;
  accepted independently of account-level VDM.

Option members are type-checked, an all-null block clears the options, and the
response blocks are shaped via Jackson. Add integration tests and an AWS SDK v2
compatibility test, and document the endpoints.

* feat(ses): validate SendingPoolName against dedicated IP pools

Now that dedicated IP pool management is available, DeliveryOptions
SendingPoolName is validated against the pool store instead of being rejected
unconditionally: a pool created via CreateDedicatedIpPool is accepted (and
echoed by GetConfigurationSet), while an unknown pool still returns
'SendingPool <name> doesn't exist' and a blank one 'sendingPoolName can't be
blank.' (verified against real AWS).

Add integration and SDK compatibility tests for referencing an existing pool.

* fix(ses): stop validating ArchiveArn format

Floci does not model Mail Manager archives, so the ArchiveArn format is not
validated — any provided value is stored and echoed (matching the store-only
behaviour of other local AWS emulators). The JSON-string type check is kept.

Replace the malformed-ARN rejection test with one asserting an arbitrary
ArchiveArn round-trips.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-06-20 11:47:36 -05:00
1 parent fd904bc409
commit 1ffa9a4e21
18 files changed
+1868 -1

No files matched your search

@@ -3,9 +3,14 @@ package io.github.hectorvent.floci.services.ses;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.services.ses.model.AccountSuppressionAttributes;
import io.github.hectorvent.floci.services.ses.model.ArchivingOptions;
import io.github.hectorvent.floci.services.ses.model.DashboardOptions;
import io.github.hectorvent.floci.services.ses.model.GuardianOptions;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
import io.github.hectorvent.floci.services.ses.model.DedicatedIpPool;
import io.github.hectorvent.floci.services.ses.model.DeliveryOptions;
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
import io.github.hectorvent.floci.services.ses.model.EventDestination;
import io.github.hectorvent.floci.services.ses.model.Identity;
@@ -14,6 +19,8 @@ import io.github.hectorvent.floci.services.ses.model.MessageTag;
import io.github.hectorvent.floci.services.ses.model.SuppressedDestination;
import io.github.hectorvent.floci.services.ses.model.SuppressionOptions;
import io.github.hectorvent.floci.services.ses.model.Tag;
import io.github.hectorvent.floci.services.ses.model.TrackingOptions;
import io.github.hectorvent.floci.services.ses.model.VdmOptions;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -631,6 +638,30 @@ public class SesController {
}
cs.setSendingEnabled(parseSendingEnabled(sendingNode.path("SendingEnabled")));
}
JsonNode reputationNode = request.path("ReputationOptions");
if (!reputationNode.isMissingNode() && !reputationNode.isNull()) {
requireOptionObject(reputationNode);
Boolean rme = parseReputationMetricsEnabled(reputationNode.path("ReputationMetricsEnabled"));
if (rme != null) {
cs.setReputationMetricsEnabled(rme);
}
}
JsonNode trackingNode = request.path("TrackingOptions");
if (!trackingNode.isMissingNode() && !trackingNode.isNull()) {
cs.setTrackingOptions(parseTrackingOptions(trackingNode));
}
JsonNode deliveryNode = request.path("DeliveryOptions");
if (!deliveryNode.isMissingNode() && !deliveryNode.isNull()) {
cs.setDeliveryOptions(parseDeliveryOptions(deliveryNode));
}
JsonNode archivingNode = request.path("ArchivingOptions");
if (!archivingNode.isMissingNode() && !archivingNode.isNull()) {
cs.setArchivingOptions(parseArchivingOptions(archivingNode));
}
JsonNode vdmNode = request.path("VdmOptions");
if (!vdmNode.isMissingNode() && !vdmNode.isNull()) {
cs.setVdmOptions(parseVdmOptions(vdmNode));
}
sesService.createConfigurationSet(cs, region);
LOG.infov("SES V2 CreateConfigurationSet: {0}", name);
return Response.ok(objectMapper.createObjectNode()).build();
@@ -679,6 +710,23 @@ public class SesController {
}
ObjectNode sendingNode = result.putObject("SendingOptions");
sendingNode.put("SendingEnabled", cs.isSendingEnabledEffective());
// AWS always returns ReputationOptions (true by default), like SendingOptions.
ObjectNode reputationNode = result.putObject("ReputationOptions");
reputationNode.put("ReputationMetricsEnabled", cs.isReputationMetricsEnabledEffective());
// The option models carry @JsonProperty/@JsonInclude(NON_NULL), so let
// Jackson shape the response and omit unset members.
if (cs.getTrackingOptions() != null) {
result.set("TrackingOptions", objectMapper.valueToTree(cs.getTrackingOptions()));
}
if (cs.getDeliveryOptions() != null) {
result.set("DeliveryOptions", objectMapper.valueToTree(cs.getDeliveryOptions()));
}
if (cs.getArchivingOptions() != null) {
result.set("ArchivingOptions", objectMapper.valueToTree(cs.getArchivingOptions()));
}
if (cs.getVdmOptions() != null) {
result.set("VdmOptions", objectMapper.valueToTree(cs.getVdmOptions()));
}
return Response.ok(result).build();
} catch (AwsException e) {
throw remapV1Exception(e);
@@ -734,6 +782,210 @@ public class SesController {
}
}
@PUT
@Path("/configuration-sets/{configurationSetName}/reputation-options")
public Response putConfigurationSetReputationOptions(@Context HttpHeaders headers,
@PathParam("configurationSetName") String name,
String body) {
String region = regionResolver.resolveRegion(headers);
try {
JsonNode request = readOptionBody(body);
Boolean enabled = parseReputationMetricsEnabled(request.path("ReputationMetricsEnabled"));
boolean effectiveEnabled = enabled != null && enabled;
sesService.setConfigurationSetReputationOptions(name, effectiveEnabled, region);
LOG.infov("SES V2 PutConfigurationSetReputationOptions: {0} on {1}", effectiveEnabled, name);
return Response.ok(objectMapper.createObjectNode()).build();
} catch (AwsException e) {
throw remapV1Exception(e);
}
}
@PUT
@Path("/configuration-sets/{configurationSetName}/tracking-options")
public Response putConfigurationSetTrackingOptions(@Context HttpHeaders headers,
@PathParam("configurationSetName") String name,
String body) {
String region = regionResolver.resolveRegion(headers);
try {
JsonNode request = readOptionBody(body);
sesService.setConfigurationSetTrackingOptions(name, parseTrackingOptions(request), region);
LOG.infov("SES V2 PutConfigurationSetTrackingOptions on {0}", name);
return Response.ok(objectMapper.createObjectNode()).build();
} catch (AwsException e) {
throw remapV1Exception(e);
}
}
@PUT
@Path("/configuration-sets/{configurationSetName}/delivery-options")
public Response putConfigurationSetDeliveryOptions(@Context HttpHeaders headers,
@PathParam("configurationSetName") String name,
String body) {
String region = regionResolver.resolveRegion(headers);
try {
JsonNode request = readOptionBody(body);
sesService.setConfigurationSetDeliveryOptions(name, parseDeliveryOptions(request), region);
LOG.infov("SES V2 PutConfigurationSetDeliveryOptions on {0}", name);
return Response.ok(objectMapper.createObjectNode()).build();
} catch (AwsException e) {
throw remapV1Exception(e);
}
}
@PUT
@Path("/configuration-sets/{configurationSetName}/archiving-options")
public Response putConfigurationSetArchivingOptions(@Context HttpHeaders headers,
@PathParam("configurationSetName") String name,
String body) {
String region = regionResolver.resolveRegion(headers);
try {
JsonNode request = readOptionBody(body);
sesService.setConfigurationSetArchivingOptions(name, parseArchivingOptions(request), region);
LOG.infov("SES V2 PutConfigurationSetArchivingOptions on {0}", name);
return Response.ok(objectMapper.createObjectNode()).build();
} catch (AwsException e) {
throw remapV1Exception(e);
}
}
@PUT
@Path("/configuration-sets/{configurationSetName}/vdm-options")
public Response putConfigurationSetVdmOptions(@Context HttpHeaders headers,
@PathParam("configurationSetName") String name,
String body) {
String region = regionResolver.resolveRegion(headers);
try {
JsonNode request = readOptionBody(body);
JsonNode vdmNode = request.path("VdmOptions");
VdmOptions options = (vdmNode.isMissingNode() || vdmNode.isNull())
? null : parseVdmOptions(vdmNode);
sesService.setConfigurationSetVdmOptions(name, options, region);
LOG.infov("SES V2 PutConfigurationSetVdmOptions on {0}", name);
return Response.ok(objectMapper.createObjectNode()).build();
} catch (AwsException e) {
throw remapV1Exception(e);
}
}
/** Reject a non-object option block, mirroring the AWS deserialization layer. */
private static void requireOptionObject(JsonNode node) {
if (!node.isObject()) {
throw new AwsException("SerializationException", "Expected null", 400);
}
}
/** Parse a configuration-set option PUT body into a JSON object, treating an empty body as {}. */
private JsonNode readOptionBody(String body) {
try {
JsonNode request = (body == null || body.isBlank())
? objectMapper.createObjectNode()
: objectMapper.readTree(body);
requireJsonObject(request);
return request;
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
throw new AwsException("BadRequestException", e.getMessage(), 400);
}
}
private static Boolean parseReputationMetricsEnabled(JsonNode node) {
if (node.isMissingNode() || node.isNull()) {
return null;
}
if (!node.isBoolean()) {
throw new AwsException("BadRequestException",
"ReputationMetricsEnabled must be a boolean.", 400);
}
return node.booleanValue();
}
/** Read an optional string member, rejecting a non-string value the way the AWS deserialization layer does. */
private static String parseOptionString(JsonNode node, String field) {
if (node.isMissingNode() || node.isNull()) {
return null;
}
if (!node.isTextual()) {
throw new AwsException("BadRequestException", field + " must be a JSON string.", 400);
}
return node.asText();
}
private static TrackingOptions parseTrackingOptions(JsonNode node) {
requireOptionObject(node);
TrackingOptions t = new TrackingOptions();
t.setCustomRedirectDomain(parseOptionString(node.path("CustomRedirectDomain"), "CustomRedirectDomain"));
t.setHttpsPolicy(parseOptionString(node.path("HttpsPolicy"), "HttpsPolicy"));
// An all-null block (e.g. an empty PUT body) clears the options rather
// than persisting an empty object that GetConfigurationSet would echo.
if (t.getCustomRedirectDomain() == null && t.getHttpsPolicy() == null) {
return null;
}
return t;
}
private static DeliveryOptions parseDeliveryOptions(JsonNode node) {
requireOptionObject(node);
DeliveryOptions d = new DeliveryOptions();
d.setTlsPolicy(parseOptionString(node.path("TlsPolicy"), "TlsPolicy"));
d.setSendingPoolName(parseOptionString(node.path("SendingPoolName"), "SendingPoolName"));
JsonNode max = node.path("MaxDeliverySeconds");
if (!max.isMissingNode() && !max.isNull()) {
if (!max.isNumber()) {
throw new AwsException("BadRequestException",
"MaxDeliverySeconds must be a number.", 400);
}
if (!max.isIntegralNumber()) {
throw new AwsException("BadRequestException",
"MaxDeliverySeconds must be an integer.", 400);
}
d.setMaxDeliverySeconds(max.asLong());
}
if (d.getTlsPolicy() == null && d.getSendingPoolName() == null && d.getMaxDeliverySeconds() == null) {
return null;
}
return d;
}
private static ArchivingOptions parseArchivingOptions(JsonNode node) {
requireOptionObject(node);
ArchivingOptions a = new ArchivingOptions();
a.setArchiveArn(parseOptionString(node.path("ArchiveArn"), "ArchiveArn"));
if (a.getArchiveArn() == null) {
return null;
}
return a;
}
private static VdmOptions parseVdmOptions(JsonNode node) {
requireOptionObject(node);
VdmOptions v = new VdmOptions();
JsonNode dashboard = node.path("DashboardOptions");
if (!dashboard.isMissingNode() && !dashboard.isNull()) {
requireOptionObject(dashboard);
String engagementMetrics = parseOptionString(dashboard.path("EngagementMetrics"), "EngagementMetrics");
if (engagementMetrics != null) {
DashboardOptions d = new DashboardOptions();
d.setEngagementMetrics(engagementMetrics);
v.setDashboardOptions(d);
}
}
JsonNode guardian = node.path("GuardianOptions");
if (!guardian.isMissingNode() && !guardian.isNull()) {
requireOptionObject(guardian);
String optimized = parseOptionString(guardian.path("OptimizedSharedDelivery"), "OptimizedSharedDelivery");
if (optimized != null) {
GuardianOptions g = new GuardianOptions();
g.setOptimizedSharedDelivery(optimized);
v.setGuardianOptions(g);
}
}
// An all-null block (e.g. an empty PUT body) clears the options rather
// than persisting an empty object that GetConfigurationSet would echo.
if (v.getDashboardOptions() == null && v.getGuardianOptions() == null) {
return null;
}
return v;
}
@DELETE
@Path("/configuration-sets/{configurationSetName}")
public Response deleteConfigurationSet(@Context HttpHeaders headers,
@@ -837,6 +1089,70 @@ public class SesController {
}
}
// ──────────────────────── Dedicated IP Pools ────────────────────────
@POST
@Path("/dedicated-ip-pools")
public Response createDedicatedIpPool(@Context HttpHeaders headers, String body) {
String region = regionResolver.resolveRegion(headers);
try {
if (body == null || body.isBlank()) {
throw new AwsException("BadRequestException", "Request body is required.", 400);
}
JsonNode request = objectMapper.readTree(body);
requireJsonObject(request);
String poolName = readRequiredStringField(request, "PoolName");
JsonNode scalingNode = request.path("ScalingMode");
String scalingMode;
if (scalingNode.isMissingNode() || scalingNode.isNull()) {
scalingMode = null;
} else if (!scalingNode.isTextual()) {
throw new AwsException("BadRequestException",
"The ScalingMode parameter is invalid.", 400);
} else {
scalingMode = scalingNode.asText();
}
sesService.createDedicatedIpPool(poolName, scalingMode, region);
LOG.infov("SES V2 CreateDedicatedIpPool: {0}", poolName);
return Response.ok(objectMapper.createObjectNode()).build();
} catch (AwsException e) {
throw remapV1Exception(e);
} catch (com.fasterxml.jackson.core.JsonProcessingException e) {
throw new AwsException("BadRequestException", e.getMessage(), 400);
}
}
@GET
@Path("/dedicated-ip-pools")
public Response listDedicatedIpPools(@Context HttpHeaders headers) {
String region = regionResolver.resolveRegion(headers);
ObjectNode result = objectMapper.createObjectNode();
ArrayNode pools = result.putArray("DedicatedIpPools");
sesService.listDedicatedIpPools(region).forEach(pools::add);
return Response.ok(result).build();
}
@GET
@Path("/dedicated-ip-pools/{poolName}")
public Response getDedicatedIpPool(@Context HttpHeaders headers,
@PathParam("poolName") String poolName) {
String region = regionResolver.resolveRegion(headers);
DedicatedIpPool pool = sesService.getDedicatedIpPool(poolName, region);
ObjectNode result = objectMapper.createObjectNode();
result.set("DedicatedIpPool", objectMapper.valueToTree(pool));
return Response.ok(result).build();
}
@DELETE
@Path("/dedicated-ip-pools/{poolName}")
public Response deleteDedicatedIpPool(@Context HttpHeaders headers,
@PathParam("poolName") String poolName) {
String region = regionResolver.resolveRegion(headers);
sesService.deleteDedicatedIpPool(poolName, region);
LOG.infov("SES V2 DeleteDedicatedIpPool: {0}", poolName);
return Response.ok(objectMapper.createObjectNode()).build();
}
// ──────────────────────────── Account ────────────────────────────
@GET
@@ -6,15 +6,20 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.ses.model.AccountSuppressionAttributes;
import io.github.hectorvent.floci.services.ses.model.ArchivingOptions;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntry;
import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
import io.github.hectorvent.floci.services.ses.model.CloudWatchDimensionConfiguration;
import io.github.hectorvent.floci.services.ses.model.ConfigurationSet;
import io.github.hectorvent.floci.services.ses.model.DedicatedIpPool;
import io.github.hectorvent.floci.services.ses.model.DeliveryOptions;
import io.github.hectorvent.floci.services.ses.model.EmailTemplate;
import io.github.hectorvent.floci.services.ses.model.EventDestination;
import io.github.hectorvent.floci.services.ses.model.Identity;
import io.github.hectorvent.floci.services.ses.model.MessageHeader;
import io.github.hectorvent.floci.services.ses.model.MessageTag;
import io.github.hectorvent.floci.services.ses.model.TrackingOptions;
import io.github.hectorvent.floci.services.ses.model.VdmOptions;
import io.github.hectorvent.floci.services.ses.model.SentEmail;
import io.github.hectorvent.floci.services.ses.model.SuppressedDestination;
import io.github.hectorvent.floci.services.ses.model.SuppressionOptions;
@@ -67,6 +72,7 @@ public class SesService {
private final StorageBackend<String, ConfigurationSet> configSetStore;
private final StorageBackend<String, SuppressedDestination> suppressionStore;
private final StorageBackend<String, AccountSuppressionAttributes> accountSuppressionStore;
private final StorageBackend<String, DedicatedIpPool> dedicatedIpPoolStore;
private final SmtpRelay smtpRelay;
private final ObjectMapper objectMapper;
private final SesEventPublisher eventPublisher;
@@ -89,6 +95,8 @@ public class SesService {
new TypeReference<Map<String, SuppressedDestination>>() {});
this.accountSuppressionStore = storageFactory.create("ses", "ses-account-suppression.json",
new TypeReference<Map<String, AccountSuppressionAttributes>>() {});
this.dedicatedIpPoolStore = storageFactory.create("ses", "ses-dedicated-ip-pools.json",
new TypeReference<Map<String, DedicatedIpPool>>() {});
this.smtpRelay = smtpRelay;
this.objectMapper = objectMapper;
this.eventPublisher = eventPublisher;
@@ -102,6 +110,7 @@ public class SesService {
StorageBackend<String, ConfigurationSet> configSetStore,
StorageBackend<String, SuppressedDestination> suppressionStore,
StorageBackend<String, AccountSuppressionAttributes> accountSuppressionStore,
StorageBackend<String, DedicatedIpPool> dedicatedIpPoolStore,
SmtpRelay smtpRelay,
ObjectMapper objectMapper) {
this.identityStore = identityStore;
@@ -111,6 +120,7 @@ public class SesService {
this.configSetStore = configSetStore;
this.suppressionStore = suppressionStore;
this.accountSuppressionStore = accountSuppressionStore;
this.dedicatedIpPoolStore = dedicatedIpPoolStore;
this.smtpRelay = smtpRelay;
this.objectMapper = objectMapper;
this.eventPublisher = null;
@@ -646,6 +656,9 @@ public class SesService {
}
}
}
validateTrackingOptions(configSet.getTrackingOptions(), region);
validateDeliveryOptions(configSet.getDeliveryOptions(), region);
validateVdmOptions(configSet.getVdmOptions());
if (configSetStore.get(key).isPresent()) {
throw new AwsException("ConfigurationSetAlreadyExists",
"Configuration set " + configSet.getName() + " already exists.", 400);
@@ -658,6 +671,141 @@ public class SesService {
return configSet;
}
public void setConfigurationSetTrackingOptions(String configSetName, TrackingOptions options, String region) {
ConfigurationSet cs = getConfigurationSet(configSetName, region);
validateTrackingOptions(options, region);
cs.setTrackingOptions(options);
configSetStore.put(configSetKey(region, configSetName), cs);
LOG.infov("Updated TrackingOptions on configuration set {0} in region {1}", configSetName, region);
}
public void setConfigurationSetDeliveryOptions(String configSetName, DeliveryOptions options, String region) {
ConfigurationSet cs = getConfigurationSet(configSetName, region);
validateDeliveryOptions(options, region);
cs.setDeliveryOptions(options);
configSetStore.put(configSetKey(region, configSetName), cs);
LOG.infov("Updated DeliveryOptions on configuration set {0} in region {1}", configSetName, region);
}
public void setConfigurationSetReputationOptions(String configSetName, boolean metricsEnabled, String region) {
ConfigurationSet cs = getConfigurationSet(configSetName, region);
cs.setReputationMetricsEnabled(metricsEnabled);
configSetStore.put(configSetKey(region, configSetName), cs);
LOG.infov("Updated ReputationMetricsEnabled on configuration set {0} in region {1}: {2}",
configSetName, region, metricsEnabled);
}
public void setConfigurationSetArchivingOptions(String configSetName, ArchivingOptions options, String region) {
ConfigurationSet cs = getConfigurationSet(configSetName, region);
cs.setArchivingOptions(options);
configSetStore.put(configSetKey(region, configSetName), cs);
LOG.infov("Updated ArchivingOptions on configuration set {0} in region {1}", configSetName, region);
}
private static final java.util.Set<String> VDM_FEATURE_STATES = java.util.Set.of("ENABLED", "DISABLED");
public void setConfigurationSetVdmOptions(String configSetName, VdmOptions options, String region) {
ConfigurationSet cs = getConfigurationSet(configSetName, region);
validateVdmOptions(options);
cs.setVdmOptions(options);
configSetStore.put(configSetKey(region, configSetName), cs);
LOG.infov("Updated VdmOptions on configuration set {0} in region {1}", configSetName, region);
}
private void validateVdmOptions(VdmOptions options) {
if (options == null) {
return;
}
// Enum values verified against real AWS 2026-06-19; messages use the
// nested member path and the [ENABLED, DISABLED] value set.
if (options.getDashboardOptions() != null
&& options.getDashboardOptions().getEngagementMetrics() != null
&& !VDM_FEATURE_STATES.contains(options.getDashboardOptions().getEngagementMetrics())) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'vdmOptions.dashboardOptions.engagementMetrics' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]", 400);
}
if (options.getGuardianOptions() != null
&& options.getGuardianOptions().getOptimizedSharedDelivery() != null
&& !VDM_FEATURE_STATES.contains(options.getGuardianOptions().getOptimizedSharedDelivery())) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'vdmOptions.guardianOptions.optimizedSharedDelivery' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [ENABLED, DISABLED]", 400);
}
}
private static final java.util.Set<String> HTTPS_POLICIES =
java.util.Set.of("REQUIRE", "REQUIRE_OPEN_ONLY", "OPTIONAL");
private static final java.util.Set<String> TLS_POLICIES = java.util.Set.of("REQUIRE", "OPTIONAL");
private void validateTrackingOptions(TrackingOptions options, String region) {
if (options == null) {
return;
}
String domain = options.getCustomRedirectDomain();
String httpsPolicy = options.getHttpsPolicy();
// AWS validation order (verified against real AWS 2026-06-17): a present
// CustomRedirectDomain must be non-blank, and it is required whenever
// HttpsPolicy is set; then the domain must be a verified domain identity
// (checked even without HttpsPolicy); then HttpsPolicy must be a valid enum.
if ((domain != null && domain.isBlank()) || (httpsPolicy != null && domain == null)) {
throw new AwsException("BadRequestException",
"CustomRedirectDomain must be specified.", 400);
}
if (domain != null) {
Identity identity = getIdentityVerificationAttributes(domain, region);
if (identity == null || !"Success".equals(identity.getVerificationStatus())
|| !"Domain".equals(identity.getIdentityType())) {
throw new AwsException("BadRequestException",
"Domain <" + domain + "> is not verified under this account.", 400);
}
}
if (httpsPolicy != null && !HTTPS_POLICIES.contains(httpsPolicy)) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'httpsPolicy' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [OPTIONAL, REQUIRE, REQUIRE_OPEN_ONLY]", 400);
}
}
private void validateDeliveryOptions(DeliveryOptions options, String region) {
if (options == null) {
return;
}
if (options.getTlsPolicy() != null && !TLS_POLICIES.contains(options.getTlsPolicy())) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'tlsPolicy' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [OPTIONAL, REQUIRE]", 400);
}
// AWS rejects a blank SendingPoolName outright, and a non-existent
// dedicated IP pool (both verified against real AWS 2026-06-17). The
// pool must have been created via CreateDedicatedIpPool.
if (options.getSendingPoolName() != null) {
if (options.getSendingPoolName().isBlank()) {
throw new AwsException("BadRequestException",
"sendingPoolName can't be blank.", 400);
}
if (!dedicatedIpPoolExists(options.getSendingPoolName(), region)) {
throw new AwsException("BadRequestException",
"SendingPool <" + options.getSendingPoolName() + "> doesn't exist", 400);
}
}
// AWS constrains MaxDeliverySeconds to [300, 50400] (max verified against
// real AWS 2026-06-17; min follows the same smithy range-constraint shape).
if (options.getMaxDeliverySeconds() != null) {
long maxDeliverySeconds = options.getMaxDeliverySeconds();
if (maxDeliverySeconds < 300) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'maxDeliverySeconds' failed to satisfy constraint: "
+ "Member must have value greater than or equal to 300", 400);
}
if (maxDeliverySeconds > 50400) {
throw new AwsException("BadRequestException",
"1 validation error detected: Value at 'maxDeliverySeconds' failed to satisfy constraint: "
+ "Member must have value less than or equal to 50400", 400);
}
}
}
public ConfigurationSet getConfigurationSet(String name, String region) {
return configSetStore.get(configSetKey(region, name))
.orElseThrow(() -> new AwsException("ConfigurationSetDoesNotExist",
@@ -691,6 +839,61 @@ public class SesService {
return "configSet::" + region + "::" + name;
}
// ──────────────────────── Dedicated IP Pools ────────────────────────
private static final java.util.Set<String> SCALING_MODES = java.util.Set.of("STANDARD", "MANAGED");
public DedicatedIpPool createDedicatedIpPool(String poolName, String scalingMode, String region) {
if (poolName == null || poolName.isBlank()) {
throw new AwsException("BadRequestException", "PoolName is required.", 400);
}
String effectiveScaling = (scalingMode == null || scalingMode.isBlank()) ? "STANDARD" : scalingMode;
if (!SCALING_MODES.contains(effectiveScaling)) {
throw new AwsException("BadRequestException", "The ScalingMode parameter is invalid.", 400);
}
String key = dedicatedIpPoolKey(region, poolName);
if (dedicatedIpPoolStore.get(key).isPresent()) {
throw new AwsException("AlreadyExistsException",
"The pool <" + poolName + "> already exists.", 400);
}
DedicatedIpPool pool = new DedicatedIpPool(poolName, effectiveScaling);
dedicatedIpPoolStore.put(key, pool);
LOG.infov("Created SES dedicated IP pool: {0} in region {1}", poolName, region);
return pool;
}
public DedicatedIpPool getDedicatedIpPool(String poolName, String region) {
return dedicatedIpPoolStore.get(dedicatedIpPoolKey(region, poolName))
.orElseThrow(() -> new AwsException("NotFoundException",
"The requested pool <" + poolName + "> does not exist.", 404));
}
public boolean dedicatedIpPoolExists(String poolName, String region) {
return dedicatedIpPoolStore.get(dedicatedIpPoolKey(region, poolName)).isPresent();
}
public List<String> listDedicatedIpPools(String region) {
String prefix = "dedicatedIpPool::" + region + "::";
return dedicatedIpPoolStore.scan(k -> k.startsWith(prefix)).stream()
.map(DedicatedIpPool::getPoolName)
.sorted()
.toList();
}
public void deleteDedicatedIpPool(String poolName, String region) {
String key = dedicatedIpPoolKey(region, poolName);
if (dedicatedIpPoolStore.get(key).isEmpty()) {
throw new AwsException("NotFoundException",
"The requested pool <" + poolName + "> does not exist.", 404);
}
dedicatedIpPoolStore.delete(key);
LOG.infov("Deleted SES dedicated IP pool: {0} in region {1}", poolName, region);
}
private static String dedicatedIpPoolKey(String region, String name) {
return "dedicatedIpPool::" + region + "::" + name;
}
static void validateConfigurationSetName(String name) {
if (name == null || name.isBlank()) {
throw new AwsException("InvalidParameterValue",
@@ -0,0 +1,25 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* Per-configuration-set archiving override. Mirrors the AWS SES V2
* {@code ArchivingOptions} shape: the ARN of the Mail Manager archive that
* sends through the configuration set are written to.
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ArchivingOptions {
@JsonProperty("ArchiveArn")
private String archiveArn;
public ArchivingOptions() {}
public String getArchiveArn() { return archiveArn; }
public void setArchiveArn(String archiveArn) { this.archiveArn = archiveArn; }
}
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
@@ -30,6 +31,21 @@ public class ConfigurationSet {
@JsonProperty("SendingEnabled")
private Boolean sendingEnabled;
@JsonProperty("ReputationMetricsEnabled")
private Boolean reputationMetricsEnabled;
@JsonProperty("TrackingOptions")
private TrackingOptions trackingOptions;
@JsonProperty("DeliveryOptions")
private DeliveryOptions deliveryOptions;
@JsonProperty("ArchivingOptions")
private ArchivingOptions archivingOptions;
@JsonProperty("VdmOptions")
private VdmOptions vdmOptions;
public ConfigurationSet() {}
public ConfigurationSet(String name) {
@@ -66,8 +82,44 @@ public class ConfigurationSet {
* implicitly enabled. Use this anywhere v1/v2 read or enforce the toggle
* so the default rule stays consistent across surfaces.
*/
@com.fasterxml.jackson.annotation.JsonIgnore
@JsonIgnore
public boolean isSendingEnabledEffective() {
return sendingEnabled == null || sendingEnabled;
}
public Boolean getReputationMetricsEnabled() { return reputationMetricsEnabled; }
public void setReputationMetricsEnabled(Boolean reputationMetricsEnabled) {
this.reputationMetricsEnabled = reputationMetricsEnabled;
}
/**
* Effective reputation-metrics flag with the AWS default applied — an unset
* (null) field reads as enabled, matching AWS where GetConfigurationSet
* always returns {@code ReputationOptions.ReputationMetricsEnabled} (true by
* default) for a configuration set with no explicit override.
*/
@JsonIgnore
public boolean isReputationMetricsEnabledEffective() {
return reputationMetricsEnabled == null || reputationMetricsEnabled;
}
public TrackingOptions getTrackingOptions() { return trackingOptions; }
public void setTrackingOptions(TrackingOptions trackingOptions) {
this.trackingOptions = trackingOptions;
}
public DeliveryOptions getDeliveryOptions() { return deliveryOptions; }
public void setDeliveryOptions(DeliveryOptions deliveryOptions) {
this.deliveryOptions = deliveryOptions;
}
public ArchivingOptions getArchivingOptions() { return archivingOptions; }
public void setArchivingOptions(ArchivingOptions archivingOptions) {
this.archivingOptions = archivingOptions;
}
public VdmOptions getVdmOptions() { return vdmOptions; }
public void setVdmOptions(VdmOptions vdmOptions) {
this.vdmOptions = vdmOptions;
}
}
@@ -0,0 +1,26 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* VDM dashboard settings for a configuration set. Mirrors the AWS SES V2
* {@code DashboardOptions} shape: whether engagement metrics are collected.
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DashboardOptions {
@JsonProperty("EngagementMetrics")
private String engagementMetrics;
public DashboardOptions() {}
public String getEngagementMetrics() { return engagementMetrics; }
public void setEngagementMetrics(String engagementMetrics) {
this.engagementMetrics = engagementMetrics;
}
}
@@ -0,0 +1,35 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* A SES V2 dedicated IP pool. Mirrors the AWS {@code DedicatedIpPool} shape:
* a pool name and its scaling mode ({@code STANDARD} or {@code MANAGED}).
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DedicatedIpPool {
@JsonProperty("PoolName")
private String poolName;
@JsonProperty("ScalingMode")
private String scalingMode;
public DedicatedIpPool() {}
public DedicatedIpPool(String poolName, String scalingMode) {
this.poolName = poolName;
this.scalingMode = scalingMode;
}
public String getPoolName() { return poolName; }
public void setPoolName(String poolName) { this.poolName = poolName; }
public String getScalingMode() { return scalingMode; }
public void setScalingMode(String scalingMode) { this.scalingMode = scalingMode; }
}
@@ -0,0 +1,37 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* Per-configuration-set delivery override. Mirrors the AWS SES V2
* {@code DeliveryOptions} shape: the TLS policy, an optional dedicated-IP
* sending pool, and the maximum delivery time.
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeliveryOptions {
@JsonProperty("TlsPolicy")
private String tlsPolicy;
@JsonProperty("SendingPoolName")
private String sendingPoolName;
@JsonProperty("MaxDeliverySeconds")
private Long maxDeliverySeconds;
public DeliveryOptions() {}
public String getTlsPolicy() { return tlsPolicy; }
public void setTlsPolicy(String tlsPolicy) { this.tlsPolicy = tlsPolicy; }
public String getSendingPoolName() { return sendingPoolName; }
public void setSendingPoolName(String sendingPoolName) { this.sendingPoolName = sendingPoolName; }
public Long getMaxDeliverySeconds() { return maxDeliverySeconds; }
public void setMaxDeliverySeconds(Long maxDeliverySeconds) { this.maxDeliverySeconds = maxDeliverySeconds; }
}
@@ -0,0 +1,26 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* VDM Guardian settings for a configuration set. Mirrors the AWS SES V2
* {@code GuardianOptions} shape: whether optimized shared delivery is applied.
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GuardianOptions {
@JsonProperty("OptimizedSharedDelivery")
private String optimizedSharedDelivery;
public GuardianOptions() {}
public String getOptimizedSharedDelivery() { return optimizedSharedDelivery; }
public void setOptimizedSharedDelivery(String optimizedSharedDelivery) {
this.optimizedSharedDelivery = optimizedSharedDelivery;
}
}
@@ -0,0 +1,33 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* Per-configuration-set open/click tracking override. Mirrors the AWS SES V2
* {@code TrackingOptions} shape: a custom redirect domain (which must be a
* verified identity) and the HTTPS policy applied to tracking links.
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TrackingOptions {
@JsonProperty("CustomRedirectDomain")
private String customRedirectDomain;
@JsonProperty("HttpsPolicy")
private String httpsPolicy;
public TrackingOptions() {}
public String getCustomRedirectDomain() { return customRedirectDomain; }
public void setCustomRedirectDomain(String customRedirectDomain) {
this.customRedirectDomain = customRedirectDomain;
}
public String getHttpsPolicy() { return httpsPolicy; }
public void setHttpsPolicy(String httpsPolicy) { this.httpsPolicy = httpsPolicy; }
}
@@ -0,0 +1,35 @@
package io.github.hectorvent.floci.services.ses.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.runtime.annotations.RegisterForReflection;
/**
* Per-configuration-set Virtual Deliverability Manager override. Mirrors the
* AWS SES V2 {@code VdmOptions} shape: nested {@code DashboardOptions} and
* {@code GuardianOptions}.
*/
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VdmOptions {
@JsonProperty("DashboardOptions")
private DashboardOptions dashboardOptions;
@JsonProperty("GuardianOptions")
private GuardianOptions guardianOptions;
public VdmOptions() {}
public DashboardOptions getDashboardOptions() { return dashboardOptions; }
public void setDashboardOptions(DashboardOptions dashboardOptions) {
this.dashboardOptions = dashboardOptions;
}
public GuardianOptions getGuardianOptions() { return guardianOptions; }
public void setGuardianOptions(GuardianOptions guardianOptions) {
this.guardianOptions = guardianOptions;
}
}