Пример #1
0
func Example() {
	router, err := router.Get("hipache")
	if err != nil {
		panic(err)
	}
	err = router.AddBackend("myapp")
	if err != nil {
		panic(err)
	}
	url, err := url.Parse("http://10.10.10.10:8080")
	if err != nil {
		panic(err)
	}
	err = router.AddRoute("myapp", url)
	if err != nil {
		panic(err)
	}
	addr, _ := router.Addr("myapp")
	fmt.Println("Please access:", addr)
	err = router.RemoveRoute("myapp", url)
	if err != nil {
		panic(err)
	}
	err = router.RemoveBackend("myapp")
	if err != nil {
		panic(err)
	}
}
Пример #2
0
func (p *JujuProvisioner) Destroy(app provision.App) error {
	var err error
	if err = p.destroyService(app); err != nil {
		return err
	}
	if p.elbSupport() {
		router, err := Router()
		if err != nil {
			return err
		}
		err = router.RemoveBackend(app.GetName())
	}
	go p.terminateMachines(app)
	p.deleteUnits(app)
	return err
}