feat: stub out remote and replication commands and subcommands (#254)

* feat: stubbed out remote and replication commands and subcommands

* refactor: renamed remote.go file to match command

* refactor: combined replication metrics and replication list subcommands into list only

* refactor: removed extra appends to pass lint check
This commit is contained in:
mcfarlm3 2021-09-03 13:17:18 -07:00 committed by GitHub
parent 65da55e3f3
commit 1ec4e1590b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 144 additions and 0 deletions

View File

@ -54,6 +54,8 @@ var app = cli.App{
newApplyCmd(),
newStacksCmd(),
newTemplateCmd(),
newRemoteCmd(),
newReplicationCmd(),
},
Before: withContext(),
}

71
cmd/influx/remote.go Normal file
View File

@ -0,0 +1,71 @@
package main
import (
"fmt"
"github.com/influxdata/influx-cli/v2/pkg/cli/middleware"
"github.com/urfave/cli"
)
func newRemoteCmd() cli.Command {
return cli.Command{
Name: "remote",
Usage: "Remote connection management commands",
Hidden: true, // Remove this line when all subcommands are completed
Subcommands: []cli.Command{
newRemoteCreateCmd(),
newRemoteDeleteCmd(),
newRemoteListCmd(),
newRemoteUpdateCmd(),
},
}
}
func newRemoteCreateCmd() cli.Command {
return cli.Command{
Name: "create",
Usage: "Create a new remote connection",
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("remote create command was called")
},
}
}
func newRemoteDeleteCmd() cli.Command {
return cli.Command{
Name: "delete",
Usage: "Delete an existing remote connection",
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("remote delete command was called")
},
}
}
func newRemoteListCmd() cli.Command {
return cli.Command{
Name: "list",
Usage: "List all remote connections",
Aliases: []string{"find", "ls"},
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("remote list command was called")
},
}
}
func newRemoteUpdateCmd() cli.Command {
return cli.Command{
Name: "update",
Usage: "Update an existing remote connection",
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("remote update command was called")
},
}
}

71
cmd/influx/replication.go Normal file
View File

@ -0,0 +1,71 @@
package main
import (
"fmt"
"github.com/influxdata/influx-cli/v2/pkg/cli/middleware"
"github.com/urfave/cli"
)
func newReplicationCmd() cli.Command {
return cli.Command{
Name: "replication",
Usage: "Replication stream management commands",
Hidden: true, // Remove this line when all subcommands are completed
Subcommands: []cli.Command{
newReplicationCreateCmd(),
newReplicationDeleteCmd(),
newReplicationListCmd(),
newReplicationUpdateCmd(),
},
}
}
func newReplicationCreateCmd() cli.Command {
return cli.Command{
Name: "create",
Usage: "Create a new replication stream",
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("replication create command was called")
},
}
}
func newReplicationDeleteCmd() cli.Command {
return cli.Command{
Name: "delete",
Usage: "Delete an existing replication stream",
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("replication delete command was called")
},
}
}
func newReplicationListCmd() cli.Command {
return cli.Command{
Name: "list",
Usage: "List all replication streams and corresponding metrics",
Aliases: []string{"find", "ls"},
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("replication list command was called")
},
}
}
func newReplicationUpdateCmd() cli.Command {
return cli.Command{
Name: "update",
Usage: "Update an existing replication stream",
Before: middleware.WithBeforeFns(withCli(), withApi(true), middleware.NoArgs),
Flags: commonFlags(),
Action: func(ctx *cli.Context) {
fmt.Println("replication update command was called")
},
}
}