auroradns

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MPL-2.0 Imports: 12 Imported by: 0

README

Go library for accessing the Aurora DNS API

GoDoc Build Status Go Report Card

An Aurora DNS API client written in Go.

go-auroradns is a Go client library for accessing the Aurora DNS API.

Available API methods

Zones:

  • create
  • delete
  • list

Records:

  • create
  • delete
  • list

Example

tr, _ := auroradns.NewTokenTransport("userID", "key")
client, _ := auroradns.NewClient(tr.Client())

zones, _, _ := client.GetZones()

fmt.Println(zones)

API Documentation

Documentation

Index

Constants

View Source
const (
	RecordTypeA     = "A"
	RecordTypeAAAA  = "AAAA"
	RecordTypeCNAME = "CNAME"
	RecordTypeMX    = "MX"
	RecordTypeNS    = "NS"
	RecordTypeSOA   = "SOA"
	RecordTypeSRV   = "SRV"
	RecordTypeTXT   = "TXT"
	RecordTypeDS    = "DS"
	RecordTypePTR   = "PTR"
	RecordTypeSSHFP = "SSHFP"
	RecordTypeTLSA  = "TLS"
)

Record types

Variables

This section is empty.

Functions

func WithBaseURL

func WithBaseURL(rawBaseURL string) func(*Client) error

WithBaseURL Allows to define a custom base URL

Types

type Client

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

Client The API client

func NewClient

func NewClient(httpClient *http.Client, opts ...Option) (*Client, error)

NewClient Creates a new client

func (*Client) CreateRecord

func (c *Client) CreateRecord(zoneID string, record Record) (*Record, *http.Response, error)

CreateRecord Creates a new record.

func (*Client) CreateZone

func (c *Client) CreateZone(domain string) (*Zone, *http.Response, error)

CreateZone Creates a zone.

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(zoneID string, recordID string) (bool, *http.Response, error)

DeleteRecord Delete a record.

func (*Client) DeleteZone

func (c *Client) DeleteZone(zoneID string) (bool, *http.Response, error)

DeleteZone Delete a zone.

func (*Client) ListRecords

func (c *Client) ListRecords(zoneID string) ([]Record, *http.Response, error)

ListRecords returns a list of all records in given zone

func (*Client) ListZones

func (c *Client) ListZones() ([]Zone, *http.Response, error)

ListZones returns a list of all zones.

type ErrorResponse

type ErrorResponse struct {
	ErrorCode string `json:"error"`
	Message   string `json:"errormsg"`
}

ErrorResponse A representation of an API error message.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Option

type Option func(*Client) error

Option Type of a client option

type Record

type Record struct {
	ID         string `json:"id,omitempty"`
	RecordType string `json:"type"`
	Name       string `json:"name"`
	Content    string `json:"content"`
	TTL        int    `json:"ttl,omitempty"`
}

Record a DNS record

type TokenTransport

type TokenTransport struct {

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
	// contains filtered or unexported fields
}

TokenTransport HTTP transport for API authentication

func NewTokenTransport

func NewTokenTransport(userID, key string) (*TokenTransport, error)

NewTokenTransport Creates a new TokenTransport

func (*TokenTransport) Client

func (t *TokenTransport) Client() *http.Client

Client Creates a new HTTP client

func (*TokenTransport) RoundTrip

func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction

func (*TokenTransport) Wrap

func (t *TokenTransport) Wrap(client *http.Client) *http.Client

Wrap Wrap a HTTP client Transport with the TokenTransport

type Zone

type Zone struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
}

Zone a DNS zone

Jump to

Keyboard shortcuts

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