/
user_types.go
355 lines (326 loc) · 14.5 KB
/
user_types.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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
// Code generated by goagen v1.4.3, DO NOT EDIT.
//
// API "vulcan-core": Application User Types
//
// Command:
// $ main
package client
import (
"github.com/goadesign/goa"
uuid "github.com/goadesign/goa/uuid"
"time"
"unicode/utf8"
)
// assettypeType user type.
type assettypeType struct {
Assettype *string `form:"assettype,omitempty" json:"assettype,omitempty" yaml:"assettype,omitempty" xml:"assettype,omitempty"`
Name []string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
}
// Publicize creates AssettypeType from assettypeType
func (ut *assettypeType) Publicize() *AssettypeType {
var pub AssettypeType
if ut.Assettype != nil {
pub.Assettype = ut.Assettype
}
if ut.Name != nil {
pub.Name = ut.Name
}
return &pub
}
// AssettypeType user type.
type AssettypeType struct {
Assettype *string `form:"assettype,omitempty" json:"assettype,omitempty" yaml:"assettype,omitempty" xml:"assettype,omitempty"`
Name []string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
}
// checktypeType user type.
type checktypeType struct {
// List of the asset types that this checktype allows to be used against to
Assets []string `form:"assets,omitempty" json:"assets,omitempty" yaml:"assets,omitempty" xml:"assets,omitempty"`
Description *string `form:"description,omitempty" json:"description,omitempty" yaml:"description,omitempty" xml:"description,omitempty"`
Enabled *bool `form:"enabled,omitempty" json:"enabled,omitempty" yaml:"enabled,omitempty" xml:"enabled,omitempty"`
ID *uuid.UUID `form:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" xml:"id,omitempty"`
// Image that needs to be pulled to run the Check of this type
Image *string `form:"image,omitempty" json:"image,omitempty" yaml:"image,omitempty" xml:"image,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
// Default configuration options for the Checktype. It should be in JSON format
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
// The queue name to be used by a check of this type
QueueName *string `form:"queue_name,omitempty" json:"queue_name,omitempty" yaml:"queue_name,omitempty" xml:"queue_name,omitempty"`
// List of required vars that the agent must inject to a check using this checktype
RequiredVars []string `form:"required_vars,omitempty" json:"required_vars,omitempty" yaml:"required_vars,omitempty" xml:"required_vars,omitempty"`
// Specifies the maximum amount of time that the check should be running before it's killed
Timeout *int `form:"timeout,omitempty" json:"timeout,omitempty" yaml:"timeout,omitempty" xml:"timeout,omitempty"`
}
// Validate validates the checktypeType type instance.
func (ut *checktypeType) Validate() (err error) {
if ut.ID == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "id"))
}
if ut.Name == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "name"))
}
if ut.Image == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "image"))
}
if ut.Description != nil {
if ok := goa.ValidatePattern(`^[[:print:]]+`, *ut.Description); !ok {
err = goa.MergeErrors(err, goa.InvalidPatternError(`request.description`, *ut.Description, `^[[:print:]]+`))
}
}
if ut.Description != nil {
if utf8.RuneCountInString(*ut.Description) > 255 {
err = goa.MergeErrors(err, goa.InvalidLengthError(`request.description`, *ut.Description, utf8.RuneCountInString(*ut.Description), 255, false))
}
}
if ut.Name != nil {
if ok := goa.ValidatePattern(`^[[:word:]]+`, *ut.Name); !ok {
err = goa.MergeErrors(err, goa.InvalidPatternError(`request.name`, *ut.Name, `^[[:word:]]+`))
}
}
if ut.Name != nil {
if utf8.RuneCountInString(*ut.Name) < 1 {
err = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 1, true))
}
}
return
}
// Publicize creates ChecktypeType from checktypeType
func (ut *checktypeType) Publicize() *ChecktypeType {
var pub ChecktypeType
if ut.Assets != nil {
pub.Assets = ut.Assets
}
if ut.Description != nil {
pub.Description = ut.Description
}
if ut.Enabled != nil {
pub.Enabled = ut.Enabled
}
if ut.ID != nil {
pub.ID = *ut.ID
}
if ut.Image != nil {
pub.Image = *ut.Image
}
if ut.Name != nil {
pub.Name = *ut.Name
}
if ut.Options != nil {
pub.Options = ut.Options
}
if ut.QueueName != nil {
pub.QueueName = ut.QueueName
}
if ut.RequiredVars != nil {
pub.RequiredVars = ut.RequiredVars
}
if ut.Timeout != nil {
pub.Timeout = ut.Timeout
}
return &pub
}
// ChecktypeType user type.
type ChecktypeType struct {
// List of the asset types that this checktype allows to be used against to
Assets []string `form:"assets,omitempty" json:"assets,omitempty" yaml:"assets,omitempty" xml:"assets,omitempty"`
Description *string `form:"description,omitempty" json:"description,omitempty" yaml:"description,omitempty" xml:"description,omitempty"`
Enabled *bool `form:"enabled,omitempty" json:"enabled,omitempty" yaml:"enabled,omitempty" xml:"enabled,omitempty"`
ID uuid.UUID `form:"id" json:"id" yaml:"id" xml:"id"`
// Image that needs to be pulled to run the Check of this type
Image string `form:"image" json:"image" yaml:"image" xml:"image"`
Name string `form:"name" json:"name" yaml:"name" xml:"name"`
// Default configuration options for the Checktype. It should be in JSON format
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
// The queue name to be used by a check of this type
QueueName *string `form:"queue_name,omitempty" json:"queue_name,omitempty" yaml:"queue_name,omitempty" xml:"queue_name,omitempty"`
// List of required vars that the agent must inject to a check using this checktype
RequiredVars []string `form:"required_vars,omitempty" json:"required_vars,omitempty" yaml:"required_vars,omitempty" xml:"required_vars,omitempty"`
// Specifies the maximum amount of time that the check should be running before it's killed
Timeout *int `form:"timeout,omitempty" json:"timeout,omitempty" yaml:"timeout,omitempty" xml:"timeout,omitempty"`
}
// Validate validates the ChecktypeType type instance.
func (ut *ChecktypeType) Validate() (err error) {
if ut.Name == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`type`, "name"))
}
if ut.Image == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`type`, "image"))
}
if ut.Description != nil {
if ok := goa.ValidatePattern(`^[[:print:]]+`, *ut.Description); !ok {
err = goa.MergeErrors(err, goa.InvalidPatternError(`type.description`, *ut.Description, `^[[:print:]]+`))
}
}
if ut.Description != nil {
if utf8.RuneCountInString(*ut.Description) > 255 {
err = goa.MergeErrors(err, goa.InvalidLengthError(`type.description`, *ut.Description, utf8.RuneCountInString(*ut.Description), 255, false))
}
}
if ok := goa.ValidatePattern(`^[[:word:]]+`, ut.Name); !ok {
err = goa.MergeErrors(err, goa.InvalidPatternError(`type.name`, ut.Name, `^[[:word:]]+`))
}
if utf8.RuneCountInString(ut.Name) < 1 {
err = goa.MergeErrors(err, goa.InvalidLengthError(`type.name`, ut.Name, utf8.RuneCountInString(ut.Name), 1, true))
}
return
}
// checktypesGroup user type.
type checktypesGroup struct {
Checktypes []*scanChecktype `form:"checktypes,omitempty" json:"checktypes,omitempty" yaml:"checktypes,omitempty" xml:"checktypes,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
}
// Publicize creates ChecktypesGroup from checktypesGroup
func (ut *checktypesGroup) Publicize() *ChecktypesGroup {
var pub ChecktypesGroup
if ut.Checktypes != nil {
pub.Checktypes = make([]*ScanChecktype, len(ut.Checktypes))
for i2, elem2 := range ut.Checktypes {
pub.Checktypes[i2] = elem2.Publicize()
}
}
if ut.Name != nil {
pub.Name = ut.Name
}
return &pub
}
// ChecktypesGroup user type.
type ChecktypesGroup struct {
Checktypes []*ScanChecktype `form:"checktypes,omitempty" json:"checktypes,omitempty" yaml:"checktypes,omitempty" xml:"checktypes,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
}
// scanChecktype user type.
type scanChecktype struct {
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
}
// Publicize creates ScanChecktype from scanChecktype
func (ut *scanChecktype) Publicize() *ScanChecktype {
var pub ScanChecktype
if ut.Name != nil {
pub.Name = ut.Name
}
if ut.Options != nil {
pub.Options = ut.Options
}
return &pub
}
// ScanChecktype user type.
type ScanChecktype struct {
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
}
// scanPayload user type.
type scanPayload struct {
ExternalID *uuid.UUID `form:"external_id,omitempty" json:"external_id,omitempty" yaml:"external_id,omitempty" xml:"external_id,omitempty"`
ScheduledTime *time.Time `form:"scheduled_time,omitempty" json:"scheduled_time,omitempty" yaml:"scheduled_time,omitempty" xml:"scheduled_time,omitempty"`
Tag *string `form:"tag,omitempty" json:"tag,omitempty" yaml:"tag,omitempty" xml:"tag,omitempty"`
TargetGroups []*scanTargetsGroup `form:"target_groups,omitempty" json:"target_groups,omitempty" yaml:"target_groups,omitempty" xml:"target_groups,omitempty"`
Trigger *string `form:"trigger,omitempty" json:"trigger,omitempty" yaml:"trigger,omitempty" xml:"trigger,omitempty"`
}
// Publicize creates ScanPayload from scanPayload
func (ut *scanPayload) Publicize() *ScanPayload {
var pub ScanPayload
if ut.ExternalID != nil {
pub.ExternalID = ut.ExternalID
}
if ut.ScheduledTime != nil {
pub.ScheduledTime = ut.ScheduledTime
}
if ut.Tag != nil {
pub.Tag = ut.Tag
}
if ut.TargetGroups != nil {
pub.TargetGroups = make([]*ScanTargetsGroup, len(ut.TargetGroups))
for i2, elem2 := range ut.TargetGroups {
pub.TargetGroups[i2] = elem2.Publicize()
}
}
if ut.Trigger != nil {
pub.Trigger = ut.Trigger
}
return &pub
}
// ScanPayload user type.
type ScanPayload struct {
ExternalID *uuid.UUID `form:"external_id,omitempty" json:"external_id,omitempty" yaml:"external_id,omitempty" xml:"external_id,omitempty"`
ScheduledTime *time.Time `form:"scheduled_time,omitempty" json:"scheduled_time,omitempty" yaml:"scheduled_time,omitempty" xml:"scheduled_time,omitempty"`
Tag *string `form:"tag,omitempty" json:"tag,omitempty" yaml:"tag,omitempty" xml:"tag,omitempty"`
TargetGroups []*ScanTargetsGroup `form:"target_groups,omitempty" json:"target_groups,omitempty" yaml:"target_groups,omitempty" xml:"target_groups,omitempty"`
Trigger *string `form:"trigger,omitempty" json:"trigger,omitempty" yaml:"trigger,omitempty" xml:"trigger,omitempty"`
}
// scanTargetsGroup user type.
type scanTargetsGroup struct {
ChecktypesGroup *checktypesGroup `form:"checktypes_group,omitempty" json:"checktypes_group,omitempty" yaml:"checktypes_group,omitempty" xml:"checktypes_group,omitempty"`
TargetGroup *targetGroup `form:"target_group,omitempty" json:"target_group,omitempty" yaml:"target_group,omitempty" xml:"target_group,omitempty"`
}
// Publicize creates ScanTargetsGroup from scanTargetsGroup
func (ut *scanTargetsGroup) Publicize() *ScanTargetsGroup {
var pub ScanTargetsGroup
if ut.ChecktypesGroup != nil {
pub.ChecktypesGroup = ut.ChecktypesGroup.Publicize()
}
if ut.TargetGroup != nil {
pub.TargetGroup = ut.TargetGroup.Publicize()
}
return &pub
}
// ScanTargetsGroup user type.
type ScanTargetsGroup struct {
ChecktypesGroup *ChecktypesGroup `form:"checktypes_group,omitempty" json:"checktypes_group,omitempty" yaml:"checktypes_group,omitempty" xml:"checktypes_group,omitempty"`
TargetGroup *TargetGroup `form:"target_group,omitempty" json:"target_group,omitempty" yaml:"target_group,omitempty" xml:"target_group,omitempty"`
}
// target user type.
type target struct {
Identifier *string `form:"identifier,omitempty" json:"identifier,omitempty" yaml:"identifier,omitempty" xml:"identifier,omitempty"`
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
Type *string `form:"type,omitempty" json:"type,omitempty" yaml:"type,omitempty" xml:"type,omitempty"`
}
// Publicize creates Target from target
func (ut *target) Publicize() *Target {
var pub Target
if ut.Identifier != nil {
pub.Identifier = ut.Identifier
}
if ut.Options != nil {
pub.Options = ut.Options
}
if ut.Type != nil {
pub.Type = ut.Type
}
return &pub
}
// Target user type.
type Target struct {
Identifier *string `form:"identifier,omitempty" json:"identifier,omitempty" yaml:"identifier,omitempty" xml:"identifier,omitempty"`
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
Type *string `form:"type,omitempty" json:"type,omitempty" yaml:"type,omitempty" xml:"type,omitempty"`
}
// targetGroup user type.
type targetGroup struct {
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
Targets []*target `form:"targets,omitempty" json:"targets,omitempty" yaml:"targets,omitempty" xml:"targets,omitempty"`
}
// Publicize creates TargetGroup from targetGroup
func (ut *targetGroup) Publicize() *TargetGroup {
var pub TargetGroup
if ut.Name != nil {
pub.Name = ut.Name
}
if ut.Options != nil {
pub.Options = ut.Options
}
if ut.Targets != nil {
pub.Targets = make([]*Target, len(ut.Targets))
for i2, elem2 := range ut.Targets {
pub.Targets[i2] = elem2.Publicize()
}
}
return &pub
}
// TargetGroup user type.
type TargetGroup struct {
Name *string `form:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty" xml:"name,omitempty"`
Options *string `form:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty" xml:"options,omitempty"`
Targets []*Target `form:"targets,omitempty" json:"targets,omitempty" yaml:"targets,omitempty" xml:"targets,omitempty"`
}