54 lines
2.1 KiB
Go
54 lines
2.1 KiB
Go
// Package libdnstemplate implements a DNS record management client compatible
|
|
// with the libdns interfaces for <PROVIDER NAME>. TODO: This package is a
|
|
// template only. Customize all godocs for actual implementation.
|
|
package libdnstemplate
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/libdns/libdns"
|
|
)
|
|
|
|
// TODO: Providers must not require additional provisioning steps by the callers; it
|
|
// should work simply by populating a struct and calling methods on it. If your DNS
|
|
// service requires long-lived state or some extra provisioning step, do it implicitly
|
|
// when methods are called; sync.Once can help with this, and/or you can use a
|
|
// sync.(RW)Mutex in your Provider struct to synchronize implicit provisioning.
|
|
|
|
// Provider facilitates DNS record manipulation with <TODO: PROVIDER NAME>.
|
|
type Provider struct {
|
|
// TODO: put config fields here (with snake_case json
|
|
// struct tags on exported fields), for example:
|
|
APIToken string `json:"api_token,omitempty"`
|
|
}
|
|
|
|
// GetRecords lists all the records in the zone.
|
|
func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error) {
|
|
return nil, fmt.Errorf("TODO: not implemented")
|
|
}
|
|
|
|
// AppendRecords adds records to the zone. It returns the records that were added.
|
|
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error) {
|
|
return nil, fmt.Errorf("TODO: not implemented")
|
|
}
|
|
|
|
// SetRecords sets the records in the zone, either by updating existing records or creating new ones.
|
|
// It returns the updated records.
|
|
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error) {
|
|
return nil, fmt.Errorf("TODO: not implemented")
|
|
}
|
|
|
|
// DeleteRecords deletes the records from the zone. It returns the records that were deleted.
|
|
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error) {
|
|
return nil, fmt.Errorf("TODO: not implemented")
|
|
}
|
|
|
|
// Interface guards
|
|
var (
|
|
_ libdns.RecordGetter = (*Provider)(nil)
|
|
_ libdns.RecordAppender = (*Provider)(nil)
|
|
_ libdns.RecordSetter = (*Provider)(nil)
|
|
_ libdns.RecordDeleter = (*Provider)(nil)
|
|
)
|