The official Go SDK for the DataCrunch API. Get up and running with DataCrunch compute instances, storage, and networking in minutes.
go get github.com/datacrunch-io/datacrunch-sdk-goexport DATACRUNCH_BASE_URL="https://api.datacrunch.io/v1" # Optional for production client
export DATACRUNCH_CLIENT_ID="your-client-id"
export DATACRUNCH_CLIENT_SECRET="your-client-secret"💡 Get your credentials from: https://datacrunch.io/account/api
See examples/basic/ for complete working examples.
The SDK uses an AWS-style credential chain with flexible configuration:
-
Environment variables (highest priority)
DATACRUNCH_CLIENT_ID+DATACRUNCH_CLIENT_SECRETDATACRUNCH_BASE_URL(optional for production client)- production(default):
https://api.datacrunch.io/v1 - staging:
https://api-staging.datacrunch.io/v1 - testing:
https://api-testing.datacrunch.io/v1
- production(default):
-
Shared credentials file
- Location:
~/.datacrunch/credentials - Multiple profiles (default, staging, production, etc.)
- INI format with profile sections
[default] client_id = your-default-client-id client_secret = your-default-client-secret base_url = https://api.datacrunch.io/v1 [staging] client_id = your-staging-client-id client_secret = your-staging-client-secret base_url = https://api-staging.datacrunch.io/v1
- Location:
-
Static credentials
- Programmatically configured
- Useful for testing and development
-
Custom credential providers
- Environment-only, credentials-file-only, or custom chains
- Full control over credential resolution order
| Service | Description |
|---|---|
| Instance | Manage compute instances |
| InstanceTypes | Query available hardware |
| Volumes | Persistent storage |
| SSHKeys | SSH key management |
| StartScripts | Startup automation |
| Locations | Datacenter regions |
Comprehensive examples are available in the examples/ directory:
# Set credentials
export DATACRUNCH_BASE_URL="https://api.datacrunch.io/v1" # Optional for production client
export DATACRUNCH_CLIENT_ID="your-client-id"
export DATACRUNCH_CLIENT_SECRET="your-client-secret"
# Run examples
cd examples/basic && go run main.go
# Set up your credential files
cd examples/advanced && go run main.goThe SDK uses a session-based approach:
- Create a session that manages credentials and configuration
- Instantiate only the services you need
- Memory efficient with fine-grained control
- Supports all credential provider types
- Debug logging: Enable with
session.WithDebug(true) - Custom base URLs: For different environments
- Flexible credential providers: Environment, shared files, static, or custom chains
- Profile support: Multiple credential profiles in shared files
See examples/ for detailed implementation patterns.
- 📖 Documentation: pkg.go.dev
- 🐛 Issues: GitHub Issues
- 📧 Support: [email protected]
MIT License - see LICENSE file for details.
🚀 Ready to get started? Set your environment variables and create your first instance in under 5 minutes!