redis-cloud
A comprehensive Rust client library for the Redis Cloud REST API, with Python bindings.
Features
- Complete coverage of Redis Cloud REST API endpoints
- Async/await support with tokio
- Strong typing for API requests and responses
- Comprehensive error handling
- Optional Tower service integration for middleware composition
- Support for all Redis Cloud features including:
- Pro and Essentials subscriptions and databases
- User and ACL management
- Backup, restore, and import operations
- VPC peering, Transit Gateway, Private Service Connect, PrivateLink
- Cloud account integration (AWS, GCP, Azure)
- Task tracking for async operations
- Cost reports (FOCUS format)
Installation
[]
= "0.8"
# Optional: Enable Tower service integration
= { = "0.8", = ["tower-integration"] }
Quick Start
use CloudClient;
async
You can also use explicit handler creation if preferred:
use ;
async
Tower Integration
Enable the tower-integration feature to use the client with Tower middleware:
use CloudClient;
use ApiRequest;
use ServiceExt;
async
This enables composition with Tower middleware like circuit breakers, retry, rate limiting, and more.
Examples
See the examples/ directory for runnable examples:
# Basic usage - connect and list subscriptions
REDIS_CLOUD_API_KEY=xxx REDIS_CLOUD_API_SECRET=yyy
# Database operations
REDIS_CLOUD_API_KEY=xxx REDIS_CLOUD_API_SECRET=yyy
# Streaming with pagination
REDIS_CLOUD_API_KEY=xxx REDIS_CLOUD_API_SECRET=yyy
Python Bindings
This library also provides Python bindings via PyO3:
# Create client
=
# Or from environment variables
=
# Async usage
= await
# Sync usage
=
Python API
CloudClient(api_key, api_secret, base_url=None, timeout_secs=None)CloudClient.from_env()- Create from environment variablesclient.timeout- Get configured timeout in seconds (property)
Account
account()/account_sync()- Get current account information
Subscriptions
subscriptions()/subscriptions_sync()- List all subscriptionssubscription(id)/subscription_sync(id)- Get subscription by ID
Databases
databases(subscription_id, offset=None, limit=None)/databases_sync(...)- List databases (paginated)database(subscription_id, database_id)/database_sync(...)- Get databaseall_databases(subscription_id)/all_databases_sync(...)- Get all databases (auto-pagination)
Raw API
get(path)/get_sync(path)- Raw GET requestpost(path, body)/post_sync(path, body)- Raw POST requestdelete(path)/delete_sync(path)- Raw DELETE request
Environment Variables
REDIS_CLOUD_API_KEY- API keyREDIS_CLOUD_API_SECRET- API secretREDIS_CLOUD_BASE_URL- Base URL (optional)
API Coverage
This library provides comprehensive coverage of the Redis Cloud REST API:
| Handler | Description |
|---|---|
account() |
Account info, payment methods, regions, logs |
subscriptions() |
Pro subscription CRUD, pricing, CIDR, maintenance windows |
databases() |
Pro database lifecycle, backups, imports, flush |
fixed_subscriptions() |
Essentials subscription management |
fixed_databases() |
Essentials database management |
acl() |
ACL users, roles, Redis rules |
users() |
Account user management |
cloud_accounts() |
Cloud provider integration (AWS, GCP, Azure) |
vpc_peering() |
VPC peering (standard and Active-Active) |
transit_gateway() |
AWS Transit Gateway attachments |
psc() |
GCP Private Service Connect |
private_link() |
AWS PrivateLink |
tasks() |
Async operation tracking |
cost_reports() |
Cost reports in FOCUS format |
Documentation
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.