fix(lambda): quote the model's FunctionName pattern in the validation error (#5487)

The ValidationException for a bad function name quoted a region pattern
without the (eusc-)? and -iso([a-z]?) branches the Lambda model's
FunctionName pattern has. The text is only quoted, never enforced, so no
name is accepted or refused differently.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-12 06:45:50 -04:00
1 parent 03a0dfefdd
commit 32cb4b7b8b
2 files changed
+12 -1

No files matched your search

@@ -85,6 +85,15 @@ class LambdaArnUtilsTest {
assertEquals(maxLen, ref.name());
}
@Test
void aBadNameQuotesTheModelsFunctionNamePattern() {
AwsException ex = assertThrows(AwsException.class, () -> LambdaArnUtils.resolve("bad.name"));
assertEquals("ValidationException", ex.getErrorCode());
assertTrue(ex.getMessage().contains("((eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}:)?"),
ex.getMessage());
}
@Test
void resolveAccepts140CharPartialArn() {
String name = "a".repeat(118);