-
Notifications
You must be signed in to change notification settings - Fork 12
/
json.go
65 lines (57 loc) · 1.93 KB
/
json.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package dynect
/*
This struct represents the request body that would be sent to the DynECT API
for logging in and getting a session token for future requests.
*/
type LoginBlock struct {
Username string `json:"user_name"`
Password string `json:"password"`
CustomerName string `json:"customer_name"`
}
// Type ResponseBlock holds the "header" information returned by any call to
// the DynECT API.
//
// All response-type structs should include this as an anonymous/embedded field.
type ResponseBlock struct {
Status string `json:"status"`
JobId int `json:"job_id,omitempty"`
Messages []MessageBlock `json:"msgs,omitempty"`
}
// Type MessageBlock holds the message information from the server, and is
// nested within the ResponseBlock type.
type MessageBlock struct {
Info string `json:"INFO"`
Source string `json:"SOURCE"`
ErrorCode string `json:"ERR_CD"`
Level string `json:"LVL"`
}
// Type LoginResponse holds the data returned by an HTTP POST call to
// https://api.dynect.net/REST/Session/.
type LoginResponse struct {
ResponseBlock
Data LoginDataBlock `json:"data"`
}
// Type LoginDataBlock holds the token and API version information from an HTTP
// POST call to https://api.dynect.net/REST/Session/.
//
// It is nested within the LoginResponse struct.
type LoginDataBlock struct {
Token string `json:"token"`
Version string `json:"version"`
}
// RecordRequest holds the request body for a record create/update
type RecordRequest struct {
RData DataBlock `json:"rdata"`
TTL string `json:"ttl,omitempty"`
}
// CreateZoneBlock holds the request body for a zone create
type CreateZoneBlock struct {
RName string `json:"rname"`
SerialStyle string `json:"serial_style,omitempty"`
TTL string `json:"ttl"`
}
// PublishZoneBlock holds the request body for a publish zone request
// https://help.dyn.com/update-zone-api/
type PublishZoneBlock struct {
Publish bool `json:"publish"`
}