§ Documentation
Installation
How to install cloudemu in your Go project
Install cloudemu with one go get, verify it with a quick program, and migrate v1 imports if needed.
Install the package#
Add cloudemu to your Go module:
go get github.com/stackshy/cloudemu/v2This installs the library and all service packages. There are no external dependencies beyond the Go standard library.
Verify installation#
Drop this into a main.go to confirm the package resolves:
package main
import (
"context"
"fmt"
"log"
"github.com/stackshy/cloudemu/v2"
)
func main() {
ctx := context.Background()
aws := cloudemu.NewAWS()
if err := aws.S3.CreateBucket(ctx, "test-bucket"); err != nil {
log.Fatal(err)
}
buckets, err := aws.S3.ListBuckets(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("cloudemu ready — %d bucket(s)\n", len(buckets))
}Run it:
go run main.goIf it prints cloudemu ready — 1 bucket(s), the install is good. This snippet imports cloudemu directly just to check the toolchain; to actually integrate it with an app, run it in server mode and override your SDK endpoint — see Integrating cloudemu.
Import paths#
The main package and common sub-packages:
import (
"github.com/stackshy/cloudemu/v2" // NewAWS, NewAzure, NewGCP
"github.com/stackshy/cloudemu/v2/config" // WithRegion, WithClock, etc.
cerrors "github.com/stackshy/cloudemu/v2/errors" // Error codes and helpers
"github.com/stackshy/cloudemu/v2/services/compute/driver" // Compute types
"github.com/stackshy/cloudemu/v2/services/storage/driver" // Storage types
"github.com/stackshy/cloudemu/v2/services/database/driver" // Database types
"github.com/stackshy/cloudemu/v2/services/monitoring/driver" // Monitoring types
)Each service has its own driver sub-package containing the types and interfaces you need.
Migrating to v2#
v2.0.0 reorganizes the repository by role so it stays legible as it grows. This changes public
import paths, so the module is now github.com/stackshy/cloudemu/v2. Behavior is unchanged — the
entrypoints (NewAWS, NewAzure, NewGCP), every driver, wire protocol, and error type are
identical. Upgrading is a find-and-replace of the import prefix.
1. Update the dependency#
go get github.com/stackshy/cloudemu/v2@v2.0.02. Rewrite import paths#
Add the /v2 suffix and point service packages at their new homes:
import "github.com/stackshy/cloudemu/storage"
import "github.com/stackshy/cloudemu/v2/services/storage"Where packages moved:
| v1 location | v2 location |
|---|---|
<service> (e.g. storage, compute, kubernetes, cost) | services/<service> |
chaos, recorder, metrics, ratelimit, inject, topology | features/<name> |
statemachine, pagination | internal/<name> |
providers/{aws,azure,gcp}, server/{aws,azure,gcp} | unchanged (only the /v2 prefix is added) |
Next steps#
- Quick Start — build a complete example
- Configuration — customize your providers