Skip to content

Commit edef4dd

Browse files
add func IsFixedByNetworkPolicy
Signed-off-by: YiscahLevySilas1 <[email protected]>
1 parent 579a594 commit edef4dd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

reporthandling/datastructuresmethods.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import (
1212
"golang.org/x/exp/slices"
1313
)
1414

15-
const ActionRequiredAttribute string = "actionRequired"
15+
const (
16+
ActionRequiredAttribute string = "actionRequired"
17+
ControlAttributeKeyIsFixedByNetworkPolicy string = "isFixedByNetworkPolicy"
18+
)
1619

1720
// ==============================================================================================
1821
// ========================== PostureReport =====================================================
@@ -443,6 +446,19 @@ func (control *Control) GetControlTypeTags() []string {
443446
return []string{}
444447
}
445448

449+
// returns true if control has attribute "isFixedByNetworkPolicy" and its value is true
450+
func (control *Control) IsFixedByNetworkPolicy() bool {
451+
if control.Attributes == nil {
452+
return false
453+
}
454+
if v, exist := control.Attributes[ControlAttributeKeyIsFixedByNetworkPolicy]; exist {
455+
if isFixedByNetworkPolicy, ok := v.(bool); ok {
456+
return isFixedByNetworkPolicy
457+
}
458+
}
459+
return false
460+
}
461+
446462
func (control *Control) SupportSmartRemediation() bool {
447463
typeTags := control.GetControlTypeTags()
448464
return slices.Contains(typeTags, v1alpha1.ControlTypeTagSmartRemediation)

0 commit comments

Comments
 (0)