Add PKI base command (#18512)

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
This commit is contained in:
Alexander Scheel
2022-12-21 10:01:57 -05:00
committed by GitHub
parent 034b058044
commit c2620e136d
2 changed files with 49 additions and 5 deletions

View File

@@ -526,6 +526,16 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
BaseCommand: getBaseCommand(),
}, nil
},
"pki": func() (cli.Command, error) {
return &PKICommand{
BaseCommand: getBaseCommand(),
}, nil
},
"pki health-check": func() (cli.Command, error) {
return &PKIHealthCheckCommand{
BaseCommand: getBaseCommand(),
}, nil
},
"plugin": func() (cli.Command, error) {
return &PluginCommand{
BaseCommand: getBaseCommand(),
@@ -797,11 +807,6 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
ShutdownCh: MakeShutdownCh(),
}, nil
},
"pki health-check": func() (cli.Command, error) {
return &PKIHealthCheckCommand{
BaseCommand: getBaseCommand(),
}, nil
},
}
initCommandsEnt(ui, serverCmdUi, runOpts)

39
command/pki.go Normal file
View File

@@ -0,0 +1,39 @@
package command
import (
"strings"
"github.com/mitchellh/cli"
)
var _ cli.Command = (*PKICommand)(nil)
type PKICommand struct {
*BaseCommand
}
func (c *PKICommand) Synopsis() string {
return "Interact with Vault's Key-Value storage"
}
func (c *PKICommand) Help() string {
helpText := `
Usage: vault pki <subcommand> [options] [args]
This command has subcommands for interacting with Vault's PKI Secrets
Engine. Here are some simple examples, and more detailed examples are
available in the subcommands or the documentation.
Check the health of a PKI mount, to the best of this token's abilities:
$ vault pki health-check pki
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (c *PKICommand) Run(args []string) int {
return cli.RunResultHelp
}