fix(ses): check the TemplateArn of a v1 templated send as SES does (#9131)

SendTemplatedEmail and SendBulkTemplatedEmail now check TemplateArn with the
parser the v2 sends use: partition, service, region and resource type each
answer their own "Invalid template ARN" message, a value without "arn:" and an
empty template name are rejected, and the account is not checked. The v1-only
parser that looked for ":template/" is removed, and the name/ARN alignment
check moves into SesTemplateService for both protocols; the v2 controller's
remap keeps its BadRequestException.

Both v1 sends require Template whatever TemplateArn holds, as the model does,
and answer "Template cannot be empty" ahead of the ARN checks;
SendBulkTemplatedEmail treats a whitespace-only Template as empty. The Java and
Python compatibility tests build the template ARN in the client's partition and
region.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-11-21 09:37:57 -04:00
1 parent 9b19f17fe7
commit 2b9ed9cd55
9 files changed
+288 -57

No files matched your search

@@ -240,7 +240,7 @@ class SesTemplateTest {
.build())
.content(EmailContent.builder()
.template(Template.builder()
.templateArn("arn:aws:ses:us-east-1:000000000000:template/" + name)
.templateArn(TestFixtures.arn("ses", "000000000000", "template/" + name))
.templateData("{\"name\":\"Alice\"}")
.build())
.build())
@@ -446,7 +446,7 @@ class SesTemplateTest {
.source(v1Sender)
.destination(d -> d.toAddresses("recipient@example.com"))
.template(name)
.templateArn("arn:aws:ses:us-east-1:000000000000:template/" + name)
.templateArn(TestFixtures.arn("ses", "000000000000", "template/" + name))
.templateData("{\"name\":\"Alice\"}")
.build());
assertThat(response.messageId()).isNotBlank();