本文整理匯總了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}
}