The Unikraft Cloud Go SDK is an autogenerated client library that interfaces
with the Unikraft Cloud platform API, based on the public OpenAPI
specification at https://github.com/unikraft-cloud/openapi.
Installation
go get unikraft.com/cloud/sdk
Requires Go 1.25 or later.
Quickstart
main.go
package mainimport ( "context" "fmt" "unikraft.com/cloud/sdk/platform")func main() { ctx := context.Background() // Create a new client. The token and default metro are automatically // read from environment variables (UKC_TOKEN and UKC_METRO). client := platform.NewClient() // List all instances resp, err := client.GetInstances(ctx, nil, nil) if err != nil { panic(err) } // Check for API-level errors if resp.Status != "success" { panic(resp.Message) } for _, inst := range resp.Data.Instances { fmt.Printf("Name: %s\n", *inst.Name) fmt.Printf("UUID: %s\n", *inst.Uuid) fmt.Printf("State: %s\n", *inst.State) fmt.Printf("Image: %s\n", *inst.Image) fmt.Println("---") }}
Or set one of the following environment variables.
NewClient reads them automatically in order of preference:
UKC_TOKEN
UNIKRAFT_CLOUD_TOKEN
KRAFTCLOUD_TOKEN (legacy name)
You can also set the default metro via the UKC_METRO environment variable.
If not specified, the SDK defaults to fra.
// No WithToken/WithDefaultMetro needed, NewClient reads the environment automaticallyclient := platform.NewClient()
Client options
Option
Description
WithDefaultEndpoint(string)
Full API endpoint address (for example, https://api.fra.unikraft.cloud)
WithDefaultMetro(string)
Metro shorthand—converted to endpoint address automatically
WithToken(string)
API token
WithHTTPClient(...)
Custom http.Client
WithUserAgent(string)
Override the User-Agent header
WithAllowInsecure(bool)
Skip TLS verification (development only)
WithDefaultEndpoint and WithDefaultMetro both set the API endpoint.
Use WithDefaultMetro("fra") as a shorthand for WithDefaultEndpoint("https://api.fra.unikraft.cloud").
The base address is https://api.<metro>.unikraft.cloud.
Resources
The platform.Client interface covers the full Unikraft Cloud REST API surface.
// Configuration (by service group UUID)client.CreateAutoscaleConfigurationByServiceGroupUUID(ctx, uuid, req)client.GetAutoscaleConfigurationsByServiceGroupUUID(ctx, uuid)client.DeleteAutoscaleConfigurationsByServiceGroupUUID(ctx, uuid)