2018-01-12 17:12:15 -05:00
|
|
|
package classic
|
|
|
|
|
2018-01-23 21:13:51 -05:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/hashicorp/go-oracle-terraform/compute"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Artifact is an artifact implementation that contains a Snapshot.
|
2018-01-12 17:12:15 -05:00
|
|
|
type Artifact struct {
|
2018-01-23 21:13:51 -05:00
|
|
|
Snapshot *compute.Snapshot
|
|
|
|
driver *compute.ComputeClient
|
2018-01-12 17:12:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// BuilderId uniquely identifies the builder.
|
|
|
|
func (a *Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
// Files lists the files associated with an artifact. We don't have any files
|
|
|
|
// as the custom image is stored server side.
|
|
|
|
func (a *Artifact) Files() []string {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Id() string {
|
2018-01-23 21:13:51 -05:00
|
|
|
return a.Snapshot.Name
|
2018-01-12 17:12:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
2018-01-23 21:13:51 -05:00
|
|
|
return fmt.Sprintf("A Snapshot was created: \n"+
|
|
|
|
"Name: %s\n"+
|
|
|
|
"Instance: %s\n"+
|
|
|
|
"MachineImage: %s\n"+
|
|
|
|
"URI: %s",
|
|
|
|
a.Snapshot.Name, a.Snapshot.Instance, a.Snapshot.MachineImage, a.Snapshot.URI)
|
2018-01-12 17:12:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) State(name string) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Destroy deletes the custom image associated with the artifact.
|
|
|
|
func (a *Artifact) Destroy() error {
|
2018-01-23 21:14:10 -05:00
|
|
|
return nil
|
2018-01-12 17:12:15 -05:00
|
|
|
}
|