packer-cn/builder/yandex/artifact.go
Gennady Lipenkov 8e4e314553 Bulk update 'yandex' builder
Squashed commit of the following:

commit ccc020231780179d241d46eef7c0ba103366aed0
Author: Yandex.Cloud Bot <ycloud-bot@yandex.ru>
Date:   Tue Apr 9 14:38:30 2019 +0000

    sync upstream
2019-04-12 01:00:54 +03:00

47 lines
809 B
Go

package yandex
import (
"fmt"
"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
)
type Artifact struct {
config *Config
driver Driver
image *compute.Image
}
//revive:disable:var-naming
func (*Artifact) BuilderId() string {
return BuilderID
}
func (a *Artifact) Id() string {
return a.image.Id
}
func (*Artifact) Files() []string {
return nil
}
//revive:enable:var-naming
func (a *Artifact) String() string {
return fmt.Sprintf("A disk image was created: %v (id: %v) with family name %v", a.image.Name, a.image.Id, a.image.Family)
}
func (a *Artifact) State(name string) interface{} {
switch name {
case "ImageID":
return a.image.Id
case "FolderID":
return a.image.FolderId
}
return nil
}
func (a *Artifact) Destroy() error {
return a.driver.DeleteImage(a.image.Id)
}