// Print out the addresses of the API server endpoints. func (c *EndpointCommand) Run(ctx *cmd.Context) error { apiendpoint, err := juju.APIEndpointForEnv(c.EnvName, c.refresh) if err != nil { return err } return c.out.Write(ctx, apiendpoint.Addresses) }
func (s *APIEndpointForEnvSuite) TestAPIEndpointForEnvSuchName(c *gc.C) { defer coretesting.MakeMultipleEnvHome(c).Restore() _, err := juju.APIEndpointForEnv("no-such-env", false) c.Check(err, jc.Satisfies, errors.IsNotFound) c.Check(err, gc.ErrorMatches, `environment "no-such-env" not found`) }