Documentation
¶
Overview ¶
Package binarylane implements the libdns interfaces for Binary Lane (https://www.binarylane.com.au), an Australian cloud provider whose DNS is managed through the Domains endpoints of its public API.
Index ¶
- Constants
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, recs []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, recs []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, recs []libdns.Record) ([]libdns.Record, error)
Constants ¶
const DefaultAPIBase = "https://api.binarylane.com.au/v2/"
DefaultAPIBase is the root of Binary Lane's API, including the version segment every endpoint sits under.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// APIToken is a Binary Lane API token, created under Account → API in the
// Binary Lane control panel. Required.
APIToken string `json:"api_token,omitempty"`
// APIBase optionally overrides the API endpoint, including the version
// segment. A trailing slash is added if absent. Defaults to
// DefaultAPIBase.
APIBase string `json:"api_base,omitempty"`
// HTTPClient optionally supplies the client used for API calls, for
// callers that need their own transport, proxy or timeout. A client with a
// default timeout is created on first use when this is nil.
HTTPClient *http.Client `json:"-"`
// contains filtered or unexported fields
}
Provider implements the libdns interfaces for Binary Lane.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, recs []libdns.Record) ([]libdns.Record, error)
AppendRecords creates the given records in the zone and returns them. It never modifies an existing record.
Binary Lane offers no batch endpoint, so this is not atomic: if a later record fails, earlier ones remain created.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, recs []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes records from the zone, returning those actually deleted. Records that do not exist are silently ignored.
A record carrying an ID from GetRecords is deleted directly. Otherwise it is matched by value, where an empty Type, zero TTL or empty Data act as wildcards and Name is always significant.
func (*Provider) GetRecords ¶
GetRecords lists the records in the zone.
SOA records are omitted. Binary Lane serves one per zone, libdns does not model the type, and the API rejects any attempt to write it — so returning it would offer the caller a record it can read but never modify or delete. Any other type libdns does not recognise is still returned, as an opaque libdns.RR, so an unmodelled or malformed record does not cost the listing.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, recs []libdns.Record) ([]libdns.Record, error)
SetRecords makes the zone match the input: for every (name, type) pair present in recs, the records given are afterwards the only members of that RRset. Other RRsets are untouched.
Existing records are reused where an RRset shrinks or grows, so an unchanged record keeps its ID. Binary Lane offers no batch endpoint, so this is not atomic.