rdev/internal/port/dns_provider.go
jordan 34e72687e6 feat: Complete automation gaps for repeatable project deployments
- Initial K8s deployment auto-creation during project creation
- DNS record upsert support (create or update existing records)
- Ingress host management for domain aliases (AddIngressHost/RemoveIngressHost)
- Woodpecker deployer RBAC manifest for CI deploy steps
- Single-commit template seeding via Gitea bulk file API

Closes automation gaps exposed during www.threesix.ai launch:
- Projects now auto-create K8s Deployment/Service/Ingress on creation
- Domain aliases automatically update both DNS and K8s ingress
- CI deploy steps work without manual RBAC setup
- Template seeding triggers only one CI pipeline (not per-file)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:18:31 -07:00

43 lines
1.7 KiB
Go

// Package port defines interfaces (ports) for external dependencies.
package port
import (
"context"
"github.com/orchard9/rdev/internal/domain"
)
// DNSProvider manages DNS records for a zone.
type DNSProvider interface {
// CreateRecord creates a DNS record.
// If a record with the same name and type exists, it may be updated or error depending on implementation.
CreateRecord(ctx context.Context, record domain.DNSRecord) (*domain.DNSRecord, error)
// UpdateRecord updates an existing DNS record by ID.
UpdateRecord(ctx context.Context, recordID string, record domain.DNSRecord) (*domain.DNSRecord, error)
// UpsertRecord creates or updates a DNS record.
// If a record with the same type and name exists, it updates it.
// Otherwise, it creates a new record.
// This is the preferred method for adding domain aliases where the record may already exist.
UpsertRecord(ctx context.Context, record domain.DNSRecord) (*domain.DNSRecord, error)
// DeleteRecord removes a DNS record by ID.
DeleteRecord(ctx context.Context, recordID string) error
// DeleteRecordByName removes a DNS record by type and name.
// This is useful when you don't have the record ID.
DeleteRecordByName(ctx context.Context, recordType, name string) error
// GetRecord returns a single record by ID.
GetRecord(ctx context.Context, recordID string) (*domain.DNSRecord, error)
// ListRecords returns all records in the zone.
// Optionally filter by record type.
ListRecords(ctx context.Context, recordType string) ([]*domain.DNSRecord, error)
// FindRecord finds a record by type and name.
// Returns nil if not found (no error).
FindRecord(ctx context.Context, recordType, name string) (*domain.DNSRecord, error)
}