add partition cli flag to all cli commands that have namespace flag (#10668)

This commit is contained in:
R.B. Boyer 2021-07-21 14:45:24 -05:00 committed by GitHub
parent a0c531a54f
commit c9c80b5ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 229 additions and 137 deletions

View File

@ -139,7 +139,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }

View File

@ -36,7 +36,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -73,11 +73,13 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Delete an ACL auth method" const (
const help = ` synopsis = "Delete an ACL auth method"
help = `
Usage: consul acl auth-method delete -name NAME [options] Usage: consul acl auth-method delete -name NAME [options]
Delete an auth method: Delete an auth method:
$ consul acl auth-method delete -name "my-auth-method" $ consul acl auth-method delete -name "my-auth-method"
` `
)

View File

@ -46,7 +46,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -93,11 +93,13 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Lists ACL auth methods" const (
const help = ` synopsis = "Lists ACL auth methods"
help = `
Usage: consul acl auth-method list [options] Usage: consul acl auth-method list [options]
List all auth methods: List all auth methods:
$ consul acl auth-method list $ consul acl auth-method list
` `
)

View File

@ -56,7 +56,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -111,11 +111,13 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Read an ACL auth method" const (
const help = ` synopsis = "Read an ACL auth method"
help = `
Usage: consul acl auth-method read -name NAME [options] Usage: consul acl auth-method read -name NAME [options]
Read an auth method: Read an auth method:
$ consul acl auth-method read -name my-auth-method $ consul acl auth-method read -name my-auth-method
` `
)

View File

@ -143,7 +143,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -320,8 +320,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Update an ACL auth method" const (
const help = ` synopsis = "Update an ACL auth method"
help = `
Usage: consul acl auth-method update -name NAME [options] Usage: consul acl auth-method update -name NAME [options]
Updates an auth method. By default it will merge the auth method Updates an auth method. By default it will merge the auth method
@ -336,3 +337,4 @@ Usage: consul acl auth-method update -name NAME [options]
-kubernetes-ca-cert @/path/to/new-kube.ca.crt \ -kubernetes-ca-cert @/path/to/new-kube.ca.crt \
-kubernetes-service-account-jwt "NEW_JWT_CONTENTS" -kubernetes-service-account-jwt "NEW_JWT_CONTENTS"
` `
)

View File

@ -87,7 +87,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }

View File

@ -39,7 +39,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -82,8 +82,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Delete an ACL binding rule" const (
const help = ` synopsis = "Delete an ACL binding rule"
help = `
Usage: consul acl binding-rule delete -id ID [options] Usage: consul acl binding-rule delete -id ID [options]
Deletes an ACL binding rule by providing the ID or a unique ID prefix. Deletes an ACL binding rule by providing the ID or a unique ID prefix.
@ -96,3 +97,4 @@ Usage: consul acl binding-rule delete -id ID [options]
$ consul acl binding-rule delete -id b6b856da-5193-4e78-845a-7d61ca8371ba $ consul acl binding-rule delete -id b6b856da-5193-4e78-845a-7d61ca8371ba
` `
)

View File

@ -56,7 +56,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -103,8 +103,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Lists ACL binding rules" const (
const help = ` synopsis = "Lists ACL binding rules"
help = `
Usage: consul acl binding-rule list [options] Usage: consul acl binding-rule list [options]
Lists all the ACL binding rules. Lists all the ACL binding rules.
@ -117,3 +118,4 @@ Usage: consul acl binding-rule list [options]
$ consul acl binding-rule list -method="my-method" $ consul acl binding-rule list -method="my-method"
` `
)

View File

@ -58,7 +58,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -119,8 +119,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Read an ACL binding rule" const (
const help = ` synopsis = "Read an ACL binding rule"
help = `
Usage: consul acl binding-rule read -id ID [options] Usage: consul acl binding-rule read -id ID [options]
This command will retrieve and print out the details of a single binding This command will retrieve and print out the details of a single binding
@ -130,3 +131,4 @@ Usage: consul acl binding-rule read -id ID [options]
$ consul acl binding-rule read -id fdabbcb5-9de5-4b1a-961f-77214ae88cba $ consul acl binding-rule read -id fdabbcb5-9de5-4b1a-961f-77214ae88cba
` `
)

View File

@ -101,7 +101,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -217,8 +217,9 @@ func isFlagSet(flags *flag.FlagSet, name string) bool {
return found return found
} }
const synopsis = "Update an ACL binding rule" const (
const help = ` synopsis = "Update an ACL binding rule"
help = `
Usage: consul acl binding-rule update -id ID [options] Usage: consul acl binding-rule update -id ID [options]
Updates a binding rule. By default it will merge the binding rule Updates a binding rule. By default it will merge the binding rule
@ -234,3 +235,4 @@ Usage: consul acl binding-rule update -id ID [options]
-bind-name='k8s-${serviceaccount.name}' \ -bind-name='k8s-${serviceaccount.name}' \
-selector='serviceaccount.namespace==default and serviceaccount.name==web' -selector='serviceaccount.namespace==default and serviceaccount.name==web'
` `
)

View File

@ -66,7 +66,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -154,8 +154,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Create an ACL policy" const (
const help = ` synopsis = "Create an ACL policy"
help = `
Usage: consul acl policy create -name NAME [options] Usage: consul acl policy create -name NAME [options]
Both the -rules and -from-token option values allow loading the value Both the -rules and -from-token option values allow loading the value
@ -177,3 +178,4 @@ Usage: consul acl policy create -name NAME [options]
-description "Token Converted to policy" \ -description "Token Converted to policy" \
-from-token "c1e34113-e7ab-4451-b1a6-336ddcc58fc6" -from-token "c1e34113-e7ab-4451-b1a6-336ddcc58fc6"
` `
)

View File

@ -34,7 +34,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -82,8 +82,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Delete an ACL policy" const (
const help = ` synopsis = "Delete an ACL policy"
help = `
Usage: consul acl policy delete [options] -id POLICY Usage: consul acl policy delete [options] -id POLICY
Deletes an ACL policy by providing either the ID or a unique ID prefix. Deletes an ACL policy by providing either the ID or a unique ID prefix.
@ -97,3 +98,4 @@ Usage: consul acl policy delete [options] -id POLICY
$ consul acl policy delete -id b6b856da-5193-4e78-845a-7d61ca8371ba $ consul acl policy delete -id b6b856da-5193-4e78-845a-7d61ca8371ba
` `
)

View File

@ -40,7 +40,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -86,8 +86,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Lists ACL policies" const (
const help = ` synopsis = "Lists ACL policies"
help = `
Usage: consul acl policy list [options] Usage: consul acl policy list [options]
Lists all the ACL policies Lists all the ACL policies
@ -96,3 +97,4 @@ Usage: consul acl policy list [options]
$ consul acl policy list $ consul acl policy list
` `
)

View File

@ -46,7 +46,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -108,8 +108,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Read an ACL policy" const (
const help = ` synopsis = "Read an ACL policy"
help = `
Usage: consul acl policy read [options] POLICY Usage: consul acl policy read [options] POLICY
This command will retrieve and print out the details This command will retrieve and print out the details
@ -124,3 +125,4 @@ Usage: consul acl policy read [options] POLICY
$ consul acl policy read -name my-policy $ consul acl policy read -name my-policy
` `
)

View File

@ -67,7 +67,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -185,8 +185,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Update an ACL policy" const (
const help = ` synopsis = "Update an ACL policy"
help = `
Usage: consul acl policy update [options] Usage: consul acl policy update [options]
Updates a policy. By default it will merge the policy information with its Updates a policy. By default it will merge the policy information with its
@ -203,3 +204,4 @@ Usage: consul acl policy update [options]
# the description # the description
$consul acl policy update -id abcd -name "better-name" -rules @rules.hcl $consul acl policy update -id abcd -name "better-name" -rules @rules.hcl
` `
)

View File

@ -60,7 +60,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }

View File

@ -34,7 +34,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -82,8 +82,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Delete an ACL role" const (
const help = ` synopsis = "Delete an ACL role"
help = `
Usage: consul acl role delete [options] -id ROLE Usage: consul acl role delete [options] -id ROLE
Deletes an ACL role by providing the ID or a unique ID prefix. Deletes an ACL role by providing the ID or a unique ID prefix.
@ -97,3 +98,4 @@ Usage: consul acl role delete [options] -id ROLE
$ consul acl role delete -id b6b856da-5193-4e78-845a-7d61ca8371ba $ consul acl role delete -id b6b856da-5193-4e78-845a-7d61ca8371ba
` `
)

View File

@ -40,7 +40,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -86,8 +86,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Lists ACL roles" const (
const help = ` synopsis = "Lists ACL roles"
help = `
Usage: consul acl role list [options] Usage: consul acl role list [options]
Lists all the ACL roles. Lists all the ACL roles.
@ -96,3 +97,4 @@ Usage: consul acl role list [options]
$ consul acl role list $ consul acl role list
` `
)

View File

@ -47,7 +47,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -120,8 +120,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Read an ACL role" const (
const help = ` synopsis = "Read an ACL role"
help = `
Usage: consul acl role read [options] ROLE Usage: consul acl role read [options] ROLE
This command will retrieve and print out the details This command will retrieve and print out the details
@ -136,3 +137,4 @@ Usage: consul acl role read [options] ROLE
$ consul acl role read -name my-policy $ consul acl role read -name my-policy
` `
)

View File

@ -69,7 +69,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -250,8 +250,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Update an ACL role" const (
const help = ` synopsis = "Update an ACL role"
help = `
Usage: consul acl role update [options] Usage: consul acl role update [options]
Updates a role. By default it will merge the role information with its Updates a role. By default it will merge the role information with its
@ -270,3 +271,4 @@ Usage: consul acl role update [options]
-policy-name "token-replication" \ -policy-name "token-replication" \
-service-identity "web" -service-identity "web"
` `
)

View File

@ -44,7 +44,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -101,8 +101,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Clone an ACL token" const (
const help = ` synopsis = "Clone an ACL token"
help = `
Usage: consul acl token clone [options] Usage: consul acl token clone [options]
This command will clone a token. When cloning an alternate description may be given This command will clone a token. When cloning an alternate description may be given
@ -112,3 +113,4 @@ Usage: consul acl token clone [options]
$ consul acl token clone -id abcd -description "replication" $ consul acl token clone -id abcd -description "replication"
` `
)

View File

@ -75,7 +75,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -182,8 +182,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Create an ACL token" const (
const help = ` synopsis = "Create an ACL token"
help = `
Usage: consul acl token create [options] Usage: consul acl token create [options]
When creating a new token policies may be linked using either the -policy-id When creating a new token policies may be linked using either the -policy-id
@ -200,3 +201,4 @@ Usage: consul acl token create [options]
-service-identity "web" \ -service-identity "web" \
-service-identity "db:east,west" -service-identity "db:east,west"
` `
)

View File

@ -33,7 +33,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -76,8 +76,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Delete an ACL token" const (
const help = ` synopsis = "Delete an ACL token"
help = `
Usage: consul acl token delete [options] -id TOKEN Usage: consul acl token delete [options] -id TOKEN
Deletes an ACL token by providing either the ID or a unique ID prefix. Deletes an ACL token by providing either the ID or a unique ID prefix.
@ -90,3 +91,4 @@ Usage: consul acl token delete [options] -id TOKEN
$ consul acl token delete -id b6b856da-5193-4e78-845a-7d61ca8371ba $ consul acl token delete -id b6b856da-5193-4e78-845a-7d61ca8371ba
` `
)

View File

@ -39,7 +39,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -85,11 +85,13 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "List ACL tokens" const (
const help = ` synopsis = "List ACL tokens"
help = `
Usage: consul acl token list [options] Usage: consul acl token list [options]
List all the ACL tokens List all the ACL tokens
$ consul acl token list $ consul acl token list
` `
)

View File

@ -48,7 +48,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -114,8 +114,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Read an ACL token" const (
const help = ` synopsis = "Read an ACL token"
help = `
Usage: consul acl token read [options] -id TOKENID Usage: consul acl token read [options] -id TOKENID
This command will retrieve and print out the details of This command will retrieve and print out the details of
@ -129,3 +130,4 @@ Usage: consul acl token read [options] -id TOKENID
$ consul acl token read -id 4be56c77-8244-4c7d-b08c-667b8c71baed $ consul acl token read -id 4be56c77-8244-4c7d-b08c-667b8c71baed
` `
)

View File

@ -86,7 +86,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -331,8 +331,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Update an ACL token" const (
const help = ` synopsis = "Update an ACL token"
help = `
Usage: consul acl token update [options] Usage: consul acl token update [options]
This command will update a token. Some parts such as marking the token local This command will update a token. Some parts such as marking the token local
@ -349,3 +350,4 @@ Usage: consul acl token update [options]
-policy-name "token-replication" \ -policy-name "token-replication" \
-role-name "db-updater" -role-name "db-updater"
` `
)

View File

@ -46,7 +46,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -134,8 +134,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Lists all registered services in a datacenter" const (
const help = ` synopsis = "Lists all registered services in a datacenter"
help = `
Usage: consul catalog services [options] Usage: consul catalog services [options]
Retrieves the list services registered in a given datacenter. By default, the Retrieves the list services registered in a given datacenter. By default, the
@ -159,3 +160,4 @@ Usage: consul catalog services [options]
For a full list of options and examples, please see the Consul documentation. For a full list of options and examples, please see the Consul documentation.
` `
)

View File

@ -31,7 +31,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -74,8 +74,9 @@ func (c *cmd) Help() string {
return flags.Usage(help, nil) return flags.Usage(help, nil)
} }
const synopsis = "Delete a centralized config entry" const (
const help = ` synopsis = "Delete a centralized config entry"
help = `
Usage: consul config delete [options] -kind <config kind> -name <config name> Usage: consul config delete [options] -kind <config kind> -name <config name>
Deletes the configuration entry specified by the kind and name. Deletes the configuration entry specified by the kind and name.
@ -84,3 +85,4 @@ Usage: consul config delete [options] -kind <config kind> -name <config name>
$ consul config delete -kind service-defaults -name web $ consul config delete -kind service-defaults -name web
` `
)

View File

@ -29,7 +29,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -69,8 +69,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "List centralized config entries of a given kind" const (
const help = ` synopsis = "List centralized config entries of a given kind"
help = `
Usage: consul config list [options] -kind <config kind> Usage: consul config list [options] -kind <config kind>
Lists all of the config entries for a given kind. The -kind parameter Lists all of the config entries for a given kind. The -kind parameter
@ -81,3 +82,4 @@ Usage: consul config list [options] -kind <config kind>
$ consul config list -kind service-defaults $ consul config list -kind service-defaults
` `
)

View File

@ -34,7 +34,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -83,8 +83,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Read a centralized config entry" const (
const help = ` synopsis = "Read a centralized config entry"
help = `
Usage: consul config read [options] -kind <config kind> -name <config name> Usage: consul config read [options] -kind <config kind> -name <config name>
Reads the config entry specified by the given kind and name and outputs its Reads the config entry specified by the given kind and name and outputs its
@ -94,3 +95,4 @@ Usage: consul config read [options] -kind <config kind> -name <config name>
$ consul config read -kind proxy-defaults -name global $ consul config read -kind proxy-defaults -name global
` `
)

View File

@ -45,7 +45,7 @@ func (c *cmd) init() {
"This is used in combination with the -cas flag.") "This is used in combination with the -cas flag.")
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -179,8 +179,9 @@ func (c *cmd) Help() string {
return flags.Usage(c.help, nil) return flags.Usage(c.help, nil)
} }
const synopsis = "Create or update a centralized config entry" const (
const help = ` synopsis = "Create or update a centralized config entry"
help = `
Usage: consul config write [options] <configuration> Usage: consul config write [options] <configuration>
Request a config entry to be created or updated. The configuration Request a config entry to be created or updated. The configuration
@ -196,3 +197,4 @@ Usage: consul config write [options] <configuration>
$ consul config write - $ consul config write -
` `
)

View File

@ -168,7 +168,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -660,8 +660,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Runs or Configures Envoy as a Connect proxy" const (
const help = ` synopsis = "Runs or Configures Envoy as a Connect proxy"
help = `
Usage: consul connect envoy [options] [-- pass-through options] Usage: consul connect envoy [options] [-- pass-through options]
Generates the bootstrap configuration needed to start an Envoy proxy instance Generates the bootstrap configuration needed to start an Envoy proxy instance
@ -689,3 +690,4 @@ Usage: consul connect envoy [options] [-- pass-through options]
$ consul connect envoy -sidecar-for web -- --log-level debug $ consul connect envoy -sidecar-for web -- --log-level debug
` `
)

View File

@ -68,7 +68,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -237,8 +237,9 @@ func (c *cmd) generateConfigFromFlags() (iptables.Config, error) {
return cfg, nil return cfg, nil
} }
const synopsis = "Applies iptables rules for traffic redirection" const (
const help = ` synopsis = "Applies iptables rules for traffic redirection"
help = `
Usage: consul connect redirect-traffic [options] Usage: consul connect redirect-traffic [options]
Applies iptables rules for inbound and outbound traffic redirection. Applies iptables rules for inbound and outbound traffic redirection.
@ -251,3 +252,4 @@ Usage: consul connect redirect-traffic [options]
$ consul connect redirect-traffic -proxy-uid 1234 -proxy-inbound-port 20000 $ consul connect redirect-traffic -proxy-uid 1234 -proxy-inbound-port 20000
` `
)

View File

@ -23,8 +23,9 @@ type HTTPFlags struct {
datacenter StringValue datacenter StringValue
stale BoolValue stale BoolValue
// namespace flags // multi-tenancy flags
namespace StringValue namespace StringValue
partition StringValue
} }
func (f *HTTPFlags) ClientFlags() *flag.FlagSet { func (f *HTTPFlags) ClientFlags() *flag.FlagSet {
@ -74,12 +75,16 @@ func (f *HTTPFlags) ServerFlags() *flag.FlagSet {
return fs return fs
} }
func (f *HTTPFlags) NamespaceFlags() *flag.FlagSet { func (f *HTTPFlags) MultiTenancyFlags() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError) fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.Var(&f.namespace, "namespace", fs.Var(&f.namespace, "namespace",
"Specifies the namespace to query. If not provided, the namespace will be inferred "+ "Specifies the namespace to query. If not provided, the namespace will be inferred "+
"from the request's ACL token, or will default to the `default` namespace. "+ "from the request's ACL token, or will default to the `default` namespace. "+
"Namespaces are a Consul Enterprise feature.") "Namespaces are a Consul Enterprise feature.")
fs.Var(&f.partition, "partition",
"Specifies the admin partition to query. If not provided, the admin partition will be inferred "+
"from the request's ACL token, or will default to the `default` admin partition. "+
"Admin Partitions are a Consul Enterprise feature.")
return fs return fs
} }

View File

@ -31,7 +31,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -81,8 +81,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Check whether a connection between two services is allowed." const (
const help = ` synopsis = "Check whether a connection between two services is allowed."
help = `
Usage: consul intention check [options] SRC DST Usage: consul intention check [options] SRC DST
Check whether a connection between SRC and DST would be allowed by Check whether a connection between SRC and DST would be allowed by
@ -91,3 +92,4 @@ Usage: consul intention check [options] SRC DST
$ consul intention check web db $ consul intention check web db
` `
)

View File

@ -53,7 +53,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -224,8 +224,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Create intentions for service connections." const (
const help = ` synopsis = "Create intentions for service connections."
help = `
Usage: consul intention create [options] SRC DST Usage: consul intention create [options] SRC DST
Usage: consul intention create [options] -file FILE... Usage: consul intention create [options] -file FILE...
@ -254,3 +255,4 @@ Usage: consul intention create [options] -file FILE...
Additional flags and more advanced use cases are detailed below. Additional flags and more advanced use cases are detailed below.
` `
)

View File

@ -30,7 +30,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -80,8 +80,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Delete an intention." const (
const help = ` synopsis = "Delete an intention."
help = `
Usage: consul intention delete [options] SRC DST Usage: consul intention delete [options] SRC DST
Usage: consul intention delete [options] ID Usage: consul intention delete [options] ID
@ -91,3 +92,4 @@ Usage: consul intention delete [options] ID
$ consul intention delete web db $ consul intention delete web db
` `
)

View File

@ -35,7 +35,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -106,8 +106,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Show information about an intention." const (
const help = ` synopsis = "Show information about an intention."
help = `
Usage: consul intention get [options] SRC DST Usage: consul intention get [options] SRC DST
Usage: consul intention get [options] ID Usage: consul intention get [options] ID
@ -117,3 +118,4 @@ Usage: consul intention get [options] ID
$ consul intention get web db $ consul intention get web db
` `
)

View File

@ -28,7 +28,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -77,9 +77,11 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "List intentions." const (
const help = ` synopsis = "List intentions."
help = `
Usage: consul intention list Usage: consul intention list
List all intentions. List all intentions.
` `
)

View File

@ -40,7 +40,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -97,8 +97,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Show intentions that match a source or destination." const (
const help = ` synopsis = "Show intentions that match a source or destination."
help = `
Usage: consul intention match [options] SRC|DST Usage: consul intention match [options] SRC|DST
Show the list of intentions that would be enforced for a given source Show the list of intentions that would be enforced for a given source
@ -109,3 +110,4 @@ Usage: consul intention match [options] SRC|DST
$ consul intention match -source web $ consul intention match -source web
` `
)

View File

@ -39,7 +39,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -147,8 +147,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Removes data from the KV store" const (
const help = ` synopsis = "Removes data from the KV store"
help = `
Usage: consul kv delete [options] KEY_OR_PREFIX Usage: consul kv delete [options] KEY_OR_PREFIX
Removes the value from Consul's key-value store at the given path. If no Removes the value from Consul's key-value store at the given path. If no
@ -165,3 +166,4 @@ Usage: consul kv delete [options] KEY_OR_PREFIX
This will delete the keys named "foo", "food", and "foo/bar/zip" if they This will delete the keys named "foo", "food", and "foo/bar/zip" if they
existed. existed.
` `
)

View File

@ -29,7 +29,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -97,8 +97,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Exports a tree from the KV store as JSON" const (
const help = ` synopsis = "Exports a tree from the KV store as JSON"
help = `
Usage: consul kv export [KEY_OR_PREFIX] Usage: consul kv export [KEY_OR_PREFIX]
Retrieves key-value pairs for the given prefix from Consul's key-value store, Retrieves key-value pairs for the given prefix from Consul's key-value store,
@ -109,3 +110,4 @@ Usage: consul kv export [KEY_OR_PREFIX]
For a full list of options and examples, please see the Consul documentation. For a full list of options and examples, please see the Consul documentation.
` `
)

View File

@ -54,7 +54,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -210,8 +210,9 @@ func prettyKVPair(w io.Writer, pair *api.KVPair, base64EncodeValue bool) error {
return tw.Flush() return tw.Flush()
} }
const synopsis = "Retrieves or lists data from the KV store" const (
const help = ` synopsis = "Retrieves or lists data from the KV store"
help = `
Usage: consul kv get [options] [KEY_OR_PREFIX] Usage: consul kv get [options] [KEY_OR_PREFIX]
Retrieves the value from Consul's key-value store at the given key name. If no Retrieves the value from Consul's key-value store at the given key name. If no
@ -242,3 +243,4 @@ Usage: consul kv get [options] [KEY_OR_PREFIX]
For a full list of options and examples, please see the Consul documentation. For a full list of options and examples, please see the Consul documentation.
` `
)

View File

@ -41,7 +41,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -145,8 +145,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Imports a tree stored as JSON to the KV store" const (
const help = ` synopsis = "Imports a tree stored as JSON to the KV store"
help = `
Usage: consul kv import [DATA] Usage: consul kv import [DATA]
Imports key-value pairs to the key-value store from the JSON representation Imports key-value pairs to the key-value store from the JSON representation
@ -166,3 +167,4 @@ Usage: consul kv import [DATA]
For a full list of options and examples, please see the Consul documentation. For a full list of options and examples, please see the Consul documentation.
` `
)

View File

@ -68,7 +68,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -198,8 +198,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Sets or updates data in the KV store" const (
const help = ` synopsis = "Sets or updates data in the KV store"
help = `
Usage: consul kv put [options] KEY [DATA] Usage: consul kv put [options] KEY [DATA]
Writes the data to the given path in the key-value store. The data can be of Writes the data to the given path in the key-value store. The data can be of
@ -232,3 +233,4 @@ Usage: consul kv put [options] KEY [DATA]
Additional flags and more advanced use cases are detailed below. Additional flags and more advanced use cases are detailed below.
` `
)

View File

@ -63,7 +63,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -139,7 +139,7 @@ func (c *cmd) bearerTokenLogin() int {
func (c *cmd) writeToSink(tok *api.ACLToken) error { func (c *cmd) writeToSink(tok *api.ACLToken) error {
payload := []byte(tok.SecretID) payload := []byte(tok.SecretID)
return file.WriteAtomicWithPerms(c.tokenSinkFile, payload, 0755, 0600) return file.WriteAtomicWithPerms(c.tokenSinkFile, payload, 0o755, 0o600)
} }
func (c *cmd) Synopsis() string { func (c *cmd) Synopsis() string {

View File

@ -32,7 +32,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -52,7 +52,8 @@ func (c *cmd) Run(args []string) int {
} }
svcs := []*api.AgentServiceRegistration{{ svcs := []*api.AgentServiceRegistration{{
ID: c.flagId}} ID: c.flagId,
}}
if len(args) > 0 { if len(args) > 0 {
var err error var err error
svcs, err = services.ServicesFromFiles(c.UI, args) svcs, err = services.ServicesFromFiles(c.UI, args)
@ -99,8 +100,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Deregister services with the local agent" const (
const help = ` synopsis = "Deregister services with the local agent"
help = `
Usage: consul services deregister [options] [FILE...] Usage: consul services deregister [options] [FILE...]
Deregister one or more services that were previously registered with Deregister one or more services that were previously registered with
@ -115,3 +117,4 @@ Usage: consul services deregister [options] [FILE...]
Services are deregistered from the local agent catalog. This command must Services are deregistered from the local agent catalog. This command must
be run against the same agent where the service was registered. be run against the same agent where the service was registered.
` `
)

View File

@ -58,7 +58,7 @@ func (c *cmd) init() {
c.http = &flags.HTTPFlags{} c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags()) flags.Merge(c.flags, c.http.ClientFlags())
flags.Merge(c.flags, c.http.ServerFlags()) flags.Merge(c.flags, c.http.ServerFlags())
flags.Merge(c.flags, c.http.NamespaceFlags()) flags.Merge(c.flags, c.http.MultiTenancyFlags())
c.help = flags.Usage(help, c.flags) c.help = flags.Usage(help, c.flags)
} }
@ -139,8 +139,9 @@ func (c *cmd) Help() string {
return c.help return c.help
} }
const synopsis = "Register services with the local agent" const (
const help = ` synopsis = "Register services with the local agent"
help = `
Usage: consul services register [options] [FILE...] Usage: consul services register [options] [FILE...]
Register one or more services using the local agent API. Services can Register one or more services using the local agent API. Services can
@ -153,3 +154,4 @@ Usage: consul services register [options] [FILE...]
Additional flags and more advanced use cases are detailed below. Additional flags and more advanced use cases are detailed below.
` `
)