2020-07-14 14:32:47 -07:00
|
|
|
package scopes
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
2020-08-10 17:15:02 -04:00
|
|
|
"github.com/hashicorp/boundary/api/scopes"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/cmd/base"
|
2020-07-14 14:32:47 -07:00
|
|
|
)
|
|
|
|
|
|
2020-08-13 11:20:22 -04:00
|
|
|
func generateScopeTableOutput(in *scopes.Scope) string {
|
2020-07-14 14:32:47 -07:00
|
|
|
var ret []string
|
2020-08-28 01:28:26 -04:00
|
|
|
|
|
|
|
|
nonAttributeMap := map[string]interface{}{
|
|
|
|
|
"ID": in.Id,
|
2020-09-08 13:27:51 -07:00
|
|
|
"Scope ID": in.Scope.Id,
|
2020-08-28 01:28:26 -04:00
|
|
|
"Version": in.Version,
|
|
|
|
|
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
|
|
|
|
|
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
|
2020-07-14 14:32:47 -07:00
|
|
|
}
|
2020-08-28 01:28:26 -04:00
|
|
|
|
2020-08-07 12:55:02 -04:00
|
|
|
if in.Name != "" {
|
2020-08-28 01:28:26 -04:00
|
|
|
nonAttributeMap["Name"] = in.Name
|
2020-07-14 14:32:47 -07:00
|
|
|
}
|
2020-08-07 12:55:02 -04:00
|
|
|
if in.Description != "" {
|
2020-08-28 01:28:26 -04:00
|
|
|
nonAttributeMap["Description"] = in.Description
|
2020-07-14 14:32:47 -07:00
|
|
|
}
|
|
|
|
|
|
2020-08-28 01:28:26 -04:00
|
|
|
ret = append(ret, "", "Scope information:")
|
|
|
|
|
|
|
|
|
|
ret = append(ret,
|
|
|
|
|
base.WrapMap(2, 0, nonAttributeMap),
|
|
|
|
|
)
|
|
|
|
|
|
2020-07-14 14:32:47 -07:00
|
|
|
return base.WrapForHelpText(ret)
|
|
|
|
|
}
|