packer-cn/builder/amazonebs/builder.go

41 lines
665 B
Go
Raw Normal View History

package amazonebs
import (
2013-05-09 16:19:38 -04:00
"encoding/json"
"errors"
"github.com/mitchellh/packer/packer"
)
type config struct {
2013-05-09 16:19:38 -04:00
AccessKey string `json:"access_key"`
Region string
2013-05-09 16:19:38 -04:00
SecretKey string `json:"secret_key"`
SourceAmi string `json:"source_ami"`
}
type Builder struct {
config config
}
2013-05-09 16:19:38 -04:00
func (b *Builder) Prepare(raw interface{}) (err error) {
_, ok := raw.(map[string]interface{})
if !ok {
err = errors.New("configuration isn't a valid map")
return
}
jsonBytes, err := json.Marshal(raw)
if err != nil {
return
}
err = json.Unmarshal(jsonBytes, &b.config)
if err != nil {
return
}
return
}
func (*Builder) Run(packer.Build, packer.Ui) {}