本文整理匯總了Golang中github.com/juju/juju/apiserver/imagemetadata.ParseMetadataFromParams函數的典型用法代碼示例。如果您正苦於以下問題:Golang ParseMetadataFromParams函數的具體用法?Golang ParseMetadataFromParams怎麽用?Golang ParseMetadataFromParams使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ParseMetadataFromParams函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestParseMetadataCustom
func (s *funcSuite) TestParseMetadataCustom(c *gc.C) {
m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "custom"})
c.Assert(m, gc.DeepEquals, s.expected)
m = imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "CusTOM"})
c.Assert(m, gc.DeepEquals, s.expected)
}
示例2: TestParseMetadataPublic
func (s *funcSuite) TestParseMetadataPublic(c *gc.C) {
s.expected.Source = cloudimagemetadata.Public
m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "public"})
c.Assert(m, gc.DeepEquals, s.expected)
m = imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "PubLic"})
c.Assert(m, gc.DeepEquals, s.expected)
}
示例3: TestParseMetadataAnyRegion
func (s *funcSuite) TestParseMetadataAnyRegion(c *gc.C) {
region := "region"
s.expected.Region = region
m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{Region: region}, s.env)
c.Assert(err, jc.ErrorIsNil)
c.Assert(m, gc.DeepEquals, s.expected)
}
示例4: TestParseMetadataAnyStream
func (s *funcSuite) TestParseMetadataAnyStream(c *gc.C) {
stream := "happy stream"
s.expected.Stream = stream
m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{Stream: stream}, s.env)
c.Assert(err, jc.ErrorIsNil)
c.Assert(m, gc.DeepEquals, s.expected)
}
示例5: TestParseMetadataAnyStream
func (s *funcSuite) TestParseMetadataAnyStream(c *gc.C) {
stream := "happy stream"
s.expected.Stream = stream
m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{
Source: "custom",
Stream: stream,
})
c.Assert(m, gc.DeepEquals, s.expected)
}
示例6: TestParseMetadataDefaultStream
func (s *funcSuite) TestParseMetadataDefaultStream(c *gc.C) {
m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{}, s.env)
c.Assert(err, jc.ErrorIsNil)
c.Assert(m, gc.DeepEquals, s.expected)
}
示例7: TestParseMetadataAnySource
func (s *funcSuite) TestParseMetadataAnySource(c *gc.C) {
s.expected.Source = "any"
m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{Source: "any"}, s.env)
c.Assert(err, jc.ErrorIsNil)
c.Assert(m, gc.DeepEquals, s.expected)
}
示例8: TestParseMetadataDefaultStream
func (s *funcSuite) TestParseMetadataDefaultStream(c *gc.C) {
m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{
Source: "custom",
})
c.Assert(m, gc.DeepEquals, s.expected)
}
示例9: TestParseMetadataSourcePanic
func (s *funcSuite) TestParseMetadataSourcePanic(c *gc.C) {
m := func() { imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{}) }
c.Assert(m, gc.PanicMatches, `unknown cloud image metadata source ""`)
}