2020-10-27 00:03:26 +00:00
|
|
|
package internal
|
|
|
|
|
2021-01-27 23:45:52 +00:00
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
)
|
2020-10-27 00:03:26 +00:00
|
|
|
|
|
|
|
// Record a DNS record.
|
|
|
|
type Record struct {
|
|
|
|
ID string `json:"id,omitempty"`
|
|
|
|
Source string `json:"source,omitempty"`
|
|
|
|
Type string `json:"type,omitempty"`
|
|
|
|
TTL int `json:"ttl,omitempty"`
|
|
|
|
Target string `json:"target,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DNSDomain struct {
|
|
|
|
ID uint64 `json:"id,omitempty"`
|
|
|
|
CustomerName string `json:"customer_name,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type APIResponse struct {
|
|
|
|
Result string `json:"result"`
|
|
|
|
Data json.RawMessage `json:"data,omitempty"`
|
|
|
|
ErrResponse *APIErrorResponse `json:"error,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type APIErrorResponse struct {
|
|
|
|
Code string `json:"code"`
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
Context map[string]string `json:"context,omitempty"`
|
|
|
|
Errors []APIErrorResponse `json:"errors,omitempty"`
|
|
|
|
}
|
2021-01-27 23:45:52 +00:00
|
|
|
|
|
|
|
func (a APIErrorResponse) Error() string {
|
|
|
|
return fmt.Sprintf("code: %s, description: %s", a.Code, a.Description)
|
|
|
|
}
|