client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 6 Imported by: 3

Documentation

Overview

Package client contains the methods to query and modify resources in the Hetzner DNS API

Index

Constants

View Source
const Endpoint = "https://dns.hetzner.com/api/v1/"

Endpoint is the default endpoint for the Hetzner DNS API

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Record *RecordClient
	Zone   *ZoneClient
	// contains filtered or unexported fields
}

Client provides methods to configure the connection to the Hetzner DNS API

func New

func New() *Client

New instantiates a new Client for the Hetzner DNS API

func (*Client) WithEndpoint

func (c *Client) WithEndpoint(endpoint string) *Client

WithEndpoint configures a Client to use the specified endpoint

func (*Client) WithToken

func (c *Client) WithToken(token string) *Client

WithToken configures a Client to use the specified token

type RecordClient

type RecordClient struct {
	Client *Client
}

RecordClient provides methods to query and modify records in the Hetzner DNS API

func (*RecordClient) Create

func (c *RecordClient) Create(name string, recordType string, value string, zoneId string) (schema.Record, error)

Create created a new Record in the Hetzner DNS API. Allowed recordTypes are A, AAA, NS, MX, CNAME, RP, TXT, SOA, HINFO, SRV, DANE, TLSA, DS, CAA

func (*RecordClient) Delete

func (c *RecordClient) Delete(id string) error

Delete deletes a record in the Hetzner DNS API

func (*RecordClient) GetAll

func (c *RecordClient) GetAll() ([]schema.Record, error)

GetAll receives all records associated with the user from the Hetzner DNS API

func (*RecordClient) GetById

func (c *RecordClient) GetById(id string) (schema.Record, error)

GetById receives the record with the specified id from the Hetzner DNS API

func (*RecordClient) Update

func (c *RecordClient) Update(name string, recordType string, value string, zoneId string, id string) (schema.Record, error)

Update updates a record in the Hetzner DNS API

type ZoneClient

type ZoneClient struct {
	Client *Client
}

ZoneClient provides methods to query zones in the Hetzner DNS API

func (*ZoneClient) GetAll

func (c *ZoneClient) GetAll() ([]schema.Zone, error)

GetAll receives all zones associated with the user from the Hetzner DNS API

func (*ZoneClient) GetByName

func (c *ZoneClient) GetByName(name string) (schema.Zone, error)

GetByName receives the zone with the specified name from the Hetzner DNS API

Jump to

Keyboard shortcuts

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