2017-09-08 02:00:21 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Deprecation
|
|
|
|
// TODO: remove in 0.9.0
|
|
|
|
|
|
|
|
var _ cli.Command = (*PoliciesDeprecatedCommand)(nil)
|
|
|
|
|
|
|
|
type PoliciesDeprecatedCommand struct {
|
|
|
|
*BaseCommand
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *PoliciesDeprecatedCommand) Synopsis() string { return "" }
|
|
|
|
|
|
|
|
func (c *PoliciesDeprecatedCommand) Help() string {
|
|
|
|
return (&PolicyListCommand{
|
|
|
|
BaseCommand: c.BaseCommand,
|
|
|
|
}).Help()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *PoliciesDeprecatedCommand) Run(args []string) int {
|
|
|
|
oargs := args
|
|
|
|
|
|
|
|
f := c.flagSet(FlagSetHTTP)
|
|
|
|
if err := f.Parse(args); err != nil {
|
|
|
|
c.UI.Error(err.Error())
|
|
|
|
return 1
|
|
|
|
}
|
2018-02-12 23:12:16 +00:00
|
|
|
|
2017-09-08 02:00:21 +00:00
|
|
|
args = f.Args()
|
|
|
|
|
|
|
|
// Got an arg, this is trying to read a policy
|
|
|
|
if len(args) > 0 {
|
|
|
|
return (&PolicyReadCommand{
|
|
|
|
BaseCommand: &BaseCommand{
|
2018-03-16 17:52:08 +00:00
|
|
|
UI: c.UI,
|
|
|
|
client: c.client,
|
2018-03-16 17:55:56 +00:00
|
|
|
tokenHelper: c.tokenHelper,
|
2018-03-16 17:52:08 +00:00
|
|
|
flagAddress: c.flagAddress,
|
2017-09-08 02:00:21 +00:00
|
|
|
},
|
|
|
|
}).Run(oargs)
|
|
|
|
}
|
|
|
|
|
|
|
|
// No args, probably ran "vault policies" and we want to translate that to
|
|
|
|
// "vault policy list"
|
|
|
|
return (&PolicyListCommand{
|
|
|
|
BaseCommand: &BaseCommand{
|
2018-03-16 17:52:08 +00:00
|
|
|
UI: c.UI,
|
|
|
|
client: c.client,
|
2018-03-16 17:55:56 +00:00
|
|
|
tokenHelper: c.tokenHelper,
|
2018-03-16 17:52:08 +00:00
|
|
|
flagAddress: c.flagAddress,
|
2017-09-08 02:00:21 +00:00
|
|
|
},
|
|
|
|
}).Run(oargs)
|
|
|
|
}
|