Added 'sys/auth/<path>/tune' endpoints.

Displaying 'Default TTL' and 'Max TTL' in the output of 'vault auth -methods'
This commit is contained in:
vishalnayak
2016-06-15 12:35:30 -04:00
parent d232de6225
commit efaffa8f55
5 changed files with 239 additions and 69 deletions

View File

@@ -7,6 +7,7 @@ import (
"io"
"os"
"sort"
"strconv"
"strings"
"github.com/hashicorp/vault/api"
@@ -266,11 +267,19 @@ func (c *AuthCommand) listMethods() int {
}
sort.Strings(paths)
columns := []string{"Path | Type | Description"}
for _, k := range paths {
a := auth[k]
columns := []string{"Path | Type | Default TTL | Max TTL | Description"}
for _, path := range paths {
auth := auth[path]
defTTL := "system"
if auth.Config.DefaultLeaseTTL != 0 {
defTTL = strconv.Itoa(auth.Config.DefaultLeaseTTL)
}
maxTTL := "system"
if auth.Config.MaxLeaseTTL != 0 {
maxTTL = strconv.Itoa(auth.Config.MaxLeaseTTL)
}
columns = append(columns, fmt.Sprintf(
"%s | %s | %s", k, a.Type, a.Description))
"%s | %s | %s | %s | %s", path, auth.Type, defTTL, maxTTL, auth.Description))
}
c.Ui.Output(columnize.SimpleFormat(columns))