mirror of
https://github.com/floci-io/floci.git
synced 2026-11-30 08:55:17 -05:00
AwsArnUtils.Arn.of hardcoded the "aws" partition, so every ARN the emulator minted for a GovCloud or China region named the wrong partition. Correctness here was not a property of the call site: all 115 Arn.of callers and the 132 that reach it through RegionResolver.buildArn were equally wrong, including the ones following the documented pattern. AwsRegions gains partitionFor and dnsSuffixFor, with the region patterns transcribed from botocore's partitions.json regionRegex values so they stay comparable against it. Only the non-commercial partitions need a rule; an unrecognised region resolves to "aws", which is what the SDKs do and keeps a region AWS launches tomorrow working rather than failing closed. EksTokenMinter carried the same table for STS hostnames and now delegates to it, so a partition cannot go missing from one and not the other. Global services pass an empty region and keep "aws". That gap is documented on Arn.of rather than closed: an IAM ARN in a GovCloud deployment really is arn:aws-us-gov:iam::..., but nothing in the region argument can say so, and those call sites need a partition from the deployment instead. AwsArnUtils is referenced from 120 files and had no test of its own, so this adds one, written against the previous behaviour before the change and covering the resource field's colon handling that the callers depend on. No test in src/test or compatibility-tests constructs an ARN from a non-commercial region: the six that mention one are parsing a hostname or validating a supplied ARN. The emitted ARNs are therefore unchanged for the whole suite.