This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A libdns provider for Oracle Cloud Infrastructure (OCI) DNS. Single-package Go module (package oraclecloud) that implements GetRecords, AppendRecords, SetRecords, DeleteRecords, and ListZones.
Module path: github.com/libdns/oraclecloud
go build ./... # Build
go test ./... # Run all tests
go test -run TestName # Run a single test
go mod tidy # Tidy module graph (CI will fail if this produces changes)All code lives in two source files:
provider.go— the entire implementation:Providerstruct, all five libdns interface methods, OCI client initialisation, authentication strategies, zone resolution, record conversion, and helper functions.provider_test.go+test_helpers_test.go— unit tests using afakeDNSClientthat implements thednsAPIinterface in-memory; no live OCI calls needed.
dnsAPIinterface (bottom ofprovider.go) — abstracts the OCI DNS SDK client behind five methods (GetZone,GetZoneRecords,PatchZoneRecords,UpdateRRSet,ListZones). The real client issdkDNSClient; tests injectfakeDNSClient.- Authentication cascade —
configurationProvider()resolves auth via: explicit API-key fields → OCI config file → OCI CLI environment variables → instance principal. TheAuthfield (auto,api_key,config_file,environment) controls which path is used. - Zone resolution —
resolveZone()accepts either a zone name or an OCID, callsGetZoneto normalise it, and returns azoneRef(canonical name + API reference). - Scope/ViewID propagation — every OCI API request passes through an
apply*Optionshelper that sets scope (GLOBAL/PRIVATE) and optionalViewID. - Record conversion —
toLibdnsRecord()converts OCIRecord→ typed libdns records (e.g.libdns.Address,libdns.CNAME);recordToDetails()/recordToOperation()convert the other direction usinglibdns.RR.RR()for serialisation. SetRecordsis per-RRSet — records are grouped by(domain, rtype)viagroupRecordsByRRSet(), then each group is atomically replaced withUpdateRRSet.
GitHub Actions runs go mod tidy (must be clean), go build ./..., and go test ./... on Go 1.24 + stable. Releases are automated via release-please with conventional commits.
- Use conventional commits (
feat:,fix:,chore:, etc.) — release-please generates releases from these. - OCI CLI environment variable names are defined as constants (
envCLI*) at the top ofprovider.go. - Zone names are always normalised to trailing-dot form internally via
normalizeZoneName(). - libdns record names use relative form (
@for apex,wwwfor subdomains); OCI uses absolute FQDNs — conversion happens inabsoluteDomainForAPI()andtoLibdnsRecord().