feat(provider): интерфейс Provider, Credentials, Zone

This commit is contained in:
2026-07-03 12:36:18 +07:00
parent bd4f8c5a8c
commit 9f209c8931
2 changed files with 59 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
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
}