Skip to content

Commit

Permalink
Merge pull request #17 from CheckPointSW/cmd-fix
Browse files Browse the repository at this point in the history
partially revert changes in cmd
  • Loading branch information
chkp-omris committed Jul 23, 2024
2 parents c49332b + 89684c3 commit 87bae28
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/discard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(&region, "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
}
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions cmd/enforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(&region, "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
}
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(&region, "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
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 87bae28

Please sign in to comment.