refactor(core): add AwsArnUtils.looksLikeArn for name-or-ARN parameters (#6877)

A parameter that takes a name or an ARN, where AWS answers a malformed ARN with its own error, needs to treat any value starting arn: as an attempted ARN. isArn needs all six fields and would send arn:aws:rds down the name path, so the sites the earlier migration PRs left on purpose still probe with a hand-written startsWith. looksLikeArn is that probe, in one place, so the area PRs that follow can move them off the arn-probe baseline without changing the error a caller sees.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-28 20:47:03 -04:00
1 parent d726533659
commit 22ea3ca2e0
3 files changed
+37 -1

No files matched your search

@@ -142,6 +142,17 @@ public final class AwsArnUtils {
return parts.length == 6 && "arn".equals(parts[0]);
}
/**
* True when {@code value} is meant as an ARN: it starts with {@code arn:}, whether or not the
* rest is well formed. For a parameter that takes a name or an ARN, where AWS answers a
* malformed ARN with its own error (an {@code InvalidParameterValue}, a {@code ValidationError},
* a not-found) instead of looking it up as a name. {@link #isArn} needs all six segments, so it
* would send {@code arn:aws:rds} down the name path and change the error the caller sees.
*/
public static boolean looksLikeArn(String value) {
return value != null && value.startsWith("arn:"); // partition-literal: the one attempted-ARN check
}
/**
* True when {@code value} is an ARN naming {@code service}, in any partition. The common use
* is telling an identifier that may be either a bare name or a full ARN apart, e.g. a