add Expiration: info if present for sts/svc accounts (#4515)
This commit is contained in:
@@ -85,7 +85,7 @@ func printPrometheusMetrics(ctx *cli.Context) error {
|
||||
return e
|
||||
}
|
||||
req.Header.Add("Authorization", "Bearer "+token)
|
||||
client := httpClient(10 * time.Second)
|
||||
client := httpClient(60 * time.Second)
|
||||
resp, e := client.Do(req)
|
||||
if e != nil {
|
||||
return e
|
||||
|
||||
@@ -122,6 +122,7 @@ func mainAdminUserSTSAcctInfo(ctx *cli.Context) error {
|
||||
ParentUser: stsInfo.ParentUser,
|
||||
ImpliedPolicy: stsInfo.ImpliedPolicy,
|
||||
Policy: json.RawMessage(stsInfo.Policy),
|
||||
Expiration: stsInfo.Expiration,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
@@ -22,7 +22,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/colorjson"
|
||||
@@ -95,6 +97,7 @@ type acctMessage struct {
|
||||
Comment string `json:"comment,omitempty"`
|
||||
AccountStatus string `json:"accountStatus,omitempty"`
|
||||
MemberOf []string `json:"memberOf,omitempty"`
|
||||
Expiration *time.Time `json:"expiration,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -136,6 +139,12 @@ func (u acctMessage) String() string {
|
||||
fmt.Sprintf("Status: %s", u.AccountStatus),
|
||||
fmt.Sprintf("Comment: %s", u.Comment),
|
||||
fmt.Sprintf("Policy: %s", policyField),
|
||||
func() string {
|
||||
if u.Expiration != nil {
|
||||
return fmt.Sprintf("Expiration: %s", humanize.Time(*u.Expiration))
|
||||
}
|
||||
return "Expiration: no-expiry"
|
||||
}(),
|
||||
}, "\n"))
|
||||
case svcAccOpRemove:
|
||||
return console.Colorize("AccMessage", "Removed service account `"+u.AccessKey+"` successfully.")
|
||||
|
||||
@@ -103,6 +103,7 @@ func mainAdminUserSvcAcctInfo(ctx *cli.Context) error {
|
||||
ParentUser: svcInfo.ParentUser,
|
||||
ImpliedPolicy: svcInfo.ImpliedPolicy,
|
||||
Policy: json.RawMessage(svcInfo.Policy),
|
||||
Expiration: svcInfo.Expiration,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user