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:
Kenshin Okinaka authored and GitHub committed 2026-05-07 21:03:05 -05:00
1 parent 271f27da62
commit d971288d02
4 files changed
+260 -12

No files matched your search

@@ -17,7 +17,11 @@ import static org.hamcrest.Matchers.*;
class SesIntegrationTest {
private static String authorization(String service) {
return "AWS4-HMAC-SHA256 Credential=AKID/20260101/us-east-1/" + service + "/aws4_request";
return authorization(service, "us-east-1");
}
private static String authorization(String service, String region) {
return "AWS4-HMAC-SHA256 Credential=AKID/20260101/" + region + "/" + service + "/aws4_request";
}
@Test
@@ -242,7 +246,7 @@ class SesIntegrationTest {
}
@Test
@Order(14)
@Order(15)
void getAccountSendingEnabled_acceptsSesv2CredentialScopeAlias() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -256,7 +260,7 @@ class SesIntegrationTest {
}
@Test
@Order(15)
@Order(16)
void getIdentityDkimAttributes() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -272,7 +276,7 @@ class SesIntegrationTest {
}
@Test
@Order(16)
@Order(17)
void setIdentityNotificationTopic() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -289,7 +293,7 @@ class SesIntegrationTest {
}
@Test
@Order(17)
@Order(18)
void getIdentityNotificationAttributes() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -305,7 +309,7 @@ class SesIntegrationTest {
}
@Test
@Order(18)
@Order(19)
void deleteVerifiedEmailAddress() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -330,7 +334,7 @@ class SesIntegrationTest {
}
@Test
@Order(19)
@Order(20)
void deleteIdentity() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -356,7 +360,7 @@ class SesIntegrationTest {
}
@Test
@Order(20)
@Order(21)
void sendEmailV1_replyToAddressesStoredInInspection() {
given().delete("/_aws/ses").then().statusCode(200);
@@ -384,7 +388,7 @@ class SesIntegrationTest {
}
@Test
@Order(21)
@Order(22)
void deleteDomainIdentity() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -409,7 +413,7 @@ class SesIntegrationTest {
}
@Test
@Order(22)
@Order(23)
void verifyEmailIdentity_rejectsLeadingTrailingWhitespace() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -425,7 +429,7 @@ class SesIntegrationTest {
}
@Test
@Order(23)
@Order(24)
void verifyDomainIdentity_rejectsLeadingTrailingWhitespace() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -441,7 +445,7 @@ class SesIntegrationTest {
}
@Test
@Order(24)
@Order(25)
void unsupportedAction_returns400() {
given()
.contentType("application/x-www-form-urlencoded")
@@ -453,4 +457,145 @@ class SesIntegrationTest {
.statusCode(400)
.body(containsString("UnsupportedOperation"));
}
@Test
@Order(26)
void updateAccountSendingEnabled_treatsMissingOrBlankEnabledAsFalse() {
// Missing Enabled parameter
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "UpdateAccountSendingEnabled")
.when()
.post("/")
.then()
.statusCode(200);
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "GetAccountSendingEnabled")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<Enabled>false</Enabled>"));
// restore so the next assertion observes the blank-string default cleanly
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "UpdateAccountSendingEnabled")
.formParam("Enabled", "true")
.when()
.post("/")
.then()
.statusCode(200);
// Blank Enabled parameter (e.g. AWS CLI passing --enabled "") behaves the same
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "UpdateAccountSendingEnabled")
.formParam("Enabled", "")
.when()
.post("/")
.then()
.statusCode(200);
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "GetAccountSendingEnabled")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<Enabled>false</Enabled>"));
// restore default state for downstream tests
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "UpdateAccountSendingEnabled")
.formParam("Enabled", "true")
.when()
.post("/")
.then()
.statusCode(200);
}
@Test
@Order(27)
void updateAccountSendingEnabled_isolatesPerRegion() {
// Disable sending in us-west-2 only; also exercises the response envelope shape
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email", "us-west-2"))
.formParam("Action", "UpdateAccountSendingEnabled")
.formParam("Enabled", "false")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<UpdateAccountSendingEnabledResponse"));
// us-west-2 reflects the disable
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email", "us-west-2"))
.formParam("Action", "GetAccountSendingEnabled")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<Enabled>false</Enabled>"));
// us-east-1 is unaffected
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "GetAccountSendingEnabled")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<Enabled>true</Enabled>"));
// re-enable us-west-2 and confirm the toggle round-tripped
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email", "us-west-2"))
.formParam("Action", "UpdateAccountSendingEnabled")
.formParam("Enabled", "true")
.when()
.post("/")
.then()
.statusCode(200);
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email", "us-west-2"))
.formParam("Action", "GetAccountSendingEnabled")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<Enabled>true</Enabled>"));
}
@Test
@Order(28)
void updateAccountSendingEnabled_invalidValue_returns400() {
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", authorization("email"))
.formParam("Action", "UpdateAccountSendingEnabled")
.formParam("Enabled", "yes")
.when()
.post("/")
.then()
.statusCode(400)
.body(containsString("InvalidParameterValue"));
}
}