forked from hashicorp/packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
artifact.go
45 lines (37 loc) · 1018 Bytes
/
artifact.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package oci
import (
"fmt"
client "github.com/hashicorp/packer/builder/oracle/oci/client"
)
// Artifact is an artifact implementation that contains a built Custom Image.
type Artifact struct {
Image client.Image
Region string
driver Driver
}
// 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
}
// Id returns the OCID of the associated Image.
func (a *Artifact) Id() string {
return a.Image.ID
}
func (a *Artifact) String() string {
return fmt.Sprintf(
"An image was created: '%v' (OCID: %v) in region '%v'",
a.Image.DisplayName, a.Image.ID, a.Region,
)
}
func (a *Artifact) State(name string) interface{} {
return nil
}
// Destroy deletes the custom image associated with the artifact.
func (a *Artifact) Destroy() error {
return a.driver.DeleteImage(a.Image.ID)
}