github.com/rothwerx/packer@v0.9.0/builder/googlecompute/artifact.go (about)

     1  package googlecompute
     2  
     3  import (
     4  	"fmt"
     5  	"log"
     6  )
     7  
     8  // Artifact represents a GCE image as the result of a Packer build.
     9  type Artifact struct {
    10  	imageName string
    11  	driver    Driver
    12  }
    13  
    14  // BuilderId returns the builder Id.
    15  func (*Artifact) BuilderId() string {
    16  	return BuilderId
    17  }
    18  
    19  // Destroy destroys the GCE image represented by the artifact.
    20  func (a *Artifact) Destroy() error {
    21  	log.Printf("Destroying image: %s", a.imageName)
    22  	errCh := a.driver.DeleteImage(a.imageName)
    23  	return <-errCh
    24  }
    25  
    26  // Files returns the files represented by the artifact.
    27  func (*Artifact) Files() []string {
    28  	return nil
    29  }
    30  
    31  // Id returns the GCE image name.
    32  func (a *Artifact) Id() string {
    33  	return a.imageName
    34  }
    35  
    36  // String returns the string representation of the artifact.
    37  func (a *Artifact) String() string {
    38  	return fmt.Sprintf("A disk image was created: %v", a.imageName)
    39  }
    40  
    41  func (a *Artifact) State(name string) interface{} {
    42  	return nil
    43  }