refactor: read and check ARNs through AwsArnUtils in Bedrock, AgentCore and SageMaker (#6970)

The arn-probe and arn-split sites in these services now go through looksLikeArn, isArn, parse and regionOrDefault. The four AgentCore services share BedrockAgentCoreArns.resource, which reads an ARN's resource without its qualifier. A well-formed ARN reads the same as before. tools/partition/baseline.tsv drops from 44 to 34.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-29 21:39:02 -04:00
1 parent 98a3d2a346
commit 5bf89a5061
9 files changed
+85 -35

No files matched your search

@@ -0,0 +1,28 @@
package io.github.hectorvent.floci.services.bedrockagentcorecontrol;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
class BedrockAgentCoreArnsTest {
@Test
void resourceDropsTheQualifier() {
assertEquals("agent/abc",
BedrockAgentCoreArns.resource("arn:aws:bedrock-agentcore:us-east-1:123456789012:agent/abc:7"));
}
@Test
void resourceWithoutAQualifierIsKeptWhole() {
assertEquals("memory/m-1",
BedrockAgentCoreArns.resource("arn:aws-us-gov:bedrock-agentcore:us-gov-west-1:123456789012:memory/m-1"));
}
@Test
void resourceIsNullForAnythingThatIsNotAnArn() {
assertNull(BedrockAgentCoreArns.resource(null));
assertNull(BedrockAgentCoreArns.resource("agent/abc"));
assertNull(BedrockAgentCoreArns.resource("arn:aws:bedrock-agentcore:us-east-1"));
}
}