convox/pkg/cli/balancers.go
David Dollar 959533686c
add custom load balancers (#15)
* add custom load balancers

* fix tests
2019-11-15 15:40:33 -05:00

29 lines
540 B
Go

package cli
import (
"github.com/convox/convox/sdk"
"github.com/convox/stdcli"
)
func init() {
register("balancers", "list balancers for an app", Balancers, stdcli.CommandOptions{
Flags: []stdcli.Flag{flagApp, flagRack},
Validate: stdcli.Args(0),
})
}
func Balancers(rack sdk.Interface, c *stdcli.Context) error {
bs, err := rack.BalancerList(app(c))
if err != nil {
return err
}
t := c.Table("BALANCER", "SERVICE", "ENDPOINT")
for _, b := range bs {
t.AddRow(b.Name, b.Service, b.Endpoint)
}
return t.Print()
}