Skip to content

Commit

Permalink
add func IsFixedByNetworkPolicy
Browse files Browse the repository at this point in the history
Signed-off-by: YiscahLevySilas1 <yiscahls@armosec.io>
  • Loading branch information
YiscahLevySilas1 committed Mar 13, 2024
1 parent 579a594 commit edef4dd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion reporthandling/datastructuresmethods.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import (
"golang.org/x/exp/slices"
)

const ActionRequiredAttribute string = "actionRequired"
const (
ActionRequiredAttribute string = "actionRequired"
ControlAttributeKeyIsFixedByNetworkPolicy string = "isFixedByNetworkPolicy"
)

// ==============================================================================================
// ========================== PostureReport =====================================================
Expand Down Expand Up @@ -443,6 +446,19 @@ func (control *Control) GetControlTypeTags() []string {
return []string{}
}

// returns true if control has attribute "isFixedByNetworkPolicy" and its value is true
func (control *Control) IsFixedByNetworkPolicy() bool {
if control.Attributes == nil {
return false
}
if v, exist := control.Attributes[ControlAttributeKeyIsFixedByNetworkPolicy]; exist {
if isFixedByNetworkPolicy, ok := v.(bool); ok {
return isFixedByNetworkPolicy
}
}
return false
}

func (control *Control) SupportSmartRemediation() bool {
typeTags := control.GetControlTypeTags()
return slices.Contains(typeTags, v1alpha1.ControlTypeTagSmartRemediation)
Expand Down

0 comments on commit edef4dd

Please sign in to comment.