本文整理汇总了Golang中gopkg/in/juju/charmrepo/v2-unstable/csclient.Client.UploadCharm方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.UploadCharm方法的具体用法?Golang Client.UploadCharm怎么用?Golang Client.UploadCharm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gopkg/in/juju/charmrepo/v2-unstable/csclient.Client
的用法示例。
在下文中一共展示了Client.UploadCharm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UploadCharmWithMeta
// UploadCharmWithMeta pushes a new charm to the charmstore.
// The uploaded charm takes the supplied charmURL with metadata.yaml and metrics.yaml
// to define the charm, rather than relying on the charm to exist on disk.
// This allows you to create charm definitions directly in yaml and have them uploaded
// here for us in tests.
//
// For convenience the charm is also made public
func UploadCharmWithMeta(c *gc.C, client *csclient.Client, charmURL, meta, metrics string, revision int) (*charm.URL, charm.Charm) {
ch := testing.NewCharm(c, testing.CharmSpec{
Meta: meta,
Metrics: metrics,
Revision: revision,
})
chURL, err := client.UploadCharm(charm.MustParseURL(charmURL), ch)
c.Assert(err, jc.ErrorIsNil)
SetPublic(c, client, chURL)
return chURL, ch
}
示例2: UploadCharmMultiSeries
// UploadCharmMultiSeries uploads a charm with revision using the given charm store client,
// and returns the resulting charm URL and charm. This API caters for new multi-series charms
// which do not specify a series in the URL.
func UploadCharmMultiSeries(c *gc.C, client *csclient.Client, url, name string) (*charm.URL, charm.Charm) {
id := charm.MustParseURL(url)
if id.User == "" {
// We still need a user even if we are uploading a promulgated charm.
id.User = "who"
}
ch := Repo.CharmArchive(c.MkDir(), name)
// Upload the charm.
curl, err := client.UploadCharm(id, ch)
c.Assert(err, jc.ErrorIsNil)
SetPublic(c, client, curl)
// Return the charm and its URL.
return curl, ch
}
示例3: UploadCharmMultiSeries
// UploadCharmMultiSeries uploads a charm with revision using the given charm store client,
// and returns the resulting charm URL and charm. This API caters for new multi-series charms
// which do not specify a series in the URL.
func UploadCharmMultiSeries(c *gc.C, client *csclient.Client, url, name string) (*charm.URL, charm.Charm) {
id := charm.MustParseURL(url)
if id.User == "" {
// We still need a user even if we are uploading a promulgated charm.
id.User = "who"
}
ch := Repo.CharmArchive(c.MkDir(), name)
// Upload the charm.
curl, err := client.UploadCharm(id, ch)
c.Assert(err, jc.ErrorIsNil)
// Allow read permissions to everyone.
err = client.Put("/"+curl.Path()+"/meta/perm/read", []string{params.Everyone})
c.Assert(err, jc.ErrorIsNil)
// Return the charm and its URL.
return curl, ch
}