本文整理匯總了Golang中github.com/juju/juju/apiserver/params.ResolveCharmResult.URL方法的典型用法代碼示例。如果您正苦於以下問題:Golang ResolveCharmResult.URL方法的具體用法?Golang ResolveCharmResult.URL怎麽用?Golang ResolveCharmResult.URL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/apiserver/params.ResolveCharmResult
的用法示例。
在下文中一共展示了ResolveCharmResult.URL方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ResolveCharms
// ResolveCharm resolves the best available charm URLs with series, for charm
// locations without a series specified.
func ResolveCharms(st *state.State, args params.ResolveCharms) (params.ResolveCharmResults, error) {
var results params.ResolveCharmResults
envConfig, err := st.ModelConfig()
if err != nil {
return params.ResolveCharmResults{}, err
}
repo := config.SpecializeCharmRepo(
NewCharmStoreRepo(csclient.New(csclient.Params{})),
envConfig)
for _, ref := range args.References {
result := params.ResolveCharmResult{}
curl, err := charm.ParseURL(ref)
if err != nil {
result.Error = err.Error()
} else {
curl, err := resolveCharm(curl, repo)
if err != nil {
result.Error = err.Error()
} else {
result.URL = curl.String()
}
}
results.URLs = append(results.URLs, result)
}
return results, nil
}
示例2: ResolveCharms
func (c *Client) ResolveCharms(args params.ResolveCharms) (params.ResolveCharmResults, error) {
var results params.ResolveCharmResults
envConfig, err := c.api.state.EnvironConfig()
if err != nil {
return params.ResolveCharmResults{}, err
}
repo := config.SpecializeCharmRepo(CharmStore, envConfig)
for _, ref := range args.References {
result := params.ResolveCharmResult{}
curl, err := c.resolveCharm(&ref, repo)
if err != nil {
result.Error = err.Error()
} else {
result.URL = curl
}
results.URLs = append(results.URLs, result)
}
return results, nil
}
示例3: ResolveCharms
// ResolveCharm resolves the best available charm URLs with series, for charm
// locations without a series specified.
func ResolveCharms(st *state.State, args params.ResolveCharms) (params.ResolveCharmResults, error) {
var results params.ResolveCharmResults
envConfig, err := st.EnvironConfig()
if err != nil {
return params.ResolveCharmResults{}, err
}
repo := config.SpecializeCharmRepo(
NewCharmStore(charmrepo.NewCharmStoreParams{}),
envConfig)
for _, ref := range args.References {
result := params.ResolveCharmResult{}
curl, err := resolveCharm(&ref, repo)
if err != nil {
result.Error = err.Error()
} else {
result.URL = curl
}
results.URLs = append(results.URLs, result)
}
return results, nil
}