forked from go-acme/lego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
44 lines (38 loc) · 1.1 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package internal
import (
"encoding/json"
"fmt"
)
type apiResponse struct {
Data json.RawMessage `json:"data"`
}
type APIError struct {
Message string `json:"message,omitempty"`
Errors map[string]interface{} `json:"errors,omitempty"`
StatusCode int `json:"-"`
}
func (a APIError) Error() string {
msg := fmt.Sprintf("%d: %s", a.StatusCode, a.Message)
for k, v := range a.Errors {
msg += fmt.Sprintf(" %s: %v", k, v)
}
return msg
}
type Zone struct {
ID int `json:"id"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
TTL int `json:"ttl,omitempty"`
Nameserver string `json:"nameserver,omitempty"`
Dnssec bool `json:"dnssec,omitempty"`
DnssecEmail string `json:"dnssec_email,omitempty"`
}
type Record struct {
ID int `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Zone string `json:"zone,omitempty"`
Text string `json:"text,omitempty"`
TTL int `json:"ttl,omitempty"`
Comment string `json:"comment,omitempty"`
}