From 89684c3a5acce3dbd94e2e030cf9948a1b10ee47 Mon Sep 17 00:00:00 2001 From: chkp-omris Date: Tue, 23 Jul 2024 08:15:31 +0000 Subject: [PATCH] partially revert changes in cmd --- cmd/discard.go | 10 ++++++++++ cmd/enforce.go | 10 ++++++++++ cmd/publish.go | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/cmd/discard.go b/cmd/discard.go index 8480df8..173c9c1 100644 --- a/cmd/discard.go +++ b/cmd/discard.go @@ -28,6 +28,11 @@ var discardCmd = &cobra.Command{ Short: "Discard changes of a session", Long: `Discard changes of a session`, PreRunE: func(cmd *cobra.Command, args []string) error { + cmd.Flags().StringVarP(&clientID, "client-id", "c", "", "Client ID of the API key") + cmd.Flags().StringVarP(&accessKey, "access-key", "k", "", "Access key of the API key") + cmd.Flags().StringVarP(®ion, "region", "r", "eu", "Region of Infinity Next API") + cmd.Flags().StringVarP(&token, "token", "t", "", "Authorization token of the API key") + if err := viper.BindPFlags(cmd.Flags()); err != nil { return err } @@ -58,6 +63,11 @@ var discardCmd = &cobra.Command{ URL = EUCIURL case "us": URL = USCIURL + case "dev": + URL = DevCIURL + API = DevCIAPIV1 + case "preprod": + URL = DevCIURL default: fmt.Printf("Invalid region %s, expected eu or us\n", region) os.Exit(1) diff --git a/cmd/enforce.go b/cmd/enforce.go index 07e7e8c..8ab9c02 100644 --- a/cmd/enforce.go +++ b/cmd/enforce.go @@ -32,6 +32,11 @@ var enforceCmd = &cobra.Command{ Long: `Enforce a policy`, PreRunE: func(cmd *cobra.Command, args []string) error { + cmd.Flags().StringVarP(&clientID, "client-id", "c", "", "Client ID of the API key") + cmd.Flags().StringVarP(&accessKey, "access-key", "k", "", "Access key of the API key") + cmd.Flags().StringVarP(®ion, "region", "r", "eu", "Region of Infinity Next API") + cmd.Flags().StringVarP(&token, "token", "t", "", "Authorization token of the API key") + if err := viper.BindPFlags(cmd.Flags()); err != nil { return err } @@ -62,6 +67,11 @@ var enforceCmd = &cobra.Command{ URL = EUCIURL case "us": URL = USCIURL + case "dev": + URL = DevCIURL + API = DevCIAPIV1 + case "preprod": + URL = DevCIURL default: fmt.Printf("Invalid region %s, expected eu or us\n", region) os.Exit(1) diff --git a/cmd/publish.go b/cmd/publish.go index da66e48..d26a14e 100644 --- a/cmd/publish.go +++ b/cmd/publish.go @@ -37,6 +37,11 @@ var publishCmd = &cobra.Command{ Short: "Publish changes of a session", Long: `Publish changes of a session`, PreRunE: func(cmd *cobra.Command, args []string) error { + cmd.Flags().StringVarP(&clientID, "client-id", "c", "", "Client ID of the API key") + cmd.Flags().StringVarP(&accessKey, "access-key", "k", "", "Access key of the API key") + cmd.Flags().StringVarP(®ion, "region", "r", "eu", "Region of Infinity Next API") + cmd.Flags().StringVarP(&token, "token", "t", "", "Authorization token of the API key") + if err := viper.BindPFlags(cmd.Flags()); err != nil { return err } @@ -67,6 +72,11 @@ var publishCmd = &cobra.Command{ URL = EUCIURL case "us": URL = USCIURL + case "dev": + URL = DevCIURL + API = DevCIAPIV1 + case "preprod": + URL = DevCIURL default: fmt.Printf("Invalid region %s, expected eu or us\n", region) os.Exit(1)