mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
22 lines
447 B
Go
22 lines
447 B
Go
package variables
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func NeedsVariable(variable string) bool {
|
|
return variable != "" &&
|
|
!strings.Contains(variable, "request.object") &&
|
|
!strings.Contains(variable, "request.operation") &&
|
|
!strings.Contains(variable, "element") &&
|
|
variable != "elementIndex"
|
|
}
|
|
|
|
func NeedsVariables(variables ...string) bool {
|
|
for _, variable := range variables {
|
|
if NeedsVariable(variable) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|