mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
feat(ses): add UpdateAccountSendingEnabled (v1) (#737)
Implements the v1 Query action mirroring the existing v2 PUT /v2/email/account/sending endpoint. The Enabled parameter is optional per AWS docs; missing or empty is treated as false. Adds integration tests and a Java SDK compatibility test that exercises both v1 UpdateAccountSendingEnabled and verifies state is shared with the v2 GetAccount / PutAccountSendingAttributes path.
This commit is contained in:
1 parent
271f27da62
commit
d971288d02
4 files changed
+260
-12
No files matched your search
@@ -54,6 +54,7 @@ public class SesQueryHandler {
|
||||
case "GetSendQuota" -> handleGetSendQuota(region);
|
||||
case "GetSendStatistics" -> handleGetSendStatistics(region);
|
||||
case "GetAccountSendingEnabled" -> handleGetAccountSendingEnabled(region);
|
||||
case "UpdateAccountSendingEnabled" -> handleUpdateAccountSendingEnabled(params, region);
|
||||
case "ListVerifiedEmailAddresses" -> handleListVerifiedEmailAddresses(region);
|
||||
case "DeleteVerifiedEmailAddress" -> handleDeleteVerifiedEmailAddress(params, region);
|
||||
case "SetIdentityNotificationTopic" -> handleSetIdentityNotificationTopic(params, region);
|
||||
@@ -210,6 +211,12 @@ public class SesQueryHandler {
|
||||
return Response.ok(AwsQueryResponse.envelope("GetAccountSendingEnabled", AwsNamespaces.SES, result)).build();
|
||||
}
|
||||
|
||||
private Response handleUpdateAccountSendingEnabled(MultivaluedMap<String, String> params, String region) {
|
||||
boolean enabled = parseOptionalBoolean(params, "Enabled", false);
|
||||
sesService.setAccountSendingEnabled(region, enabled);
|
||||
return Response.ok(AwsQueryResponse.envelopeEmptyResult("UpdateAccountSendingEnabled", AwsNamespaces.SES)).build();
|
||||
}
|
||||
|
||||
private Response handleListVerifiedEmailAddresses(String region) {
|
||||
List<String> emails = sesService.getVerifiedEmailAddresses(region);
|
||||
var xml = new XmlBuilder().start("VerifiedEmailAddresses");
|
||||
@@ -320,6 +327,18 @@ public class SesQueryHandler {
|
||||
return Boolean.parseBoolean(raw);
|
||||
}
|
||||
|
||||
private static boolean parseOptionalBoolean(MultivaluedMap<String, String> params, String name, boolean defaultValue) {
|
||||
String raw = params.getFirst(name);
|
||||
if (raw == null || raw.isBlank()) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (!"true".equalsIgnoreCase(raw) && !"false".equalsIgnoreCase(raw)) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
name + " must be \"true\" or \"false\".", 400);
|
||||
}
|
||||
return Boolean.parseBoolean(raw);
|
||||
}
|
||||
|
||||
private Response handleGetIdentityMailFromDomainAttributes(MultivaluedMap<String, String> params, String region) {
|
||||
List<String> identities = extractMembers(params, "Identities");
|
||||
var xml = new XmlBuilder().start("MailFromDomainAttributes");
|
||||
|
||||
Reference in new issue
Block a user