~rogpeppe/juju-core/axwalk-lp1300889-disable-mongo-keyfile

« back to all changes in this revision

Viewing changes to environs/imagemetadata/validation.go

  • Committer: Ian Booth
  • Date: 2013-08-13 04:55:12 UTC
  • mto: (1603.8.2 simplify-tools-search)
  • mto: This revision was merged to the branch mainline in revision 1680.
  • Revision ID: ian.booth@canonical.com-20130813045512-e68m4emfaoyn01h9
Add support for parsing and validating tools metadata

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
        "launchpad.net/juju-core/environs/simplestreams"
10
10
)
11
11
 
12
 
// ImageMetadataValidator instances can provide parameters used to query image
13
 
// metadata to find image information for the specified region. If region is "",
14
 
// then the implementation may use its own default region if it has one,
15
 
// or else returns an error.
16
 
type ImageMetadataValidator interface {
17
 
        MetadataLookupParams(region string) (*MetadataLookupParams, error)
18
 
}
19
 
 
20
 
type MetadataLookupParams struct {
21
 
        Region        string
22
 
        Series        string
23
 
        Architectures []string
24
 
        Endpoint      string
25
 
        BaseURLs      []string
26
 
}
27
 
 
28
12
// ValidateImageMetadata attempts to load image metadata for the specified cloud attributes and returns
29
13
// any image ids found, or an error if the metadata could not be loaded.
30
 
func ValidateImageMetadata(params *MetadataLookupParams) ([]string, error) {
 
14
func ValidateImageMetadata(params *simplestreams.MetadataLookupParams) ([]string, error) {
31
15
        if params.Series == "" {
32
16
                return nil, fmt.Errorf("required parameter series not specified")
33
17
        }