func (r elbRouter) AddBackend(name string) error { var err error options := elb.CreateLoadBalancer{ Name: name, Listeners: []elb.Listener{ { InstancePort: 80, InstanceProtocol: "HTTP", LoadBalancerPort: 80, Protocol: "HTTP", }, }, } vpc, _ := config.GetBool("juju:elb-use-vpc") if vpc { options.Subnets, err = config.GetList("juju:elb-vpc-subnets") if err != nil { return err } options.SecurityGroups, err = config.GetList("juju:elb-vpc-secgroups") if err != nil { return err } options.Scheme = "internal" } else { options.AvailZones, err = config.GetList("juju:elb-avail-zones") if err != nil { return err } } _, err = r.elb().CreateLoadBalancer(&options) return router.Store(name, name) }
func (r *fakeRouter) AddBackend(name string) error { if r.HasBackend(name) { return errors.New("Backend already exists") } r.mutex.Lock() defer r.mutex.Unlock() r.backends[name] = nil return router.Store(name, name) }
func (hipacheRouter) AddBackend(name string) error { domain, err := config.GetString("hipache:domain") if err != nil { return &routeError{"add", err} } frontend := "frontend:" + name + "." + domain conn := connect() defer conn.Close() _, err = conn.Do("RPUSH", frontend, name) if err != nil { return &routeError{"add", err} } return router.Store(name, name) }