Documentation
¶
Overview ¶
Package dreamhostapi contains functions for interacting with the Dreamhost API.
Index ¶
- func AddDNSRecord(domain string, newIPAddress string, apiKey string) (string, error)
- func DeleteDNSRecord(domain string, newIPAddress string, apiKey string) (string, error)
- func GetDNSRecords(apiKey string) (string, error)
- func UpdateDNSRecord(domain string, currentIP string, newIPAddress string, apiKey string) (string, string, error)
- func WebGet(url string) (string, int, error)
- type DnsRecordsJSON
- type DreamhostAPIError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDNSRecord ¶
addDNSRecord returns the JSON "result" field after using the Dreamhost API to add an IP address to a domain in dreamhost and any errors.
func DeleteDNSRecord ¶
deleteDNSRecord returns the JSON "result" field after using the Dreamhost API to delete an IP address from a domain in dreamhost and any errors.
func GetDNSRecords ¶
getDNSRecords returns the unmarshalled JSON response containing all of the DNS records that correspond to this apiKey and any errors.
func UpdateDNSRecord ¶
func UpdateDNSRecord(domain string, currentIP string, newIPAddress string, apiKey string) (string, string, error)
updateDNSRecord returns the JSON "result" field after using the Dreamhost API to first add the new IP address and, if successful, deleting the old one. At whatever stage it errors out, it returns the empty string. So 2 empty strings would mean both operations errored.
Types ¶
type DnsRecordsJSON ¶
type DnsRecordsJSON struct {
Data []map[string]string `json:"data"` // A slice of maps representing the key/pair values for the DNS records.
}
A DnsRecordsJSON holds the data field of the JSON returned by the Dreamhost API when given the command dns-list_records.
type DreamhostAPIError ¶ added in v1.1.0
type DreamhostAPIError string
func (DreamhostAPIError) Error ¶ added in v1.1.0
func (apiErr DreamhostAPIError) Error() string