github.com/raghuse92/packer@v1.3.2/builder/ncloud/artifact.go (about)

     1  package ncloud
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  
     7  	ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
     8  )
     9  
    10  const BuilderID = "ncloud.server.image"
    11  
    12  type Artifact struct {
    13  	ServerImage *ncloud.ServerImage
    14  }
    15  
    16  func (*Artifact) BuilderId() string {
    17  	return BuilderID
    18  }
    19  
    20  func (a *Artifact) Files() []string {
    21  	/* no file */
    22  	return nil
    23  }
    24  
    25  func (a *Artifact) Id() string {
    26  	return a.ServerImage.MemberServerImageNo
    27  }
    28  
    29  func (a *Artifact) String() string {
    30  	var buf bytes.Buffer
    31  
    32  	// TODO : Logging artifact information
    33  	buf.WriteString(fmt.Sprintf("%s:\n\n", a.BuilderId()))
    34  	buf.WriteString(fmt.Sprintf("Member Server Image Name: %s\n", a.ServerImage.MemberServerImageName))
    35  	buf.WriteString(fmt.Sprintf("Member Server Image No: %s\n", a.ServerImage.MemberServerImageNo))
    36  
    37  	return buf.String()
    38  }
    39  
    40  func (a *Artifact) State(name string) interface{} {
    41  	return a.ServerImage.MemberServerImageStatus
    42  }
    43  
    44  func (a *Artifact) Destroy() error {
    45  	return nil
    46  }