Beispiel #1
0
func (r elbRouter) RemoveBackend(name string) error {
	backendName, err := router.Retrieve(name)
	if err != nil {
		return err
	}
	_, err = r.elb().DeleteLoadBalancer(backendName)
	if err != nil {
		return err
	}
	return router.Remove(backendName)
}
Beispiel #2
0
func (r hipacheRouter) RemoveBackend(name string) error {
	backendName, err := router.Retrieve(name)
	if err != nil {
		return err
	}
	domain, err := config.GetString("hipache:domain")
	if err != nil {
		return &routeError{"remove", err}
	}
	frontend := "frontend:" + backendName + "." + domain
	conn := connect()
	defer conn.Close()
	_, err = conn.Do("DEL", frontend)
	if err != nil {
		return &routeError{"remove", err}
	}
	err = router.Remove(backendName)
	if err != nil {
		return &routeError{"remove", err}
	}
	cname, err := r.getCName(backendName)
	if err != nil {
		return err
	}
	if cname == "" {
		return nil
	}
	_, err = conn.Do("DEL", "frontend:"+cname)
	if err != nil {
		return &routeError{"remove", err}
	}
	_, err = conn.Do("DEL", "cname:"+backendName)
	if err != nil {
		return &routeError{"remove", err}
	}
	return nil
}