func (p *JujuProvisioner) Addr(app provision.App) (string, error) { if p.elbSupport() { router, err := Router() if err != nil { return "", err } return router.Addr(app.GetName()) } units := app.ProvisionedUnits() if len(units) < 1 { return "", fmt.Errorf("App %q has no units.", app.GetName()) } return units[0].GetIp(), nil }
func Example() { router, err := router.Get("hipache") if err != nil { panic(err) } err = router.AddRoute("myapp", "http://10.10.10.10:8080") if err != nil { panic(err) } addr, _ := router.Addr("myapp") fmt.Println("Please access:", addr) err = router.RemoveRoute("myapp") if err != nil { panic(err) } }
func (p *JujuProvisioner) Addr(app provision.App) (string, error) { if p.elbSupport() { router, err := Router() if err != nil { return "", err } addr, err := router.Addr(app.GetName()) if err != nil { return "", fmt.Errorf("There is no ACTIVE Load Balancer named %s", app.GetName()) } return addr, nil } units := app.ProvisionedUnits() if len(units) < 1 { return "", fmt.Errorf("App %q has no units.", app.GetName()) } return units[0].GetIp(), nil }