hetzner

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2025 License: MIT Imports: 12 Imported by: 11

README

Hetzner DNS for libdns

godoc reference

This package implements the libdns interfaces for the Hetzner DNS API.

Authenticating

To authenticate, you need to supply a Hetzner Auth-API-Token.

Example

See examples and provider_test.go.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.0.0

type Client struct {
	// contains filtered or unexported fields
}

Client is a Hetzner DNS API client.

func NewClient added in v1.0.0

func NewClient(accessToken string) *Client

NewClient returns a new Client.

func (*Client) CreateRecord added in v1.0.0

func (c *Client) CreateRecord(ctx context.Context, zone string, r Record) (Record, error)

CreateRecord creates a record for the given zone.

func (*Client) DeleteRecord added in v1.0.0

func (c *Client) DeleteRecord(ctx context.Context, id string) error

DeleteRecord deletes a record for the given ID and zone.

func (*Client) GetAllRecords added in v1.0.0

func (c *Client) GetAllRecords(ctx context.Context, zone string) ([]Record, error)

GetAllRecords returns all records for the given zone.

func (*Client) GetZoneID added in v1.0.0

func (c *Client) GetZoneID(ctx context.Context, zone string) (string, error)

GetZoneID returns the zone ID for the given zone name.

func (*Client) UpdateRecord added in v1.0.0

func (c *Client) UpdateRecord(ctx context.Context, zone string, r Record) (Record, error)

UpdateRecord updates a record for the given zone.

type Provider

type Provider struct {
	// AuthAPIToken is the Hetzner Auth API token - see https://dns.hetzner.com/api-docs#section/Authentication/Auth-API-Token
	AuthAPIToken string `json:"auth_api_token"`
	// contains filtered or unexported fields
}

Provider implements the libdns interfaces for Hetzner.

func New added in v1.0.0

func New(token string) *Provider

New returns a new libdns provider for Hetzner.

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords implements the libdns.RecordAppender interface.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords implements the libdns.RecordDeleter interface.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)

GetRecords implements the libdns.RecordGetter interface.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords implements the libdns.RecordSetter interface.

type Record added in v1.0.0

type Record struct {
	ID     string `json:"id,omitempty"`
	ZoneID string `json:"zone_id,omitempty"`
	Type   string `json:"type"`
	Name   string `json:"name"`
	Value  string `json:"value"`
	TTL    int    `json:"ttl"`
}

Record is the record type for Hetzner implementing the libdns.Record interface.

func (*Record) Parse added in v1.0.0

func (r *Record) Parse(zone string) (libdns.Record, error)

Parse parses a record from the Hetzner API response into libdns.Record.

func (*Record) RR added in v1.0.0

func (r *Record) RR() libdns.RR

RR implements the libdns.Record interface.

type Zone added in v1.0.0

type Zone struct {
	ID string `json:"id"`
}

Zone is the zone type for Hetzner.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL