-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdyndns.go
206 lines (169 loc) · 7.1 KB
/
dyndns.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
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Dyndns is a generated struct representing the Sophos Dyndns Endpoint
// GET /api/nodes/dyndns
type Dyndns struct {
Rules []interface{} `json:"rules"`
}
var _ sophos.Endpoint = &Dyndns{}
var defsDyndns = map[string]sophos.RestObject{
"DyndnsDyndns": &DyndnsDyndns{},
"DyndnsGroup": &DyndnsGroup{},
}
// RestObjects implements the sophos.Node interface and returns a map of Dyndns's Objects
func (Dyndns) RestObjects() map[string]sophos.RestObject { return defsDyndns }
// GetPath implements sophos.RestGetter
func (*Dyndns) GetPath() string { return "/api/nodes/dyndns" }
// RefRequired implements sophos.RestGetter
func (*Dyndns) RefRequired() (string, bool) { return "", false }
var defDyndns = &sophos.Definition{Description: "dyndns", Name: "dyndns", Link: "/api/definitions/dyndns"}
// Definition returns the /api/definitions struct of Dyndns
func (Dyndns) Definition() sophos.Definition { return *defDyndns }
// ApiRoutes returns all known Dyndns Paths
func (Dyndns) ApiRoutes() []string {
return []string{
"/api/objects/dyndns/dyndns/",
"/api/objects/dyndns/dyndns/{ref}",
"/api/objects/dyndns/dyndns/{ref}/usedby",
"/api/objects/dyndns/group/",
"/api/objects/dyndns/group/{ref}",
"/api/objects/dyndns/group/{ref}/usedby",
}
}
// References returns the Dyndns's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Dyndns) References() []string {
return []string{
"REF_DyndnsDyndns",
"REF_DyndnsGroup",
}
}
// DyndnsDyndnss is an Sophos Endpoint subType and implements sophos.RestObject
type DyndnsDyndnss []DyndnsDyndns
// DyndnsDyndns represents a UTM DynDNS mapping
type DyndnsDyndns struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Aliases []string `json:"aliases"`
// Backupmx default value is false
Backupmx bool `json:"backupmx"`
Comment string `json:"comment"`
// Hostname default value is ""
Hostname string `json:"hostname"`
// Interface description: REF(interface/*)
Interface string `json:"interface"`
// Label default value is ""
Label string `json:"label"`
// Mx description: (HOSTNAME)
// Mx default value is ""
Mx string `json:"mx"`
Mxpri int `json:"mxpri"`
Name string `json:"name"`
// Password default value is ""
Password string `json:"password"`
// Record can be one of: []string{"a", "aaaa", "both"}
// Record default value is "a"
Record string `json:"record"`
// Status default value is false
Status bool `json:"status"`
// Strategy can be one of: []string{"if", "web"}
// Strategy default value is "if"
Strategy string `json:"strategy"`
// Type can be one of: []string{"dns-o-matic", "dnsdynamic", "dnspark", "dtdns", "dyndns", "dyndns-custom", "easydns", "freedns", "namecheap", "no-ip", "opendns", "selfhost", "strato", "zoneedit"}
// Type default value is "dyndns"
Type string `json:"type"`
User string `json:"user"`
// Wildcard default value is false
Wildcard bool `json:"wildcard"`
}
var _ sophos.RestGetter = &DyndnsDyndns{}
// GetPath implements sophos.RestObject and returns the DyndnsDyndnss GET path
// Returns all available dyndns/dyndns objects
func (*DyndnsDyndnss) GetPath() string { return "/api/objects/dyndns/dyndns/" }
// RefRequired implements sophos.RestObject
func (*DyndnsDyndnss) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the DyndnsDyndnss GET path
// Returns all available dyndns types
func (d *DyndnsDyndns) GetPath() string {
return fmt.Sprintf("/api/objects/dyndns/dyndns/%s", d.Reference)
}
// RefRequired implements sophos.RestObject
func (d *DyndnsDyndns) RefRequired() (string, bool) { return d.Reference, true }
// DeletePath implements sophos.RestObject and returns the DyndnsDyndns DELETE path
// Creates or updates the complete object dyndns
func (*DyndnsDyndns) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/dyndns/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the DyndnsDyndns PATCH path
// Changes to parts of the object dyndns types
func (*DyndnsDyndns) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/dyndns/%s", ref)
}
// PostPath implements sophos.RestObject and returns the DyndnsDyndns POST path
// Create a new dyndns/dyndns object
func (*DyndnsDyndns) PostPath() string {
return "/api/objects/dyndns/dyndns/"
}
// PutPath implements sophos.RestObject and returns the DyndnsDyndns PUT path
// Creates or updates the complete object dyndns
func (*DyndnsDyndns) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/dyndns/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*DyndnsDyndns) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/dyndns/%s/usedby", ref)
}
// DyndnsGroups is an Sophos Endpoint subType and implements sophos.RestObject
type DyndnsGroups []DyndnsGroup
// DyndnsGroup represents a UTM group
type DyndnsGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &DyndnsGroup{}
// GetPath implements sophos.RestObject and returns the DyndnsGroups GET path
// Returns all available dyndns/group objects
func (*DyndnsGroups) GetPath() string { return "/api/objects/dyndns/group/" }
// RefRequired implements sophos.RestObject
func (*DyndnsGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the DyndnsGroups GET path
// Returns all available group types
func (d *DyndnsGroup) GetPath() string {
return fmt.Sprintf("/api/objects/dyndns/group/%s", d.Reference)
}
// RefRequired implements sophos.RestObject
func (d *DyndnsGroup) RefRequired() (string, bool) { return d.Reference, true }
// DeletePath implements sophos.RestObject and returns the DyndnsGroup DELETE path
// Creates or updates the complete object group
func (*DyndnsGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the DyndnsGroup PATCH path
// Changes to parts of the object group types
func (*DyndnsGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the DyndnsGroup POST path
// Create a new dyndns/group object
func (*DyndnsGroup) PostPath() string {
return "/api/objects/dyndns/group/"
}
// PutPath implements sophos.RestObject and returns the DyndnsGroup PUT path
// Creates or updates the complete object group
func (*DyndnsGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*DyndnsGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/dyndns/group/%s/usedby", ref)
}