Documentation
¶
Overview ¶
Package regfish implements a DNS record management client compatible with the libdns interfaces for regfish.
Index ¶
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// APIToken is a regfish API key (regfish dash: Account, Security, API keys).
APIToken string `json:"api_token,omitempty"`
// contains filtered or unexported fields
}
Provider facilitates DNS record manipulation with regfish.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records from the zone that match the input. Type, TTL and value act as wildcards when left empty; the name must always be given. Input records that do not exist in the zone are ignored. It returns the records that were deleted.
A record managed by regfish itself (one the API reports as "auto") is only deleted when the input names its type and value. A wildcard never removes it.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
SetRecords makes the input records the only members of their RRsets: for every (name, type) pair in the input, records of that pair which are not part of the input are removed, and missing ones are created. Records of other names or types are left alone. It returns the records that were set.
The input is checked completely before the first write. SetRecords refuses to work on an RRset that contains a record managed by regfish itself (one the API reports as "auto") unless that record already has a wanted value.
The API has no transaction, so the change is applied record by record. A record that only needs a different value is updated in place rather than deleted and re-created, which keeps a single-record RRset resolvable throughout. If a request fails midway, the records set so far are returned together with the error.