Debian Codegraph @

server/instance_info.go

raw
1 package server
2
3 import (
4 "fmt"
5 "net/url"
6
7 pb "github.com/google/go-tpm-tools/proto/attest"
8 )
9
10 // GCEInstanceURL returns a Google API URL to the specified instance. This URL
11 // can then be used with GCE instance APIs.
12 func GCEInstanceURL(i *pb.GCEInstanceInfo) string {
13 return fmt.Sprintf(
14 "https://www.googleapis.com/compute/v1/projects/%s/zones/%s/instances/%s",
15 url.PathEscape(i.GetProjectId()),
16 url.PathEscape(i.GetZone()),
17 url.PathEscape(i.GetInstanceName()), // Can use either the name or id here
18 )
19 }