Go SDK for OSAPI — client library and orchestration primitives.
go get github.com/osapi-io/osapi-sdkTyped Go client for every OSAPI endpoint. See the client docs for targeting, options, and quick start.
| Service | Operations | Docs | Source |
|---|---|---|---|
| Node | Hostname, disk, memory, load, uptime, OS info, status | docs | node.go |
| Network | DNS get/update, ping | docs | node.go |
| Command | exec, shell | docs | node.go |
| Job | Create, get, list, delete, retry, stats | docs | job.go |
| Agent | List, get (discovery + heartbeat data) | docs | agent.go |
| Health | Liveness, readiness, status | docs | health.go |
| Audit | List, get, export | docs | audit.go |
| Metrics | Prometheus text | docs | metrics.go |
DAG-based task execution on top of the client. See the orchestration docs for hooks, error strategies, and adding new operations.
| Feature | Description | Source |
|---|---|---|
| DAG execution | Dependency-based ordering with automatic parallelism | plan.go |
| Op tasks | Declarative OSAPI operations with target routing and params | task.go |
| TaskFunc | Custom Go functions with SDK client access | task.go |
| TaskFuncWithResults | Custom functions that receive completed results from prior tasks | task.go |
| Hooks | 8 lifecycle callbacks — consumer-controlled logging | options.go |
| Error strategies | StopAll, Continue (skip dependents), Retry(n) | options.go |
| Guards | When predicates, OnlyIfChanged conditional execution |
task.go |
| Changed detection | Read-only ops return false, mutators reflect actual state | runner.go |
| Result access | Results.Get() for cross-task data flow, Status for outcome inspection |
result.go |
| Broadcast results | Per-host HostResult data for multi-target operations |
result.go |
| Operation | Description | Idempotent | Docs |
|---|---|---|---|
node.hostname.get |
Get system hostname | Read-only | docs |
node.status.get |
Get node status | Read-only | docs |
node.disk.get |
Get disk usage | Read-only | docs |
node.memory.get |
Get memory stats | Read-only | docs |
node.load.get |
Get load averages | Read-only | docs |
network.dns.get |
Get DNS configuration | Read-only | docs |
network.dns.update |
Update DNS servers | Yes | docs |
network.ping.do |
Ping a host | Read-only | docs |
command.exec.execute |
Execute a command | No | docs |
command.shell.execute |
Execute a shell string | No | docs |
Each example is a standalone Go program you can read and run.
| Example | What it shows |
|---|---|
| discovery | Runnable DAG that discovers fleet info: health check, agent listing, and status in parallel |
| all | Every feature: hooks, Op tasks, TaskFunc, dependencies, guards, Levels(), error strategies, reporting |
cd examples/discovery
OSAPI_TOKEN="<jwt>" go run main.goSee the generated documentation for package-level API details.
See the Development guide for prerequisites, setup, and conventions. See the Contributing guide before submitting a PR.
The MIT License.