本文整理汇总了Golang中github.com/juju/juju/environs/simplestreams.LookupParams类的典型用法代码示例。如果您正苦于以下问题:Golang LookupParams类的具体用法?Golang LookupParams怎么用?Golang LookupParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LookupParams类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: constructImageConstraint
// constructImageConstraint returns model-specific criteria used to look for image metadata.
func (p *ProvisionerAPI) constructImageConstraint(m *state.Machine) (*imagemetadata.ImageConstraint, environs.Environ, error) {
// If we can determine current region,
// we want only metadata specific to this region.
cloud, env, err := p.obtainEnvCloudConfig()
if err != nil {
return nil, nil, errors.Trace(err)
}
lookup := simplestreams.LookupParams{
Series: []string{m.Series()},
Stream: env.Config().ImageStream(),
}
mcons, err := m.Constraints()
if err != nil {
return nil, nil, errors.Annotatef(err, "cannot get machine constraints for machine %v", m.MachineTag().Id())
}
if mcons.Arch != nil {
lookup.Arches = []string{*mcons.Arch}
}
if cloud != nil {
lookup.CloudSpec = *cloud
}
return imagemetadata.NewImageConstraint(lookup), env, nil
}
示例2: NewImageConstraint
func NewImageConstraint(params simplestreams.LookupParams) *ImageConstraint {
if len(params.Series) == 0 {
params.Series = series.SupportedSeries()
}
if len(params.Arches) == 0 {
params.Arches = arch.AllSupportedArches
}
return &ImageConstraint{LookupParams: params}
}