dreamhostapi

package module
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

README

This package was spun out of my DreamHost_DNS_Go program so that it can be the basis of other small DreamHost utility programs.

It currently supports the endpoints I need for my projects. I will accept issues or pull requests to add the listserve endpoints.

Documentation

Overview

Package dreamhostapi contains functions for interacting with the Dreamhost API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDNSRecord

func AddDNSRecord(domain string, newIPAddress string, apiKey string) (string, error)

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

func DeleteDNSRecord(domain string, newIPAddress string, apiKey string) (string, error)

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

func GetDNSRecords(apiKey string) (string, error)

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.

func WebGet

func WebGet(url string) (string, int, error)

webGet gets the data from a url. It returns the body as a string, an int representing the HTTP status code, and any errors.

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

Jump to

Keyboard shortcuts

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