github.com/hashicorp/packer@v1.14.3/post-processor/compress/artifact.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package compress
     5  
     6  import (
     7  	"fmt"
     8  	"os"
     9  )
    10  
    11  const BuilderId = "packer.post-processor.compress"
    12  
    13  type Artifact struct {
    14  	Path string
    15  }
    16  
    17  func (a *Artifact) BuilderId() string {
    18  	return BuilderId
    19  }
    20  
    21  func (*Artifact) Id() string {
    22  	return ""
    23  }
    24  
    25  func (a *Artifact) Files() []string {
    26  	return []string{a.Path}
    27  }
    28  
    29  func (a *Artifact) String() string {
    30  	return fmt.Sprintf("compressed artifacts in: %s", a.Path)
    31  }
    32  
    33  func (*Artifact) State(name string) interface{} {
    34  	return nil
    35  }
    36  
    37  func (a *Artifact) Destroy() error {
    38  	return os.Remove(a.Path)
    39  }