2018-05-12 02:47:26 +00:00
|
|
|
package intention
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/consul/command/flags"
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func New() *cmd {
|
|
|
|
return &cmd{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type cmd struct{}
|
|
|
|
|
|
|
|
func (c *cmd) Run(args []string) int {
|
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Synopsis() string {
|
|
|
|
return synopsis
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *cmd) Help() string {
|
|
|
|
return flags.Usage(help, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
const synopsis = "Interact with Connect service intentions"
|
|
|
|
const help = `
|
|
|
|
Usage: consul intention <subcommand> [options] [args]
|
|
|
|
|
|
|
|
This command has subcommands for interacting with intentions. Intentions
|
2018-05-22 17:22:41 +00:00
|
|
|
are permissions describing which services are allowed to communicate via
|
2018-05-12 02:47:26 +00:00
|
|
|
Connect. Here are some simple examples, and more detailed examples are
|
|
|
|
available in the subcommands or the documentation.
|
|
|
|
|
|
|
|
Create an intention to allow "web" to talk to "db":
|
|
|
|
|
|
|
|
$ consul intention create web db
|
|
|
|
|
|
|
|
Test whether a "web" is allowed to connect to "db":
|
|
|
|
|
|
|
|
$ consul intention check web db
|
|
|
|
|
2021-01-12 20:14:31 +00:00
|
|
|
List all intentions:
|
|
|
|
|
|
|
|
$ consul intention list
|
|
|
|
|
2018-05-12 02:47:26 +00:00
|
|
|
Find all intentions for communicating to the "db" service:
|
|
|
|
|
|
|
|
$ consul intention match db
|
|
|
|
|
|
|
|
For more examples, ask for subcommand help or view the documentation.
|
|
|
|
`
|