5
"launchpad.net/juju-core/cmd"
6
"launchpad.net/juju-core/juju"
7
"launchpad.net/juju-core/state/api/params"
8
"launchpad.net/juju-core/state/statecmd"
11
// ExposeCommand is responsible exposing services.
12
type ExposeCommand struct {
17
func (c *ExposeCommand) Info() *cmd.Info {
21
Purpose: "expose a service",
25
func (c *ExposeCommand) Init(args []string) error {
27
return errors.New("no service name specified")
29
c.ServiceName = args[0]
30
return cmd.CheckEmpty(args[1:])
33
// Run changes the juju-managed firewall to expose any
34
// ports that were also explicitly marked by units as open.
35
func (c *ExposeCommand) Run(_ *cmd.Context) error {
36
conn, err := juju.NewConnFromName(c.EnvName)
42
params := params.ServiceExpose{
43
ServiceName: c.ServiceName,
45
return statecmd.ServiceExpose(conn.State, params)