fix(ses): populate VerificationStatus in v2 ListEmailIdentities (#1722)

* fix(ses): populate VerificationStatus in v2 ListEmailIdentities

ListEmailIdentities built each item with only IdentityType / IdentityName /
SendingEnabled, so VerificationStatus always serialized as null and clients had
to call GetEmailIdentity per identity. Populate it from the identity's stored
status (mapped to the v2 enum via toV2Status), and refresh each identity's
state the same way GetEmailIdentity does so the list stays consistent (e.g. a
domain that transitioned to SUCCESS via its DKIM records).

* fix(ses): derive SendingEnabled from verification status in v2 ListEmailIdentities

SendingEnabled was hard-coded to true, so a not-yet-verified identity was
reported as sendable, which is inconsistent now that VerificationStatus is
populated. AWS returns SendingEnabled=true only when the identity is verified
(VerificationStatus SUCCESS) and false otherwise (PENDING/FAILED), matching the
VerifiedForSendingStatus logic already used by GetEmailIdentity. Derive it the
same way here.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-07-09 23:54:43 -05:00
1 parent 3771c1e9a2
commit efc9453fd7
3 files changed
+56 -4

No files matched your search

@@ -127,10 +127,20 @@ public class SesController {
ObjectNode result = objectMapper.createObjectNode();
ArrayNode items = result.putArray("EmailIdentities");
for (Identity id : identities) {
// Only a not-yet-verified domain can still transition (via its DKIM records),
// so refresh just those; refreshing every identity would scan Route53 per call.
Identity current = id;
if ("Domain".equals(id.getIdentityType()) && !"Success".equals(id.getVerificationStatus())) {
Identity refreshed = sesService.getIdentityVerificationAttributes(id.getIdentity(), region);
if (refreshed != null) {
current = refreshed;
}
}
ObjectNode item = objectMapper.createObjectNode();
item.put("IdentityType", toV2IdentityType(id.getIdentityType()));
item.put("IdentityName", id.getIdentity());
item.put("SendingEnabled", true);
item.put("IdentityType", toV2IdentityType(current.getIdentityType()));
item.put("IdentityName", current.getIdentity());
item.put("SendingEnabled", "Success".equals(current.getVerificationStatus()));
item.put("VerificationStatus", toV2Status(current.getVerificationStatus()));
items.add(item);
}
return Response.ok(result).build();