Skip to content

feat: multi-zone-origin support via vns-targeted record updates - #4

Merged
Alserda merged 11 commits into
mainfrom
feat/resolve-virtual-name-server
Jul 23, 2026
Merged

feat: multi-zone-origin support via vns-targeted record updates#4
Alserda merged 11 commits into
mainfrom
feat/resolve-virtual-name-server

Conversation

@Alserda

@Alserda Alserda commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Context

An AutoDNS zone is identified by its origin plus its virtual name server, and one origin can carry more than one zone (the same domain served from two different virtual name servers). The record-mutation endpoint this client used, POST /zone/{origin}/_stream, is keyed by the origin alone: it cannot target one of several zones that share an origin. This PR moves record mutation onto the vns-targeted PATCH /zone/{origin}/{virtualNameServer} and adds the resolution and error surface a caller needs for multi-zone origins.

Related issues

Highlights

  • UpdateRecords(ctx, origin, virtualNameServer, adds, rems) applies record additions and removals to one specific zone via PATCH, with models.ZonePatchRequest (resourceRecordsAdd / resourceRecordsRem) as its body.
  • ErrAmbiguousZone sentinel: ResolveVirtualNameServer returns it (via errors.Is) when more than one zone shares an origin, and the message enumerates the candidate virtual name servers.
  • fakeautodns serves the PATCH route keyed by (origin, virtualNameServer).
  • Breaking: StreamRecords, models.RecordStreamRequest, and the _stream route are removed; UpdateRecords replaces them.

Out of scope

  • Provider-side changes live in the consuming Terraform provider, not this client.

Note for reviewers

  • Breaking change, appropriate on the pre-1.0 line. The one endpoint behavior the vendor OpenAPI spec does not document (how resourceRecordsRem matches) was verified against the live API before this landed, and matches on name+type+value.

Proof of work

  • make test (client, fakeautodns, e2e, -race): green.
  • make lint: 0 issues.
  • Live-API smoke test: created a TXT record via UpdateRecords against a real zone and confirmed it was added (then removed it).

Add ResolveVirtualNameServer to the client package, so origin-to-vns
resolution stays AutoDNS knowledge inside this library rather than
being reimplemented by the Terraform provider that consumes it.
@Alserda
Alserda force-pushed the feat/resolve-virtual-name-server branch from 98c2289 to feb573d Compare July 22, 2026 13:02
Alserda added 10 commits July 22, 2026 21:06
…g, test)

Fix a whole-branch review of Phase A (UpdateRecords/ErrAmbiguousZone):
update the README's Usage example and Errors section to the new
UpdateRecords surface, drop a public doc comment's reference to a
never-committed planning doc, tighten two overlapping CHANGELOG
bullets, and align a fakeautodns test's name and blank-line grouping
with the file's conventions.
Single-zone scenarios used a_seeded_zone (vns implicit) but then named
testVirtualNameServer in the WHEN and THEN steps, so the vns appeared from
nowhere when reading top to bottom. Default helpers now hide the vns
entirely; only the shared-origin scenario names it, on both sides.
TestZone_ResolveVirtualNameServerReturnsTheSeededVNS seeded via
a_seeded_zone (vns implicit) then asserted testVirtualNameServer out of
nowhere. Seeding explicitly at testVirtualNameServer makes the expected
resolved value visible in the GIVEN.
@Alserda Alserda changed the title feat: resolve a zone's virtual name server by origin feat: multi-zone-origin support via vns-targeted record updates Jul 23, 2026
@Alserda
Alserda merged commit 250bb4f into main Jul 23, 2026
6 checks passed
@Alserda
Alserda deleted the feat/resolve-virtual-name-server branch July 23, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve a zone's virtual name server from its origin

1 participant