redis-enterprise 0.7.5

Redis Enterprise REST API client library
Documentation

redis-enterprise

Crates.io Documentation CI License

A comprehensive Rust client library for the Redis Enterprise REST API.

Features

  • Complete coverage of Redis Enterprise 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 Enterprise features including:
    • Cluster management and bootstrap
    • Database (BDB) operations
    • Node management and statistics
    • User and role management
    • Redis modules
    • Active-Active (CRDB) databases
    • Monitoring and alerts

Installation

[dependencies]
redis-enterprise = "0.7"

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

Quick Start

use redis_enterprise::EnterpriseClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create client using builder pattern
    let client = EnterpriseClient::builder()
        .url("https://cluster.example.com:9443")
        .username("admin@example.com")
        .password("your-password")
        .insecure(false) // Set to true for self-signed certificates
        .build()?;

    // Get cluster information
    let cluster = client.cluster().info().await?;
    println!("Cluster: {:?}", cluster);

    // List databases (BDBs)
    let databases = client.database().list().await?;
    println!("Databases: {:?}", databases);

    // Get node statistics
    let nodes = client.node().list().await?;
    println!("Nodes: {:?}", nodes);

    Ok(())
}

Tower Integration

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

use redis_enterprise::EnterpriseClient;
use redis_enterprise::tower_support::ApiRequest;
use tower::ServiceExt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = EnterpriseClient::builder()
        .base_url("https://localhost:9443")
        .username("admin")
        .password("password")
        .insecure(true)
        .build()?;

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

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

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

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

API Coverage

This library provides 100% coverage of the Redis Enterprise REST API, including:

  • Cluster Operations - Bootstrap, configuration, topology
  • Database Management - CRUD operations, actions, statistics
  • Node Management - Add/remove nodes, statistics, actions
  • Security - Users, roles, ACLs, LDAP integration
  • Modules - Upload and manage Redis modules
  • Monitoring - Stats, alerts, logs, diagnostics
  • Active-Active - CRDB management and tasks
  • Administration - License, certificates, services

Documentation

License

Licensed under either of

at your option.