github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/imageserver/client/getImage.go (about)

     1  package client
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/image"
     7  	"github.com/Cloud-Foundations/Dominator/lib/srpc"
     8  	"github.com/Cloud-Foundations/Dominator/proto/imageserver"
     9  )
    10  
    11  func getImage(client *srpc.Client, name string, timeout time.Duration) (
    12  	*image.Image, error) {
    13  	request := imageserver.GetImageRequest{ImageName: name, Timeout: timeout}
    14  	var reply imageserver.GetImageResponse
    15  	err := client.RequestReply("ImageServer.GetImage", request, &reply)
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  	return reply.Image, nil
    20  }