-
Notifications
You must be signed in to change notification settings - Fork 4
/
role.go
178 lines (141 loc) · 5.91 KB
/
role.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
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Role is a generated struct representing the Sophos Role Endpoint
// GET /api/nodes/role
type Role struct {
RoleGroup RoleGroup `json:"role_group"`
RoleRole RoleRole `json:"role_role"`
}
var _ sophos.Endpoint = &Role{}
var defsRole = map[string]sophos.RestObject{
"RoleGroup": &RoleGroup{},
"RoleRole": &RoleRole{},
}
// RestObjects implements the sophos.Node interface and returns a map of Role's Objects
func (Role) RestObjects() map[string]sophos.RestObject { return defsRole }
// GetPath implements sophos.RestGetter
func (*Role) GetPath() string { return "/api/nodes/role" }
// RefRequired implements sophos.RestGetter
func (*Role) RefRequired() (string, bool) { return "", false }
var defRole = &sophos.Definition{Description: "role", Name: "role", Link: "/api/definitions/role"}
// Definition returns the /api/definitions struct of Role
func (Role) Definition() sophos.Definition { return *defRole }
// ApiRoutes returns all known Role Paths
func (Role) ApiRoutes() []string {
return []string{
"/api/objects/role/group/",
"/api/objects/role/group/{ref}",
"/api/objects/role/group/{ref}/usedby",
"/api/objects/role/role/",
"/api/objects/role/role/{ref}",
"/api/objects/role/role/{ref}/usedby",
}
}
// References returns the Role's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Role) References() []string {
return []string{
"REF_RoleGroup",
"REF_RoleRole",
}
}
// RoleGroups is an Sophos Endpoint subType and implements sophos.RestObject
type RoleGroups []RoleGroup
// RoleGroup represents a UTM group
type RoleGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &RoleGroup{}
// GetPath implements sophos.RestObject and returns the RoleGroups GET path
// Returns all available role/group objects
func (*RoleGroups) GetPath() string { return "/api/objects/role/group/" }
// RefRequired implements sophos.RestObject
func (*RoleGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the RoleGroups GET path
// Returns all available group types
func (r *RoleGroup) GetPath() string { return fmt.Sprintf("/api/objects/role/group/%s", r.Reference) }
// RefRequired implements sophos.RestObject
func (r *RoleGroup) RefRequired() (string, bool) { return r.Reference, true }
// DeletePath implements sophos.RestObject and returns the RoleGroup DELETE path
// Creates or updates the complete object group
func (*RoleGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/role/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the RoleGroup PATCH path
// Changes to parts of the object group types
func (*RoleGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/role/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the RoleGroup POST path
// Create a new role/group object
func (*RoleGroup) PostPath() string {
return "/api/objects/role/group/"
}
// PutPath implements sophos.RestObject and returns the RoleGroup PUT path
// Creates or updates the complete object group
func (*RoleGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/role/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*RoleGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/role/group/%s/usedby", ref)
}
// RoleRoles is an Sophos Endpoint subType and implements sophos.RestObject
type RoleRoles []RoleRole
// RoleRole represents a UTM role
type RoleRole struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Members []string `json:"members"`
Name string `json:"name"`
Rights []string `json:"rights"`
// WebadminAccess default value is false
WebadminAccess bool `json:"webadmin_access"`
}
var _ sophos.RestGetter = &RoleRole{}
// GetPath implements sophos.RestObject and returns the RoleRoles GET path
// Returns all available role/role objects
func (*RoleRoles) GetPath() string { return "/api/objects/role/role/" }
// RefRequired implements sophos.RestObject
func (*RoleRoles) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the RoleRoles GET path
// Returns all available role types
func (r *RoleRole) GetPath() string { return fmt.Sprintf("/api/objects/role/role/%s", r.Reference) }
// RefRequired implements sophos.RestObject
func (r *RoleRole) RefRequired() (string, bool) { return r.Reference, true }
// DeletePath implements sophos.RestObject and returns the RoleRole DELETE path
// Creates or updates the complete object role
func (*RoleRole) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/role/role/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the RoleRole PATCH path
// Changes to parts of the object role types
func (*RoleRole) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/role/role/%s", ref)
}
// PostPath implements sophos.RestObject and returns the RoleRole POST path
// Create a new role/role object
func (*RoleRole) PostPath() string {
return "/api/objects/role/role/"
}
// PutPath implements sophos.RestObject and returns the RoleRole PUT path
// Creates or updates the complete object role
func (*RoleRole) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/role/role/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*RoleRole) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/role/role/%s/usedby", ref)
}