packer-cn/builder/oracle/classic/artifact.go

50 lines
1.1 KiB
Go
Raw Normal View History

2018-01-12 17:12:15 -05:00
package classic
2018-01-23 21:13:51 -05:00
import (
"fmt"
)
2018-01-31 13:47:19 -05:00
// Artifact is an artifact implementation that contains Image List
// and Machine Image info.
2018-01-12 17:12:15 -05:00
type Artifact struct {
2018-01-31 13:47:19 -05:00
MachineImageName string
MachineImageFile string
ImageListVersion int
// StateData should store data such as GeneratedData
// to be shared with post-processors
StateData map[string]interface{}
2018-01-12 17:12:15 -05:00
}
// BuilderId uniquely identifies the builder.
func (a *Artifact) BuilderId() string {
return BuilderId
}
// Files lists the files associated with an artifact. We don't have any files
// as the custom image is stored server side.
func (a *Artifact) Files() []string {
return nil
}
func (a *Artifact) Id() string {
2018-01-31 13:47:19 -05:00
return a.MachineImageName
2018-01-12 17:12:15 -05:00
}
func (a *Artifact) String() string {
2018-01-31 13:47:19 -05:00
return fmt.Sprintf("An image list entry was created: \n"+
2018-01-23 21:13:51 -05:00
"Name: %s\n"+
2018-01-31 13:47:19 -05:00
"File: %s\n"+
"Version: %d",
a.MachineImageName, a.MachineImageFile, a.ImageListVersion)
2018-01-12 17:12:15 -05:00
}
func (a *Artifact) State(name string) interface{} {
return a.StateData[name]
2018-01-12 17:12:15 -05:00
}
// Destroy deletes the custom image associated with the artifact.
func (a *Artifact) Destroy() error {
return nil
2018-01-12 17:12:15 -05:00
}