Beispiel #1
0
// checkAvailable ensures the Juju GUI is available on the controller at the
// given URL.
func (c *guiCommand) checkAvailable(rawURL string, conn api.Connection) error {
	client, err := conn.HTTPClient()
	if err != nil {
		return errors.Annotate(err, "cannot retrieve HTTP client")
	}
	if err = clientGet(client, rawURL); err != nil {
		return errors.Annotate(err, "Juju GUI is not available")
	}
	return nil
}
Beispiel #2
0
func newAPIClient(apiCaller api.Connection) (*client.Client, error) {
	caller := base.NewFacadeCallerForVersion(apiCaller, resource.ComponentName, server.Version)

	httpClient, err := apiCaller.HTTPClient()
	if err != nil {
		return nil, errors.Trace(err)
	}
	// The apiCaller takes care of prepending /environment/<envUUID>.
	apiClient := client.NewClient(caller, httpClient, apiCaller)
	return apiClient, nil
}