Documentation
¶
Overview ¶
Package nameocean implements the libdns interfaces for NameOcean DNS (https://nameocean.net/dns/), through NameOcean's API v1 (https://nameocean.net/developers/api/).
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) ListZones(ctx context.Context) ([]libdns.Zone, 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 {
// APIKey is a NameOcean API key with the dns:read and dns:write scopes
// (Dashboard → API). It may be limited to the zones it should touch.
// Defaults to the NAMEOCEAN_API_KEY environment variable.
APIKey string `json:"api_key,omitempty"`
// BaseURL overrides the API address. Default: https://nameocean.net/api/v1
BaseURL string `json:"base_url,omitempty"`
// HTTPClient is used for API calls. Default: a client with a 30 second timeout.
HTTPClient *http.Client `json:"-"`
// contains filtered or unexported fields
}
Provider manages records in NameOcean DNS zones. The zero value works when NAMEOCEAN_API_KEY is set in the environment.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone and returns them as created. It never changes existing records.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records of the zone that match the input. The name is required; an empty type, a zero TTL or empty data match any value. Records that are not in the zone are ignored. It returns the records it deleted.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone. NameOcean's HTTP redirect records are not DNS records and are left out.
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 records of their (name, type) pairs in the zone. Records that already match are kept (a different TTL is changed in place); other records of the same (name, type) are changed in place to the remaining input records; what is still missing is added and what is left over is deleted. Other records are not touched.
It is not atomic: NameOcean's per-record API has no batch call, so an error part-way can leave some changes made. Deletions come last, so a name keeps answering during the change.