Esempio n. 1
0
func main() {
	creds := aws.Creds(os.Getenv("research_key"), os.Getenv("research_secret"), "")
	cli := elb.New(creds, "us-east-1", nil)
	resp, err := descElb("grinder-perf", cli)
	if err != nil {
		fmt.Println(err)
	}
	//	fmt.Println(resp)
	for _, v := range resp.LoadBalancerDescriptions {
		descInstanceHealth(v.Instances, cli)
	}
	//fmt.Printf("%v", reflect.TypeOf(cli))
	//	args := os.Args[1:]
	//	for i := 0; i < len(args); i++ {
	//elbinput := elb.DescribeAccessPointsInput{LoadBalancerNames: []string{args[i]},}
	//elbs, err := cli.DescribeLoadBalancers(&elbinput)
	//elbs, err := cli.DescribeLoadBalancers(nil)
	//		if err != nil {
	//			fmt.Print(err)
	//		}
	//		for _, elb := range elbs.LoadBalancerDescriptions {
	//			fmt.Println("LoadBalancer Name:", *elb.LoadBalancerName)
	//			for _, instance := range elb.Instances {
	//				fmt.Println(*instance.InstanceID)
	//			}
	//		}
	//	}

}
Esempio n. 2
0
func main() {
	creds := aws.Creds("ACCESS", "SECRET", "")
	cli := elb.New(creds, "us-east-1", nil)
	//  elbs := elb.DescribeAccessPointsInput{LoadBalancerNames: []string{"grinder-perf", "etcd-test"}}
	//  elbs.LoadBalancerNames = []string{"test"}
	//  resp, err := cli.DescribeLoadBalancers(&elbs)
	resp, err := getElbInfo("grinder-perf", &cli)
	if err != nil {
		fmt.Println(err)
		return
	}

	for _, v := range resp.LoadBalancerDescriptions {
		//      elbInfo[*v.DNSName]
		getInstanceHealth(v.Instances, &cli)
		//      for _, instance := range v.Instances {
		//          health = getInstanceHealth(id, &cli)
		//          elbInfo[*v.DNSName][*instance.InstanceID]
		//          fmt.Println(elbInfo)
		//  }
		//      elbInfo["test"]["instance"] = string(*v.Instances[0].InstanceID)
		//  fmt.Println(*v.Instances[0].InstanceID)
		//      fmt.Println(v.AvailabilityZones)
	}
	fmt.Println("######################", elbInfo)
}