/
models_container.go
386 lines (277 loc) · 9.13 KB
/
models_container.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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// ModelsContainer models container
//
// swagger:model models.Container
type ModelsContainer struct {
// agents
Agents []ModelsContainerAgents `json:"agents"`
// allow privilege escalation
AllowPrivilegeEscalation bool `json:"allow_privilege_escalation,omitempty"`
// cid
// Required: true
Cid *string `json:"cid"`
// cloud
Cloud string `json:"cloud,omitempty"`
// cloud account id
CloudAccountID string `json:"cloud_account_id,omitempty"`
// cloud region
CloudRegion string `json:"cloud_region,omitempty"`
// cluster id
ClusterID string `json:"cluster_id,omitempty"`
// cluster name
ClusterName string `json:"cluster_name,omitempty"`
// config labels
ConfigLabels string `json:"config_labels,omitempty"`
// config user
ConfigUser string `json:"config_user,omitempty"`
// container image id
ContainerImageID string `json:"container_image_id,omitempty"`
// created at
CreatedAt int64 `json:"created_at,omitempty"`
// cve ids
CveIds []string `json:"cve_ids"`
// first seen
FirstSeen int64 `json:"first_seen,omitempty"`
// host config devices
HostConfigDevices string `json:"host_config_devices,omitempty"`
// id
// Required: true
ID *string `json:"id"`
// image application package count
ImageApplicationPackageCount int32 `json:"image_application_package_count,omitempty"`
// image assessed at
ImageAssessedAt int64 `json:"image_assessed_at,omitempty"`
// image detection count
ImageDetectionCount int32 `json:"image_detection_count,omitempty"`
// image detection id list
ImageDetectionIDList []string `json:"image_detection_id_list"`
// image detection name list
ImageDetectionNameList []string `json:"image_detection_name_list"`
// image detection severity by type
ImageDetectionSeverityByType map[string]int64 `json:"image_detection_severity_by_type,omitempty"`
// image digest
ImageDigest string `json:"image_digest,omitempty"`
// image has been assessed
ImageHasBeenAssessed bool `json:"image_has_been_assessed,omitempty"`
// image highest severity vulnerability
ImageHighestSeverityVulnerability string `json:"image_highest_severity_vulnerability,omitempty"`
// image id
ImageID string `json:"image_id,omitempty"`
// image package count
ImagePackageCount int32 `json:"image_package_count,omitempty"`
// image registry
ImageRegistry string `json:"image_registry,omitempty"`
// image repo
ImageRepo string `json:"image_repo,omitempty"`
// image tag
ImageTag string `json:"image_tag,omitempty"`
// image vulnerability count
ImageVulnerabilityCount int32 `json:"image_vulnerability_count,omitempty"`
// image vulnerability severity by type
ImageVulnerabilitySeverityByType map[string]int64 `json:"image_vulnerability_severity_by_type,omitempty"`
// insecure mount source
InsecureMountSource string `json:"insecure_mount_source,omitempty"`
// insecure mount type
InsecureMountType string `json:"insecure_mount_type,omitempty"`
// insecure propagation mode
InsecurePropagationMode bool `json:"insecure_propagation_mode,omitempty"`
// interactive mode
InteractiveMode bool `json:"interactive_mode,omitempty"`
// ipv4
IPV4 string `json:"ipv4,omitempty"`
// ipv6
IPV6 string `json:"ipv6,omitempty"`
// kpa coverage
KpaCoverage bool `json:"kpa_coverage,omitempty"`
// labels
Labels map[string]string `json:"labels,omitempty"`
// labels list
LabelsList []string `json:"labels_list"`
// last seen
LastSeen int64 `json:"last_seen,omitempty"`
// linux sensor aid
LinuxSensorAid string `json:"linux_sensor_aid,omitempty"`
// linux sensor config build
LinuxSensorConfigBuild string `json:"linux_sensor_config_build,omitempty"`
// linux sensor coverage
LinuxSensorCoverage bool `json:"linux_sensor_coverage,omitempty"`
// lumos sensor aid
LumosSensorAid string `json:"lumos_sensor_aid,omitempty"`
// lumos sensor config build
LumosSensorConfigBuild string `json:"lumos_sensor_config_build,omitempty"`
// lumos sensor coverage
LumosSensorCoverage bool `json:"lumos_sensor_coverage,omitempty"`
// name
Name string `json:"name,omitempty"`
// namespace
Namespace string `json:"namespace,omitempty"`
// node id
NodeID string `json:"node_id,omitempty"`
// node name
NodeName string `json:"node_name,omitempty"`
// pod id
PodID string `json:"pod_id,omitempty"`
// pod name
PodName string `json:"pod_name,omitempty"`
// port list
PortList []ModelsContainerPortList `json:"port_list"`
// privileged
Privileged bool `json:"privileged,omitempty"`
// root write access
RootWriteAccess bool `json:"root_write_access,omitempty"`
// rpd
Rpd []int64 `json:"rpd"`
// run as root group
RunAsRootGroup bool `json:"run_as_root_group,omitempty"`
// run as root user
RunAsRootUser bool `json:"run_as_root_user,omitempty"`
// running status
RunningStatus bool `json:"running_status,omitempty"`
// snapshot coverage
SnapshotCoverage bool `json:"snapshot_coverage,omitempty"`
// unidentified
Unidentified bool `json:"unidentified,omitempty"`
// volume mounts
VolumeMounts string `json:"volume_mounts,omitempty"`
}
// Validate validates this models container
func (m *ModelsContainer) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAgents(formats); err != nil {
res = append(res, err)
}
if err := m.validateCid(formats); err != nil {
res = append(res, err)
}
if err := m.validateID(formats); err != nil {
res = append(res, err)
}
if err := m.validatePortList(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ModelsContainer) validateAgents(formats strfmt.Registry) error {
if swag.IsZero(m.Agents) { // not required
return nil
}
for i := 0; i < len(m.Agents); i++ {
if m.Agents[i] != nil {
if err := m.Agents[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("agents" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("agents" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *ModelsContainer) validateCid(formats strfmt.Registry) error {
if err := validate.Required("cid", "body", m.Cid); err != nil {
return err
}
return nil
}
func (m *ModelsContainer) validateID(formats strfmt.Registry) error {
if err := validate.Required("id", "body", m.ID); err != nil {
return err
}
return nil
}
func (m *ModelsContainer) validatePortList(formats strfmt.Registry) error {
if swag.IsZero(m.PortList) { // not required
return nil
}
for i := 0; i < len(m.PortList); i++ {
if m.PortList[i] != nil {
if err := m.PortList[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("port_list" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("port_list" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this models container based on the context it is used
func (m *ModelsContainer) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAgents(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidatePortList(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ModelsContainer) contextValidateAgents(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Agents); i++ {
if swag.IsZero(m.Agents[i]) { // not required
return nil
}
if err := m.Agents[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("agents" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("agents" + "." + strconv.Itoa(i))
}
return err
}
}
return nil
}
func (m *ModelsContainer) contextValidatePortList(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.PortList); i++ {
if swag.IsZero(m.PortList[i]) { // not required
return nil
}
if err := m.PortList[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("port_list" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("port_list" + "." + strconv.Itoa(i))
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *ModelsContainer) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ModelsContainer) UnmarshalBinary(b []byte) error {
var res ModelsContainer
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}