github.com/sneal/packer@v0.5.2/builder/openstack/artifact.go (about) 1 package openstack 2 3 import ( 4 "fmt" 5 "github.com/rackspace/gophercloud" 6 "log" 7 ) 8 9 // Artifact is an artifact implementation that contains built images. 10 type Artifact struct { 11 // ImageId of built image 12 ImageId string 13 14 // BuilderId is the unique ID for the builder that created this image 15 BuilderIdValue string 16 17 // OpenStack connection for performing API stuff. 18 Conn gophercloud.CloudServersProvider 19 } 20 21 func (a *Artifact) BuilderId() string { 22 return a.BuilderIdValue 23 } 24 25 func (*Artifact) Files() []string { 26 // We have no files 27 return nil 28 } 29 30 func (a *Artifact) Id() string { 31 return a.ImageId 32 } 33 34 func (a *Artifact) String() string { 35 return fmt.Sprintf("An image was created: %v", a.ImageId) 36 } 37 38 func (a *Artifact) Destroy() error { 39 log.Printf("Destroying image: %d", a.ImageId) 40 return a.Conn.DeleteImageById(a.ImageId) 41 }