mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-06 10:46:52 +00:00
24 lines
572 B
Go
24 lines
572 B
Go
package policyhandler
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
apisv1 "github.com/armosec/opa-utils/httpserver/apis/v1"
|
|
|
|
"github.com/armosec/kubescape/v2/core/cautils"
|
|
)
|
|
|
|
func getScanKind(policyIdentifier []cautils.PolicyIdentifier) apisv1.NotificationPolicyKind {
|
|
if len(policyIdentifier) > 0 {
|
|
return policyIdentifier[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
|
|
}
|