29 lines
794 B
Go
29 lines
794 B
Go
package provider
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/vasyakrg/dns-autoresolver/internal/diff"
|
|
"github.com/vasyakrg/dns-autoresolver/internal/model"
|
|
)
|
|
|
|
// Credentials holds the secret used to authenticate against a provider.
|
|
// For Selectel this is the project-scoped token sent as X-Auth-Token.
|
|
type Credentials struct {
|
|
Secret string
|
|
}
|
|
|
|
// Zone is a provider-neutral DNS zone reference.
|
|
type Zone struct {
|
|
ID string
|
|
Name string
|
|
}
|
|
|
|
// Provider is implemented per DNS provider (Selectel first).
|
|
type Provider interface {
|
|
Name() string
|
|
ListZones(ctx context.Context, creds Credentials) ([]Zone, error)
|
|
GetRecords(ctx context.Context, creds Credentials, zoneID string) ([]model.Record, error)
|
|
ApplyChanges(ctx context.Context, creds Credentials, zoneID string, cs diff.Changeset) error
|
|
}
|