Documentation
¶
Overview ¶
Package hetzner implements the libdns(https://github.com/libdns/libdns) interfaces for the Hetzner Cloud DNS 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 {
// APIToken is the Hetzner Cloud API token to use with HTTP requests. If not set, it defaults to the
// LIBDNS_HETZNER_TOKEN environment variable.
//
// See https://docs.hetzner.cloud/reference/cloud#getting-started to learn how to generate a new token.
APIToken string `json:"api_token,omitempty"`
// contains filtered or unexported fields
}
Provider implements the libdns interfaces for the Hetzner DNS API.
func New ¶
New returns a new libdns provider for Hetzner.
If token is empty, the provider will default to the LIBDNS_HETZNER_TOKEN environment variable.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ( []libdns.Record, error, )
AppendRecords creates the inputted records in the given zone and returns the populated records that were created. This function fulfills the libdns.RecordAppender interface.
Please note that appending records may fail if the TTL doesn't match an existing RRset. For example,
;; Original zone example.com. 3600 IN TXT "hello world" ;; Input example.com. 60 IN TXT "hello world as well"
will fail, as the given TTL of 60s conflicts with TTL 3600s of the existing RRset identified by (example.com., TXT).
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ( []libdns.Record, error, )
DeleteRecords deletes the given records from the zone if they exist in the zone and exactly match the input. If the input records do not exist in the zone, they are silently ignored. DeleteRecords returns only the records that were deleted, and does not return any records that were provided in the input but did not exist in the zone. This function fulfills the libdns.RecordDeleter interface.
func (*Provider) GetRecords ¶
GetRecords returns all the records in the DNS zone. This function fulfills the libdns.RecordGetter interface.
This implementation includes DNSSEC-related records.
func (*Provider) ListZones ¶
ListZones returns the list of available DNS zones for use by other functions. This function fulfills the libdns.ZoneLister interface.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ( []libdns.Record, error, )
SetRecords updates the zone so that the records described in the input are reflected in the output. It returns the records which were set. Errors may result in partial changes to the zone. This function fulfills the libdns.RecordSetter interface.
This implementation supports setting DNSSEC-related records.