github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/plugins/juju-metadata/cloudimagemetadata.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package main 5 6 import ( 7 "launchpad.net/gnuflag" 8 9 "github.com/juju/juju/api/imagemetadata" 10 ) 11 12 type cloudImageMetadataCommandBase struct { 13 imageMetadataCommandBase 14 } 15 16 // SetFlags implements Command.SetFlags. 17 func (c *cloudImageMetadataCommandBase) SetFlags(f *gnuflag.FlagSet) { 18 c.imageMetadataCommandBase.SetFlags(f) 19 } 20 21 // NewImageMetadataAPI returns a image metadata api for the root api endpoint 22 // that the environment command returns. 23 func (c *cloudImageMetadataCommandBase) NewImageMetadataAPI() (*imagemetadata.Client, error) { 24 root, err := c.NewAPIRoot() 25 if err != nil { 26 return nil, err 27 } 28 return imagemetadata.NewClient(root), nil 29 } 30 31 // MetadataInfo defines the serialization behaviour of image metadata information. 32 type MetadataInfo struct { 33 Source string `yaml:"source" json:"source"` 34 Series string `yaml:"series" json:"series"` 35 Arch string `yaml:"arch" json:"arch"` 36 Region string `yaml:"region" json:"region"` 37 ImageId string `yaml:"image-id" json:"image-id"` 38 Stream string `yaml:"stream" json:"stream"` 39 VirtType string `yaml:"virt-type,omitempty" json:"virt-type,omitempty"` 40 RootStorageType string `yaml:"storage-type,omitempty" json:"storage-type,omitempty"` 41 }