github.com/rothwerx/packer@v0.9.0/post-processor/compress/artifact.go (about)

     1  package compress
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  )
     7  
     8  const BuilderId = "packer.post-processor.compress"
     9  
    10  type Artifact struct {
    11  	Path     string
    12  	Provider string
    13  	files    []string
    14  }
    15  
    16  func NewArtifact(provider, path string) *Artifact {
    17  	return &Artifact{
    18  		Path:     path,
    19  		Provider: provider,
    20  	}
    21  }
    22  
    23  func (a *Artifact) BuilderId() string {
    24  	return BuilderId
    25  }
    26  
    27  func (*Artifact) Id() string {
    28  	return ""
    29  }
    30  
    31  func (a *Artifact) Files() []string {
    32  	return []string{a.Path}
    33  }
    34  
    35  func (a *Artifact) String() string {
    36  	return fmt.Sprintf("'%s' compressing: %s", a.Provider, a.Path)
    37  }
    38  
    39  func (*Artifact) State(name string) interface{} {
    40  	return nil
    41  }
    42  
    43  func (a *Artifact) Destroy() error {
    44  	return os.Remove(a.Path)
    45  }