本文整理汇总了Golang中github.com/juju/juju/apiserver/params.CloudImageMetadata类的典型用法代码示例。如果您正苦于以下问题:Golang CloudImageMetadata类的具体用法?Golang CloudImageMetadata怎么用?Golang CloudImageMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CloudImageMetadata类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestSaveAndFindAndDeleteMetadata
func (s *cloudImageMetadataSuite) TestSaveAndFindAndDeleteMetadata(c *gc.C) {
metadata, err := s.client.List("", "", nil, nil, "", "")
c.Assert(err, gc.ErrorMatches, "matching cloud image metadata not found")
c.Assert(metadata, gc.HasLen, 0)
// check db too
conn := s.State.MongoSession()
coll, closer := mongo.CollectionFromName(conn.DB("juju"), "cloudimagemetadata")
defer closer()
before, err := coll.Count()
c.Assert(err, jc.ErrorIsNil)
c.Assert(before == 0, jc.IsTrue)
imageId := "1"
m := params.CloudImageMetadata{
Source: "custom",
Stream: "stream",
Region: "region",
Series: "trusty",
Arch: "arch",
VirtType: "virtType",
RootStorageType: "rootStorageType",
ImageId: imageId,
}
err = s.client.Save([]params.CloudImageMetadata{m})
c.Assert(err, jc.ErrorIsNil)
added, err := s.client.List("", "", nil, nil, "", "")
c.Assert(err, jc.ErrorIsNil)
// m.Version would be deduced from m.Series
m.Version = "14.04"
c.Assert(added, jc.DeepEquals, []params.CloudImageMetadata{m})
// make sure it's in db too
after, err := coll.Count()
c.Assert(err, jc.ErrorIsNil)
c.Assert(after == 1, jc.IsTrue)
err = s.client.Delete(imageId)
c.Assert(err, jc.ErrorIsNil)
// make sure it's no longer in db too
afterDelete, err := coll.Count()
c.Assert(err, jc.ErrorIsNil)
c.Assert(afterDelete, gc.Equals, 0)
}
开发者ID:imoapps,项目名称:juju,代码行数:48,代码来源:cloudimagemetadata_test.go
示例2: constructMetadataParam
// constructMetadataParam returns cloud image metadata as a param.
func (c *addImageMetadataCommand) constructMetadataParam() params.CloudImageMetadata {
info := params.CloudImageMetadata{
ImageId: c.ImageId,
Region: c.Region,
Series: c.Series,
Arch: c.Arch,
VirtType: c.VirtType,
RootStorageType: c.RootStorageType,
Stream: c.Stream,
Source: "custom",
}
if c.RootStorageSize != 0 {
info.RootStorageSize = &c.RootStorageSize
}
return info
}
开发者ID:snailwalker,项目名称:juju,代码行数:17,代码来源:addimage.go
示例3: assertValidAddImageMetadata
func (s *addImageSuite) assertValidAddImageMetadata(c *gc.C, m params.CloudImageMetadata) {
args := getAddImageMetadataCmdFlags(c, m)
_, err := runAddImageMetadata(c, args...)
c.Assert(err, jc.ErrorIsNil)
// Need to make sure that defaults are populated
if m.Arch == "" {
m.Arch = "amd64"
}
if m.Stream == "" {
m.Stream = "released"
}
c.Assert(s.data, gc.DeepEquals, []params.CloudImageMetadata{m})
}
开发者ID:howbazaar,项目名称:juju,代码行数:16,代码来源:addimage_test.go
注:本文中的github.com/juju/juju/apiserver/params.CloudImageMetadata类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论