Documentation
¶
Overview ¶
Package dreamhostapi contains functions for interacting with the Dreamhost API.
Index ¶
- func UpdateDNSRecord(domain string, currentIP string, newIPAddress string, apiKey string, ...) (commandResult, commandResult, error)
- func UpdateZoneFile(command string, domain string, IPAddress string, apiKey string, comment string) (commandResult, error)
- func WebGet(url string) (string, int, error)
- type DnsRecord
- type DnsRecords
- type DreamhostAPIError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateDNSRecord ¶
func UpdateDNSRecord(domain string, currentIP string, newIPAddress string, apiKey string, comment string) (commandResult, commandResult, error)
updateDNSRecord returns a commandResult after using the Dreamhost API to first add the new IP address and, if successful, deleting the old one. If adding a record does not succeed, either through underlying error (web, JSON unmarshalling) or because the API was not successful, it will not continue to the deletion.
func UpdateZoneFile ¶
func UpdateZoneFile(command string, domain string, IPAddress string, apiKey string, comment string) (commandResult, error)
UpdateZoneFile returns a commandResult after using the Dreamhost API to either add or delete an IP address from a domain in Dreamhost and any errors. In the case of a success, it should only contain one record in the slice. It returns an empty struct in the case of any errors in the web-layer, JSON demarshalling, or API non-success result. Currently implemented commands for the command parameter are:
- "add" to add a value (typically IP address) to a record (typically a domain).
- "del" to remove a value (typically IP address) from a record (typically a domain).
Types ¶
type DnsRecord ¶
type DnsRecord struct {
Record string // the URL
Zone string // This is the base of the URL. If Record is www.google.com, Zone is google.com
Value string // this is what the zone points to - usually IP address
Editable string // 0 or 1 value, but comes back as a string
ZoneType string `json:"type"` // zone type: A,CNAME,NS,NAPTR,SRV,TXT, or AAAA
Comment string // comment that can be added to a record
AccountId string `json:"account_id"` // the account associated with this record
}
DnsRecord is a DNS Record on Dreamhost
type DnsRecords ¶
dnsRecords holds an array of DnsRecord structs returned by the Dreamhost API
func GetDNSRecords ¶
func GetDNSRecords(apiKey string) (DnsRecords, error)
getDNSRecords returns a DnsRecords struct containing all of the DNS records that correspond to this apiKey and any errors. It returns an empty struct in the case of any errors in the web-layer, JSON demarshalling, or API non-success result.
type DreamhostAPIError ¶
type DreamhostAPIError string
func (DreamhostAPIError) Error ¶
func (apiErr DreamhostAPIError) Error() string