Skip to content

Commit

Permalink
Changed the way elbs print to match closer to ec2s print
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch Anderson committed Aug 5, 2017
1 parent 93e1003 commit ec7494b
Show file tree
Hide file tree
Showing 8 changed files with 1,125 additions and 4 deletions.
26 changes: 22 additions & 4 deletions elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,24 @@ import (
"github.com/urfave/cli"
)

func printElb(elb []map[string]string) error {
for _, e := range elb {
fmt.Printf(
"%-45s\t%-3s\t%-2s:%-2s\t%-15s\t%-50s\n",
color.YellowString(e["name"]), e["numInstances"], color.GreenString(e["instances_in"]),
color.RedString(e["instances_out"]), e["scheme"], e["dns"])
}
return nil
}

func elbList(c *cli.Context) error {
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
Profile: awsProfile,
}))

var elbList []map[string]string

elbsvc := elb.New(sess)

// I don't want to filter results of ELB's
Expand Down Expand Up @@ -52,11 +64,17 @@ func elbList(c *cli.Context) error {
}
}

elbState := fmt.Sprintf("In: %-2s / Out: %-2s", color.GreenString(strconv.Itoa(inservice)), color.RedString(strconv.Itoa(noservice)))
elbInstance := map[string]string{
"name": *lb.LoadBalancerName,
"numInstances": strconv.Itoa(len(lb.Instances)),
"instances_in": strconv.Itoa(inservice),
"instances_out": strconv.Itoa(noservice),
"scheme": *lb.Scheme,
"dns": *lb.DNSName,
}

fmt.Printf(
"%-45s\t%-4d\t%-15s\t%-15s\t%-50s\n",
color.YellowString(*lb.LoadBalancerName), len(lb.Instances), elbState, *lb.Scheme, *lb.DNSName)
elbList = append(elbList, elbInstance)
}
printElb(elbList)
return nil
}
21 changes: 21 additions & 0 deletions vendor/github.com/mattn/go-colorable/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions vendor/github.com/mattn/go-colorable/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions vendor/github.com/mattn/go-colorable/colorable_appengine.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions vendor/github.com/mattn/go-colorable/colorable_others.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ec7494b

Please sign in to comment.