github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/builder/oracle/oci/artifact.go (about)

     1  package oci
     2  
     3  import (
     4  	"fmt"
     5  	client "github.com/hashicorp/packer/builder/oracle/oci/client"
     6  )
     7  
     8  // Artifact is an artifact implementation that contains a built Custom Image.
     9  type Artifact struct {
    10  	Image  client.Image
    11  	Region string
    12  	driver Driver
    13  }
    14  
    15  // BuilderId uniquely identifies the builder.
    16  func (a *Artifact) BuilderId() string {
    17  	return BuilderId
    18  }
    19  
    20  // Files lists the files associated with an artifact. We don't have any files
    21  // as the custom image is stored server side.
    22  func (a *Artifact) Files() []string {
    23  	return nil
    24  }
    25  
    26  // Id returns the OCID of the associated Image.
    27  func (a *Artifact) Id() string {
    28  	return a.Image.ID
    29  }
    30  
    31  func (a *Artifact) String() string {
    32  	return fmt.Sprintf(
    33  		"An image was created: '%v' (OCID: %v) in region '%v'",
    34  		a.Image.DisplayName, a.Image.ID, a.Region,
    35  	)
    36  }
    37  
    38  func (a *Artifact) State(name string) interface{} {
    39  	return nil
    40  }
    41  
    42  // Destroy deletes the custom image associated with the artifact.
    43  func (a *Artifact) Destroy() error {
    44  	return a.driver.DeleteImage(a.Image.ID)
    45  }