Beispiel #1
0
func parseGroup(s string) ec2.SecurityGroup {
	var g ec2.SecurityGroup
	if secGroupPat.MatchString(s) {
		g.Id = s
	} else {
		g.Name = s
	}
	return g
}
Beispiel #2
0
func delgroup(c cmd, conn *ec2.EC2, args []string) {
	run := parallel.NewRun(40)
	for _, g := range args {
		g := g
		run.Do(func() error {
			var ec2g ec2.SecurityGroup
			if secGroupPat.MatchString(g) {
				ec2g.Id = g
			} else {
				ec2g.Name = g
			}
			_, err := conn.DeleteSecurityGroup(ec2g)
			if err != nil {
				errorf("cannot delete %q: %v", g, err)
				return errgo.Newf("error")
			}
			return nil
		})
	}
	if run.Wait() != nil {
		os.Exit(1)
	}
}