mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
* add flag validation for --account-id (#605) Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com> * add flag validation for --client-id & --secret-key Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com> * Validation method should be a member function * Adding unit tests for credentials validate Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com> Co-authored-by: David Wertenteil <dwertent@armosec.io>
35 lines
892 B
Go
35 lines
892 B
Go
package submit
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
logger "github.com/kubescape/go-logger"
|
|
"github.com/kubescape/kubescape/v2/core/meta"
|
|
metav1 "github.com/kubescape/kubescape/v2/core/meta/datastructures/v1"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func getExceptionsCmd(ks meta.IKubescape, submitInfo *metav1.Submit) *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "exceptions <full path to exceptions file>",
|
|
Short: "Submit exceptions to the Kubescape SaaS version",
|
|
Args: func(cmd *cobra.Command, args []string) error {
|
|
if len(args) != 1 {
|
|
return fmt.Errorf("missing full path to exceptions file")
|
|
}
|
|
return nil
|
|
},
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
if err := flagValidationSubmit(submitInfo); err != nil {
|
|
logger.L().Fatal(err.Error())
|
|
}
|
|
|
|
if err := ks.SubmitExceptions(&submitInfo.Credentials, args[0]); err != nil {
|
|
logger.L().Fatal(err.Error())
|
|
}
|
|
},
|
|
}
|
|
}
|