-
Notifications
You must be signed in to change notification settings - Fork 4
/
dns.go
255 lines (206 loc) · 8.76 KB
/
dns.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Dns is a generated struct representing the Sophos Dns Endpoint
// GET /api/nodes/dns
type Dns struct {
AllowedNetworks []string `json:"allowed_networks"`
Axfr []interface{} `json:"axfr"`
Dnssec int64 `json:"dnssec"`
Email string `json:"email"`
EmptyZones string `json:"empty_zones"`
FwdDynamic int64 `json:"fwd_dynamic"`
FwdStatic []string `json:"fwd_static"`
RecheckInterval int64 `json:"recheck_interval"`
RetryForNonexistingNxdomain int64 `json:"retry_for_nonexisting_nxdomain"`
Routes []interface{} `json:"routes"`
}
var _ sophos.Endpoint = &Dns{}
var defsDns = map[string]sophos.RestObject{
"DnsAxfr": &DnsAxfr{},
"DnsGroup": &DnsGroup{},
"DnsRoute": &DnsRoute{},
}
// RestObjects implements the sophos.Node interface and returns a map of Dns's Objects
func (Dns) RestObjects() map[string]sophos.RestObject { return defsDns }
// GetPath implements sophos.RestGetter
func (*Dns) GetPath() string { return "/api/nodes/dns" }
// RefRequired implements sophos.RestGetter
func (*Dns) RefRequired() (string, bool) { return "", false }
var defDns = &sophos.Definition{Description: "dns", Name: "dns", Link: "/api/definitions/dns"}
// Definition returns the /api/definitions struct of Dns
func (Dns) Definition() sophos.Definition { return *defDns }
// ApiRoutes returns all known Dns Paths
func (Dns) ApiRoutes() []string {
return []string{
"/api/objects/dns/axfr/",
"/api/objects/dns/axfr/{ref}",
"/api/objects/dns/axfr/{ref}/usedby",
"/api/objects/dns/group/",
"/api/objects/dns/group/{ref}",
"/api/objects/dns/group/{ref}/usedby",
"/api/objects/dns/route/",
"/api/objects/dns/route/{ref}",
"/api/objects/dns/route/{ref}/usedby",
}
}
// References returns the Dns's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Dns) References() []string {
return []string{
"REF_DnsAxfr",
"REF_DnsGroup",
"REF_DnsRoute",
}
}
// DnsAxfrs is an Sophos Endpoint subType and implements sophos.RestObject
type DnsAxfrs []DnsAxfr
// DnsAxfr represents a UTM DNS slave zone
type DnsAxfr struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Master []string `json:"master"`
Name string `json:"name"`
// Status default value is false
Status bool `json:"status"`
// Zone description: (HOSTNAME)
Zone string `json:"zone"`
}
var _ sophos.RestGetter = &DnsAxfr{}
// GetPath implements sophos.RestObject and returns the DnsAxfrs GET path
// Returns all available dns/axfr objects
func (*DnsAxfrs) GetPath() string { return "/api/objects/dns/axfr/" }
// RefRequired implements sophos.RestObject
func (*DnsAxfrs) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the DnsAxfrs GET path
// Returns all available axfr types
func (d *DnsAxfr) GetPath() string { return fmt.Sprintf("/api/objects/dns/axfr/%s", d.Reference) }
// RefRequired implements sophos.RestObject
func (d *DnsAxfr) RefRequired() (string, bool) { return d.Reference, true }
// DeletePath implements sophos.RestObject and returns the DnsAxfr DELETE path
// Creates or updates the complete object axfr
func (*DnsAxfr) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/dns/axfr/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the DnsAxfr PATCH path
// Changes to parts of the object axfr types
func (*DnsAxfr) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/axfr/%s", ref)
}
// PostPath implements sophos.RestObject and returns the DnsAxfr POST path
// Create a new dns/axfr object
func (*DnsAxfr) PostPath() string {
return "/api/objects/dns/axfr/"
}
// PutPath implements sophos.RestObject and returns the DnsAxfr PUT path
// Creates or updates the complete object axfr
func (*DnsAxfr) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/axfr/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*DnsAxfr) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/axfr/%s/usedby", ref)
}
// DnsGroups is an Sophos Endpoint subType and implements sophos.RestObject
type DnsGroups []DnsGroup
// DnsGroup represents a UTM group
type DnsGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &DnsGroup{}
// GetPath implements sophos.RestObject and returns the DnsGroups GET path
// Returns all available dns/group objects
func (*DnsGroups) GetPath() string { return "/api/objects/dns/group/" }
// RefRequired implements sophos.RestObject
func (*DnsGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the DnsGroups GET path
// Returns all available group types
func (d *DnsGroup) GetPath() string { return fmt.Sprintf("/api/objects/dns/group/%s", d.Reference) }
// RefRequired implements sophos.RestObject
func (d *DnsGroup) RefRequired() (string, bool) { return d.Reference, true }
// DeletePath implements sophos.RestObject and returns the DnsGroup DELETE path
// Creates or updates the complete object group
func (*DnsGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/dns/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the DnsGroup PATCH path
// Changes to parts of the object group types
func (*DnsGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the DnsGroup POST path
// Create a new dns/group object
func (*DnsGroup) PostPath() string {
return "/api/objects/dns/group/"
}
// PutPath implements sophos.RestObject and returns the DnsGroup PUT path
// Creates or updates the complete object group
func (*DnsGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*DnsGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/group/%s/usedby", ref)
}
// DnsRoutes is an Sophos Endpoint subType and implements sophos.RestObject
type DnsRoutes []DnsRoute
// DnsRoute represents a UTM DNS request route
type DnsRoute struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
// Prefix description: (HOSTNAME)
Prefix string `json:"prefix"`
// Status default value is false
Status bool `json:"status"`
Targets []string `json:"targets"`
}
var _ sophos.RestGetter = &DnsRoute{}
// GetPath implements sophos.RestObject and returns the DnsRoutes GET path
// Returns all available dns/route objects
func (*DnsRoutes) GetPath() string { return "/api/objects/dns/route/" }
// RefRequired implements sophos.RestObject
func (*DnsRoutes) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the DnsRoutes GET path
// Returns all available route types
func (d *DnsRoute) GetPath() string { return fmt.Sprintf("/api/objects/dns/route/%s", d.Reference) }
// RefRequired implements sophos.RestObject
func (d *DnsRoute) RefRequired() (string, bool) { return d.Reference, true }
// DeletePath implements sophos.RestObject and returns the DnsRoute DELETE path
// Creates or updates the complete object route
func (*DnsRoute) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/dns/route/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the DnsRoute PATCH path
// Changes to parts of the object route types
func (*DnsRoute) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/route/%s", ref)
}
// PostPath implements sophos.RestObject and returns the DnsRoute POST path
// Create a new dns/route object
func (*DnsRoute) PostPath() string {
return "/api/objects/dns/route/"
}
// PutPath implements sophos.RestObject and returns the DnsRoute PUT path
// Creates or updates the complete object route
func (*DnsRoute) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/route/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*DnsRoute) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/dns/route/%s/usedby", ref)
}