mirror of
https://github.com/kubescape/kubescape.git
synced 2026-03-03 18:20:19 +00:00
22 lines
528 B
Go
22 lines
528 B
Go
package policyhandler
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/armosec/opa-utils/reporthandling"
|
|
)
|
|
|
|
func getScanKind(notification *reporthandling.PolicyNotification) reporthandling.NotificationPolicyKind {
|
|
if len(notification.Rules) > 0 {
|
|
return notification.Rules[0].Kind
|
|
}
|
|
return "unknown"
|
|
}
|
|
func policyDownloadError(err error) error {
|
|
if strings.Contains(err.Error(), "unsupported protocol scheme") {
|
|
err = fmt.Errorf("failed to download from GitHub release, try running with `--use-default` flag")
|
|
}
|
|
return err
|
|
}
|