Skip to content

Commit

Permalink
update "kong" to "gateway" subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Jul 25, 2023
1 parent 7dae0d2 commit 0b68e88
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
7 changes: 2 additions & 5 deletions cmd/kong.go → cmd/gateway.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/*
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
*/
package cmd

import (
Expand All @@ -9,13 +6,13 @@ import (

//
//
// Define the CLI data for the kong sub-command
// Define the CLI data for the gateway sub-command
//
//

func newKongSubCmd() *cobra.Command {
kongSubCmd := &cobra.Command{
Use: "kong [sub-command]...",
Use: "gateway [sub-command]...",
Short: "Sub-command to host the decK network operations",
Long: `Sub-command to host the decK network operations`,
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/kong_diff.go → cmd/gateway_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func newDiffCmd(deprecated bool) *cobra.Command {

if deprecated {
use = "diff"
short = "[deprecated] use 'kong diff' instead"
short = "[deprecated] use 'gateway diff' instead"
execute = func(cmd *cobra.Command, args []string) error {
cprint.UpdatePrintf("Warning: 'deck diff' is DEPRECATED and will be removed in a future version. " +
"Use 'deck kong diff' instead.\n")
"Use 'deck gateway diff' instead.\n")
return executeDiff(cmd, args)
}
argsValidator = validateNoArgs
Expand Down
10 changes: 6 additions & 4 deletions cmd/kong_dump.go → cmd/gateway_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/spf13/cobra"
)

const defaultFileOutName = "kong"

var (
dumpCmdKongStateFile string
dumpCmdStateFormat string
Expand Down Expand Up @@ -67,7 +69,7 @@ func executeDump(cmd *cobra.Command, _ []string) error {
if dumpWorkspace != "" {
return fmt.Errorf("workspace cannot be specified with --all-workspace flag")
}
if dumpCmdKongStateFile != "kong" {
if dumpCmdKongStateFile != defaultFileOutName {
return fmt.Errorf("output-file cannot be specified with --all-workspace flag")
}
workspaces, err := listWorkspaces(ctx, wsClient)
Expand Down Expand Up @@ -145,13 +147,13 @@ func newDumpCmd(deprecated bool) *cobra.Command {
execute := executeDump
fileOutDefault := "-"
if deprecated {
short = "[deprecated] use 'kong dump' instead"
short = "[deprecated] use 'gateway dump' instead"
execute = func(cmd *cobra.Command, args []string) error {
cprint.UpdatePrintf("Warning: 'deck dump' is DEPRECATED and will be removed in a future version. " +
"Use 'deck kong dump' instead.\n")
"Use 'deck gateway dump' instead.\n")
return executeDump(cmd, args)
}
fileOutDefault = "kong"
fileOutDefault = defaultFileOutName
}

dumpCmd := &cobra.Command{
Expand Down
4 changes: 2 additions & 2 deletions cmd/kong_ping.go → cmd/gateway_ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func newPingCmd(deprecated bool) *cobra.Command {
short := "Verify connectivity with Kong"
execute := executePing
if deprecated {
short = "[deprecated] use 'kong ping' instead"
short = "[deprecated] use 'gateway ping' instead"
execute = func(cmd *cobra.Command, args []string) error {
cprint.UpdatePrintf("Warning: 'deck ping' is DEPRECATED and will be removed in a future version. " +
"Use 'deck kong ping' instead.\n")
"Use 'deck gateway ping' instead.\n")
return executePing(cmd, args)
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/kong_reset.go → cmd/gateway_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ func newResetCmd(deprecated bool) *cobra.Command {
short := "Reset deletes all entities in Kong"
execute := executeReset
if deprecated {
short = "[deprecated] use 'kong reset' instead"
short = "[deprecated] use 'gateway reset' instead"
execute = func(cmd *cobra.Command, args []string) error {
cprint.UpdatePrintf("Warning: 'deck reset' is DEPRECATED and will be removed in a future version. " +
"Use 'deck kong reset' instead.\n")
"Use 'deck gateway reset' instead.\n")
return executeReset(cmd, args)
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/kong_sync.go → cmd/gateway_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func newSyncCmd(deprecated bool) *cobra.Command {

if deprecated {
use = "sync"
short = "[deprecated] use 'kong sync' instead"
short = "[deprecated] use 'gateway sync' instead"
execute = func(cmd *cobra.Command, args []string) error {
cprint.UpdatePrintf("Warning: 'deck sync' is DEPRECATED and will be removed in a future version. " +
"Use 'deck kong sync' instead.\n")
"Use 'deck gateway sync' instead.\n")
return executeSync(cmd, args)
}
argsValidator = validateNoArgs
Expand Down
6 changes: 3 additions & 3 deletions cmd/kong_validate.go → cmd/gateway_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ and alerts if there are broken relationships, or missing links present.

if deprecated {
use = "validate"
short = "[deprecated] use 'kong validate' instead"
short = "[deprecated] use 'gateway validate' instead"
long = `The validate command reads the state file and ensures validity.
It reads all the specified state files and reports YAML/JSON
parsing issues. It also checks for foreign relationships
Expand All @@ -106,7 +106,7 @@ this command unless --online flag is used.

execute = func(cmd *cobra.Command, args []string) error {
cprint.UpdatePrintf("Warning: 'deck validate' is DEPRECATED and will be removed in a future version. " +
"Use 'deck kong validate' instead.\n")
"Use 'deck gateway validate' instead.\n")
return executeValidate(cmd, args)
}
argsValidator = validateNoArgs
Expand All @@ -128,7 +128,7 @@ this command unless --online flag is used.
short = short + " (locally)"
long = long + "No communication takes places between decK and Kong during the execution of\n" +
"this command. This is faster than the online validation, but catches fewer errors.\n" +
"For online validation see 'deck kong validate'.\n"
"For online validation see 'deck gateway validate'.\n"
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ It can be used to export, import, or sync entities to Kong.`,
viper.BindPFlag("analytics",
rootCmd.PersistentFlags().Lookup("analytics"))

// TODO: everything below are online flags to be moved to the "kong" subcommand
// TODO: everything below are online flags to be moved to the "gateway" subcommand
// moving them now would break to top-level commands (sync, diff, etc) we still
// need for backward compatibility.
rootCmd.PersistentFlags().String("kong-addr", defaultKongURL,
Expand Down

0 comments on commit 0b68e88

Please sign in to comment.