本文整理汇总了Golang中launchpad/net/juju-core/state.Charm.Meta方法的典型用法代码示例。如果您正苦于以下问题:Golang Charm.Meta方法的具体用法?Golang Charm.Meta怎么用?Golang Charm.Meta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launchpad/net/juju-core/state.Charm
的用法示例。
在下文中一共展示了Charm.Meta方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: assertCustomCharm
func assertCustomCharm(c *C, ch *state.Charm, series string, meta *charm.Meta, config *charm.Config, revision int) {
// Check Charm interface method results.
c.Assert(ch.Meta(), DeepEquals, meta)
c.Assert(ch.Config(), DeepEquals, config)
c.Assert(ch.Revision(), DeepEquals, revision)
// Test URL matches charm and expected series.
url := ch.URL()
c.Assert(url.Series, Equals, series)
c.Assert(url.Revision, Equals, ch.Revision())
// Ignore the BundleURL and BundleSHA256 methods, they're irrelevant.
}
示例2: AddService
// AddService creates a new service with the given name to run the given
// charm. If svcName is empty, the charm name will be used.
func (conn *Conn) AddService(name string, ch *state.Charm) (*state.Service, error) {
if name == "" {
name = ch.URL().Name // TODO ch.Meta().Name ?
}
svc, err := conn.State.AddService(name, ch)
if err != nil {
return nil, err
}
meta := ch.Meta()
for rname, rel := range meta.Peers {
ep := state.Endpoint{
name,
rel.Interface,
rname,
state.RolePeer,
rel.Scope,
}
if _, err := conn.State.AddRelation(ep); err != nil {
return nil, fmt.Errorf("cannot add peer relation %q to service %q: %v", rname, name, err)
}
}
return svc, nil
}
示例3: assertStandardCharm
func assertStandardCharm(c *C, ch *state.Charm, series string) {
chd := testing.Charms.Dir(ch.Meta().Name)
assertCustomCharm(c, ch, series, chd.Meta(), chd.Config(), chd.Revision())
}
示例4: assertCharm
func assertCharm(c *C, bun *corecharm.Bundle, sch *state.Charm) {
c.Assert(bun.Revision(), Equals, sch.Revision())
c.Assert(bun.Meta(), DeepEquals, sch.Meta())
c.Assert(bun.Config(), DeepEquals, sch.Config())
}