dnsmadeeasy

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MPL-2.0 Imports: 13 Imported by: 0

README

dnsmadeeasy

Build Status Coverage GoDoc https://github.com/Disciple-Media/dnsmadeeasy v1.1

This package provides the dnsmadeeasy package which offers an interface to the DNSMadeEasy API.

It doesn't have full API coverage, and only implements specific endpoints, as it is designed for use with Terraform.

For those reasons, I recommend looking elsewhere if you just need a standard DNSMadeEasy API client.

Sonia Hamilton, sonia@snowfrog.net, http://blog.snowfrog.net.

Documentation

The full documentation is available on Godoc

License

See LICENSE. Copyright the DNSMadeEasy authors, see AUTHORS.md.

Documentation

Index

Constants

View Source
const SandboxURL = "http://api.sandbox.dnsmadeeasy.com/V2.0"

SandboxURL is the URL of the DNS Made Easy Sandbox

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body map[string]interface{}

Body is the body of a request

type Client

type Client struct {
	// API Key
	AKey string

	// Secret Key
	SKey string

	// URL to the API to use
	URL string

	// HttpClient is the client to use. Default will be
	// used if not provided.
	HTTP *http.Client
}

Client provides a client to the dnsmadeeasy API

func NewClient

func NewClient(akey string, skey string) (*Client, error)

NewClient returns a new dnsmadeeasy client. It requires an API key and secret key. You can generate them by visiting the Config, Account Information section of the dnsmadeeasy control panel for your account.

func (*Client) CreateRecord

func (c *Client) CreateRecord(domainID string, cr map[string]interface{}) (string, error)

CreateRecord creates a DNS record on DNSMadeEasy

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(domainID string, recordID string) error

DeleteRecord destroys a record by the ID specified and returns an error if it fails. If no error is returned, the Record was succesfully destroyed.

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, body *bytes.Buffer,
	requestDate string) (*http.Request, error)

NewRequest creates a new request with the params

func (*Client) ReadRecord

func (c *Client) ReadRecord(domainID string, recordID string) (*Record, error)

ReadRecord gets a record by the ID specified and returns a Record and an error.

func (*Client) UpdateRecord

func (c *Client) UpdateRecord(domainID string, recordID string, cr map[string]interface{}) (string, error)

UpdateRecord updated a record from the parameters specified and returns an error if it fails.

type DataResponse

type DataResponse struct {
	Data []Record `json:"data"`
}

DataResponse is the response from a GET ie all records for a domainID

type Error

type Error struct {
	Errors []string `json:"error"`
}

Error is the error format that they return to us if there is a problem

func (*Error) Join

func (d *Error) Join() string

Join joins all the errors together, separated by spaces.

type Record

type Record struct {
	Name         string `json:"name" mapstructure:"name"`
	Value        string `json:"value" mapstructure:"value"`
	RecordID     int64  `json:"id"`
	Type         string `json:"type" mapstructure:"type"`
	Source       int64  `json:"source"`
	SourceID     int64  `json:"sourceId"`
	DynamicDNS   bool   `json:"dynamicDns"`
	Password     string `json:"password"`
	TTL          int64  `json:"ttl" mapstructure:"ttl"`
	Monitor      bool   `json:"monitor"`
	Failover     bool   `json:"failover"`
	Failed       bool   `json:"failed"`
	GtdLocation  string `json:"gtdLocation"`
	Description  string `json:"description" mapstructure:"description"`
	Keywords     string `json:"keywords" mapstructure:"keywords"`
	Title        string `json:"title" mapstructure:"title"`
	HardLink     bool   `json:"hardLink" mapstructure:"hardLink"`
	MXLevel      int64  `json:"mxLevel" mapstructure:"mxLevel"`
	Weight       int64  `json:"weight" mapstructure:"weight"`
	Priority     int64  `json:"priority" mapstructure:"priority"`
	Port         int64  `json:"port" mapstructure:"port"`
	RedirectType string `json:"redirectType" mapstructure:"redirectType"`
}

Record is used to represent a retrieved Record.

func (*Record) StringRecordID

func (r *Record) StringRecordID() string

StringRecordID returns the record id as a string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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