Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Go

The Go client uses gRPC. Dial the apiserver, then call a generated service through platformsdk.Client.

cl, err := platformsdk.Dial("127.0.0.1:9090",
platformsdk.WithInsecure(),
platformsdk.WithToken(os.Getenv("PLATFORM_TOKEN")),
platformsdk.WithApp("app_default"),
)
ctx := cl.Context(context.Background())
resp, err := cl.Compute.ListInstances(ctx, &genv1.ListInstancesRequest{})

cl.Catalog.ListInstanceTypes is the same pattern against the catalog.

A full create / wait / stop / delete walkthrough lives in this repo:

Terminal window
go run ./sdk/go/examples/lifecycle

That example reads PLATFORM_GRPC (default 127.0.0.1:9091 for the docker provider), PLATFORM_TOKEN, and PLATFORM_APP. Against a local apiserver use PLATFORM_GRPC=127.0.0.1:9090.

Needs Go 1.25+.

Terminal window
go get github.com/cloud/platform/sdk/go

Run that from the directory that contains your go.mod. Apple Silicon and Intel both work.

Imports:

import (
platformsdk "github.com/cloud/platform/sdk/go"
genv1 "github.com/cloud/platform/sdk/go/genv1"
)