本文整理汇总了Golang中github.com/juju/juju/state.Charm.BundleURL方法的典型用法代码示例。如果您正苦于以下问题:Golang Charm.BundleURL方法的具体用法?Golang Charm.BundleURL怎么用?Golang Charm.BundleURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.Charm
的用法示例。
在下文中一共展示了Charm.BundleURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CharmArchiveURL
// CharmArchiveURL returns the URL, corresponding to the charm archive
// (bundle) in the provider storage for each given charm URL, along
// with the DisableSSLHostnameVerification flag.
func (u *UniterAPI) CharmArchiveURL(args params.CharmURLs) (params.CharmArchiveURLResults, error) {
result := params.CharmArchiveURLResults{
Results: make([]params.CharmArchiveURLResult, len(args.URLs)),
}
// Get the SSL hostname verification environment setting.
envConfig, err := u.st.EnvironConfig()
if err != nil {
return result, err
}
// SSLHostnameVerification defaults to true, so we need to
// invert that, for backwards-compatibility (older versions
// will have DisableSSLHostnameVerification: false by default).
disableSSLHostnameVerification := !envConfig.SSLHostnameVerification()
for i, arg := range args.URLs {
curl, err := charm.ParseURL(arg.URL)
if err != nil {
err = common.ErrPerm
} else {
var sch *state.Charm
sch, err = u.st.Charm(curl)
if errors.IsNotFound(err) {
err = common.ErrPerm
}
if err == nil {
result.Results[i].Result = sch.BundleURL().String()
result.Results[i].DisableSSLHostnameVerification = disableSSLHostnameVerification
}
}
result.Results[i].Error = common.ServerError(err)
}
return result, nil
}