Auth methods CLI (#277)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-08-18 17:46:34 -04:00
1 parent 041e1f9fd3
commit adfc5681be
41 files changed
+951 -192

No files matched your search

+7 -3
View File
@@ -104,12 +104,14 @@ func MakeShutdownCh() chan struct{} {
// Client returns the HTTP API client. The client is cached on the command to
// save performance on future calls.
func (c *Command) Client() (*api.Client, error) {
func (c *Command) Client(opt ...Option) (*api.Client, error) {
// Read the test client if present
if c.client != nil {
return c.client, nil
}
opts := getOpts(opt...)
config, err := api.DefaultConfig()
if err != nil {
return nil, err
@@ -194,7 +196,9 @@ func (c *Command) Client() (*api.Client, error) {
c.UI.Error(fmt.Sprintf("Error unmarshaling stored token information after reading from system credential store: %s", err))
} else {
c.client.SetToken(authToken.Token)
c.client.SetScopeId(authToken.Scope.Id)
if !opts.withNoTokenScope {
c.client.SetScopeId(authToken.Scope.Id)
}
}
}
}
@@ -211,7 +215,7 @@ func (c *Command) Client() (*api.Client, error) {
c.UI.Info(fmt.Sprintf("Scope of %q set from -scope command flag", c.flagScope))
}
}
} else if c.client.ScopeId() != "" {
} else if c.client.ScopeId() != "" && !opts.withNoTokenScope {
// If it didn't come from env or a flag but isn't empty, it must have come from the token
if c.flagFormat == "table" && c.flagVerbose {
c.UI.Info(fmt.Sprintf("Scope of %q set from saved token with name %q", c.client.ScopeId(), tokenName))
+23
View File
@@ -54,6 +54,29 @@ func WrapForHelpText(lines []string) string {
return strings.Join(ret, "\n")
}
func WrapMap(prefixSpaces, maxLengthOverride int, input map[string]interface{}) string {
maxKeyLength := maxLengthOverride
if maxKeyLength == 0 {
for k := range input {
if len(k) > maxKeyLength {
maxKeyLength = len(k)
}
}
}
var ret []string
for k, v := range input {
spaces := maxKeyLength - len(k)
ret = append(ret, fmt.Sprintf("%s%s%s%s",
strings.Repeat(" ", prefixSpaces),
fmt.Sprintf("%s: ", k),
strings.Repeat(" ", spaces),
fmt.Sprintf("%v", v)),
)
}
return strings.Join(ret, "\n")
}
type FormatOptions struct {
Format string
}
+31
View File
@@ -0,0 +1,31 @@
package base
// getOpts - iterate the inbound Options and return a struct.
func getOpts(opt ...Option) Options {
opts := getDefaultOptions()
for _, o := range opt {
o(&opts)
}
return opts
}
// Option - how Options are passed as arguments.
type Option func(*Options)
// Options - how Options are represented.
type Options struct {
withNoTokenScope bool
}
func getDefaultOptions() Options {
return Options{}
}
// WithNoTokenScope tells the client not to set a scope for the client from a
// saved token's scope, as this can cause confusing behavior at authentication
// time.
func WithNoTokenScope() Option {
return func(o *Options) {
o.withNoTokenScope = true
}
}
+44
View File
@@ -7,6 +7,7 @@ import (
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/commands/authenticate"
"github.com/hashicorp/boundary/internal/cmd/commands/authmethods"
"github.com/hashicorp/boundary/internal/cmd/commands/authtokens"
"github.com/hashicorp/boundary/internal/cmd/commands/config"
"github.com/hashicorp/boundary/internal/cmd/commands/controller"
@@ -68,6 +69,49 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
}, nil
},
"auth-methods": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
}, nil
},
"auth-methods read": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
Func: "read",
}, nil
},
"auth-methods delete": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
Func: "delete",
}, nil
},
"auth-methods list": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
Func: "list",
}, nil
},
"auth-methods password": func() (cli.Command, error) {
return &authmethods.Command{
Command: base.NewCommand(ui),
Func: "password",
}, nil
},
"auth-methods password create": func() (cli.Command, error) {
return &authmethods.PasswordCommand{
Command: base.NewCommand(ui),
Func: "create",
}, nil
},
"auth-methods password update": func() (cli.Command, error) {
return &authmethods.PasswordCommand{
Command: base.NewCommand(ui),
Func: "update",
}, nil
},
"auth-tokens": func() (cli.Command, error) {
return &authtokens.Command{
Command: base.NewCommand(ui),
@@ -112,7 +112,7 @@ func (c *PasswordCommand) Run(args []string) int {
c.flagPassword = strings.TrimSpace(value)
}
client, err := c.Client()
client, err := c.Client(base.WithNoTokenScope())
if err != nil {
c.UI.Error(fmt.Sprintf("Error creating API client: %s", err.Error()))
return 2
@@ -0,0 +1,240 @@
package authmethods
import (
"fmt"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/common"
"github.com/hashicorp/boundary/internal/types/resource"
"github.com/hashicorp/vault/sdk/helper/strutil"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
var _ cli.Command = (*Command)(nil)
var _ cli.CommandAutocomplete = (*Command)(nil)
type Command struct {
*base.Command
Func string
}
func (c *Command) Synopsis() string {
if c.Func == "password" {
return "Manage password auth-methods within Boundary"
}
return common.SynopsisFunc(c.Func, "auth-method")
}
var flagsMap = map[string][]string{
"read": {"id"},
"delete": {"id"},
}
func (c *Command) Help() string {
helpMap := common.HelpMap("auth-method")
switch c.Func {
case "":
return base.WrapForHelpText([]string{
"Usage: boundary auth-methods [sub command] [options] [args]",
"",
" This command allows operations on Boundary auth-method resources. Example:",
"",
" Read an auth-method:",
"",
` $ boundary auth-methods read -id paum_1234567890`,
"",
" Please see the auth-methods subcommand help for detailed usage information.",
})
case "password":
return base.WrapForHelpText([]string{
"Usage: boundary auth-methods password [sub command] [options] [args]",
"",
" This command allows operations on Boundary password-type auth-method resources. Example:",
"",
" Create a password-type auth-method:",
"",
` $ boundary auth-methods pasword create -name prodops -description "For ProdOps usage"`,
"",
" Please see the subcommand help for detailed usage information.",
})
default:
return helpMap[c.Func]() + c.Flags().Help()
}
}
func (c *Command) Flags() *base.FlagSets {
set := c.FlagSet(base.FlagSetHTTP | base.FlagSetClient | base.FlagSetOutputFormat)
if len(flagsMap[c.Func]) > 0 {
f := set.NewFlagSet("Command Options")
common.PopulateCommonFlags(c.Command, f, resource.User.String(), flagsMap[c.Func])
}
return set
}
func (c *Command) AutocompleteArgs() complete.Predictor {
return complete.PredictAnything
}
func (c *Command) AutocompleteFlags() complete.Flags {
return c.Flags().Completions()
}
func (c *Command) Run(args []string) int {
if c.Func == "" || c.Func == "password" {
return cli.RunResultHelp
}
f := c.Flags()
if err := f.Parse(args); err != nil {
c.UI.Error(err.Error())
return 1
}
if strutil.StrListContains(flagsMap[c.Func], "id") && c.FlagId == "" {
c.UI.Error("ID is required but not passed in via -id")
return 1
}
client, err := c.Client()
if err != nil {
c.UI.Error(fmt.Sprintf("Error creating API client: %s", err.Error()))
return 2
}
var opts []authmethods.Option
switch c.FlagName {
case "":
case "null":
opts = append(opts, authmethods.DefaultName())
default:
opts = append(opts, authmethods.WithName(c.FlagName))
}
switch c.FlagDescription {
case "":
case "null":
opts = append(opts, authmethods.DefaultDescription())
default:
opts = append(opts, authmethods.WithDescription(c.FlagDescription))
}
authmethodClient := authmethods.NewAuthMethodsClient(client)
var existed bool
var method *authmethods.AuthMethod
var listedMethods []*authmethods.AuthMethod
var apiErr *api.Error
switch c.Func {
case "read":
method, apiErr, err = authmethodClient.Read(c.Context, c.FlagId, opts...)
case "delete":
existed, apiErr, err = authmethodClient.Delete(c.Context, c.FlagId, opts...)
case "list":
listedMethods, apiErr, err = authmethodClient.List(c.Context, opts...)
}
plural := "auth method"
if c.Func == "list" {
plural = "auth methods"
}
if err != nil {
c.UI.Error(fmt.Sprintf("Error trying to %s %s: %s", c.Func, plural, err.Error()))
return 2
}
if apiErr != nil {
c.UI.Error(fmt.Sprintf("Error from controller when performing %s on %s: %s", c.Func, plural, pretty.Sprint(apiErr)))
return 1
}
switch c.Func {
case "delete":
switch base.Format(c.UI) {
case "json":
c.UI.Output("null")
case "table":
output := "The delete operation completed successfully"
switch existed {
case true:
output += "."
default:
output += ", however the resource did not exist at the time."
}
c.UI.Output(output)
}
return 0
case "list":
switch base.Format(c.UI) {
case "json":
if len(listedMethods) == 0 {
c.UI.Output("null")
return 0
}
b, err := base.JsonFormatter{}.Format(listedMethods)
if err != nil {
c.UI.Error(fmt.Errorf("Error formatting as JSON: %w", err).Error())
return 1
}
c.UI.Output(string(b))
case "table":
if len(listedMethods) == 0 {
c.UI.Output("No auth methods found")
return 0
}
var output []string
output = []string{
"",
"Auth Method information:",
}
for i, m := range listedMethods {
if i > 0 {
output = append(output, "")
}
if true {
output = append(output,
fmt.Sprintf(" ID: %s", m.Id),
fmt.Sprintf(" Version: %d", m.Version),
fmt.Sprintf(" Type: %s", m.Type),
)
}
if m.Name != "" {
output = append(output,
fmt.Sprintf(" Name: %s", m.Name),
)
}
if m.Description != "" {
output = append(output,
fmt.Sprintf(" Description: %s", m.Description),
)
}
}
c.UI.Output(base.WrapForHelpText(output))
}
return 0
}
switch base.Format(c.UI) {
case "table":
c.UI.Output(generateAuthMethodTableOutput(method))
case "json":
b, err := base.JsonFormatter{}.Format(method)
if err != nil {
c.UI.Error(fmt.Errorf("Error formatting as JSON: %w", err).Error())
return 1
}
c.UI.Output(string(b))
}
return 0
}
@@ -0,0 +1,86 @@
package authmethods
import (
"fmt"
"time"
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/boundary/internal/cmd/base"
)
func addPasswordFlags(c *PasswordCommand, f *base.FlagSet) {
f.StringVar(&base.StringVar{
Name: "min-login-name-length",
Target: &c.flagMinLoginNameLength,
Usage: "The minimum length of login names",
})
f.StringVar(&base.StringVar{
Name: "min-password-length",
Target: &c.flagMinPasswordLength,
Usage: "The minimum length of passwords",
})
}
func generateAuthMethodTableOutput(in *authmethods.AuthMethod) string {
var ret []string
nonAttributeMap := map[string]interface{}{
"ID": in.Id,
"Version": in.Version,
"Type": in.Type,
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
}
if in.Name != "" {
nonAttributeMap["Name"] = in.Name
}
if in.Description != "" {
nonAttributeMap["Description"] = in.Description
}
maxLength := 0
for k := range nonAttributeMap {
if len(k) > maxLength {
maxLength = len(k)
}
}
if len(in.Attributes) > 0 {
for k, v := range in.Attributes {
if attributeMap[k] != "" {
in.Attributes[attributeMap[k]] = v
delete(in.Attributes, k)
}
}
for k := range in.Attributes {
if len(k) > maxLength {
maxLength = len(k)
}
}
}
ret = append(ret, "", "User information:")
ret = append(ret,
// We do +2 because there is another +2 offset for attributes below
base.WrapMap(2, maxLength+2, nonAttributeMap),
)
if len(in.Attributes) > 0 {
if true {
ret = append(ret,
fmt.Sprintf(" Attributes: %s", ""),
)
}
ret = append(ret,
base.WrapMap(4, maxLength, in.Attributes),
)
}
return base.WrapForHelpText(ret)
}
var attributeMap = map[string]string{
"min_login_name_length": "Minimum Login Name Length",
"min_password_length": "Minimum Password Length",
}
@@ -0,0 +1,216 @@
package authmethods
import (
"fmt"
"net/textproto"
"strconv"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/common"
"github.com/hashicorp/vault/sdk/helper/strutil"
"github.com/kr/pretty"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
var _ cli.Command = (*PasswordCommand)(nil)
var _ cli.CommandAutocomplete = (*PasswordCommand)(nil)
type PasswordCommand struct {
*base.Command
Func string
flagMinLoginNameLength string
flagMinPasswordLength string
}
func (c *PasswordCommand) Synopsis() string {
return fmt.Sprintf("%s a password-type auth-method within Boundary", textproto.CanonicalMIMEHeaderKey(c.Func))
}
var passwordFlagsMap = map[string][]string{
"create": {"name", "description"},
"update": {"id", "name", "description", "version"},
}
func (c *PasswordCommand) Help() string {
var info string
switch c.Func {
case "create":
info = base.WrapForHelpText([]string{
"Usage: boundary auth-methods password create [options] [args]",
"",
" Create a password-type auth-method. Example:",
"",
` $ boundary auth-methods password create -name prodops -description "Password auth-method for ProdOps"`,
"",
"",
})
case "update":
info = base.WrapForHelpText([]string{
"Usage: boundary auth-methods password update [options] [args]",
"",
" Update a password-type auth-method given its ID. Example:",
"",
` $ boundary auth-methods password update -id paum_1234567890 -name "devops" -description "Password auth-method for DevOps"`,
"",
"",
})
}
return info + c.Flags().Help()
}
func (c *PasswordCommand) Flags() *base.FlagSets {
set := c.FlagSet(base.FlagSetHTTP | base.FlagSetClient | base.FlagSetOutputFormat)
if len(passwordFlagsMap[c.Func]) > 0 {
f := set.NewFlagSet("Command Options")
common.PopulateCommonFlags(c.Command, f, "password-type auth-method", passwordFlagsMap[c.Func])
}
f := set.NewFlagSet("Password Auth-Method Options")
addPasswordFlags(c, f)
return set
}
func (c *PasswordCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictAnything
}
func (c *PasswordCommand) AutocompleteFlags() complete.Flags {
return c.Flags().Completions()
}
func (c *PasswordCommand) Run(args []string) int {
if c.Func == "" {
return cli.RunResultHelp
}
f := c.Flags()
if err := f.Parse(args); err != nil {
c.UI.Error(err.Error())
return 1
}
if strutil.StrListContains(passwordFlagsMap[c.Func], "id") && c.FlagId == "" {
c.UI.Error("ID is required but not passed in via -id")
return 1
}
client, err := c.Client()
if err != nil {
c.UI.Error(fmt.Sprintf("Error creating API client: %s", err.Error()))
return 2
}
var opts []authmethods.Option
switch c.FlagName {
case "":
case "null":
opts = append(opts, authmethods.DefaultName())
default:
opts = append(opts, authmethods.WithName(c.FlagName))
}
switch c.FlagDescription {
case "":
case "null":
opts = append(opts, authmethods.DefaultDescription())
default:
opts = append(opts, authmethods.WithDescription(c.FlagDescription))
}
var attributes map[string]interface{}
addAttribute := func(name string, value interface{}) {
if attributes == nil {
attributes = make(map[string]interface{})
}
attributes[name] = value
}
switch c.flagMinLoginNameLength {
case "":
case "null":
addAttribute("min_login_name_length", nil)
default:
length, err := strconv.ParseUint(c.flagMinLoginNameLength, 10, 32)
if err != nil {
c.UI.Error(fmt.Sprintf("Error parsing %q: %s", c.flagMinLoginNameLength, err))
return 1
}
addAttribute("min_login_name_length", uint32(length))
}
switch c.flagMinPasswordLength {
case "":
case "null":
addAttribute("min_password_length", nil)
default:
length, err := strconv.ParseUint(c.flagMinPasswordLength, 10, 32)
if err != nil {
c.UI.Error(fmt.Sprintf("Error parsing %q: %s", c.flagMinPasswordLength, err))
return 1
}
addAttribute("min_password_length", uint32(length))
}
if attributes != nil {
opts = append(opts, authmethods.WithAttributes(attributes))
}
authmethodClient := authmethods.NewAuthMethodsClient(client)
// Perform check-and-set when needed
var version uint32
switch c.Func {
case "create":
// These don't update so don't need the existing version
default:
switch c.FlagVersion {
case 0:
opts = append(opts, authmethods.WithAutomaticVersioning())
default:
version = uint32(c.FlagVersion)
}
}
var method *authmethods.AuthMethod
var apiErr *api.Error
switch c.Func {
case "create":
method, apiErr, err = authmethodClient.Create(c.Context, "password", opts...)
case "update":
method, apiErr, err = authmethodClient.Update(c.Context, c.FlagId, version, opts...)
}
plural := "password-type auth-method"
if err != nil {
c.UI.Error(fmt.Sprintf("Error trying to %s %s: %s", c.Func, plural, err.Error()))
return 2
}
if apiErr != nil {
c.UI.Error(fmt.Sprintf("Error from controller when performing %s on %s: %s", c.Func, plural, pretty.Sprint(apiErr)))
return 1
}
switch base.Format(c.UI) {
case "table":
c.UI.Output(generateAuthMethodTableOutput(method))
case "json":
b, err := base.JsonFormatter{}.Format(method)
if err != nil {
c.UI.Error(fmt.Errorf("Error formatting as JSON: %w", err).Error())
return 1
}
c.UI.Output(string(b))
}
return 0
}
@@ -38,7 +38,7 @@ func (c *Command) Help() string {
if c.Func == "" {
return helpMap["base"]()
}
return helpMap[c.Func]() + "\n\n" + c.Flags().Help()
return helpMap[c.Func]() + c.Flags().Help()
}
func (c *Command) Flags() *base.FlagSets {
@@ -46,7 +46,7 @@ func (c *Command) Flags() *base.FlagSets {
if len(flagsMap[c.Func]) > 0 {
f := set.NewFlagSet("Command Options")
common.PopulateCommonFlags(c.Command, f, resource.AuthToken, flagsMap[c.Func])
common.PopulateCommonFlags(c.Command, f, resource.AuthToken.String(), flagsMap[c.Func])
}
return set
+1 -1
View File
@@ -56,7 +56,7 @@ func removeMembersHelp() string {
}
func populateFlags(c *Command, f *base.FlagSet, flagNames []string) {
common.PopulateCommonFlags(c.Command, f, resource.Group, flagNames)
common.PopulateCommonFlags(c.Command, f, resource.Group.String(), flagNames)
for _, name := range flagNames {
switch name {
+1 -1
View File
@@ -57,7 +57,7 @@ func (c *Command) Help() string {
if c.Func == "" {
return hm["base"]()
}
return hm[c.Func]() + "\n\n" + c.Flags().Help()
return hm[c.Func]() + c.Flags().Help()
}
func (c *Command) Flags() *base.FlagSets {
+1 -1
View File
@@ -60,7 +60,7 @@ func removePrincipalsHelp() string {
}
func populateFlags(c *Command, f *base.FlagSet, flagNames []string) {
common.PopulateCommonFlags(c.Command, f, resource.Role, flagNames)
common.PopulateCommonFlags(c.Command, f, resource.Role.String(), flagNames)
for _, name := range flagNames {
switch name {
+1 -1
View File
@@ -68,7 +68,7 @@ func (c *Command) Help() string {
if c.Func == "" {
return hm["base"]()
}
return hm[c.Func]() + "\n\n" + c.Flags().Help()
return hm[c.Func]() + c.Flags().Help()
}
func (c *Command) Flags() *base.FlagSets {
+2 -2
View File
@@ -39,7 +39,7 @@ func (c *Command) Help() string {
if c.Func == "" {
return helpMap["base"]()
}
return helpMap[c.Func]() + "\n\n" + c.Flags().Help()
return helpMap[c.Func]() + c.Flags().Help()
}
func (c *Command) Flags() *base.FlagSets {
@@ -47,7 +47,7 @@ func (c *Command) Flags() *base.FlagSets {
if len(flagsMap[c.Func]) > 0 {
f := set.NewFlagSet("Command Options")
common.PopulateCommonFlags(c.Command, f, resource.Scope, flagsMap[c.Func])
common.PopulateCommonFlags(c.Command, f, resource.Scope.String(), flagsMap[c.Func])
}
return set
+2 -2
View File
@@ -39,7 +39,7 @@ func (c *Command) Help() string {
if c.Func == "" {
return helpMap["base"]()
}
return helpMap[c.Func]() + "\n\n" + c.Flags().Help()
return helpMap[c.Func]() + c.Flags().Help()
}
func (c *Command) Flags() *base.FlagSets {
@@ -47,7 +47,7 @@ func (c *Command) Flags() *base.FlagSets {
if len(flagsMap[c.Func]) > 0 {
f := set.NewFlagSet("Command Options")
common.PopulateCommonFlags(c.Command, f, resource.User, flagsMap[c.Func])
common.PopulateCommonFlags(c.Command, f, resource.User.String(), flagsMap[c.Func])
}
return set
+5 -6
View File
@@ -4,35 +4,34 @@ import (
"fmt"
"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/types/resource"
)
func PopulateCommonFlags(c *base.Command, f *base.FlagSet, resourceType resource.Type, flagNames []string) {
func PopulateCommonFlags(c *base.Command, f *base.FlagSet, resourceType string, flagNames []string) {
for _, name := range flagNames {
switch name {
case "id":
f.StringVar(&base.StringVar{
Name: "id",
Target: &c.FlagId,
Usage: fmt.Sprintf("ID of the %s on which to operate", resourceType.String()),
Usage: fmt.Sprintf("ID of the %s on which to operate", resourceType),
})
case "name":
f.StringVar(&base.StringVar{
Name: "name",
Target: &c.FlagName,
Usage: fmt.Sprintf("Name to set on the %s", resourceType.String()),
Usage: fmt.Sprintf("Name to set on the %s", resourceType),
})
case "description":
f.StringVar(&base.StringVar{
Name: "description",
Target: &c.FlagDescription,
Usage: fmt.Sprintf("Description to set on the %s", resourceType.String()),
Usage: fmt.Sprintf("Description to set on the %s", resourceType),
})
case "version":
f.IntVar(&base.IntVar{
Name: "version",
Target: &c.FlagVersion,
Usage: fmt.Sprintf("The version of the %s against which to perform an update operation. If not specified, the command will perform a check-and-set automatically.", resourceType.String()),
Usage: fmt.Sprintf("The version of the %s against which to perform an update operation. If not specified, the command will perform a check-and-set automatically.", resourceType),
})
}
}
+9 -1
View File
@@ -38,7 +38,7 @@ func HelpMap(resType string) map[string]func() string {
return base.WrapForHelpText(subType([]string{
"Usage: boundary {{type}}s [sub command] [options] [args]",
"",
" This command allows operations on Boundary {{type}} resources. Examples",
" This command allows operations on Boundary {{type}} resources. Example:",
"",
" Create {{articletype}}:",
"",
@@ -67,6 +67,8 @@ func HelpMap(resType string) map[string]func() string {
" Update {{articletype}} given its ID. Example:",
"",
` $ boundary {{type}}s update -id {{prefix}}_1234567890 -name "devops" -description "{{uppertype}} for DevOps"`,
"",
"",
}, resType, prefixMap))
},
@@ -77,6 +79,8 @@ func HelpMap(resType string) map[string]func() string {
" Read {{articletype}} given its ID. Example:",
"",
` $ boundary {{type}}s read -id {{prefix}}_1234567890`,
"",
"",
}, resType, prefixMap))
},
@@ -87,6 +91,8 @@ func HelpMap(resType string) map[string]func() string {
" Delete {{articletype}} given its ID. Example:",
"",
` $ boundary {{type}}s delete -id {{prefix}}_1234567890`,
"",
"",
}, resType, prefixMap))
},
@@ -97,6 +103,8 @@ func HelpMap(resType string) map[string]func() string {
" List {{type}}s within an enclosing scope or resource. Example:",
"",
` $ boundary {{type}}s list`,
"",
"",
}, resType, prefixMap))
},
}