-
Notifications
You must be signed in to change notification settings - Fork 25
/
datastructures.go
69 lines (60 loc) · 2.67 KB
/
datastructures.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
package reportsummary
import (
"github.com/kubescape/opa-utils/reporthandling/apis"
helpersv1 "github.com/kubescape/opa-utils/reporthandling/helpers/v1"
)
type PostureAttributes struct {
Attribute string `json:"attributeName"`
Values []string `json:"values"`
}
type ControlSummaries map[string]ControlSummary
// SummaryDetails detailed summary of the scanning. will contain versions, counters, etc.
type SummaryDetails struct {
Controls ControlSummaries `json:"controls,omitempty"`
Status apis.ScanningStatus `json:"status"`
Frameworks []FrameworkSummary `json:"frameworks"`
SeverityCounters SeverityCounters `json:"severityCounters,omitempty"`
ResourceCounters ResourceCounters `json:",inline"`
Score float32 `json:"score"`
}
// FrameworkSummary summary of scanning from a single framework perspective
type FrameworkSummary struct {
Controls ControlSummaries `json:"controls,omitempty"` // mapping of control - map[<control ID>]<control summary>
Name string `json:"name"` // framework name
Status apis.ScanningStatus `json:"status"`
Version string `json:"version"`
ResourceCounters ResourceCounters `json:",inline"`
Score float32 `json:"score"`
}
// ControlSummary summary of scanning from a single control perspective
type ControlSummary struct {
StatusInfo apis.StatusInfo `json:"statusInfo,omitempty"`
ControlID string `json:"controlID"`
Name string `json:"name"`
Status apis.ScanningStatus `json:"status"`
Description string `json:"-"`
Remediation string `json:"-"`
ResourceIDs helpersv1.AllLists `json:"resourceIDs"`
ResourceCounters ResourceCounters `json:",inline"`
Score float32 `json:"score"`
ScoreFactor float32 `json:"scoreFactor"`
}
type ResourceCounters struct {
PassedResources int `json:"passedResources"`
FailedResources int `json:"failedResources"`
ExcludedResources int `json:"excludedResources"`
}
type SeverityCounters struct {
ResourcesWithCriticalSeverityCounter int `json:"criticalSeverity"`
ResourcesWithHighSeverityCounter int `json:"highSeverity"`
ResourcesWithMediumSeverityCounter int `json:"mediumSeverity"`
ResourcesWithLowSeverityCounter int `json:"lowSeverity"`
}
type PostureCounters struct {
PassedCounter int `json:"passed"`
FailedCounter int `json:"failed"`
ExcludedCounter int `json:"excluded"`
SkippedCounter int `json:"skipped"`
IgnoredCounter int `json:"ignored"`
UnknownCounter int `json:"unknown"`
}