Skip to content

Commit 5dcfc09

Browse files
Djelibeybiclaude
andauthored
fix: update Go module path to github.com/libdns/oraclecloud (#2)
Update the module path and all internal imports to reflect the new home under the libdns GitHub organisation. Signed-off-by: Avi Miller <me@dje.li> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aa5adc1 commit 5dcfc09

5 files changed

Lines changed: 51 additions & 6 deletions

File tree

CLAUDE.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
A [libdns](https://github.com/libdns/libdns) provider for Oracle Cloud Infrastructure (OCI) DNS. Single-package Go module (`package oraclecloud`) that implements `GetRecords`, `AppendRecords`, `SetRecords`, `DeleteRecords`, and `ListZones`.
8+
9+
Module path: `github.com/libdns/oraclecloud`
10+
11+
## Build & Test Commands
12+
13+
```bash
14+
go build ./... # Build
15+
go test ./... # Run all tests
16+
go test -run TestName # Run a single test
17+
go mod tidy # Tidy module graph (CI will fail if this produces changes)
18+
```
19+
20+
## Architecture
21+
22+
All code lives in two source files:
23+
24+
- **`provider.go`** — the entire implementation: `Provider` struct, all five libdns interface methods, OCI client initialisation, authentication strategies, zone resolution, record conversion, and helper functions.
25+
- **`provider_test.go`** + **`test_helpers_test.go`** — unit tests using a `fakeDNSClient` that implements the `dnsAPI` interface in-memory; no live OCI calls needed.
26+
27+
### Key Design Patterns
28+
29+
- **`dnsAPI` interface** (bottom of `provider.go`) — abstracts the OCI DNS SDK client behind five methods (`GetZone`, `GetZoneRecords`, `PatchZoneRecords`, `UpdateRRSet`, `ListZones`). The real client is `sdkDNSClient`; tests inject `fakeDNSClient`.
30+
- **Authentication cascade**`configurationProvider()` resolves auth via: explicit API-key fields → OCI config file → OCI CLI environment variables → instance principal. The `Auth` field (`auto`, `api_key`, `config_file`, `environment`) controls which path is used.
31+
- **Zone resolution**`resolveZone()` accepts either a zone name or an OCID, calls `GetZone` to normalise it, and returns a `zoneRef` (canonical name + API reference).
32+
- **Scope/ViewID propagation** — every OCI API request passes through an `apply*Options` helper that sets scope (`GLOBAL`/`PRIVATE`) and optional `ViewID`.
33+
- **Record conversion**`toLibdnsRecord()` converts OCI `Record` → typed libdns records (e.g. `libdns.Address`, `libdns.CNAME`); `recordToDetails()`/`recordToOperation()` convert the other direction using `libdns.RR.RR()` for serialisation.
34+
- **`SetRecords` is per-RRSet** — records are grouped by `(domain, rtype)` via `groupRecordsByRRSet()`, then each group is atomically replaced with `UpdateRRSet`.
35+
36+
## CI
37+
38+
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.
39+
40+
## Conventions
41+
42+
- Use conventional commits (`feat:`, `fix:`, `chore:`, etc.) — release-please generates releases from these.
43+
- OCI CLI environment variable names are defined as constants (`envCLI*`) at the top of `provider.go`.
44+
- Zone names are always normalised to trailing-dot form internally via `normalizeZoneName()`.
45+
- libdns record names use relative form (`@` for apex, `www` for subdomains); OCI uses absolute FQDNs — conversion happens in `absoluteDomainForAPI()` and `toLibdnsRecord()`.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ For Go modules, that means:
115115
- `feat:` conventional commits map to minor releases
116116
- `feat!:` or any commit with a `BREAKING CHANGE:` footer maps to a major release
117117
- if this module ever releases `v2+`, the Go module path must also change to include the major suffix
118-
such as `github.com/Djelibeybi/libdns-oraclecloud/v2`
118+
such as `github.com/libdns/oraclecloud/v2`
119119

120120
GitHub Actions uses `release-please` to turn conventional commits merged to `main` into release PRs,
121121
SemVer tags, changelog updates, and GitHub Releases.
@@ -126,4 +126,4 @@ SemVer tags, changelog updates, and GitHub Releases.
126126
force use of `~/.oci/config`, set `Auth: "config_file"`.
127127
- For private zones accessed by name, OCI requires `ViewID`.
128128
- `SetRecords` is atomic per RRSet because OCI exposes RRSet replacement as a single operation, but it is not atomic across multiple distinct RRSets.
129-
- The module path is `github.com/Djelibeybi/libdns-oraclecloud`.
129+
- The module path is `github.com/libdns/oraclecloud`.

cmd/ocismoke/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"strings"
1212
"time"
1313

14-
oraclecloud "github.com/Djelibeybi/libdns-oraclecloud"
15-
"github.com/Djelibeybi/libdns-oraclecloud/internal/txtrdata"
14+
oraclecloud "github.com/libdns/oraclecloud"
15+
"github.com/libdns/oraclecloud/internal/txtrdata"
1616
"github.com/libdns/libdns"
1717
)
1818

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/Djelibeybi/libdns-oraclecloud
1+
module github.com/libdns/oraclecloud
22

33
go 1.25.0
44

provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"sync"
1313
"time"
1414

15-
"github.com/Djelibeybi/libdns-oraclecloud/internal/txtrdata"
15+
"github.com/libdns/oraclecloud/internal/txtrdata"
1616
"github.com/libdns/libdns"
1717
"github.com/oracle/oci-go-sdk/v65/common"
1818
ociauth "github.com/oracle/oci-go-sdk/v65/common/auth"

0 commit comments

Comments
 (0)