Skip to main content

Python bindings for Redis Enterprise REST API client

Project description

redis-enterprise

Crates.io Documentation CI License PyPI

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

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()
        .base_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.databases().list().await?;
    println!("Databases: {:?}", databases);

    // Get node statistics
    let nodes = client.nodes().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.

Python Bindings

This library also provides Python bindings via PyO3:

pip install redis-enterprise
from redis_enterprise import EnterpriseClient

# Create client
client = EnterpriseClient(
    base_url="https://cluster:9443",
    username="admin@redis.local",
    password="secret",
    insecure=True  # For self-signed certs
)

# Or from environment variables
client = EnterpriseClient.from_env()

# Async usage
async def main():
    dbs = await client.databases()
    for db in dbs:
        print(db["name"], db["uid"])

# Sync usage
dbs = client.databases_sync()

Python API

  • EnterpriseClient(base_url, username, password, insecure=False, timeout_secs=None)
  • EnterpriseClient.from_env() - Create from environment variables

Cluster

  • cluster_info() / cluster_info_sync() - Get cluster info
  • cluster_stats() / cluster_stats_sync() - Get cluster statistics
  • license() / license_sync() - Get license info

Databases

  • databases() / databases_sync() - List all databases
  • database(uid) / database_sync(uid) - Get database by UID

Nodes

  • nodes() / nodes_sync() - List all nodes
  • node(uid) / node_sync(uid) - Get node by UID

Users

  • users() / users_sync() - List all users

Raw API

  • get(path) / get_sync(path) - Raw GET request
  • post(path, body) / post_sync(path, body) - Raw POST request
  • delete(path) / delete_sync(path) - Raw DELETE request

Environment Variables

  • REDIS_ENTERPRISE_URL - Base URL (default: https://localhost:9443)
  • REDIS_ENTERPRISE_USER - Username
  • REDIS_ENTERPRISE_PASSWORD - Password
  • REDIS_ENTERPRISE_INSECURE - Set to "true" for self-signed certs

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redis_enterprise-0.8.3.tar.gz (174.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

redis_enterprise-0.8.3-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12Windows x86-64

redis_enterprise-0.8.3-cp312-cp312-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

redis_enterprise-0.8.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file redis_enterprise-0.8.3.tar.gz.

File metadata

  • Download URL: redis_enterprise-0.8.3.tar.gz
  • Upload date:
  • Size: 174.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for redis_enterprise-0.8.3.tar.gz
Algorithm Hash digest
SHA256 c9b61eab715661d2b6a4e7ca94c4fa0b7306c0fa412c487f02b07808ff4c825e
MD5 55a0487bde7a71d3e8e023fae81016a6
BLAKE2b-256 03a2011da7684c068ed21cdcf3247a15e2086ac65d4417e914625b7209aeeabb

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.8.3.tar.gz:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redis_enterprise-0.8.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for redis_enterprise-0.8.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3862d24aa4bc444280182d7eccad0d515aecb217dc2ca35f62f5f53275a37bc9
MD5 ff120cd21702a20c3ab52f2e35491d76
BLAKE2b-256 298898c35c08bf30040b27f2e951469b2b71dc24fa14ef2a4a11abcc2aab07a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.8.3-cp312-cp312-win_amd64.whl:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redis_enterprise-0.8.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for redis_enterprise-0.8.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1beb814097dcf1b9282d877defd47d97bbd4610a4f661ce65ae702298d1db71
MD5 002da2303285e73d499c3caeb5e7da51
BLAKE2b-256 280aa23d119070b8f4da392ff60f01904b41a2e9c181acd7f24ef33cfd48ec77

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.8.3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file redis_enterprise-0.8.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_enterprise-0.8.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b055c313f9572fbe9e93b1a9df6dd365d343b505369fd9b9714c0b7b72542073
MD5 54dd7afedf5a197e49f2cc75405b81ff
BLAKE2b-256 f98e76533e01a23662ba4711b9bc890d8f1bbb80a587f3769b50a6131c5f7d0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for redis_enterprise-0.8.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on redis-developer/redis-enterprise-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page