Files
floci/docs
Allen Sanborn 97cbce205b feat(config): add aggregation authorization CRUD (#3627)
* feat(config): add aggregation authorization CRUD

PutAggregationAuthorization, DescribeAggregationAuthorizations and
DeleteAggregationAuthorization were unrouted, so the JSON handler answered
InvalidAction and aws_config_aggregate_authorization could not be created.

Authorizations are keyed by (AuthorizedAccountId, AuthorizedAwsRegion) within
the request region, persisted through StorageFactory like the other durable
Config resources. Put is an upsert that preserves the ARN and creation time of
an existing authorization, and accepts Tags, which land in the same tag store
that ListTagsForResource reads. Delete of an absent authorization succeeds: the
Config model declares no not-found error for that operation.

* fix(config): remove aggregation-authorization tags on every delete attempt

Tag cleanup ran only when the delete found an entry to remove. A delete that
removed the authorization but did not reach the tags left them behind, and the
retry that should have cleaned them up skipped the cleanup because the entry
was already gone. Put reuses a deterministic ARN, so those tags reappeared on
the next authorization for the same account and region.

The ARN is now derived from the key instead of read off the removed entry, and
its tags are dropped on every attempt. The authorization map is still persisted
only when an entry was actually removed.

* fix(config): apply PutAggregationAuthorization tags at creation only

PutAggregationAuthorization is idempotent, and AWS applies request tags at
creation only: a later Put that finds the authorization already there ignores
its Tags and leaves the existing ones alone. Tagging the existing ARN on every
Put let a local test retag by re-putting, which production would silently
refuse.

Return the existing authorization untouched and tag only the one just created.
Tags still change through TagResource/UntagResource, which is the only way AWS
offers.

* fix(config): make aggregation authorization put/delete atomic

putAggregationAuthorization did a get-then-put on the region map with nothing
holding the two together, and deleteAggregationAuthorization removed-then-
persisted the same way. Two concurrent Puts for one (AuthorizedAccountId,
AuthorizedAwsRegion) could both find nothing and both create: the second
overwrote the first's CreationTime and re-applied creation tags over a set
TagResource may already have changed, so the documented idempotency held only
probabilistically.

Both now take the same per-key lock putConfigRule/deleteConfigRule already use
for rules. The lock keys are namespaced apart from the rule keys in the shared
map rather than relying on rule names never containing '|'.

The regression runs many short rounds rather than one wide one, because the
unlocked window is a few instructions: repeated fresh starts land the race,
more threads on one start do not. It asserts reference identity, which is what
distinguishes the two cases -- the store is keyed on the pair so its size is 1
either way, the ARN is derived from the key so it is equal either way, and
CreationTime is epoch seconds so a racing pair created inside one second is
indistinguishable by timestamp. Verified to fail with the lock removed
(17 mismatches) and pass with it, five runs.
2026-09-15 14:48:11 -04:00
..
2026-03-15 17:43:56 -05:00