The official Go client library for Eryph - the open-source infrastructure platform for creating and managing cloud-native virtual machines.
- π OAuth2 JWT Authentication - Secure authentication using RSA private keys (RFC 7523)
- π Cross-Platform - Native support for Windows, Linux, and macOS
- π Hierarchical Configuration - Automatic credential discovery across multiple locations
- π Automatic Token Refresh - Seamless token management with 5-minute expiration buffer
- β‘ Generated API Client - Modern Go client generated from OpenAPI specifications
- π― Operation Tracking - Monitor long-running operations to completion
- π§ͺ Comprehensive Testing - Full unit, integration, and end-to-end test coverage
go get github.com/eryph-org/go-client/runtime
go get github.com/eryph-org/go-client/computepackage main
import (
"context"
"fmt"
"log"
"time"
"github.com/eryph-org/go-client/compute"
"github.com/eryph-org/go-client/runtime"
)
func main() {
// Create client with automatic credential discovery
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
client, err := compute.NewClient(ctx, &runtime.ClientOptions{
Scopes: []string{"compute:read", "compute:write"},
})
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
// List all catlets (virtual machines)
catlets, err := client.API().CatletsListWithResponse(ctx, nil)
if err != nil {
log.Fatalf("Failed to list catlets: %v", err)
}
fmt.Printf("Found %d catlets:\n", len(catlets.JSON200.Value))
for _, catlet := range catlets.JSON200.Value {
fmt.Printf("- %s (%s): %v\n", catlet.Name, catlet.Id, catlet.Status)
}
}The Eryph Go Client uses OAuth2 with JWT Bearer Assertion (RFC 7523) for secure authentication. No client secrets are required - only RSA private keys.
The client automatically discovers credentials from multiple locations in this order:
- Current Directory:
./.eryph/ - User Home:
~/.config/eryph/(Linux/macOS) or%APPDATA%\eryph\(Windows) - System:
/etc/eryph/(Linux/macOS) or%PROGRAMDATA%\eryph\(Windows)
Configuration files use JSON format with .config extension:
{
"defaultClientId": "my-client",
"clients": [
{
"id": "my-client",
"name": "My Application"
}
],
"endpoints": {
"identity": "https://identity.example.com",
"compute": "https://compute.example.com"
}
}Private keys are stored separately in the private/ subdirectory as PEM files.
The client provides access to all Eryph APIs:
- Catlets - Virtual machine lifecycle management
- Networks - Virtual networking configuration
- Projects - Resource organization and access control
- Genes - VM templates and image management
- Operations - Asynchronous operation tracking
See the examples/ directory for complete working examples:
basic_auth/- Authentication and client setupcreate_catlet/- Create and manage virtual machineslist_resources/- Query resources across projects
- Go 1.21 or later
- pnpm for build tooling
- eryph-zero for E2E testing (Windows only)
# Install dependencies
pnpm install
# Build all platforms
pnpm run build
# Run tests
go test ./...
# Run E2E tests (requires eryph-zero)
go test ./e2e -vThe project uses a monorepo structure with Go workspaces:
go-client/
βββ runtime/ # Core authentication & configuration
βββ compute/ # Compute API client
βββ compute_api/ # Generated API client (from OpenAPI)
βββ cmd/eryph-cli/ # CLI application
βββ e2e/ # End-to-end tests
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- π Bug Reports: Use the issue tracker with bug template
- π‘ Feature Requests: Use the issue tracker with feature template
- π Security Issues: Email security@eryph.io
This project is licensed under the MIT License - see the LICENSE file for details.
- π Website: eryph.io
- π Documentation: docs.eryph.io
- π¬ Community: Discord
- π Source Code: GitHub
Made with β€οΈ by the Eryph community