2017-09-08 02:00:21 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ cli.Command = (*PolicyCommand)(nil)
|
|
|
|
|
|
|
|
// PolicyCommand is a Command that holds the audit commands
|
|
|
|
type PolicyCommand struct {
|
|
|
|
*BaseCommand
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *PolicyCommand) Synopsis() string {
|
|
|
|
return "Interact with policies"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *PolicyCommand) Help() string {
|
|
|
|
helpText := `
|
|
|
|
Usage: vault policy <subcommand> [options] [args]
|
|
|
|
|
2018-03-22 13:29:59 +00:00
|
|
|
This command groups subcommands for interacting with policies.
|
2017-09-08 02:00:21 +00:00
|
|
|
Users can write, read, and list policies in Vault.
|
|
|
|
|
|
|
|
List all enabled policies:
|
|
|
|
|
|
|
|
$ vault policy list
|
|
|
|
|
|
|
|
Create a policy named "my-policy" from contents on local disk:
|
|
|
|
|
|
|
|
$ vault policy write my-policy ./my-policy.hcl
|
|
|
|
|
|
|
|
Delete the policy named my-policy:
|
|
|
|
|
|
|
|
$ vault policy delete my-policy
|
|
|
|
|
|
|
|
Please see the individual subcommand help for detailed usage information.
|
|
|
|
`
|
|
|
|
|
|
|
|
return strings.TrimSpace(helpText)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *PolicyCommand) Run(args []string) int {
|
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|