本文整理汇总了Golang中github.com/juju/juju/api.Connection.HTTPClient方法的典型用法代码示例。如果您正苦于以下问题:Golang Connection.HTTPClient方法的具体用法?Golang Connection.HTTPClient怎么用?Golang Connection.HTTPClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/api.Connection
的用法示例。
在下文中一共展示了Connection.HTTPClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: checkAvailable
// 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
}
示例2: newAPIClient
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
}