Files
floci/src/main/java
Sam Fakhreddine e471946f44 feat(route53): VPC association lifecycle actions (#2638)
* feat(route53): add VPC association lifecycle actions

Zone creation already persists VPC associations, but the lifecycle
operations that manage them afterwards were missing. Adds, on top of the
existing VpcAssociation model:

- AssociateVPCWithHostedZone   POST /hostedzone/{Id}/associatevpc
- DisassociateVPCFromHostedZone POST /hostedzone/{Id}/disassociatevpc
- CreateVPCAssociationAuthorization POST /hostedzone/{Id}/authorizevpcassociation
- DeleteVPCAssociationAuthorization POST /hostedzone/{Id}/deauthorizevpcassociation
- ListHostedZonesByVPC          GET  /hostedzonesbyvpc

Request paths, XML element names and response shapes follow the Route 53
2013-04-01 rest-xml model, including HostedZoneSummary's HostedZoneId and
Owner members, and ListHostedZonesByVPC honours maxitems/nexttoken.
Associate is idempotent; disassociate raises VPCAssociationNotFound for
an unknown VPC and LastVPCAssociation when it would remove the only
remaining association, and associating a public zone raises
PublicZoneVPCAssociation.

VpcAssociation has no value equality, so associations are matched on VPC
ID and region rather than object identity.

The two authorization endpoints are shape-only: hosted zones are not
account-scoped here, so an authorization cannot gate a later associate
call. They validate the request and echo the VPC back.

* fix(route53): enforce the VPCRegion enum on the VPC association actions

AssociateVPCWithHostedZone, DisassociateVPCFromHostedZone, the two
authorization actions and ListHostedZonesByVPC all read VPCRegion and
stored or matched on it verbatim. A region outside the modelled enum was
accepted, so the association was written under a region that could never
be matched again: the associate reported INSYNC while the later
disassociate answered VPCAssociationNotFound and ListHostedZonesByVPC
silently omitted the zone.

Reject an unmodelled VPCRegion with InvalidInput, which the model lists
for every one of these operations. The check carries the enum from the
model rather than reusing AwsRegions.KNOWN_IDS, because the enum admits
the ISO and European Sovereign partitions the emulator never advertises.

* fix(route53): reject unmodelled VPC regions on create and fix VPC-list pagination

CreateHostedZone stored a VPC association's region without checking it
against the modelled VPCRegion enum, so an association created that way
could never be found again by the later disassociate/list lifecycle
actions, which do check it. ListHostedZonesByVPC also silently restarted
pagination on an unrecognized NextToken and ignored a non-positive
MaxItems instead of rejecting both with InvalidInput.

* fix(route53): don't strand legacy VPC regions, and stabilize equal-name pagination

Two review findings from the latest re-review:
- ListHostedZonesByVPC and DisassociateVPCFromHostedZone rejected any VPCRegion outside the
  modelled enum before ever touching storage, so an association persisted under a region since
  retired from the enum (or from before this check existed) could never be listed or removed —
  only a full hosted-zone deletion could get rid of it. The enum check now applies only to the
  paths that create a new association (AssociateVPCWithHostedZone, CreateHostedZone,
  CreateVPCAssociationAuthorization); lookups and removal accept whatever region is on record.
- ListHostedZonesByVPC sorted matches by name only, so two zones with the same name were ordered
  however the backing store happened to iterate them, which can differ between the page-1 and
  page-2 scans and desync the id-based NextToken continuation point. The sort now tie-breaks by
  id so the total order is fixed regardless of iteration order.

* fix(route53): use the modeled InvalidPaginationToken and ConflictingDomainExists errors

ListHostedZonesByVPC returned the generic InvalidInput for an
unrecognized NextToken instead of the purpose-built
InvalidPaginationToken the model declares for exactly this operation.
AssociateVPCWithHostedZone also let the same VPC attach to two
different hosted zones sharing a name, something the model documents
as ConflictingDomainExists; the existing listHostedZonesByVpc lookup
now scans for that conflict before storing a new association.
2026-08-28 08:19:14 -04:00
..