Expand description
§redisctl-core
Layer 2: Higher-level interface on top of redis-cloud and redis-enterprise clients.
This crate provides:
- Unified error handling - CoreError wrapping both platform errors
- Client resolution - Shared profile, credential, endpoint, and TLS handling
- Progress callbacks - For Cloud’s async task polling
- Module resolution - Validate Enterprise modules before creation
- Workflows - Multi-step operations (create + wait, etc.)
§Philosophy
Don’t rebuild Layer 1. Use it and add value.
- Simple operations: Use Layer 1 directly (
redis_cloud::DatabaseHandler, etc.) - Operations with progress: Use Layer 2 workflows
- Operations with validation: Use Layer 2 helpers
§Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Layer 3: Consumers │
│ CLI (redisctl) MCP (redisctl-mcp) │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Layer 2: redisctl-core │
│ - Unified errors (CoreError) │
│ - Client resolution (ClientResolver) │
│ - Progress callbacks (poll_task) │
│ - Module resolution (resolve_modules) │
│ - Workflows (create_and_wait, etc.) │
└──────────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Layer 1: Raw API Clients │
│ redis-cloud redis-enterprise │
└─────────────────────────────────────────────────────────────────┘§Example Usage
ⓘ
use redis_cloud::{CloudClient, DatabaseHandler};
use redisctl_core::{poll_task, ProgressEvent};
use std::time::Duration;
// Simple operation: use Layer 1 directly
let handler = DatabaseHandler::new(client.clone());
let databases = handler.list(subscription_id).await?;
// Operation with progress: use Layer 2
let task = handler.create(subscription_id, &request).await?;
let completed = poll_task(
&client,
&task.task_id.unwrap(),
Duration::from_secs(600),
Duration::from_secs(10),
Some(Box::new(|event| {
if let ProgressEvent::Polling { status, elapsed, .. } = event {
println!("Status: {} ({:.0}s)", status, elapsed.as_secs());
}
})),
).await?;Re-exports§
pub use auth::AuthError;pub use auth::CapiKey;pub use auth::CloudAuthenticator;pub use auth::DeviceAuthorization;pub use auth::DeviceFlowClient;pub use auth::LoopbackFlowClient;pub use auth::MintedCredentials;pub use auth::SmAccount;pub use auth::SmApiClient;pub use auth::SmUser;pub use auth::TokenSet;pub use error::CoreError;pub use error::Result;pub use progress::ProgressCallback;pub use progress::ProgressEvent;pub use progress::poll_task;pub use clients::ClientResolutionError;pub use clients::ClientResolver;pub use clients::ResolvedCloudConnection;pub use clients::ResolvedEnterpriseConnection;pub use config::CloudAuthConfig;pub use config::Config;pub use config::ConfigError;pub use config::CredentialStorage;pub use config::CredentialStore;pub use config::DeploymentType;pub use config::EnvironmentOverrides;pub use config::Profile;pub use config::ProfileCredentials;pub use redis_cloud;pub use redis_enterprise;
Modules§
- auth
- Cloud authentication: OIDC flows that bootstrap a Redis Cloud CAPI key.
- clients
- Shared profile resolution and API client construction.
- cloud
- Cloud-specific workflows and helpers
- config
- Configuration and profile management for Redis CLI tools
- enterprise
- Enterprise-specific workflows and helpers
- error
- Unified error handling for redisctl-core
- progress
- Progress tracking and task polling for async Cloud operations
Constants§
- USER_
AGENT User-Agentsent by every redisctl HTTP client.