github.com/phobos182/packer@v0.2.3-0.20130819023704-c84d2aeffc68/builder/digitalocean/artifact.go (about) 1 package digitalocean 2 3 import ( 4 "fmt" 5 "log" 6 ) 7 8 type Artifact struct { 9 // The name of the snapshot 10 snapshotName string 11 12 // The ID of the image 13 snapshotId uint 14 15 // The client for making API calls 16 client *DigitalOceanClient 17 } 18 19 func (*Artifact) BuilderId() string { 20 return BuilderId 21 } 22 23 func (*Artifact) Files() []string { 24 // No files with DigitalOcean 25 return nil 26 } 27 28 func (a *Artifact) Id() string { 29 return a.snapshotName 30 } 31 32 func (a *Artifact) String() string { 33 return fmt.Sprintf("A snapshot was created: %v", a.snapshotName) 34 } 35 36 func (a *Artifact) Destroy() error { 37 log.Printf("Destroying image: %d", a.snapshotId) 38 return a.client.DestroyImage(a.snapshotId) 39 }