github.com/Cloud-Foundations/Dominator@v0.3.4/imageserver/client/findLatestImage.go (about)

     1  package client
     2  
     3  import (
     4  	"github.com/Cloud-Foundations/Dominator/lib/errors"
     5  	"github.com/Cloud-Foundations/Dominator/lib/srpc"
     6  	"github.com/Cloud-Foundations/Dominator/proto/imageserver"
     7  )
     8  
     9  func findLatestImage(client srpc.ClientI,
    10  	request imageserver.FindLatestImageRequest) (string, error) {
    11  	var reply imageserver.FindLatestImageResponse
    12  	err := client.RequestReply("ImageServer.FindLatestImage", request, &reply)
    13  	if err == nil {
    14  		err = errors.New(reply.Error)
    15  	}
    16  	if err != nil {
    17  		return "", err
    18  	}
    19  	return reply.ImageName, nil
    20  }