Documentation
¶
Overview ¶
Utility functions used while parsing the somewhat convoluted JSON returned by LogicBoxes API calls.
Index ¶
- Constants
- func Atoi(s string) int64
- func GetResponse(c http.Client, url string) (*maplist, error)
- func ParseBool(b string) bool
- func ParseDate(s string) time.Time
- func PostResponse(c http.Client, url string) (*maplist, error)
- type Client
- func (c *Client) AddARecord(domain, address, host string, ttl int64, six bool) error
- func (c *Client) AddCNAME(domain, value, host string, ttl int64) error
- func (c *Client) AddMX(domain, value, host string, ttl int64, priority uint16) error
- func (c *Client) AddNS(domain, value, host string, ttl int64, priority uint16) error
- func (c *Client) AddSRV(domain, value, host string, ttl int64, priority, port, weight uint16) error
- func (c *Client) AddTXT(domain, value, host string, ttl int64, priority uint16) error
- func (c *Client) Authenticate(username, password string) (*CustomerDetails, error)
- func (c *Client) CustomerByID(cid int64) (*CustomerDetails, error)
- func (c *Client) Customers(page int) (*CustomerList, error)
- func (c *Client) DNSActive(id string) bool
- func (c *Client) DeleteARecord(domain, value, host string, six bool) error
- func (c *Client) DeleteCNAME(domain, value, host string) error
- func (c *Client) DeleteMX(domain, value, host string) error
- func (c *Client) DeleteNS(domain, value, host string) error
- func (c *Client) DeleteSRV(domain, value, host string, port, weight uint16) error
- func (c *Client) DeleteTXT(domain, value, host string) error
- func (c *Client) Domain(name string) (*Domain, error)
- func (c *Client) DomainsFor(customer string, page int) (*DomainList, error)
- func (c *Client) EditARecord(domain, oldip, newip, host string, ttl int64, six bool) error
- func (c *Client) EditCNAME(domain, oldip, newip, host string, ttl int64) error
- func (c *Client) EditMX(domain, oldip, newip, host string, ttl int64, priority uint16) error
- func (c *Client) EditNS(domain, oldip, newip, host string, ttl int64) error
- func (c *Client) EditSOA(domain, person string, refresh, retry, expire, ttl int64) error
- func (c *Client) EditSRV(domain, oldval, newval, host string, ttl int64, priority, port, weight uint) error
- func (c *Client) EditTXT(domain, oldip, newip, host string, ttl int64) error
- func (c *Client) GetDNSRecords(domain, value, host, t string, page int) (*DNSRecordList, error)
- type Customer
- type CustomerDetails
- type CustomerList
- type Customers
- type DNSRecord
- type DNSRecordList
- type DNSRecords
- type Domain
- type DomainList
- type Domains
- type DomainsByName
Constants ¶
const ( // APIURL is the default LogicBoxes API URL. APIURL = "https://httpapi.com/api/" // APITESTURL is the LogicBoxes API URL used for test accounts. APITESTURL = "https://test.httpapi.com/api/" // apiDomainsSearch is the source of all domain order information. APIDomainsSearch = "api/domains/search.json" APIDNSAddIPv4 = "api/dns/manage/add-ipv4-record.json" APIDNSAddIPv6 = "api/dns/manage/add-ipv6-record.json" APIDNSAddCNAME = "api/dns/manage/add-cname-record.json" APIDNSAddMX = "api/dns/manage/add-mx-record.json" APIDNSAddNS = "api/dns/manage/add-ns-record.json" APIDNSAddTXT = "api/dns/manage/add-txt-record.json" APIDNSAddSRV = "api/dns/manage/add-srv-record.json" APIDNSDeleteIPv4 = "api/dns/manage/delete-ipv4-record.json" APIDNSDeleteIPv6 = "api/dns/manage/delete-ipv6-record.json" APIDNSDeleteCNAME = "api/dns/manage/delete-cname-record.json" APIDNSDeleteMX = "api/dns/manage/delete-mx-record.json" APIDNSDeleteNS = "api/dns/manage/delete-ns-record.json" APIDNSDeleteTXT = "api/dns/manage/delete-txt-record.json" APIDNSDeleteSRV = "api/dns/manage/delete-srv-record.json" APIDNSUpdateIPv4 = "api/dns/manage/update-ipv4-record.json" APIDNSUpdateIPv6 = "api/dns/manage/update-ipv6-record.json" APIDNSUpdateCNAME = "api/dns/manage/update-cname-record.json" APIDNSUpdateMX = "api/dns/manage/update-mx-record.json" APIDNSUpdateNS = "api/dns/manage/update-ns-record.json" APIDNSUpdateTXT = "api/dns/manage/update-txt-record.json" APIDNSUpdateSRV = "api/dns/manage/update-srv-record.json" APIDNSUpdateSOA = "api/dns/manage/update-soa-record.json" )
Variables ¶
This section is empty.
Functions ¶
func GetResponse ¶
GetReponse fetches a URL's JSON, decode it into a maplist and returns it as a map of strings.
Types ¶
type Client ¶
type Client struct {
http.Client
// URL of the API, usually https://httpapi.com.
URL string
// ID of the reseller.
ID string
// Key to authenticate with.
Key string
}
Client is the structure for reseller API access to LogicBoxes systems.
func (*Client) AddARecord ¶
AddARecord adds A or AAAA records.
func (*Client) Authenticate ¶
func (c *Client) Authenticate(username, password string) (*CustomerDetails, error)
func (*Client) CustomerByID ¶
func (c *Client) CustomerByID(cid int64) (*CustomerDetails, error)
func (*Client) DNSActive ¶
DNSActive reports if an order has activated DNS yet. This is normally on by default, but will be activated when this is called otherwise.
func (*Client) DeleteARecord ¶
DeleteARecord deletes A or AAAA records.
func (*Client) DeleteCNAME ¶
DeleteCNAME does exactly that.
func (*Client) DomainsFor ¶
func (c *Client) DomainsFor(customer string, page int) (*DomainList, error)
DomainsFor customer, starting on a specified page. Up to 500 records are returned. Compare Count and MaxRecords to tell if another page exists.
func (*Client) EditARecord ¶
EditARecord modifies A or AAAA records.
func (*Client) EditSRV ¶
func (c *Client) EditSRV(domain, oldval, newval, host string, ttl int64, priority, port, weight uint) error
EditSRV modifies a SRV (service) record.
func (*Client) GetDNSRecords ¶
func (c *Client) GetDNSRecords(domain, value, host, t string, page int) (*DNSRecordList, error)
GetDNSRecords gets the first up to 50 records of one type for a domain. Pass a higher page number to get the next set of up to 50.
type Customer ¶
type Customer struct {
ID int64
Email string
Name string
Company string
City string
Country string
Status string
TotalReceipts string
Websites int64
}
Customer is the simple overview returned by bulk search of customers.
type CustomerDetails ¶
type CustomerDetails struct {
Created time.Time
ID int64
ParentReseller int64
Name string
Email string
Phone string
Address string
Zip string
City string
State string
Country string
Language string
PIN string
Status string
TotalReceipts string
Twofactor bool
}
CustomerDetails contains the personal details returned by single-user fetch.
type CustomerList ¶
type CustomerList struct {
// Count of records returned in this structure.
Count int64
// MaxRecords is the total available for this query.
MaxRecords int64
// Domains for the specified search query.
Customers Customers
}
CustomerList is what client software gets. It's not guaranteed to hold all records, so check Count against MaxRecords.
type DNSRecord ¶
type DNSRecord struct {
TTL int64 // 7200 is a safe default
Priority uint16 // Only available for some record types
Port uint16 // Only available for some record types
Weight uint16 // Only available for some record types
Host string // subdomain or @ for the primary domain
Type string // A, AAAA, MX etc.
Value string // IPv4 or IPv6 address
Status string // Normally "Active"
}
DNSRecord is an individual record.
type DNSRecordList ¶
type DNSRecordList struct {
// Count of records returned in this structure.
Count int64
// MaxRecords is the total available for this query.
MaxRecords int64
// Domains for the specified search query.
Records DNSRecords
}
DNSRecordList is what client software gets. It's not guaranteed to hold all records, so check Count against MaxRecords.
type DNSRecords ¶
type DNSRecords []*DNSRecord
DNSRecords is a special sortable structure.
func (DNSRecords) Less ¶
func (slice DNSRecords) Less(i, j int) bool
Less checks if host name i comes before host name j.
type Domain ¶
type Domain struct {
Endtime time.Time
CreationTime time.Time
CreationDT time.Time
Timestamp time.Time
OrderID int64
CustomerID int64
EntityID int64
TypeID int64
Description string
Status string
TypeKey string
TypeName string
Autorenew bool
ResellerLock bool
CustomerLock bool
TransferLock bool
}
Domain is the parsed structure from the messy JSON returned by LogicBoxes.
type DomainList ¶
type DomainList struct {
// Count of records returned in this structure.
Count int64
// MaxRecords can be used to calculate pagination.
MaxRecords int64
// Domains for the specified search query.
Domains Domains
}
DomainList is what client software gets. It's not guaranteed to hold all records, so check Count against MaxRecords.
type DomainsByName ¶
type DomainsByName []*Domain
DomainsByName uses the name instead.
func (DomainsByName) Less ¶
func (slice DomainsByName) Less(i, j int) bool
Less compares domain names for sorting.