packer-cn/builder/triton/artifact.go
James Nugent e15be036d7 builder: add Triton builder
This is a builder for Joyent's Triton system. It was originally at
jen20/packer-builder-triton, and subsequently at
joyent/packer-builder-triton on GitHub. The following commit vendors the
dependencies.
2016-12-24 10:25:31 +01:00

50 lines
926 B
Go

package triton
import (
"fmt"
"log"
)
// Artifact is an artifact implementation that contains built Triton images.
type Artifact struct {
// ImageID is the image ID of the artifact
ImageID string
// BuilderIDValue is the unique ID for the builder that created this Image
BuilderIDValue string
// SDC connection for cleanup etc
Driver Driver
}
func (a *Artifact) BuilderId() string {
return a.BuilderIDValue
}
func (*Artifact) Files() []string {
return nil
}
func (a *Artifact) Id() string {
return a.ImageID
}
func (a *Artifact) String() string {
return fmt.Sprintf("Image was created: %s", a.ImageID)
}
func (a *Artifact) State(name string) interface{} {
//TODO(jen20): Figure out how to make this work with Atlas
return nil
}
func (a *Artifact) Destroy() error {
log.Printf("Deleting image ID (%s)", a.ImageID)
err := a.Driver.DeleteImage(a.ImageID)
if err != nil {
return err
}
return nil
}