-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathartifact.go
47 lines (38 loc) · 1.07 KB
/
artifact.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package vpc
import (
"fmt"
"log"
)
// Artifact represents a Image volume as the result of a Packer build.
type Artifact struct {
imageName string
imageId string
client *IBMCloudClient
// StateData should store data such as GeneratedData to be shared with post-processors
StateData map[string]interface{}
}
// BuilderId returns the builder Id.
func (*Artifact) BuilderId() string {
return BuilderId
}
// Files returns the files represented by the artifact.
func (a *Artifact) Files() []string {
return nil
}
// Id returns the IBMCloud image ID.
func (a *Artifact) Id() string {
return a.imageId
}
// String returns the string representation of the artifact.
func (a *Artifact) String() string {
return fmt.Sprintf("Image Name: %s || Image ID: %s", a.imageName, a.imageId)
}
func (a *Artifact) State(name string) interface{} {
return a.StateData[name]
}
// Destroy destroys the VPC image represented by the artifact.
func (a *Artifact) Destroy() error {
log.Printf("Destroying image: %s", a.String())
// err := artifact.client.destroyImage(artifact.imageId)
return nil
}