feat(ses): implement PutConfigurationSetDeliveryOptions for SES v1 (#1553)

* feat(ses): implement PutConfigurationSetDeliveryOptions for SES v1

The classic SES Query API action was unhandled — only the v2 REST path
reached the existing setConfigurationSetDeliveryOptions service logic.
Route the v1 action through SesQueryHandler and register it in the
AwsQueryController SES action set.

The v1 DeliveryOptions structure carries only TlsPolicy (Require/Optional);
Floci stores the v2 canonical REQUIRE/OPTIONAL, so the handler normalizes
the value before delegating to the shared, already-validated service. An
all-null payload passes null to clear the block, mirroring the v2 path
rather than persisting an empty object.

Tests: v1 Query integration coverage (success, unknown set, invalid TLS
policy) and an AWS Java SDK v1 compatibility test that writes Require via
the v1 SesClient and reads it back as the canonical REQUIRE through v2
GetConfigurationSet, asserts an empty put clears the block, and asserts
the modeled ConfigurationSetDoesNotExistException for an unknown set.

* fix(ses): return v1 ValidationError for an invalid delivery-options TlsPolicy

The v1 PutConfigurationSetDeliveryOptions surfaced the shared service's
v2-style BadRequestException for an invalid TlsPolicy, so a v1 SDK could only
map it to a generic exception. Validate Require/Optional (case-sensitive) in
the v1 handler and throw the Smithy enum ValidationError AWS actually returns.

Verified against real AWS: an invalid or wrong-case TlsPolicy returns
ValidationError "1 validation error detected: Value at
'deliveryOptions.tlsPolicy' failed to satisfy constraint: Member must satisfy
enum value set: [Optional, Require]". The v1 integration test now asserts that
shape; valid Require/Optional still normalize to the canonical value for the
shared service.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-06-25 22:49:14 -05:00
1 parent 0530ca11ab
commit 54ba15c218
5 files changed
+204 -1

No files matched your search

@@ -385,7 +385,8 @@ public class AwsQueryController {
"CreateConfigurationSetTrackingOptions",
"UpdateConfigurationSetTrackingOptions",
"DeleteConfigurationSetTrackingOptions",
"UpdateConfigurationSetReputationMetricsEnabled"
"UpdateConfigurationSetReputationMetricsEnabled",
"PutConfigurationSetDeliveryOptions"
);
private static final Set<String> COGNITO_ACTIONS = Set.of(
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.ses.model.BulkEmailEntryResult;
import io.github.hectorvent.floci.services.ses.model.CloudWatchDestination;
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.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;
@@ -25,6 +26,7 @@ import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* Query-protocol handler for SES actions.
@@ -98,6 +100,8 @@ public class SesQueryHandler {
handleDeleteConfigurationSetTrackingOptions(params, region);
case "UpdateConfigurationSetReputationMetricsEnabled" ->
handleUpdateConfigurationSetReputationMetricsEnabled(params, region);
case "PutConfigurationSetDeliveryOptions" ->
handlePutConfigurationSetDeliveryOptions(params, region);
default -> AwsQueryResponse.error("UnsupportedOperation",
"Operation " + action + " is not supported by SES.", AwsNamespaces.SES, 400);
};
@@ -753,6 +757,32 @@ public class SesQueryHandler {
"UpdateConfigurationSetReputationMetricsEnabled", AwsNamespaces.SES)).build();
}
private Response handlePutConfigurationSetDeliveryOptions(MultivaluedMap<String, String> params,
String region) {
String configSet = requireParam(params, "ConfigurationSetName");
String tlsPolicy = getParam(params, "DeliveryOptions.TlsPolicy");
// The V1 API accepts TlsPolicy Require/Optional (PascalCase, case-sensitive). Validate
// here so an invalid enum value yields the v1 ValidationError AWS returns rather than the
// shared service's v2-style BadRequestException. Message verified against real AWS.
if (tlsPolicy != null && !"Require".equals(tlsPolicy) && !"Optional".equals(tlsPolicy)) {
throw new AwsException("ValidationError",
"1 validation error detected: Value at 'deliveryOptions.tlsPolicy' failed to "
+ "satisfy constraint: Member must satisfy enum value set: [Optional, Require]",
400);
}
// Mirror the V2 path: an all-null DeliveryOptions clears the block rather than
// persisting an empty object. Normalize the value to the V2 canonical REQUIRE/OPTIONAL
// that Floci stores internally.
DeliveryOptions options = null;
if (tlsPolicy != null) {
options = new DeliveryOptions();
options.setTlsPolicy(tlsPolicy.toUpperCase(Locale.ROOT));
}
sesService.setConfigurationSetDeliveryOptions(configSet, options, region);
return Response.ok(AwsQueryResponse.envelopeEmptyResult(
"PutConfigurationSetDeliveryOptions", AwsNamespaces.SES)).build();
}
/**
* AWS V1 SES uses lowercased event-type names on the wire (e.g. {@code send},
* {@code complaint}, {@code renderingFailure}) while V2 uses