1package internal
2
3import "fmt"
4
5// APIException defines model for apiException.
6type APIException struct {
7	Message    string `json:"message,omitempty"`
8	StatusCode int32  `json:"statusCode,omitempty"`
9	Type       string `json:"type,omitempty"`
10}
11
12func (a APIException) Error() string {
13	return fmt.Sprintf("%d: %s: %s", a.StatusCode, a.Type, a.Message)
14}
15
16// APIResponse defines model for apiResponse.
17type APIResponse struct {
18	Exception  *APIException `json:"exception,omitempty"`
19	StatusCode int32         `json:"statusCode,omitempty"`
20}
21
22// DNSRecord defines model for dnsRecords.
23type DNSRecord struct {
24	ID         int64  `json:"id,omitempty"`
25	Type       string `json:"recordType,omitempty"`
26	DomainID   int64  `json:"domainId,omitempty"`
27	DomainName string `json:"domainName,omitempty"`
28	NodeName   string `json:"nodeName,omitempty"`
29	Hostname   string `json:"hostname,omitempty"`
30	State      bool   `json:"state,omitempty"`
31	Content    string `json:"content,omitempty"`
32	TextData   string `json:"textData,omitempty"`
33	TTL        int    `json:"ttl,omitempty"`
34}
35
36// DNSHostname defines model for DNS.hostname.
37type DNSHostname struct {
38	*APIException
39
40	ID         int64  `json:"id,omitempty"`
41	DomainName string `json:"domainName,omitempty"`
42	Hostname   string `json:"hostname,omitempty"`
43	Node       string `json:"node,omitempty"`
44}
45
46// RecordsResponse defines model for recordsResponse.
47type RecordsResponse struct {
48	*APIException
49
50	DNSRecords []DNSRecord `json:"dnsRecords,omitempty"`
51}
52
53// RecordResponse defines model for recordResponse.
54type RecordResponse struct {
55	*APIException
56
57	DNSRecord
58}
59