An open API service indexing awesome lists of open source software.

https://github.com/buddy/sandbox-sdk

TypeScript SDK for managing Buddy sandboxes - isolated Ubuntu environments for running commands
https://github.com/buddy/sandbox-sdk

api automation buddy buddyworks cd ci ci-cd cicd cloud devops isolated isolation nodejs sandbox sdk sdk-ts sdk-typescript typescript ubuntu

Last synced: 3 months ago
JSON representation

TypeScript SDK for managing Buddy sandboxes - isolated Ubuntu environments for running commands

Awesome Lists containing this project

README

          

# Buddy Sandbox SDK

TypeScript SDK for managing Buddy sandboxes - isolated Ubuntu environments for running commands.

## Installation

```bash
npm install @buddy-works/sandbox-sdk
```

## Usage

```typescript
import { Sandbox } from "@buddy-works/sandbox-sdk";

const identifier = "my-sandbox";

let sandbox: Sandbox;

try {
sandbox = await Sandbox.getByIdentifier(identifier);
} catch {
sandbox = await Sandbox.create({
identifier,
name: "My Sandbox",
os: "ubuntu:24.04",
});
}

await sandbox.start();

await sandbox.runCommand({
command: "ping -c 5 buddy.works",
});

await sandbox.stop();
```

Set required environment variables:

```bash
export BUDDY_TOKEN="your-api-token"
export BUDDY_WORKSPACE="your-workspace"
export BUDDY_PROJECT="your-project"
export BUDDY_REGION="US" # Optional: US (default), EU, or AP
```

## Regions

Configure the API region:

```bash
# Via environment variable (recommended)
export BUDDY_REGION="EU"
```

```typescript
// Or via connection config
const sandbox = await Sandbox.create({
identifier: "my-sandbox",
name: "My Sandbox",
os: "ubuntu:24.04",
connection: {
region: "EU" // US, EU, or AP
}
});
```

## Connection overrides

Override workspace/auth per call:

```typescript
await Sandbox.create({
identifier: "my-sandbox",
name: "My Sandbox",
os: "ubuntu:24.04",
connection: {
workspace: "different-workspace",
project: "different-project",
token: "custom-token",
region: "EU"
}
});
```