2019-08-09 03:00:23 -04:00
|
|
|
package jdcloud
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"sort"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Artifact struct {
|
|
|
|
ImageId string
|
|
|
|
RegionID string
|
2020-01-30 05:27:58 -05:00
|
|
|
|
|
|
|
// StateData should store data such as GeneratedData
|
|
|
|
// to be shared with post-processors
|
|
|
|
StateData map[string]interface{}
|
2019-08-09 03:00:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) BuilderId() string {
|
|
|
|
return BUILDER_ID
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) Files() []string {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plan
|
|
|
|
// Though this part is supposed to be an array of Image Ids associated
|
|
|
|
// with its region, but currently only a single image is supported
|
|
|
|
func (a *Artifact) Id() string {
|
|
|
|
parts := []string{fmt.Sprintf("%s:%s", a.RegionID, a.ImageId)}
|
|
|
|
sort.Strings(parts)
|
|
|
|
return strings.Join(parts, ",")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
|
|
|
return fmt.Sprintf("A VMImage was created: %s", a.ImageId)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plan
|
|
|
|
// State and destroy function is abandoned
|
|
|
|
func (a *Artifact) State(name string) interface{} {
|
2020-01-30 05:27:58 -05:00
|
|
|
return a.StateData[name]
|
2019-08-09 03:00:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Destroy() error {
|
|
|
|
return nil
|
|
|
|
}
|