本文整理汇总了Golang中gopkg/in/juju/charmrepo/v2-unstable/csclient.Client.UploadBundleWithRevision方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.UploadBundleWithRevision方法的具体用法?Golang Client.UploadBundleWithRevision怎么用?Golang Client.UploadBundleWithRevision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gopkg/in/juju/charmrepo/v2-unstable/csclient.Client
的用法示例。
在下文中一共展示了Client.UploadBundleWithRevision方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UploadBundle
// UploadBundle uploads a bundle using the given charm store client, and
// returns the resulting bundle URL and bundle.
func UploadBundle(c *gc.C, client *csclient.Client, url, name string) (*charm.URL, charm.Bundle) {
id := charm.MustParseURL(url)
promulgatedRevision := -1
if id.User == "" {
// We still need a user even if we are uploading a promulgated bundle.
id.User = "who"
promulgatedRevision = id.Revision
}
b := Repo.BundleArchive(c.MkDir(), name)
// Upload the bundle.
err := client.UploadBundleWithRevision(id, b, promulgatedRevision)
c.Assert(err, jc.ErrorIsNil)
SetPublic(c, client, id)
// Return the bundle and its URL.
return id, b
}
示例2: UploadBundle
// UploadBundle uploads a bundle using the given charm store client, and
// returns the resulting bundle URL and bundle.
func UploadBundle(c *gc.C, client *csclient.Client, url, name string) (*charm.URL, charm.Bundle) {
id := charm.MustParseURL(url)
promulgatedRevision := -1
if id.User == "" {
// We still need a user even if we are uploading a promulgated bundle.
id.User = "who"
promulgatedRevision = id.Revision
}
b := Repo.BundleArchive(c.MkDir(), name)
// Upload the bundle.
err := client.UploadBundleWithRevision(id, b, promulgatedRevision)
c.Assert(err, jc.ErrorIsNil)
// Allow read permissions to everyone.
err = client.Put("/"+id.Path()+"/meta/perm/read", []string{params.Everyone})
c.Assert(err, jc.ErrorIsNil)
// Return the bundle and its URL.
return id, b
}