evroc Go SDK

The evroc Go SDK is the official Go client for the evroc cloud APIs. It lets you provision virtual machines, configure networking, manage storage, and control access from your Go code.

For installation, examples, and the full API reference, see the GitHub repository.

Overview

When you're building services that run on evroc, you often need programmatic control over your infrastructure — scaling compute out at peak load, provisioning environments from a CI pipeline, or driving resources from a control plane of your own. The Go SDK wraps the evroc REST APIs in idiomatic, type-safe Go so you don't have to hand-roll HTTP clients or track API changes yourself.

The SDK covers the same surface as the evroc CLI and Terraform provider, and builds on the same public APIs as the evroc Console.

Key features

The Go SDK provides:

  • Type-safe clients - Strongly typed Go structs for every API resource, with compile-time validation of request shapes
  • Builder pattern - Fluent builders for constructing VM, disk, security group, and other resource specs without memorizing the underlying API schema
  • Async helpers - Waiters that block until a resource reaches a desired state (e.g., VM running, disk ready), so you don't have to write polling loops
  • Context support - Every call accepts a context.Context for cancellation, timeouts, and deadlines
  • Configurable retries - Built-in exponential backoff for transient API errors
  • Automatic token refresh - Long-running programs keep authenticating as access tokens expire
  • Prometheus metrics - Optional metrics for request rates, latencies, and errors

The SDK covers the Compute, Networking, Storage, IAM, Quotas, and Think APIs. For the current capability matrix, see the coverage table in the README.

How it works

You create a single Client that holds your credentials and HTTP configuration, then reach the service-specific sub-clients through it:

client, err := evroc.NewFromEnv(ctx)
vm, err := client.Compute().VirtualMachines().Get(ctx, "my-vm")

Each sub-client (Compute(), Networking(), Storage(), and so on) exposes CRUD methods for its resources. Resource specs are built with fluent builders that help you construct valid requests:

disk, err := client.Compute().Disks().Create(ctx,
    compute.NewDiskBuilder("my-disk").
        WithImage(compute.DiskImageUbuntuMinimal2404).
        WithSizeGB(50).
        WithZone("a").
        Build(),
)

The SDK handles authentication, token refresh, retries, and response parsing internally, so you work with Go types rather than raw HTTP.

Authentication

The SDK supports two authentication methods:

  • evroc CLI credentials - If you've run evroc login, the SDK automatically reads your tokens and project settings from ~/.evroc/config.yaml. This is the easiest path for local development.
  • Environment variables - Set EVROC_REFRESH_TOKEN, EVROC_PROJECT, and EVROC_REGION (or EVROC_USERNAME and EVROC_PASSWORD for service accounts). This is typical in CI pipelines and production services.

For information on obtaining service account credentials, contact evroc support.

Prerequisites

To use the Go SDK, you need:

  • Go 1.24 or later
  • An evroc account with at least one project
  • Credentials — either from the evroc CLI (evroc login) or a service account

Learn more