Skip to main content

redis-cloud

Crates.io Documentation CI License PyPI

A comprehensive Rust client library for the Redis Cloud REST API, with Python bindings.

Features

  • Complete coverage of all Redis Cloud REST API endpoints (155/155 routes verified against the bundled OpenAPI spec in CI)
  • 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

[dependencies]
redis-cloud = "0.10"

# Optional: Enable Tower service integration
redis-cloud = { version = "0.10", features = ["tower-integration"] }

Quick Start

use redis_cloud::CloudClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = CloudClient::builder()
        .api_key(std::env::var("REDIS_CLOUD_API_KEY")?)
        .api_secret(std::env::var("REDIS_CLOUD_API_SECRET")?)
        .build()?;

    // Account info
    let account = client.account().get_current_account().await?;
    if let Some(acc) = account.account {
        println!("Account: {:?} ({:?})", acc.name, acc.id);
    }

    // List Pro subscriptions
    let subs = client.subscriptions().list().await?;
    for sub in subs.subscriptions.unwrap_or_default() {
        println!("  - subscription {:?}: {:?}", sub.id, sub.name);
    }

    // List databases for a subscription (unwrapped helper)
    let dbs = client.databases().list(123).await?;
    for db in &dbs {
        println!("  - db {:?}: {:?}", db.database_id, db.name);
    }

    Ok(())
}

Environment Variables

  • REDIS_CLOUD_API_KEY — API key
  • REDIS_CLOUD_API_SECRET — API secret
  • REDIS_CLOUD_BASE_URL — Override the API base URL (optional; defaults to the production Redis Cloud endpoint)

Tower Integration

Enable the tower-integration feature to use the client with Tower middleware:

use redis_cloud::CloudClient;
use redis_cloud::tower_support::ApiRequest;
use tower::ServiceExt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = CloudClient::builder()
        .api_key("your-api-key")
        .api_secret("your-api-secret")
        .build()?;

    // Convert to a Tower service
    let mut service = client.into_service();

    // Use the service
    let response = service
        .oneshot(ApiRequest::get("/subscriptions"))
        .await?;

    println!("Response: {:?}", response.body);
    Ok(())
}

This enables composition with Tower middleware like circuit breakers, retry, rate limiting, and more.

Examples

See the examples/ directory for runnable end-to-end programs:

# Basic — connect, fetch account, list Pro + Essentials subscriptions
cargo run --example basic

# Database operations — list databases for a subscription, paginated
cargo run --example databases [SUBSCRIPTION_ID]

# Streaming — process databases one at a time via the paginated stream
cargo run --example stream_databases -- SUBSCRIPTION_ID

# Tasks — poll an async task by ID
cargo run --example tasks -- TASK_ID

# Cost reports — fetch a cost report in FOCUS-format JSON
cargo run --example cost_report -- START_DATE END_DATE

All examples read credentials from REDIS_CLOUD_API_KEY / REDIS_CLOUD_API_SECRET.

Python Bindings

A PyO3 binding providing a convenience layer covering read operations across all major API domains is published at redis-cloud on PyPI. See python/README.md for the full supported API, the parity scope decision, and what is intentionally out of scope (connectivity handlers, cost reports, and write operations — all reachable via the raw HTTP helpers or the Rust client).

The PyPI publish workflow has been failing since the reqwest 0.13 upgrade (#48).

API Coverage

The crate covers 100% of the documented Redis Cloud REST API surface (155/155 routes). Route coverage is enforced by an executable check (tests/openapi_route_coverage.rs) that diffs the typed handlers against the bundled OpenAPI spec; intentional gaps (currently none) and known off-spec routes (currently none) are tracked in tests/fixtures/openapi_unsupported_routes.txt and tests/fixtures/openapi_non_spec_routes.txt.

Handler organization:

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

For the authoritative per-endpoint mapping see the bundled OpenAPI spec at tests/fixtures/cloud_openapi.json.

Documentation

License

Licensed under either of

at your option.

Metadata

Release files for redis-cloud 0.9.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redis-cloud 0.9.5
File Size Uploaded
redis_cloud-0.9.5.tar.gz 234.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for redis-cloud 0.9.5
File Interpreter ABI Platform
redis_cloud-0.9.5-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
redis_cloud-0.9.5-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
redis_cloud-0.9.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details

Total release size: 11.0 MB

Release files / redis_cloud-0.9.5.tar.gz

Download URL redis_cloud-0.9.5.tar.gz
Size 234.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e4e1dd41e6cd45946f182844019babe3cd6b8649d18390d875ad93f04723f0ec
BLAKE2b-256 checksum
How to use checksums
2bb44cc038ad4a17f864133bfe14ca986edd074873286f79431d3696edc3820e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release files / redis_cloud-0.9.5-cp312-cp312-win_amd64.whl

Download URL redis_cloud-0.9.5-cp312-cp312-win_amd64.whl
Size 3.2 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
86779b6e834af605c727e8238a5d3eb9d3140b69e7ec7a1c470e63c9da12528f
BLAKE2b-256 checksum
How to use checksums
813c898e772925e606225ef0a939b1c461f4829e6e31d25bc266af9e9d754713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release files / redis_cloud-0.9.5-cp312-cp312-macosx_11_0_arm64.whl

Download URL redis_cloud-0.9.5-cp312-cp312-macosx_11_0_arm64.whl
Size 3.6 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4aac360d8d0f303d103ee77da6c9ed044cf0825f1e4c7d2a5a9e7cf6ee0562b1
BLAKE2b-256 checksum
How to use checksums
9254ab8b3f7f19def7b64d456efab7a67b034e74f4915f03101658e8d813b1e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release files / redis_cloud-0.9.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL redis_cloud-0.9.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.9 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5e8be760d973a4effc508bc1d00aad951f89a01877b6ffcd1c82660608596db4
BLAKE2b-256 checksum
How to use checksums
d5c3150adcbbf0210acbd2660bcb3577ae58ebe13de7cedd2ec7d4def0cbeabc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.5 This release

4 release files

0.9.3

4 release files

0.1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page