2013-05-09 01:34:20 -04:00
|
|
|
package amazonebs
|
|
|
|
|
|
|
|
import (
|
2013-05-09 16:19:38 -04:00
|
|
|
"encoding/json"
|
2013-05-09 01:34:20 -04:00
|
|
|
"github.com/mitchellh/packer/packer"
|
2013-05-09 16:26:40 -04:00
|
|
|
"log"
|
2013-05-09 01:34:20 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type config struct {
|
2013-05-09 16:19:38 -04:00
|
|
|
AccessKey string `json:"access_key"`
|
2013-05-09 01:34:20 -04:00
|
|
|
Region string
|
2013-05-09 16:19:38 -04:00
|
|
|
SecretKey string `json:"secret_key"`
|
|
|
|
SourceAmi string `json:"source_ami"`
|
2013-05-09 01:34:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type Builder struct {
|
|
|
|
config config
|
|
|
|
}
|
|
|
|
|
2013-05-09 16:19:38 -04:00
|
|
|
func (b *Builder) Prepare(raw interface{}) (err error) {
|
|
|
|
jsonBytes, err := json.Marshal(raw)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err = json.Unmarshal(jsonBytes, &b.config)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2013-05-09 16:26:40 -04:00
|
|
|
log.Printf("Config: %+v\n", b.config)
|
2013-05-09 16:19:38 -04:00
|
|
|
return
|
2013-05-09 13:54:42 -04:00
|
|
|
}
|
2013-05-09 01:34:20 -04:00
|
|
|
|
|
|
|
func (*Builder) Run(packer.Build, packer.Ui) {}
|