-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaws.go
250 lines (201 loc) · 8.84 KB
/
aws.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
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Aws is a generated struct representing the Sophos Aws Endpoint
// GET /api/nodes/aws
type Aws struct {
AwsGroup AwsGroup `json:"aws_group"`
AwsInstanceType AwsInstanceType `json:"aws_instance_type"`
AwsRegion AwsRegion `json:"aws_region"`
}
var _ sophos.Endpoint = &Aws{}
var defsAws = map[string]sophos.RestObject{
"AwsGroup": &AwsGroup{},
"AwsInstanceType": &AwsInstanceType{},
"AwsRegion": &AwsRegion{},
}
// RestObjects implements the sophos.Node interface and returns a map of Aws's Objects
func (Aws) RestObjects() map[string]sophos.RestObject { return defsAws }
// GetPath implements sophos.RestGetter
func (*Aws) GetPath() string { return "/api/nodes/aws" }
// RefRequired implements sophos.RestGetter
func (*Aws) RefRequired() (string, bool) { return "", false }
var defAws = &sophos.Definition{Description: "aws", Name: "aws", Link: "/api/definitions/aws"}
// Definition returns the /api/definitions struct of Aws
func (Aws) Definition() sophos.Definition { return *defAws }
// ApiRoutes returns all known Aws Paths
func (Aws) ApiRoutes() []string {
return []string{
"/api/objects/aws/group/",
"/api/objects/aws/group/{ref}",
"/api/objects/aws/group/{ref}/usedby",
"/api/objects/aws/instance_type/",
"/api/objects/aws/instance_type/{ref}",
"/api/objects/aws/instance_type/{ref}/usedby",
"/api/objects/aws/region/",
"/api/objects/aws/region/{ref}",
"/api/objects/aws/region/{ref}/usedby",
}
}
// References returns the Aws's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Aws) References() []string {
return []string{
"REF_AwsGroup",
"REF_AwsInstanceType",
"REF_AwsRegion",
}
}
// AwsGroups is an Sophos Endpoint subType and implements sophos.RestObject
type AwsGroups []AwsGroup
// AwsGroup represents a UTM aws->group
type AwsGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &AwsGroup{}
// GetPath implements sophos.RestObject and returns the AwsGroups GET path
// Returns all available aws/group objects
func (*AwsGroups) GetPath() string { return "/api/objects/aws/group/" }
// RefRequired implements sophos.RestObject
func (*AwsGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AwsGroups GET path
// Returns all available group types
func (a *AwsGroup) GetPath() string { return fmt.Sprintf("/api/objects/aws/group/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AwsGroup) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AwsGroup DELETE path
// Creates or updates the complete object group
func (*AwsGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/aws/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AwsGroup PATCH path
// Changes to parts of the object group types
func (*AwsGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AwsGroup POST path
// Create a new aws/group object
func (*AwsGroup) PostPath() string {
return "/api/objects/aws/group/"
}
// PutPath implements sophos.RestObject and returns the AwsGroup PUT path
// Creates or updates the complete object group
func (*AwsGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AwsGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/group/%s/usedby", ref)
}
// AwsInstanceTypes is an Sophos Endpoint subType and implements sophos.RestObject
type AwsInstanceTypes []AwsInstanceType
// AwsInstanceType represents a UTM instance type
type AwsInstanceType struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
CpuCores int `json:"cpu_cores"`
// Deprecated default value is false
Deprecated bool `json:"deprecated"`
MemoryBytes int `json:"memory_bytes"`
Model string `json:"model"`
Name string `json:"name"`
NetworkPerformance string `json:"network_performance"`
}
var _ sophos.RestGetter = &AwsInstanceType{}
// GetPath implements sophos.RestObject and returns the AwsInstanceTypes GET path
// Returns all available aws/instance_type objects
func (*AwsInstanceTypes) GetPath() string { return "/api/objects/aws/instance_type/" }
// RefRequired implements sophos.RestObject
func (*AwsInstanceTypes) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AwsInstanceTypes GET path
// Returns all available instance_type types
func (a *AwsInstanceType) GetPath() string {
return fmt.Sprintf("/api/objects/aws/instance_type/%s", a.Reference)
}
// RefRequired implements sophos.RestObject
func (a *AwsInstanceType) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AwsInstanceType DELETE path
// Creates or updates the complete object instance_type
func (*AwsInstanceType) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/aws/instance_type/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AwsInstanceType PATCH path
// Changes to parts of the object instance_type types
func (*AwsInstanceType) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/instance_type/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AwsInstanceType POST path
// Create a new aws/instance_type object
func (*AwsInstanceType) PostPath() string {
return "/api/objects/aws/instance_type/"
}
// PutPath implements sophos.RestObject and returns the AwsInstanceType PUT path
// Creates or updates the complete object instance_type
func (*AwsInstanceType) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/instance_type/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AwsInstanceType) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/instance_type/%s/usedby", ref)
}
// AwsRegions is an Sophos Endpoint subType and implements sophos.RestObject
type AwsRegions []AwsRegion
// AwsRegion represents a UTM region
type AwsRegion struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
AvailabilityZones []string `json:"availability_zones"`
Code string `json:"code"`
Comment string `json:"comment"`
InstanceTypes []string `json:"instance_types"`
Name string `json:"name"`
Partition string `json:"partition"`
}
var _ sophos.RestGetter = &AwsRegion{}
// GetPath implements sophos.RestObject and returns the AwsRegions GET path
// Returns all available aws/region objects
func (*AwsRegions) GetPath() string { return "/api/objects/aws/region/" }
// RefRequired implements sophos.RestObject
func (*AwsRegions) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AwsRegions GET path
// Returns all available region types
func (a *AwsRegion) GetPath() string { return fmt.Sprintf("/api/objects/aws/region/%s", a.Reference) }
// RefRequired implements sophos.RestObject
func (a *AwsRegion) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AwsRegion DELETE path
// Creates or updates the complete object region
func (*AwsRegion) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/aws/region/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AwsRegion PATCH path
// Changes to parts of the object region types
func (*AwsRegion) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/region/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AwsRegion POST path
// Create a new aws/region object
func (*AwsRegion) PostPath() string {
return "/api/objects/aws/region/"
}
// PutPath implements sophos.RestObject and returns the AwsRegion PUT path
// Creates or updates the complete object region
func (*AwsRegion) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/region/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AwsRegion) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/aws/region/%s/usedby", ref)
}