2016-06-10 01:26:22 -04:00
|
|
|
package manifest
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
const BuilderId = "packer.post-processor.manifest"
|
|
|
|
|
2016-08-09 09:46:15 -04:00
|
|
|
type ArtifactFile struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Size int64 `json:"size"`
|
|
|
|
}
|
|
|
|
|
2016-06-10 01:26:22 -04:00
|
|
|
type Artifact struct {
|
2019-01-29 06:07:24 -05:00
|
|
|
BuildName string `json:"name"`
|
|
|
|
BuilderType string `json:"builder_type"`
|
2020-04-09 05:14:37 -04:00
|
|
|
BuildTime int64 `json:"build_time,omitempty"`
|
2019-01-29 06:07:24 -05:00
|
|
|
ArtifactFiles []ArtifactFile `json:"files"`
|
|
|
|
ArtifactId string `json:"artifact_id"`
|
|
|
|
PackerRunUUID string `json:"packer_run_uuid"`
|
|
|
|
CustomData map[string]string `json:"custom_data"`
|
2016-06-10 01:26:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Files() []string {
|
2016-08-09 09:46:15 -04:00
|
|
|
var files []string
|
|
|
|
for _, af := range a.ArtifactFiles {
|
|
|
|
files = append(files, af.Name)
|
|
|
|
}
|
|
|
|
return files
|
2016-06-10 01:26:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Id() string {
|
2016-06-10 04:31:41 -04:00
|
|
|
return a.ArtifactId
|
2016-06-10 01:26:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
2016-06-10 04:31:41 -04:00
|
|
|
return fmt.Sprintf("%s-%s", a.BuildName, a.ArtifactId)
|
2016-06-10 01:26:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) State(name string) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Destroy() error {
|
|
|
|
return nil
|
|
|
|
}
|