forked from esurdam/go-sophos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaaa.go
215 lines (177 loc) · 7.93 KB
/
aaa.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
package objects
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Aaa is a generated struct representing the Sophos Aaa Endpoint
// GET /api/nodes/aaa
type Aaa struct {
AaaGroup AaaGroup `json:"aaa_group"`
AaaUser AaaUser `json:"aaa_user"`
}
var _ sophos.Endpoint = &Aaa{}
var defsAaa = map[string]sophos.RestObject{
"AaaGroup": &AaaGroup{},
"AaaUser": &AaaUser{},
}
// RestObjects implements the sophos.Node interface and returns a map of Aaa's Objects
func (Aaa) RestObjects() map[string]sophos.RestObject { return defsAaa }
// GetPath implements sophos.RestGetter
func (*Aaa) GetPath() string { return "/api/nodes/aaa" }
// RefRequired implements sophos.RestGetter
func (*Aaa) RefRequired() (string, bool) { return "", false }
var defAaa = &sophos.Definition{Description: "aaa", Name: "aaa", Link: "/api/definitions/aaa"}
// Definition returns the /api/definitions struct of Aaa
func (Aaa) Definition() sophos.Definition { return *defAaa }
// ApiRoutes returns all known Aaa Paths
func (Aaa) ApiRoutes() []string {
return []string{
"/api/objects/aaa/group/",
"/api/objects/aaa/group/{ref}",
"/api/objects/aaa/group/{ref}/usedby",
"/api/objects/aaa/user/",
"/api/objects/aaa/user/{ref}",
"/api/objects/aaa/user/{ref}/usedby",
}
}
// References returns the Aaa's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Aaa) References() []string {
return []string{
"REF_AaaGroup",
"REF_AaaUser",
}
}
// AaaGroups is an Sophos Endpoint subType and implements sophos.RestObject
type AaaGroups []AaaGroup
// AaaGroup is a generated Sophos object
type AaaGroup struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AdirectoryGroups []interface{} `json:"adirectory_groups"`
AdirectoryGroupsSids struct{} `json:"adirectory_groups_sids"`
BackendMatch string `json:"backend_match"`
Comment string `json:"comment"`
Dynamic string `json:"dynamic"`
EdirectoryGroups []interface{} `json:"edirectory_groups"`
IpsecDn string `json:"ipsec_dn"`
LdapAttribute string `json:"ldap_attribute"`
LdapAttributeValue string `json:"ldap_attribute_value"`
Members []string `json:"members"`
Name string `json:"name"`
Network string `json:"network"`
RadiusGroups []interface{} `json:"radius_groups"`
TacacsGroups []interface{} `json:"tacacs_groups"`
}
var _ sophos.RestGetter = &AaaGroup{}
// GetPath implements sophos.RestObject and returns the AaaGroups GET path
// Returns all available aaa/group objects
func (*AaaGroups) GetPath() string { return "/api/objects/aaa/group/" }
// RefRequired implements sophos.RestObject
func (*AaaGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AaaGroups GET path
// Returns all available group types
func (a *AaaGroup) GetPath() string { return fmt.Sprintf("/api/objects/aaa/group/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AaaGroup) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AaaGroup DELETE path
// Creates or updates the complete object group
func (*AaaGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AaaGroup PATCH path
// Changes to parts of the object group types
func (*AaaGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AaaGroup POST path
// Create a new aaa/group object
func (*AaaGroup) PostPath() string {
return "/api/objects/aaa/group/"
}
// PutPath implements sophos.RestObject and returns the AaaGroup PUT path
// Creates or updates the complete object group
func (*AaaGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AaaGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/group/%s/usedby", ref)
}
// GetType implements sophos.Object
func (a *AaaGroup) GetType() string { return a.ObjectType }
// AaaUsers is an Sophos Endpoint subType and implements sophos.RestObject
type AaaUsers []AaaUser
// AaaUser is a generated Sophos object
type AaaUser struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AccManaged bool `json:"acc_managed"`
AllowedNetworks []string `json:"allowed_networks"`
Authentication string `json:"authentication"`
BackendUpdate bool `json:"backend_update"`
Clearpass string `json:"clearpass"`
Comment string `json:"comment"`
EmailPrimary string `json:"email_primary"`
EmailSecondary []interface{} `json:"email_secondary"`
Enabled bool `json:"enabled"`
LastauthBackend string `json:"lastauth_backend"`
LastauthFacility string `json:"lastauth_facility"`
LastauthTime int64 `json:"lastauth_time"`
Loc string `json:"loc"`
Md4hash string `json:"md4hash"`
Name string `json:"name"`
Network string `json:"network"`
Pop3Accounts []interface{} `json:"pop3_accounts"`
RasIP string `json:"ras_ip"`
RasOnline bool `json:"ras_online"`
Realname string `json:"realname"`
SenderBlacklist []interface{} `json:"sender_blacklist"`
SenderWhitelist []interface{} `json:"sender_whitelist"`
Status bool `json:"status"`
UseRasIP bool `json:"use_ras_ip"`
UserPreferences string `json:"user_preferences"`
X509Cert string `json:"x509_cert"`
X509CertGost string `json:"x509_cert_gost"`
}
var _ sophos.RestGetter = &AaaUser{}
// GetPath implements sophos.RestObject and returns the AaaUsers GET path
// Returns all available aaa/user objects
func (*AaaUsers) GetPath() string { return "/api/objects/aaa/user/" }
// RefRequired implements sophos.RestObject
func (*AaaUsers) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AaaUsers GET path
// Returns all available user types
func (a *AaaUser) GetPath() string { return fmt.Sprintf("/api/objects/aaa/user/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AaaUser) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AaaUser DELETE path
// Creates or updates the complete object user
func (*AaaUser) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/user/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AaaUser PATCH path
// Changes to parts of the object user types
func (*AaaUser) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/user/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AaaUser POST path
// Create a new aaa/user object
func (*AaaUser) PostPath() string {
return "/api/objects/aaa/user/"
}
// PutPath implements sophos.RestObject and returns the AaaUser PUT path
// Creates or updates the complete object user
func (*AaaUser) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/user/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AaaUser) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/aaa/user/%s/usedby", ref)
}
// GetType implements sophos.Object
func (a *AaaUser) GetType() string { return a.ObjectType }