From d6368a20cf0b8dea4d13b14ef4c0dc369ed23759 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Tue, 25 Jan 2022 15:31:50 +0100 Subject: [PATCH] etcdctl: Remove V2 API commands --- bill-of-materials.json | 27 -- etcdctl/ctlv2/command/auth_commands.go | 90 ------ etcdctl/ctlv2/command/backup_command.go | 54 ---- etcdctl/ctlv2/command/cluster_health.go | 140 -------- etcdctl/ctlv2/command/doc.go | 16 - etcdctl/ctlv2/command/error.go | 43 --- etcdctl/ctlv2/command/exec_watch_command.go | 127 -------- etcdctl/ctlv2/command/format.go | 60 ---- etcdctl/ctlv2/command/get_command.go | 67 ---- etcdctl/ctlv2/command/ls_command.go | 91 ------ etcdctl/ctlv2/command/member_commands.go | 207 ------------ etcdctl/ctlv2/command/mk_command.go | 77 ----- etcdctl/ctlv2/command/mkdir_command.go | 60 ---- etcdctl/ctlv2/command/rm_command.go | 64 ---- etcdctl/ctlv2/command/rmdir_command.go | 55 ---- etcdctl/ctlv2/command/role_commands.go | 255 --------------- etcdctl/ctlv2/command/set_command.go | 74 ----- etcdctl/ctlv2/command/set_dir_command.go | 36 --- etcdctl/ctlv2/command/update_command.go | 64 ---- etcdctl/ctlv2/command/update_dir_command.go | 58 ---- etcdctl/ctlv2/command/user_commands.go | 225 ------------- etcdctl/ctlv2/command/util.go | 341 -------------------- etcdctl/ctlv2/command/util_test.go | 70 ---- etcdctl/ctlv2/command/watch_command.go | 87 ----- etcdctl/ctlv2/ctl.go | 84 ----- etcdctl/go.mod | 26 +- etcdctl/go.sum | 75 ----- etcdctl/main.go | 42 +-- go.sum | 4 - tests/e2e/ctl_v3_test.go | 2 +- 30 files changed, 6 insertions(+), 2615 deletions(-) delete mode 100644 etcdctl/ctlv2/command/auth_commands.go delete mode 100644 etcdctl/ctlv2/command/backup_command.go delete mode 100644 etcdctl/ctlv2/command/cluster_health.go delete mode 100644 etcdctl/ctlv2/command/doc.go delete mode 100644 etcdctl/ctlv2/command/error.go delete mode 100644 etcdctl/ctlv2/command/exec_watch_command.go delete mode 100644 etcdctl/ctlv2/command/format.go delete mode 100644 etcdctl/ctlv2/command/get_command.go delete mode 100644 etcdctl/ctlv2/command/ls_command.go delete mode 100644 etcdctl/ctlv2/command/member_commands.go delete mode 100644 etcdctl/ctlv2/command/mk_command.go delete mode 100644 etcdctl/ctlv2/command/mkdir_command.go delete mode 100644 etcdctl/ctlv2/command/rm_command.go delete mode 100644 etcdctl/ctlv2/command/rmdir_command.go delete mode 100644 etcdctl/ctlv2/command/role_commands.go delete mode 100644 etcdctl/ctlv2/command/set_command.go delete mode 100644 etcdctl/ctlv2/command/set_dir_command.go delete mode 100644 etcdctl/ctlv2/command/update_command.go delete mode 100644 etcdctl/ctlv2/command/update_dir_command.go delete mode 100644 etcdctl/ctlv2/command/user_commands.go delete mode 100644 etcdctl/ctlv2/command/util.go delete mode 100644 etcdctl/ctlv2/command/util_test.go delete mode 100644 etcdctl/ctlv2/command/watch_command.go delete mode 100644 etcdctl/ctlv2/ctl.go diff --git a/bill-of-materials.json b/bill-of-materials.json index 083162c4f37..a76a248b26e 100644 --- a/bill-of-materials.json +++ b/bill-of-materials.json @@ -89,15 +89,6 @@ } ] }, - { - "project": "github.com/cpuguy83/go-md2man/v2/md2man", - "licenses": [ - { - "type": "MIT License", - "confidence": 1 - } - ] - }, { "project": "github.com/creack/pty", "licenses": [ @@ -323,15 +314,6 @@ } ] }, - { - "project": "github.com/russross/blackfriday/v2", - "licenses": [ - { - "type": "BSD 2-clause \"Simplified\" License", - "confidence": 0.9626168224299065 - } - ] - }, { "project": "github.com/sirupsen/logrus", "licenses": [ @@ -386,15 +368,6 @@ } ] }, - { - "project": "github.com/urfave/cli", - "licenses": [ - { - "type": "MIT License", - "confidence": 1 - } - ] - }, { "project": "github.com/xiang90/probing", "licenses": [ diff --git a/etcdctl/ctlv2/command/auth_commands.go b/etcdctl/ctlv2/command/auth_commands.go deleted file mode 100644 index fa19200ecfd..00000000000 --- a/etcdctl/ctlv2/command/auth_commands.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "fmt" - "os" - "strings" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" -) - -func NewAuthCommands() cli.Command { - return cli.Command{ - Name: "auth", - Usage: "overall auth controls", - Subcommands: []cli.Command{ - { - Name: "enable", - Usage: "enable auth access controls", - ArgsUsage: " ", - Action: actionAuthEnable, - }, - { - Name: "disable", - Usage: "disable auth access controls", - ArgsUsage: " ", - Action: actionAuthDisable, - }, - }, - } -} - -func actionAuthEnable(c *cli.Context) error { - authEnableDisable(c, true) - return nil -} - -func actionAuthDisable(c *cli.Context) error { - authEnableDisable(c, false) - return nil -} - -func mustNewAuthAPI(c *cli.Context) client.AuthAPI { - hc := mustNewClient(c) - - if c.GlobalBool("debug") { - fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", ")) - } - - return client.NewAuthAPI(hc) -} - -func authEnableDisable(c *cli.Context, enable bool) { - if len(c.Args()) != 0 { - fmt.Fprintln(os.Stderr, "No arguments accepted") - os.Exit(1) - } - s := mustNewAuthAPI(c) - ctx, cancel := contextWithTotalTimeout(c) - var err error - if enable { - err = s.Enable(ctx) - } else { - err = s.Disable(ctx) - } - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - if enable { - fmt.Println("Authentication Enabled") - } else { - fmt.Println("Authentication Disabled") - } -} diff --git a/etcdctl/ctlv2/command/backup_command.go b/etcdctl/ctlv2/command/backup_command.go deleted file mode 100644 index be77ea7a906..00000000000 --- a/etcdctl/ctlv2/command/backup_command.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "github.com/urfave/cli" - "go.etcd.io/etcd/etcdutl/v3/etcdutl" -) - -const ( - description = "Performs an offline backup of etcd directory.\n\n" + - "Moved to `./etcdutl backup` and going to be decomissioned in v3.5\n\n" + - "The recommended (online) backup command is: `./etcdctl snapshot save ...`.\n\n" -) - -func NewBackupCommand() cli.Command { - return cli.Command{ - Name: "backup", - Usage: "--data-dir=... --backup-dir={output}", - UsageText: "[deprecated] offline backup an etcd directory.", - Description: description, - Flags: []cli.Flag{ - cli.StringFlag{Name: "data-dir", Value: "", Usage: "Path to the etcd data dir"}, - cli.StringFlag{Name: "wal-dir", Value: "", Usage: "Path to the etcd wal dir"}, - cli.StringFlag{Name: "backup-dir", Value: "", Usage: "Path to the backup dir"}, - cli.StringFlag{Name: "backup-wal-dir", Value: "", Usage: "Path to the backup wal dir"}, - cli.BoolFlag{Name: "with-v3", Usage: "Backup v3 backend data"}, - }, - Action: handleBackup, - } -} - -func handleBackup(c *cli.Context) error { - etcdutl.HandleBackup( - c.Bool("with-v3"), - c.String("data-dir"), - c.String("backup-dir"), - c.String("wal-dir"), - c.String("backup-wal-dir"), - ) - return nil -} diff --git a/etcdctl/ctlv2/command/cluster_health.go b/etcdctl/ctlv2/command/cluster_health.go deleted file mode 100644 index 653be468548..00000000000 --- a/etcdctl/ctlv2/command/cluster_health.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "context" - "encoding/json" - "fmt" - "io" - "net/http" - "os" - "os/signal" - "time" - - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/urfave/cli" -) - -func NewClusterHealthCommand() cli.Command { - return cli.Command{ - Name: "cluster-health", - Usage: "check the health of the etcd cluster", - ArgsUsage: " ", - Flags: []cli.Flag{ - cli.BoolFlag{Name: "forever, f", Usage: "forever check the health every 10 second until CTRL+C"}, - }, - Action: handleClusterHealth, - } -} - -func handleClusterHealth(c *cli.Context) error { - forever := c.Bool("forever") - if forever { - sigch := make(chan os.Signal, 1) - signal.Notify(sigch, os.Interrupt) - - go func() { - <-sigch - os.Exit(0) - }() - } - - tr, err := getTransport(c) - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - hc := http.Client{ - Transport: tr, - } - - cln := mustNewClientNoSync(c) - mi := client.NewMembersAPI(cln) - ms, err := mi.List(context.TODO()) - if err != nil { - fmt.Println("cluster may be unhealthy: failed to list members") - handleError(c, cobrautl.ExitServerError, err) - } - - for { - healthyMembers := 0 - for _, m := range ms { - if len(m.ClientURLs) == 0 { - fmt.Printf("member %s is unreachable: no available published client urls\n", m.ID) - continue - } - - checked := false - for _, url := range m.ClientURLs { - resp, err := hc.Get(url + "/health") - if err != nil { - fmt.Printf("failed to check the health of member %s on %s: %v\n", m.ID, url, err) - continue - } - - result := struct{ Health string }{} - nresult := struct{ Health bool }{} - bytes, err := io.ReadAll(resp.Body) - if err != nil { - fmt.Printf("failed to check the health of member %s on %s: %v\n", m.ID, url, err) - continue - } - resp.Body.Close() - - err = json.Unmarshal(bytes, &result) - if err != nil { - err = json.Unmarshal(bytes, &nresult) - } - if err != nil { - fmt.Printf("failed to check the health of member %s on %s: %v\n", m.ID, url, err) - continue - } - - checked = true - if result.Health == "true" || nresult.Health { - fmt.Printf("member %s is healthy: got healthy result from %s\n", m.ID, url) - healthyMembers++ - } else { - fmt.Printf("member %s is unhealthy: got unhealthy result from %s\n", m.ID, url) - } - break - } - if !checked { - fmt.Printf("member %s is unreachable: %v are all unreachable\n", m.ID, m.ClientURLs) - } - } - switch healthyMembers { - case len(ms): - fmt.Println("cluster is healthy") - case 0: - fmt.Println("cluster is unavailable") - default: - fmt.Println("cluster is degraded") - } - - if !forever { - if healthyMembers == len(ms) { - os.Exit(cobrautl.ExitSuccess) - } - os.Exit(cobrautl.ExitClusterNotHealthy) - } - - fmt.Printf("\nnext check after 10 second...\n\n") - time.Sleep(10 * time.Second) - } -} diff --git a/etcdctl/ctlv2/command/doc.go b/etcdctl/ctlv2/command/doc.go deleted file mode 100644 index cedf3f762f6..00000000000 --- a/etcdctl/ctlv2/command/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package command is a set of libraries for etcdctl commands. -package command diff --git a/etcdctl/ctlv2/command/error.go b/etcdctl/ctlv2/command/error.go deleted file mode 100644 index 4403150af8c..00000000000 --- a/etcdctl/ctlv2/command/error.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "encoding/json" - "fmt" - "os" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" -) - -func handleError(c *cli.Context, code int, err error) { - if c.GlobalString("output") == "json" { - if err, ok := err.(*client.Error); ok { - b, err := json.Marshal(err) - if err != nil { - panic(err) - } - fmt.Fprintln(os.Stderr, string(b)) - os.Exit(code) - } - } - - fmt.Fprintln(os.Stderr, "Error: ", err) - if cerr, ok := err.(*client.ClusterError); ok { - fmt.Fprintln(os.Stderr, cerr.Detail()) - } - os.Exit(code) -} diff --git a/etcdctl/ctlv2/command/exec_watch_command.go b/etcdctl/ctlv2/command/exec_watch_command.go deleted file mode 100644 index 2b52d8a76c9..00000000000 --- a/etcdctl/ctlv2/command/exec_watch_command.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "context" - "errors" - "fmt" - "os" - "os/exec" - "os/signal" - - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/urfave/cli" -) - -// NewExecWatchCommand returns the CLI command for "exec-watch". -func NewExecWatchCommand() cli.Command { - return cli.Command{ - Name: "exec-watch", - Usage: "watch a key for changes and exec an executable", - ArgsUsage: " [args...]", - Flags: []cli.Flag{ - cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"}, - cli.BoolFlag{Name: "recursive, r", Usage: "watch all values for key and child keys"}, - }, - Action: func(c *cli.Context) error { - execWatchCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// execWatchCommandFunc executes the "exec-watch" command. -func execWatchCommandFunc(c *cli.Context, ki client.KeysAPI) { - args := c.Args() - argslen := len(args) - - if argslen < 2 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key and command to exec required")) - } - - var ( - key string - cmdArgs []string - ) - - foundSep := false - for i := range args { - if args[i] == "--" && i != 0 { - foundSep = true - break - } - } - - if foundSep { - key = args[0] - cmdArgs = args[2:] - } else { - // If no flag is parsed, the order of key and cmdArgs will be switched and - // args will not contain `--`. - key = args[argslen-1] - cmdArgs = args[:argslen-1] - } - - index := c.Uint64("after-index") - - recursive := c.Bool("recursive") - - sigch := make(chan os.Signal, 1) - signal.Notify(sigch, os.Interrupt) - - go func() { - <-sigch - os.Exit(0) - }() - - w := ki.Watcher(key, &client.WatcherOptions{AfterIndex: uint64(index), Recursive: recursive}) - - for { - resp, err := w.Next(context.TODO()) - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - if resp.Node.Dir { - fmt.Fprintf(os.Stderr, "Ignored dir %s change\n", resp.Node.Key) - continue - } - - cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) - cmd.Env = environResponse(resp, os.Environ()) - - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - go func() { - err := cmd.Start() - if err != nil { - fmt.Fprint(os.Stderr, err.Error()) - os.Exit(1) - } - cmd.Wait() - }() - } -} - -func environResponse(resp *client.Response, env []string) []string { - env = append(env, "ETCD_WATCH_ACTION="+resp.Action) - env = append(env, "ETCD_WATCH_MODIFIED_INDEX="+fmt.Sprintf("%d", resp.Node.ModifiedIndex)) - env = append(env, "ETCD_WATCH_KEY="+resp.Node.Key) - env = append(env, "ETCD_WATCH_VALUE="+resp.Node.Value) - return env -} diff --git a/etcdctl/ctlv2/command/format.go b/etcdctl/ctlv2/command/format.go deleted file mode 100644 index 58ca0eff838..00000000000 --- a/etcdctl/ctlv2/command/format.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "encoding/json" - "fmt" - "os" - - "go.etcd.io/etcd/client/v2" -) - -// printResponseKey only supports to print key correctly. -func printResponseKey(resp *client.Response, format string) { - // Format the result. - switch format { - case "simple": - if resp.Action != "delete" { - fmt.Println(resp.Node.Value) - } else { - fmt.Println("PrevNode.Value:", resp.PrevNode.Value) - } - case "extended": - // Extended prints in a rfc2822 style format - fmt.Println("Key:", resp.Node.Key) - fmt.Println("Created-Index:", resp.Node.CreatedIndex) - fmt.Println("Modified-Index:", resp.Node.ModifiedIndex) - - if resp.PrevNode != nil { - fmt.Println("PrevNode.Value:", resp.PrevNode.Value) - } - - fmt.Println("TTL:", resp.Node.TTL) - fmt.Println("Index:", resp.Index) - if resp.Action != "delete" { - fmt.Println("") - fmt.Println(resp.Node.Value) - } - case "json": - b, err := json.Marshal(resp) - if err != nil { - panic(err) - } - fmt.Println(string(b)) - default: - fmt.Fprintln(os.Stderr, "Unsupported output format:", format) - } -} diff --git a/etcdctl/ctlv2/command/get_command.go b/etcdctl/ctlv2/command/get_command.go deleted file mode 100644 index 9f158c9c909..00000000000 --- a/etcdctl/ctlv2/command/get_command.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - "fmt" - "os" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewGetCommand returns the CLI command for "get". -func NewGetCommand() cli.Command { - return cli.Command{ - Name: "get", - Usage: "retrieve the value of a key", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"}, - cli.BoolFlag{Name: "quorum, q", Usage: "require quorum for get request"}, - }, - Action: func(c *cli.Context) error { - getCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// getCommandFunc executes the "get" command. -func getCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - - key := c.Args()[0] - sorted := c.Bool("sort") - quorum := c.Bool("quorum") - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sorted, Quorum: quorum}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - if resp.Node.Dir { - fmt.Fprintln(os.Stderr, fmt.Sprintf("%s: is a directory", resp.Node.Key)) - os.Exit(1) - } - - printResponseKey(resp, c.GlobalString("output")) -} diff --git a/etcdctl/ctlv2/command/ls_command.go b/etcdctl/ctlv2/command/ls_command.go deleted file mode 100644 index cbc76ba1876..00000000000 --- a/etcdctl/ctlv2/command/ls_command.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "fmt" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -func NewLsCommand() cli.Command { - return cli.Command{ - Name: "ls", - Usage: "retrieve a directory", - ArgsUsage: "[key]", - Flags: []cli.Flag{ - cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"}, - cli.BoolFlag{Name: "recursive, r", Usage: "returns all key names recursively for the given path"}, - cli.BoolFlag{Name: "p", Usage: "append slash (/) to directories"}, - cli.BoolFlag{Name: "quorum, q", Usage: "require quorum for get request"}, - }, - Action: func(c *cli.Context) error { - lsCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// lsCommandFunc executes the "ls" command. -func lsCommandFunc(c *cli.Context, ki client.KeysAPI) { - key := "/" - if len(c.Args()) != 0 { - key = c.Args()[0] - } - - sort := c.Bool("sort") - recursive := c.Bool("recursive") - quorum := c.Bool("quorum") - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sort, Recursive: recursive, Quorum: quorum}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - printLs(c, resp) -} - -// printLs writes a response out in a manner similar to the `ls` command in unix. -// Non-empty directories list their contents and files list their name. -func printLs(c *cli.Context, resp *client.Response) { - if c.GlobalString("output") == "simple" { - if !resp.Node.Dir { - fmt.Println(resp.Node.Key) - } - for _, node := range resp.Node.Nodes { - rPrint(c, node) - } - } else { - // user wants JSON or extended output - printResponseKey(resp, c.GlobalString("output")) - } -} - -// rPrint recursively prints out the nodes in the node structure. -func rPrint(c *cli.Context, n *client.Node) { - if n.Dir && c.Bool("p") { - fmt.Println(fmt.Sprintf("%v/", n.Key)) - } else { - fmt.Println(n.Key) - } - - for _, node := range n.Nodes { - rPrint(c, node) - } -} diff --git a/etcdctl/ctlv2/command/member_commands.go b/etcdctl/ctlv2/command/member_commands.go deleted file mode 100644 index 0fc99fcdca0..00000000000 --- a/etcdctl/ctlv2/command/member_commands.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "fmt" - "os" - "strings" - - "github.com/urfave/cli" -) - -func NewMemberCommand() cli.Command { - return cli.Command{ - Name: "member", - Usage: "member add, remove and list subcommands", - Subcommands: []cli.Command{ - { - Name: "list", - Usage: "enumerate existing cluster members", - ArgsUsage: " ", - Action: actionMemberList, - }, - { - Name: "add", - Usage: "add a new member to the etcd cluster", - ArgsUsage: " ", - Action: actionMemberAdd, - }, - { - Name: "remove", - Usage: "remove an existing member from the etcd cluster", - ArgsUsage: "", - Action: actionMemberRemove, - }, - { - Name: "update", - Usage: "update an existing member in the etcd cluster", - ArgsUsage: " ", - Action: actionMemberUpdate, - }, - }, - } -} - -func actionMemberList(c *cli.Context) error { - if len(c.Args()) != 0 { - fmt.Fprintln(os.Stderr, "No arguments accepted") - os.Exit(1) - } - mAPI := mustNewMembersAPI(c) - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - - members, err := mAPI.List(ctx) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - leader, err := mAPI.Leader(ctx) - if err != nil { - fmt.Fprintln(os.Stderr, "Failed to get leader: ", err) - os.Exit(1) - } - - for _, m := range members { - isLeader := false - if m.ID == leader.ID { - isLeader = true - } - if len(m.Name) == 0 { - fmt.Printf("%s[unstarted]: peerURLs=%s\n", m.ID, strings.Join(m.PeerURLs, ",")) - } else { - fmt.Printf("%s: name=%s peerURLs=%s clientURLs=%s isLeader=%v\n", m.ID, m.Name, strings.Join(m.PeerURLs, ","), strings.Join(m.ClientURLs, ","), isLeader) - } - } - - return nil -} - -func actionMemberAdd(c *cli.Context) error { - args := c.Args() - if len(args) != 2 { - fmt.Fprintln(os.Stderr, "Provide a name and a single member peerURL") - os.Exit(1) - } - - mAPI := mustNewMembersAPI(c) - - url := args[1] - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - - m, err := mAPI.Add(ctx, url) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - newID := m.ID - newName := args[0] - fmt.Printf("Added member named %s with ID %s to cluster\n", newName, newID) - - members, err := mAPI.List(ctx) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - conf := []string{} - for _, memb := range members { - for _, u := range memb.PeerURLs { - n := memb.Name - if memb.ID == newID { - n = newName - } - conf = append(conf, fmt.Sprintf("%s=%s", n, u)) - } - } - - fmt.Print("\n") - fmt.Printf("ETCD_NAME=%q\n", newName) - fmt.Printf("ETCD_INITIAL_CLUSTER=%q\n", strings.Join(conf, ",")) - fmt.Printf("ETCD_INITIAL_CLUSTER_STATE=\"existing\"\n") - return nil -} - -func actionMemberRemove(c *cli.Context) error { - args := c.Args() - if len(args) != 1 { - fmt.Fprintln(os.Stderr, "Provide a single member ID") - os.Exit(1) - } - removalID := args[0] - - mAPI := mustNewMembersAPI(c) - - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - // Get the list of members. - members, err := mAPI.List(ctx) - if err != nil { - fmt.Fprintln(os.Stderr, "Error while verifying ID against known members:", err.Error()) - os.Exit(1) - } - // Sanity check the input. - foundID := false - for _, m := range members { - if m.ID == removalID { - foundID = true - } - if m.Name == removalID { - // Note that, so long as it's not ambiguous, we *could* do the right thing by name here. - fmt.Fprintf(os.Stderr, "Found a member named %s; if this is correct, please use its ID, eg:\n\tetcdctl member remove %s\n", m.Name, m.ID) - fmt.Fprintf(os.Stderr, "For more details, read the documentation at https://github.com/etcd-io/etcd/blob/main/Documentation/runtime-configuration.md#remove-a-member\n\n") - } - } - if !foundID { - fmt.Fprintf(os.Stderr, "Couldn't find a member in the cluster with an ID of %s.\n", removalID) - os.Exit(1) - } - - // Actually attempt to remove the member. - err = mAPI.Remove(ctx, removalID) - if err != nil { - fmt.Fprintf(os.Stderr, "Received an error trying to remove member %s: %s", removalID, err.Error()) - os.Exit(1) - } - - fmt.Printf("Removed member %s from cluster\n", removalID) - return nil -} - -func actionMemberUpdate(c *cli.Context) error { - args := c.Args() - if len(args) != 2 { - fmt.Fprintln(os.Stderr, "Provide an ID and a list of comma separated peerURL (0xabcd http://example.com,http://example1.com)") - os.Exit(1) - } - - mAPI := mustNewMembersAPI(c) - - mid := args[0] - urls := args[1] - ctx, cancel := contextWithTotalTimeout(c) - err := mAPI.Update(ctx, mid, strings.Split(urls, ",")) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("Updated member with ID %s in cluster\n", mid) - return nil -} diff --git a/etcdctl/ctlv2/command/mk_command.go b/etcdctl/ctlv2/command/mk_command.go deleted file mode 100644 index 1db24f16a64..00000000000 --- a/etcdctl/ctlv2/command/mk_command.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - "os" - "time" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewMakeCommand returns the CLI command for "mk". -func NewMakeCommand() cli.Command { - return cli.Command{ - Name: "mk", - Usage: "make a new key with a given value", - ArgsUsage: " ", - Flags: []cli.Flag{ - cli.BoolFlag{Name: "in-order", Usage: "create in-order key under directory "}, - cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live in seconds"}, - }, - Action: func(c *cli.Context) error { - mkCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// mkCommandFunc executes the "mk" command. -func mkCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - value, err := argOrStdin(c.Args(), os.Stdin, 1) - if err != nil { - handleError(c, cobrautl.ExitBadArgs, errors.New("value required")) - } - - ttl := c.Int("ttl") - inorder := c.Bool("in-order") - - var resp *client.Response - ctx, cancel := contextWithTotalTimeout(c) - if !inorder { - // Since PrevNoExist means that the Node must not exist previously, - // this Set method always creates a new key. Therefore, mk command - // succeeds only if the key did not previously exist, and the command - // prevents one from overwriting values accidentally. - resp, err = ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, PrevExist: client.PrevNoExist}) - } else { - // If in-order flag is specified then create an inorder key under - // the directory identified by the key argument. - resp, err = ki.CreateInOrder(ctx, key, value, &client.CreateInOrderOptions{TTL: time.Duration(ttl) * time.Second}) - } - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - printResponseKey(resp, c.GlobalString("output")) -} diff --git a/etcdctl/ctlv2/command/mkdir_command.go b/etcdctl/ctlv2/command/mkdir_command.go deleted file mode 100644 index 1a307601e92..00000000000 --- a/etcdctl/ctlv2/command/mkdir_command.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - "time" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewMakeDirCommand returns the CLI command for "mkdir". -func NewMakeDirCommand() cli.Command { - return cli.Command{ - Name: "mkdir", - Usage: "make a new directory", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live in seconds"}, - }, - Action: func(c *cli.Context) error { - mkdirCommandFunc(c, mustNewKeyAPI(c), client.PrevNoExist) - return nil - }, - } -} - -// mkdirCommandFunc executes the "mkdir" command. -func mkdirCommandFunc(c *cli.Context, ki client.KeysAPI, prevExist client.PrevExistType) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - - key := c.Args()[0] - ttl := c.Int("ttl") - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: prevExist}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - if c.GlobalString("output") != "simple" { - printResponseKey(resp, c.GlobalString("output")) - } -} diff --git a/etcdctl/ctlv2/command/rm_command.go b/etcdctl/ctlv2/command/rm_command.go deleted file mode 100644 index 45ccf4632fb..00000000000 --- a/etcdctl/ctlv2/command/rm_command.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewRemoveCommand returns the CLI command for "rm". -func NewRemoveCommand() cli.Command { - return cli.Command{ - Name: "rm", - Usage: "remove a key or a directory", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.BoolFlag{Name: "dir", Usage: "removes the key if it is an empty directory or a key-value pair"}, - cli.BoolFlag{Name: "recursive, r", Usage: "removes the key and all child keys(if it is a directory)"}, - cli.StringFlag{Name: "with-value", Value: "", Usage: "previous value"}, - cli.IntFlag{Name: "with-index", Value: 0, Usage: "previous index"}, - }, - Action: func(c *cli.Context) error { - rmCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// rmCommandFunc executes the "rm" command. -func rmCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - recursive := c.Bool("recursive") - dir := c.Bool("dir") - prevValue := c.String("with-value") - prevIndex := c.Int("with-index") - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Delete(ctx, key, &client.DeleteOptions{PrevIndex: uint64(prevIndex), PrevValue: prevValue, Dir: dir, Recursive: recursive}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - if !resp.Node.Dir || c.GlobalString("output") != "simple" { - printResponseKey(resp, c.GlobalString("output")) - } -} diff --git a/etcdctl/ctlv2/command/rmdir_command.go b/etcdctl/ctlv2/command/rmdir_command.go deleted file mode 100644 index c7f5c8edd69..00000000000 --- a/etcdctl/ctlv2/command/rmdir_command.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewRemoveDirCommand returns the CLI command for "rmdir". -func NewRemoveDirCommand() cli.Command { - return cli.Command{ - Name: "rmdir", - Usage: "removes the key if it is an empty directory or a key-value pair", - ArgsUsage: "", - Action: func(c *cli.Context) error { - rmdirCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// rmdirCommandFunc executes the "rmdir" command. -func rmdirCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Delete(ctx, key, &client.DeleteOptions{Dir: true}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - if !resp.Node.Dir || c.GlobalString("output") != "simple" { - printResponseKey(resp, c.GlobalString("output")) - } -} diff --git a/etcdctl/ctlv2/command/role_commands.go b/etcdctl/ctlv2/command/role_commands.go deleted file mode 100644 index 498739c4583..00000000000 --- a/etcdctl/ctlv2/command/role_commands.go +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "fmt" - "os" - "reflect" - "strings" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/pkg/v3/pathutil" - "go.etcd.io/etcd/client/v2" -) - -func NewRoleCommands() cli.Command { - return cli.Command{ - Name: "role", - Usage: "role add, grant and revoke subcommands", - Subcommands: []cli.Command{ - { - Name: "add", - Usage: "add a new role for the etcd cluster", - ArgsUsage: " ", - Action: actionRoleAdd, - }, - { - Name: "get", - Usage: "get details for a role", - ArgsUsage: "", - Action: actionRoleGet, - }, - { - Name: "list", - Usage: "list all roles", - ArgsUsage: " ", - Action: actionRoleList, - }, - { - Name: "remove", - Usage: "remove a role from the etcd cluster", - ArgsUsage: "", - Action: actionRoleRemove, - }, - { - Name: "grant", - Usage: "grant path matches to an etcd role", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.StringFlag{Name: "path", Value: "", Usage: "Path granted for the role to access"}, - cli.BoolFlag{Name: "read", Usage: "Grant read-only access"}, - cli.BoolFlag{Name: "write", Usage: "Grant write-only access"}, - cli.BoolFlag{Name: "readwrite, rw", Usage: "Grant read-write access"}, - }, - Action: actionRoleGrant, - }, - { - Name: "revoke", - Usage: "revoke path matches for an etcd role", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.StringFlag{Name: "path", Value: "", Usage: "Path revoked for the role to access"}, - cli.BoolFlag{Name: "read", Usage: "Revoke read access"}, - cli.BoolFlag{Name: "write", Usage: "Revoke write access"}, - cli.BoolFlag{Name: "readwrite, rw", Usage: "Revoke read-write access"}, - }, - Action: actionRoleRevoke, - }, - }, - } -} - -func mustNewAuthRoleAPI(c *cli.Context) client.AuthRoleAPI { - hc := mustNewClient(c) - - if c.GlobalBool("debug") { - fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", ")) - } - - return client.NewAuthRoleAPI(hc) -} - -func actionRoleList(c *cli.Context) error { - if len(c.Args()) != 0 { - fmt.Fprintln(os.Stderr, "No arguments accepted") - os.Exit(1) - } - r := mustNewAuthRoleAPI(c) - ctx, cancel := contextWithTotalTimeout(c) - roles, err := r.ListRoles(ctx) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - for _, role := range roles { - fmt.Printf("%s\n", role) - } - - return nil -} - -func actionRoleAdd(c *cli.Context) error { - api, role := mustRoleAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - currentRole, _ := api.GetRole(ctx, role) - if currentRole != nil { - fmt.Fprintf(os.Stderr, "Role %s already exists\n", role) - os.Exit(1) - } - - err := api.AddRole(ctx, role) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("Role %s created\n", role) - return nil -} - -func actionRoleRemove(c *cli.Context) error { - api, role := mustRoleAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - err := api.RemoveRole(ctx, role) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("Role %s removed\n", role) - return nil -} - -func actionRoleGrant(c *cli.Context) error { - roleGrantRevoke(c, true) - return nil -} - -func actionRoleRevoke(c *cli.Context) error { - roleGrantRevoke(c, false) - return nil -} - -func roleGrantRevoke(c *cli.Context, grant bool) { - path := c.String("path") - if path == "" { - fmt.Fprintln(os.Stderr, "No path specified; please use `--path`") - os.Exit(1) - } - if pathutil.CanonicalURLPath(path) != path { - fmt.Fprintf(os.Stderr, "Not canonical path; please use `--path=%s`\n", pathutil.CanonicalURLPath(path)) - os.Exit(1) - } - - read := c.Bool("read") - write := c.Bool("write") - rw := c.Bool("readwrite") - permcount := 0 - for _, v := range []bool{read, write, rw} { - if v { - permcount++ - } - } - if permcount != 1 { - fmt.Fprintln(os.Stderr, "Please specify exactly one of --read, --write or --readwrite") - os.Exit(1) - } - var permType client.PermissionType - switch { - case read: - permType = client.ReadPermission - case write: - permType = client.WritePermission - case rw: - permType = client.ReadWritePermission - } - - api, role := mustRoleAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - currentRole, err := api.GetRole(ctx, role) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - var newRole *client.Role - if grant { - newRole, err = api.GrantRoleKV(ctx, role, []string{path}, permType) - } else { - newRole, err = api.RevokeRoleKV(ctx, role, []string{path}, permType) - } - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - if reflect.DeepEqual(newRole, currentRole) { - if grant { - fmt.Printf("Role unchanged; already granted") - } else { - fmt.Printf("Role unchanged; already revoked") - } - } - - fmt.Printf("Role %s updated\n", role) -} - -func actionRoleGet(c *cli.Context) error { - api, rolename := mustRoleAPIAndName(c) - - ctx, cancel := contextWithTotalTimeout(c) - role, err := api.GetRole(ctx, rolename) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - fmt.Printf("Role: %s\n", role.Role) - fmt.Printf("KV Read:\n") - for _, v := range role.Permissions.KV.Read { - fmt.Printf("\t%s\n", v) - } - fmt.Printf("KV Write:\n") - for _, v := range role.Permissions.KV.Write { - fmt.Printf("\t%s\n", v) - } - return nil -} - -func mustRoleAPIAndName(c *cli.Context) (client.AuthRoleAPI, string) { - args := c.Args() - if len(args) != 1 { - fmt.Fprintln(os.Stderr, "Please provide a role name") - os.Exit(1) - } - - name := args[0] - api := mustNewAuthRoleAPI(c) - return api, name -} diff --git a/etcdctl/ctlv2/command/set_command.go b/etcdctl/ctlv2/command/set_command.go deleted file mode 100644 index 372c5b96cac..00000000000 --- a/etcdctl/ctlv2/command/set_command.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - "os" - "time" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewSetCommand returns the CLI command for "set". -func NewSetCommand() cli.Command { - return cli.Command{ - Name: "set", - Usage: "set the value of a key", - ArgsUsage: " ", - Description: `Set sets the value of a key. - - When begins with '-', is interpreted as a flag. - Insert '--' for workaround: - - $ set -- `, - Flags: []cli.Flag{ - cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live in seconds"}, - cli.StringFlag{Name: "swap-with-value", Value: "", Usage: "previous value"}, - cli.IntFlag{Name: "swap-with-index", Value: 0, Usage: "previous index"}, - }, - Action: func(c *cli.Context) error { - setCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// setCommandFunc executes the "set" command. -func setCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - value, err := argOrStdin(c.Args(), os.Stdin, 1) - if err != nil { - handleError(c, cobrautl.ExitBadArgs, errors.New("value required")) - } - - ttl := c.Int("ttl") - prevValue := c.String("swap-with-value") - prevIndex := c.Int("swap-with-index") - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, PrevIndex: uint64(prevIndex), PrevValue: prevValue}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - printResponseKey(resp, c.GlobalString("output")) -} diff --git a/etcdctl/ctlv2/command/set_dir_command.go b/etcdctl/ctlv2/command/set_dir_command.go deleted file mode 100644 index ed85ad57aa5..00000000000 --- a/etcdctl/ctlv2/command/set_dir_command.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" -) - -// NewSetDirCommand returns the CLI command for "setDir". -func NewSetDirCommand() cli.Command { - return cli.Command{ - Name: "setdir", - Usage: "create a new directory or update an existing directory TTL", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live in seconds"}, - }, - Action: func(c *cli.Context) error { - mkdirCommandFunc(c, mustNewKeyAPI(c), client.PrevIgnore) - return nil - }, - } -} diff --git a/etcdctl/ctlv2/command/update_command.go b/etcdctl/ctlv2/command/update_command.go deleted file mode 100644 index 71cd6ce662d..00000000000 --- a/etcdctl/ctlv2/command/update_command.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - "os" - "time" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewUpdateCommand returns the CLI command for "update". -func NewUpdateCommand() cli.Command { - return cli.Command{ - Name: "update", - Usage: "update an existing key with a given value", - ArgsUsage: " ", - Flags: []cli.Flag{ - cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live in seconds"}, - }, - Action: func(c *cli.Context) error { - updateCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// updateCommandFunc executes the "update" command. -func updateCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - value, err := argOrStdin(c.Args(), os.Stdin, 1) - if err != nil { - handleError(c, cobrautl.ExitBadArgs, errors.New("value required")) - } - - ttl := c.Int("ttl") - - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, PrevExist: client.PrevExist}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - - printResponseKey(resp, c.GlobalString("output")) -} diff --git a/etcdctl/ctlv2/command/update_dir_command.go b/etcdctl/ctlv2/command/update_dir_command.go deleted file mode 100644 index e1fd61777b6..00000000000 --- a/etcdctl/ctlv2/command/update_dir_command.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "errors" - "time" - - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" -) - -// NewUpdateDirCommand returns the CLI command for "updatedir". -func NewUpdateDirCommand() cli.Command { - return cli.Command{ - Name: "updatedir", - Usage: "update an existing directory", - ArgsUsage: " ", - Flags: []cli.Flag{ - cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live in seconds"}, - }, - Action: func(c *cli.Context) error { - updatedirCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// updatedirCommandFunc executes the "updatedir" command. -func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - ttl := c.Int("ttl") - ctx, cancel := contextWithTotalTimeout(c) - resp, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist}) - cancel() - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - if c.GlobalString("output") != "simple" { - printResponseKey(resp, c.GlobalString("output")) - } -} diff --git a/etcdctl/ctlv2/command/user_commands.go b/etcdctl/ctlv2/command/user_commands.go deleted file mode 100644 index 5da11753bfb..00000000000 --- a/etcdctl/ctlv2/command/user_commands.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "fmt" - "os" - "strings" - - "github.com/bgentry/speakeasy" - "github.com/urfave/cli" - "go.etcd.io/etcd/client/v2" -) - -func NewUserCommands() cli.Command { - return cli.Command{ - Name: "user", - Usage: "user add, grant and revoke subcommands", - Subcommands: []cli.Command{ - { - Name: "add", - Usage: "add a new user for the etcd cluster", - ArgsUsage: "", - Action: actionUserAdd, - }, - { - Name: "get", - Usage: "get details for a user", - ArgsUsage: "", - Action: actionUserGet, - }, - { - Name: "list", - Usage: "list all current users", - ArgsUsage: "", - Action: actionUserList, - }, - { - Name: "remove", - Usage: "remove a user for the etcd cluster", - ArgsUsage: "", - Action: actionUserRemove, - }, - { - Name: "grant", - Usage: "grant roles to an etcd user", - ArgsUsage: "", - Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}}, - Action: actionUserGrant, - }, - { - Name: "revoke", - Usage: "revoke roles for an etcd user", - ArgsUsage: "", - Flags: []cli.Flag{cli.StringSliceFlag{Name: "roles", Value: new(cli.StringSlice), Usage: "List of roles to grant or revoke"}}, - Action: actionUserRevoke, - }, - { - Name: "passwd", - Usage: "change password for a user", - ArgsUsage: "", - Action: actionUserPasswd, - }, - }, - } -} - -func mustNewAuthUserAPI(c *cli.Context) client.AuthUserAPI { - hc := mustNewClient(c) - - if c.GlobalBool("debug") { - fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", ")) - } - - return client.NewAuthUserAPI(hc) -} - -func actionUserList(c *cli.Context) error { - if len(c.Args()) != 0 { - fmt.Fprintln(os.Stderr, "No arguments accepted") - os.Exit(1) - } - u := mustNewAuthUserAPI(c) - ctx, cancel := contextWithTotalTimeout(c) - users, err := u.ListUsers(ctx) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - for _, user := range users { - fmt.Printf("%s\n", user) - } - return nil -} - -func actionUserAdd(c *cli.Context) error { - api, userarg := mustUserAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - user, _, _ := getUsernamePassword("", userarg+":") - - _, pass, err := getUsernamePassword("New password: ", userarg) - if err != nil { - fmt.Fprintln(os.Stderr, "Error reading password:", err) - os.Exit(1) - } - err = api.AddUser(ctx, user, pass) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("User %s created\n", user) - return nil -} - -func actionUserRemove(c *cli.Context) error { - api, user := mustUserAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - err := api.RemoveUser(ctx, user) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("User %s removed\n", user) - return nil -} - -func actionUserPasswd(c *cli.Context) error { - api, user := mustUserAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - pass, err := speakeasy.Ask("New password: ") - if err != nil { - fmt.Fprintln(os.Stderr, "Error reading password:", err) - os.Exit(1) - } - - _, err = api.ChangePassword(ctx, user, pass) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("Password updated\n") - return nil -} - -func actionUserGrant(c *cli.Context) error { - userGrantRevoke(c, true) - return nil -} - -func actionUserRevoke(c *cli.Context) error { - userGrantRevoke(c, false) - return nil -} - -func userGrantRevoke(c *cli.Context, grant bool) { - roles := c.StringSlice("roles") - if len(roles) == 0 { - fmt.Fprintln(os.Stderr, "No roles specified; please use `--roles`") - os.Exit(1) - } - - ctx, cancel := contextWithTotalTimeout(c) - defer cancel() - - api, user := mustUserAPIAndName(c) - var err error - if grant { - _, err = api.GrantUser(ctx, user, roles) - } else { - _, err = api.RevokeUser(ctx, user, roles) - } - - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - fmt.Printf("User %s updated\n", user) -} - -func actionUserGet(c *cli.Context) error { - api, username := mustUserAPIAndName(c) - ctx, cancel := contextWithTotalTimeout(c) - user, err := api.GetUser(ctx, username) - cancel() - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - fmt.Printf("User: %s\n", user.User) - fmt.Printf("Roles: %s\n", strings.Join(user.Roles, " ")) - return nil -} - -func mustUserAPIAndName(c *cli.Context) (client.AuthUserAPI, string) { - args := c.Args() - if len(args) != 1 { - fmt.Fprintln(os.Stderr, "Please provide a username") - os.Exit(1) - } - - api := mustNewAuthUserAPI(c) - username := args[0] - return api, username -} diff --git a/etcdctl/ctlv2/command/util.go b/etcdctl/ctlv2/command/util.go deleted file mode 100644 index 7db2df56f62..00000000000 --- a/etcdctl/ctlv2/command/util.go +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "context" - "errors" - "fmt" - "io" - "net" - "net/http" - "net/url" - "os" - "strings" - "syscall" - "time" - - "go.etcd.io/etcd/client/pkg/v3/transport" - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/bgentry/speakeasy" - "github.com/urfave/cli" -) - -var ( - ErrNoAvailSrc = errors.New("no available argument and stdin") - - // the maximum amount of time a dial will wait for a connection to setup. - // 30s is long enough for most of the network conditions. - defaultDialTimeout = 30 * time.Second -) - -func argOrStdin(args []string, stdin io.Reader, i int) (string, error) { - if i < len(args) { - return args[i], nil - } - bytes, err := io.ReadAll(stdin) - if string(bytes) == "" || err != nil { - return "", ErrNoAvailSrc - } - return string(bytes), nil -} - -func getPeersFlagValue(c *cli.Context) []string { - peerstr := c.GlobalString("endpoints") - - if peerstr == "" { - peerstr = os.Getenv("ETCDCTL_ENDPOINTS") - } - - if peerstr == "" { - peerstr = c.GlobalString("endpoint") - } - - if peerstr == "" { - peerstr = os.Getenv("ETCDCTL_ENDPOINT") - } - - if peerstr == "" { - peerstr = c.GlobalString("peers") - } - - if peerstr == "" { - peerstr = os.Getenv("ETCDCTL_PEERS") - } - - // If we still don't have peers, use a default - if peerstr == "" { - peerstr = "http://127.0.0.1:2379,http://127.0.0.1:4001" - } - - return strings.Split(peerstr, ",") -} - -func getDomainDiscoveryFlagValue(c *cli.Context) ([]string, error) { - domainstr, insecure, serviceName := getDiscoveryDomain(c) - - // If we still don't have domain discovery, return nothing - if domainstr == "" { - return []string{}, nil - } - - discoverer := client.NewSRVDiscover() - eps, err := discoverer.Discover(domainstr, serviceName) - if err != nil { - return nil, err - } - if insecure { - return eps, err - } - // strip insecure connections - ret := []string{} - for _, ep := range eps { - if strings.HasPrefix(ep, "http://") { - fmt.Fprintf(os.Stderr, "ignoring discovered insecure endpoint %q\n", ep) - continue - } - ret = append(ret, ep) - } - return ret, err -} - -func getDiscoveryDomain(c *cli.Context) (domainstr string, insecure bool, serviceName string) { - domainstr = c.GlobalString("discovery-srv") - // Use an environment variable if nothing was supplied on the - // command line - if domainstr == "" { - domainstr = os.Getenv("ETCDCTL_DISCOVERY_SRV") - } - insecure = c.GlobalBool("insecure-discovery") || (os.Getenv("ETCDCTL_INSECURE_DISCOVERY") != "") - serviceName = c.GlobalString("discovery-srv-name") - if serviceName == "" { - serviceName = os.Getenv("ETCDCTL_DISCOVERY_SRV_NAME") - } - return domainstr, insecure, serviceName -} - -func getEndpoints(c *cli.Context) ([]string, error) { - eps, err := getDomainDiscoveryFlagValue(c) - if err != nil { - return nil, err - } - - // If domain discovery returns no endpoints, check peer flag - if len(eps) == 0 { - eps = getPeersFlagValue(c) - } - - for i, ep := range eps { - u, err := url.Parse(ep) - if err != nil { - return nil, err - } - - if u.Scheme == "" { - u.Scheme = "http" - } - - eps[i] = u.String() - } - - return eps, nil -} - -func getTransport(c *cli.Context) (*http.Transport, error) { - cafile := c.GlobalString("ca-file") - certfile := c.GlobalString("cert-file") - keyfile := c.GlobalString("key-file") - - // Use an environment variable if nothing was supplied on the - // command line - if cafile == "" { - cafile = os.Getenv("ETCDCTL_CA_FILE") - } - if certfile == "" { - certfile = os.Getenv("ETCDCTL_CERT_FILE") - } - if keyfile == "" { - keyfile = os.Getenv("ETCDCTL_KEY_FILE") - } - - discoveryDomain, insecure, _ := getDiscoveryDomain(c) - if insecure { - discoveryDomain = "" - } - tls := transport.TLSInfo{ - CertFile: certfile, - KeyFile: keyfile, - ServerName: discoveryDomain, - TrustedCAFile: cafile, - } - - dialTimeout := defaultDialTimeout - totalTimeout := c.GlobalDuration("total-timeout") - if totalTimeout != 0 && totalTimeout < dialTimeout { - dialTimeout = totalTimeout - } - return transport.NewTransport(tls, dialTimeout) -} - -func getUsernamePasswordFromFlag(usernameFlag string) (username string, password string, err error) { - return getUsernamePassword("Password: ", usernameFlag) -} - -func getUsernamePassword(prompt, usernameFlag string) (username string, password string, err error) { - colon := strings.Index(usernameFlag, ":") - if colon == -1 { - username = usernameFlag - // Prompt for the password. - password, err = speakeasy.Ask(prompt) - if err != nil { - return "", "", err - } - } else { - username = usernameFlag[:colon] - password = usernameFlag[colon+1:] - } - return username, password, nil -} - -func mustNewKeyAPI(c *cli.Context) client.KeysAPI { - return client.NewKeysAPI(mustNewClient(c)) -} - -func mustNewMembersAPI(c *cli.Context) client.MembersAPI { - return client.NewMembersAPI(mustNewClient(c)) -} - -func mustNewClient(c *cli.Context) client.Client { - hc, err := newClient(c) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - debug := c.GlobalBool("debug") - if debug { - client.EnablecURLDebug() - } - - if !c.GlobalBool("no-sync") { - if debug { - fmt.Fprintf(os.Stderr, "start to sync cluster using endpoints(%s)\n", strings.Join(hc.Endpoints(), ",")) - } - ctx, cancel := contextWithTotalTimeout(c) - err := hc.Sync(ctx) - cancel() - if err != nil { - if err == client.ErrNoEndpoints { - fmt.Fprintf(os.Stderr, "etcd cluster has no published client endpoints.\n") - fmt.Fprintf(os.Stderr, "Try '--no-sync' if you want to access non-published client endpoints(%s).\n", strings.Join(hc.Endpoints(), ",")) - handleError(c, cobrautl.ExitServerError, err) - } - if isConnectionError(err) { - handleError(c, cobrautl.ExitBadConnection, err) - } - } - if debug { - fmt.Fprintf(os.Stderr, "got endpoints(%s) after sync\n", strings.Join(hc.Endpoints(), ",")) - } - } - - if debug { - fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", ")) - } - - return hc -} - -func isConnectionError(err error) bool { - switch t := err.(type) { - case *client.ClusterError: - for _, cerr := range t.Errors { - if !isConnectionError(cerr) { - return false - } - } - return true - case *net.OpError: - if t.Op == "dial" || t.Op == "read" { - return true - } - return isConnectionError(t.Err) - case syscall.Errno: - if t == syscall.ECONNREFUSED { - return true - } - case net.Error: - if t.Timeout() { - return true - } - } - return false -} - -func mustNewClientNoSync(c *cli.Context) client.Client { - hc, err := newClient(c) - if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) - } - - if c.GlobalBool("debug") { - fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", ")) - client.EnablecURLDebug() - } - - return hc -} - -func newClient(c *cli.Context) (client.Client, error) { - eps, err := getEndpoints(c) - if err != nil { - return nil, err - } - - tr, err := getTransport(c) - if err != nil { - return nil, err - } - - cfg := client.Config{ - Transport: tr, - Endpoints: eps, - HeaderTimeoutPerRequest: c.GlobalDuration("timeout"), - } - - uFlag := c.GlobalString("username") - - if uFlag == "" { - uFlag = os.Getenv("ETCDCTL_USERNAME") - } - - if uFlag != "" { - username, password, err := getUsernamePasswordFromFlag(uFlag) - if err != nil { - return nil, err - } - cfg.Username = username - cfg.Password = password - } - - return client.New(cfg) -} - -func contextWithTotalTimeout(c *cli.Context) (context.Context, context.CancelFunc) { - return context.WithTimeout(context.Background(), c.GlobalDuration("total-timeout")) -} diff --git a/etcdctl/ctlv2/command/util_test.go b/etcdctl/ctlv2/command/util_test.go deleted file mode 100644 index 7f9bed8dcd2..00000000000 --- a/etcdctl/ctlv2/command/util_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "bytes" - "testing" -) - -func TestArgOrStdin(t *testing.T) { - tests := []struct { - args []string - stdin string - i int - w string - we error - }{ - { - args: []string{ - "a", - }, - stdin: "b", - i: 0, - w: "a", - we: nil, - }, - { - args: []string{ - "a", - }, - stdin: "b", - i: 1, - w: "b", - we: nil, - }, - { - args: []string{ - "a", - }, - stdin: "", - i: 1, - w: "", - we: ErrNoAvailSrc, - }, - } - - for i, tt := range tests { - var b bytes.Buffer - b.Write([]byte(tt.stdin)) - g, ge := argOrStdin(tt.args, &b, tt.i) - if g != tt.w { - t.Errorf("#%d: expect %v, not %v", i, tt.w, g) - } - if ge != tt.we { - t.Errorf("#%d: expect %v, not %v", i, tt.we, ge) - } - } -} diff --git a/etcdctl/ctlv2/command/watch_command.go b/etcdctl/ctlv2/command/watch_command.go deleted file mode 100644 index 3af28934216..00000000000 --- a/etcdctl/ctlv2/command/watch_command.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package command - -import ( - "context" - "errors" - "fmt" - "os" - "os/signal" - - "go.etcd.io/etcd/client/v2" - "go.etcd.io/etcd/pkg/v3/cobrautl" - - "github.com/urfave/cli" -) - -// NewWatchCommand returns the CLI command for "watch". -func NewWatchCommand() cli.Command { - return cli.Command{ - Name: "watch", - Usage: "watch a key for changes", - ArgsUsage: "", - Flags: []cli.Flag{ - cli.BoolFlag{Name: "forever, f", Usage: "forever watch a key until CTRL+C"}, - cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"}, - cli.BoolFlag{Name: "recursive, r", Usage: "returns all values for key and child keys"}, - }, - Action: func(c *cli.Context) error { - watchCommandFunc(c, mustNewKeyAPI(c)) - return nil - }, - } -} - -// watchCommandFunc executes the "watch" command. -func watchCommandFunc(c *cli.Context, ki client.KeysAPI) { - if len(c.Args()) == 0 { - handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) - } - key := c.Args()[0] - recursive := c.Bool("recursive") - forever := c.Bool("forever") - index := c.Int("after-index") - - stop := false - w := ki.Watcher(key, &client.WatcherOptions{AfterIndex: uint64(index), Recursive: recursive}) - - sigch := make(chan os.Signal, 1) - signal.Notify(sigch, os.Interrupt) - - go func() { - <-sigch - os.Exit(0) - }() - - for !stop { - resp, err := w.Next(context.TODO()) - if err != nil { - handleError(c, cobrautl.ExitServerError, err) - } - if resp.Node.Dir { - continue - } - if recursive { - fmt.Printf("[%s] %s\n", resp.Action, resp.Node.Key) - } - - printResponseKey(resp, c.GlobalString("output")) - - if !forever { - stop = true - } - } -} diff --git a/etcdctl/ctlv2/ctl.go b/etcdctl/ctlv2/ctl.go deleted file mode 100644 index 981da0d9f8a..00000000000 --- a/etcdctl/ctlv2/ctl.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2015 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package ctlv2 contains the main entry point for the etcdctl for v2 API. -package ctlv2 - -import ( - "fmt" - "os" - "time" - - "go.etcd.io/etcd/api/v3/version" - "go.etcd.io/etcd/etcdctl/v3/ctlv2/command" - - "github.com/urfave/cli" -) - -func Start() error { - app := cli.NewApp() - app.Name = "etcdctl" - app.Version = version.Version - cli.VersionPrinter = func(c *cli.Context) { - fmt.Fprintf(c.App.Writer, "etcdctl version: %v\n", c.App.Version) - fmt.Fprintln(c.App.Writer, "API version: 2") - } - app.Usage = "A simple command line client for etcd." - - app.Flags = []cli.Flag{ - cli.BoolFlag{Name: "debug", Usage: "output cURL commands which can be used to reproduce the request"}, - cli.BoolFlag{Name: "no-sync", Usage: "don't synchronize cluster information before sending request"}, - cli.StringFlag{Name: "output, o", Value: "simple", Usage: "output response in the given format (`simple`, `extended` or `json`)"}, - cli.StringFlag{Name: "discovery-srv, D", Usage: "domain name to query for SRV records describing cluster endpoints"}, - cli.BoolFlag{Name: "insecure-discovery", Usage: "accept insecure SRV records describing cluster endpoints"}, - cli.StringFlag{Name: "peers, C", Value: "", Usage: "DEPRECATED - \"--endpoints\" should be used instead"}, - cli.StringFlag{Name: "endpoint", Value: "", Usage: "DEPRECATED - \"--endpoints\" should be used instead"}, - cli.StringFlag{Name: "endpoints", Value: "", Usage: "a comma-delimited list of machine addresses in the cluster (default: \"http://127.0.0.1:2379,http://127.0.0.1:4001\")"}, - cli.StringFlag{Name: "cert-file", Value: "", Usage: "identify HTTPS client using this SSL certificate file"}, - cli.StringFlag{Name: "key-file", Value: "", Usage: "identify HTTPS client using this SSL key file"}, - cli.StringFlag{Name: "ca-file", Value: "", Usage: "verify certificates of HTTPS-enabled servers using this CA bundle"}, - cli.StringFlag{Name: "username, u", Value: "", Usage: "provide username[:password] and prompt if password is not supplied."}, - cli.DurationFlag{Name: "timeout", Value: 2 * time.Second, Usage: "connection timeout per request"}, - cli.DurationFlag{Name: "total-timeout", Value: 5 * time.Second, Usage: "timeout for the command execution (except watch)"}, - } - app.Commands = []cli.Command{ - command.NewBackupCommand(), - command.NewClusterHealthCommand(), - command.NewMakeCommand(), - command.NewMakeDirCommand(), - command.NewRemoveCommand(), - command.NewRemoveDirCommand(), - command.NewGetCommand(), - command.NewLsCommand(), - command.NewSetCommand(), - command.NewSetDirCommand(), - command.NewUpdateCommand(), - command.NewUpdateDirCommand(), - command.NewWatchCommand(), - command.NewExecWatchCommand(), - command.NewMemberCommand(), - command.NewUserCommands(), - command.NewRoleCommands(), - command.NewAuthCommands(), - } - return app.Run(os.Args) -} - -func MustStart() { - err := Start() - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} diff --git a/etcdctl/go.mod b/etcdctl/go.mod index a2d3c8bc7fa..18c5867c2ca 100644 --- a/etcdctl/go.mod +++ b/etcdctl/go.mod @@ -8,12 +8,9 @@ require ( github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 - github.com/urfave/cli v1.22.4 go.etcd.io/etcd/api/v3 v3.6.0-alpha.0 go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 - go.etcd.io/etcd/client/v2 v2.306.0-alpha.0 go.etcd.io/etcd/client/v3 v3.6.0-alpha.0 - go.etcd.io/etcd/etcdutl/v3 v3.6.0-alpha.0 go.etcd.io/etcd/pkg/v3 v3.6.0-alpha.0 go.uber.org/zap v1.17.0 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba @@ -22,42 +19,23 @@ require ( ) require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/fatih/color v1.13.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/btree v1.0.1 // indirect + github.com/google/go-cmp v0.5.6 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/jonboulle/clockwork v0.2.2 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_golang v1.12.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.32.1 // indirect - github.com/prometheus/procfs v0.7.3 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - go.etcd.io/etcd/raft/v3 v3.6.0-alpha.0 // indirect - go.etcd.io/etcd/server/v3 v3.6.0-alpha.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.26.1 // indirect - go.opentelemetry.io/otel v1.2.0 // indirect - go.opentelemetry.io/otel/trace v1.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.7.0 // indirect - golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect google.golang.org/protobuf v1.27.1 // indirect - sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect ) replace ( diff --git a/etcdctl/go.sum b/etcdctl/go.sum index f2f5983219b..def36405d7c 100644 --- a/etcdctl/go.sum +++ b/etcdctl/go.sum @@ -12,7 +12,6 @@ cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bP cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= @@ -47,11 +46,7 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI= -github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -65,20 +60,11 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 h1:xD/lrqdvwsc+O2bjSSi3YqY73Ke3LAiSCx49aCesA0E= -github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= -github.com/cockroachdb/errors v1.2.4 h1:Lap807SXTH5tri2TivECb/4abUkMZC9zRoLarvcKDqs= -github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -89,14 +75,11 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs= -github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -110,16 +93,12 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -146,8 +125,6 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -173,8 +150,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -183,8 +158,6 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -194,7 +167,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -203,7 +175,6 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -223,7 +194,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -254,15 +224,10 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= @@ -276,45 +241,21 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= -github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.26.1 h1:puWrOArBwWlr5dq6vyZ6fKykHyS8JgMIVhTBA8XsGuU= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.26.1/go.mod h1:4wsfAAW5N9wUHM0QTmZS8z7fvYZ1rv3m+sVeSpf8NhU= -go.opentelemetry.io/otel v1.1.0/go.mod h1:7cww0OW51jQ8IaZChIEdqLwgh+44+7uiTdWsAL0wQpA= -go.opentelemetry.io/otel v1.2.0 h1:YOQDvxO1FayUcT9MIhJhgMyNO1WqoduiyvQHzGN0kUQ= -go.opentelemetry.io/otel v1.2.0/go.mod h1:aT17Fk0Z1Nor9e0uisf98LrntPGMnk4frBO9+dkf69I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.1.0/go.mod h1:/E4iniSqAEvqbq6KM5qThKZR2sd42kDvD+SrYt00vRw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.1.0/go.mod h1:Gyc0evUosTBVNRqTFGuu0xqebkEWLkLwv42qggTCwro= -go.opentelemetry.io/otel/sdk v1.1.0/go.mod h1:3aQvM6uLm6C4wJpHtT8Od3vNzeZ34Pqc6bps8MywWzo= -go.opentelemetry.io/otel/sdk v1.2.0/go.mod h1:jNN8QtpvbsKhgaC6V5lHiejMoKD+V8uadoSafgHPx1U= -go.opentelemetry.io/otel/trace v1.1.0/go.mod h1:i47XtdcBQiktu5IsrPqOHe8w+sBmnLwwHt8wiUsWGTI= -go.opentelemetry.io/otel/trace v1.2.0 h1:Ys3iqbqZhcf28hHzrm5WAquMkDHNZTUkw7KHbuNjej0= -go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg= -go.opentelemetry.io/proto/otlp v0.10.0/go.mod h1:zG20xCK0szZ1xdokeSOwEcmlXu+x9kkdRe6N1DhKcfU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -323,8 +264,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -384,10 +323,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 h1:+6WJMRLHlD7X7frgp7TUZ36RnQzSf9wVVTNakEp+nqY= golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -395,7 +332,6 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -420,7 +356,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -440,17 +375,14 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= @@ -471,7 +403,6 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -539,7 +470,6 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -562,7 +492,6 @@ google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -588,7 +517,6 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= @@ -613,7 +541,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -636,6 +563,4 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s= -sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/etcdctl/main.go b/etcdctl/main.go index 7fbd771f648..aac15a72675 100644 --- a/etcdctl/main.go +++ b/etcdctl/main.go @@ -16,55 +16,19 @@ package main import ( - "fmt" - "os" - - "go.etcd.io/etcd/etcdctl/v3/ctlv2" "go.etcd.io/etcd/etcdctl/v3/ctlv3" ) -const ( - apiEnv = "ETCDCTL_API" -) - /** mainWithError is fully analogous to main, but instead of signaling errors by os.Exit, it exposes the error explicitly, such that test-logic can intercept control to e.g. dump coverage data (even for test-for-failure scenarios). */ func mainWithError() error { - apiv := os.Getenv(apiEnv) - - // unset apiEnv to avoid side-effect for future env and flag parsing. - os.Unsetenv(apiEnv) - - if len(apiv) == 0 || apiv == "3" { - return ctlv3.Start() - } - - if apiv == "2" { - return ctlv2.Start() - } - - fmt.Fprintf(os.Stderr, "unsupported API version: %s\n", apiv) - return fmt.Errorf("unsupported API version: %s", apiv) + return ctlv3.Start() } func main() { - apiv := os.Getenv(apiEnv) - - // unset apiEnv to avoid side-effect for future env and flag parsing. - os.Unsetenv(apiEnv) - if len(apiv) == 0 || apiv == "3" { - ctlv3.MustStart() - return - } - - if apiv == "2" { - ctlv2.MustStart() - return - } - - fmt.Fprintf(os.Stderr, "unsupported API version: %v\n", apiv) - os.Exit(1) + ctlv3.MustStart() + return } diff --git a/go.sum b/go.sum index 6b8e121d902..926989b0cf2 100644 --- a/go.sum +++ b/go.sum @@ -83,7 +83,6 @@ github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmf github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -278,9 +277,7 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -304,7 +301,6 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/tests/e2e/ctl_v3_test.go b/tests/e2e/ctl_v3_test.go index ebb24e59742..8b11cf6b516 100644 --- a/tests/e2e/ctl_v3_test.go +++ b/tests/e2e/ctl_v3_test.go @@ -306,7 +306,7 @@ func (cx *ctlCtx) prefixArgs(eps []string) []string { useEnv := cx.envMap != nil - cmdArgs := []string{e2e.CtlBinPath + "3"} + cmdArgs := []string{e2e.CtlBinPath} for k, v := range fmap { if useEnv { ek := flags.FlagToEnv("ETCDCTL", k)