2016-05-26 23:21:55 -04:00
|
|
|
package lxd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Artifact struct {
|
2016-05-30 21:13:09 -04:00
|
|
|
id string
|
2020-01-30 05:27:58 -05:00
|
|
|
|
|
|
|
// StateData should store data such as GeneratedData
|
|
|
|
// to be shared with post-processors
|
|
|
|
StateData map[string]interface{}
|
2016-05-26 23:21:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Files() []string {
|
2016-05-30 21:13:09 -04:00
|
|
|
return nil
|
2016-05-26 23:21:55 -04:00
|
|
|
}
|
|
|
|
|
2016-05-30 21:13:09 -04:00
|
|
|
func (a *Artifact) Id() string {
|
|
|
|
return a.id
|
2016-05-26 23:21:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
2016-05-30 21:13:09 -04:00
|
|
|
return fmt.Sprintf("image: %s", a.id)
|
2016-05-26 23:21:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) State(name string) interface{} {
|
2020-01-30 05:27:58 -05:00
|
|
|
return a.StateData[name]
|
2016-05-26 23:21:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Destroy() error {
|
2016-08-06 23:47:52 -04:00
|
|
|
_, err := LXDCommand("image", "delete", a.id)
|
|
|
|
return err
|
2016-05-26 23:21:55 -04:00
|
|
|
}
|