Add token as a subcommand

This commit is contained in:
Seth Vargo
2017-09-07 21:58:13 -04:00
parent 98b356d7f1
commit b50d7d69bd
7 changed files with 87 additions and 51 deletions

View File

@@ -8,11 +8,9 @@ import (
"github.com/posener/complete"
)
// Ensure we are implementing the right interfaces.
var _ cli.Command = (*TokenRevokeCommand)(nil)
var _ cli.CommandAutocomplete = (*TokenRevokeCommand)(nil)
// TokenRevokeCommand is a Command that mounts a new mount.
type TokenRevokeCommand struct {
*BaseCommand
@@ -22,12 +20,12 @@ type TokenRevokeCommand struct {
}
func (c *TokenRevokeCommand) Synopsis() string {
return "Revokes tokens and their children"
return "Revoke a token and its children"
}
func (c *TokenRevokeCommand) Help() string {
helpText := `
Usage: vault token-revoke [options] [TOKEN | ACCESSOR]
Usage: vault token revoke [options] [TOKEN | ACCESSOR]
Revokes authentication tokens and their children. If a TOKEN is not provided,
the locally authenticated token is used. The "-mode" flag can be used to
@@ -36,15 +34,15 @@ Usage: vault token-revoke [options] [TOKEN | ACCESSOR]
Revoke a token and all the token's children:
$ vault token-revoke 96ddf4bc-d217-f3ba-f9bd-017055595017
$ vault token revoke 96ddf4bc-d217-f3ba-f9bd-017055595017
Revoke a token leaving the token's children:
$ vault token-revoke -mode=orphan 96ddf4bc-d217-f3ba-f9bd-017055595017
$ vault token revoke -mode=orphan 96ddf4bc-d217-f3ba-f9bd-017055595017
Revoke a token by accessor:
$ vault token-revoke -accessor 9793c9b3-e04a-46f3-e7b8-748d7da248da
$ vault token revoke -accessor 9793c9b3-e04a-46f3-e7b8-748d7da248da
For a full list of examples, please see the documentation.