Go SDK
The Okustera Go SDK provides idiomatic, high-performance Go packages to interact with the Okustera Cloud API.
It powers the official Okustera Terraform Provider and custom Kubernetes controllers.
Repository & Module Path
The Go SDK client library is currently hosted inside the official Terraform provider repository:
go get gitlab.com/Haroyan/okustera-terraform-provider/client
The standalone mirror at github.com/okustera/okustera-sdk-go will track upcoming v1.0 releases.
Installation
go get gitlab.com/Haroyan/okustera-terraform-provider/client
Example Usage
package main
import (
"context"
"fmt"
"log"
"gitlab.com/Haroyan/okustera-terraform-provider/client"
)
func main() {
ctx := context.Background()
// Initialize the API client
c, err := client.NewClient(client.Config{
Endpoint: "https://portal.okustera.com/api/v1",
APIToken: "YOUR_OKUSTERA_API_TOKEN",
TenantID: "tenant-production",
})
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
// Create a high-availability PostgreSQL database
db, err := c.CreatePostgresCluster(ctx, client.DatabaseClusterCreate{
Name: "inventory-db",
Namespace: "default",
Replicas: 3,
StorageSize: "100Gi",
DatabaseName: "inventory",
StorageClass: "ceph-rbd",
})
if err != nil {
log.Fatalf("failed to create database: %v", err)
}
fmt.Printf("Database %s provisioned successfully (Status: %s, Endpoint: %s)\n", db.Name, db.Status, db.ServiceEndpoint)
}