2020-07-17 11:36:48 -04:00
|
|
|
package yandeximport
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
const BuilderId = "packer.post-processor.yandex-import"
|
|
|
|
|
|
|
|
type Artifact struct {
|
2020-07-21 18:01:30 -04:00
|
|
|
imageID string
|
|
|
|
sourceType string
|
|
|
|
sourceID string
|
|
|
|
|
|
|
|
// StateData should store data such as GeneratedData
|
|
|
|
// to be shared with post-processors
|
|
|
|
StateData map[string]interface{}
|
2020-07-17 11:36:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Id() string {
|
2020-07-21 18:01:30 -04:00
|
|
|
return a.imageID
|
2020-07-17 11:36:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Files() []string {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
2020-07-21 18:01:30 -04:00
|
|
|
return fmt.Sprintf("Create image %v from source type %v with ID/URL %v", a.imageID, a.sourceType, a.sourceID)
|
2020-07-17 11:36:48 -04:00
|
|
|
}
|
|
|
|
|
2020-07-21 18:01:30 -04:00
|
|
|
func (a *Artifact) State(name string) interface{} {
|
|
|
|
if _, ok := a.StateData[name]; ok {
|
|
|
|
return a.StateData[name]
|
|
|
|
}
|
|
|
|
|
2020-07-17 11:36:48 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Destroy() error {
|
|
|
|
return nil
|
|
|
|
}
|