@@ -27,6 +27,28 @@ const (
27
27
CheckTypeNone = ""
28
28
)
29
29
30
+ // ScannerType is an enum type for the scanner type
31
+ type ScannerType string
32
+
33
+ // InputType is an enum type for the input type
34
+ type InputType string
35
+
36
+ const (
37
+ // ScannerTypeOpenSCAP is the default scanner type
38
+ ScannerTypeOpenSCAP ScannerType = "OpenSCAP"
39
+ // ScannerTypeCelScanner is the scanner type for the CEL scanner
40
+ ScannerTypeCelScanner ScannerType = "CEL"
41
+ // ScannerTypeUnknown is the scanner type for an unknown scanner
42
+ ScannerTypeUnknown ScannerType = "Unknown"
43
+ )
44
+
45
+ type Evaluation struct {
46
+ // The CEL expression to be evaluated
47
+ Expression string `json:"expression"`
48
+ // Error message to be displayed if the evaluation fails
49
+ ErrorMessage string `json:"errorMessage,omitempty"`
50
+ }
51
+
30
52
type RulePayload struct {
31
53
// The XCCDF ID
32
54
ID string `json:"id"`
@@ -50,6 +72,45 @@ type RulePayload struct {
50
72
// +optional
51
73
// +listType=atomic
52
74
AvailableFixes []FixDefinition `json:"availableFixes,omitempty"`
75
+ // Scanner is the type of scanner that should be used to evaluate this rule
76
+ // Defaults to OpenSCAP
77
+ // +kubebuilder:default=OpenSCAP
78
+ Scanner ScannerType `json:"scanner,omitempty"`
79
+ // Evaluations is the list of CEL expressions that will be used
80
+ // to evaluate the rule
81
+ // +nullable
82
+ // +optional
83
+ // +listType=atomic
84
+ Evaluatiosn []Evaluation `json:"evaluations,omitempty"`
85
+ // Inputs represent the input parameters for the CEL expression
86
+ // +nullable
87
+ // +optional
88
+ // +listType=atomic
89
+ Inputs []InputPayload `json:"inputs,omitempty"`
90
+ }
91
+
92
+ // KubernetesResource represents a kubernetes resource that can be used as an input
93
+ // for the CEL expression
94
+ type KubernetesResource struct {
95
+ // The API group of the resource
96
+ APIGroup string `json:"apiGroup"`
97
+ // The version of the resource
98
+ ApiVersion string `json:"apiVersion"`
99
+ // The resource type
100
+ Resource string `json:"resource"`
101
+ // The namespace of the resource
102
+ // +optional
103
+ Namespace string `json:"namespace,omitempty"`
104
+ }
105
+
106
+ // InputPayload defines the structure for the inputs used in the CEL expression
107
+ type InputPayload struct {
108
+ // The name of the input parameter
109
+ Name string `json:"name"`
110
+ // The kubernetes resource that will be used as input
111
+ // +nullable
112
+ // +optional
113
+ KubeResource KubernetesResource `json:"kubeResource,omitempty"`
53
114
}
54
115
55
116
// +kubebuilder:object:root=true
0 commit comments