github.com/cvmfs/docker-graphdriver@v0.0.0-20181206110523-155ec6df0521/repository-manager/lib/wish.go (about)

     1  package lib
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  type Wish struct {
     8  	Id          int
     9  	InputImage  int
    10  	OutputImage int
    11  	CvmfsRepo   string
    12  }
    13  
    14  type WishFriendly struct {
    15  	Id         int
    16  	InputId    int
    17  	InputName  string
    18  	OutputId   int
    19  	OutputName string
    20  	CvmfsRepo  string
    21  	Converted  bool
    22  	UserInput  string
    23  	UserOutput string
    24  }
    25  
    26  func CreateWish(inputImage, outputImage, cvmfsRepo, userInput, userOutput string) (wish WishFriendly, err error) {
    27  
    28  	inputImg, err := ParseImage(inputImage)
    29  	if err != nil {
    30  		err = fmt.Errorf("%s | %s", err.Error(), "Error in parsing the input image")
    31  		return
    32  	}
    33  	inputImg.User = userInput
    34  
    35  	wish.InputName = inputImg.WholeName()
    36  
    37  	outputImg, err := ParseImage(outputImage)
    38  	if err != nil {
    39  		err = fmt.Errorf("%s | %s", err.Error(), "Error in parsing the output image")
    40  		return
    41  	}
    42  	outputImg.User = userOutput
    43  	outputImg.IsThin = true
    44  	wish.OutputName = outputImg.WholeName()
    45  
    46  	wish.Id = 0
    47  	wish.InputId = 0
    48  	wish.OutputId = 0
    49  	wish.CvmfsRepo = cvmfsRepo
    50  	wish.UserInput = userInput
    51  	wish.UserOutput = userOutput
    52  	return
    53  }