diff --git a/README.md b/README.md index 14fab71f..cd1258de 100644 --- a/README.md +++ b/README.md @@ -144,35 +144,76 @@ docker compose down -v ### 1. Configure Authentication -#### Redis Cloud +#### Option 1: Interactive Setup Wizard (Recommended) ```bash -# Using environment variables -export REDIS_CLOUD_API_KEY="your-api-key" -export REDIS_CLOUD_API_SECRET="your-api-secret" +# Launch guided setup for any deployment type +redisctl auth setup -# Or using profiles -redisctl profile set prod-cloud \ - --deployment-type cloud \ - --api-key YOUR_KEY \ - --api-secret YOUR_SECRET +# Test your authentication +redisctl auth test ``` -#### Redis Enterprise +The interactive setup wizard will: +- Guide you through credential collection +- Test authentication during setup +- Create and save working profiles +- Set up your first profile as default + +#### Option 2: Manual Profile Creation + +##### Redis Cloud ```bash -# Using environment variables +# Create a Cloud profile manually +redisctl profile set prod-cloud cloud \ + --api-key "your-api-key" \ + --api-secret "your-api-secret" + +# Set as default profile +redisctl profile default prod-cloud +``` + +##### Redis Enterprise +```bash +# Create an Enterprise profile manually +redisctl profile set prod-enterprise enterprise \ + --url https://cluster:9443 \ + --username admin@example.com \ + --password your-password +``` + +#### Option 3: Environment Variables +```bash +# Redis Cloud +export REDIS_CLOUD_API_KEY="your-api-key" +export REDIS_CLOUD_API_SECRET="your-api-secret" + +# Redis Enterprise export REDIS_ENTERPRISE_URL="https://cluster.example.com:9443" -export REDIS_ENTERPRISE_USER="admin@example.com" +export REDIS_ENTERPRISE_USER="admin@example.com" export REDIS_ENTERPRISE_PASSWORD="your-password" -# Or using profiles -redisctl profile set prod-enterprise \ - --deployment-type enterprise \ - --url https://cluster:9443 \ - --username admin \ - --password secret +# Test authentication works +redisctl auth test +``` + +### 2. Verify Your Setup + +```bash +# Test authentication for any profile or environment vars +redisctl auth test +redisctl auth test --profile prod-cloud + +# View your configuration +redisctl config show + +# Validate all profiles +redisctl config validate + +# Find your config file location +redisctl config path ``` -### 2. Basic Usage +### 3. Basic Usage ```bash # List all profiles @@ -194,7 +235,7 @@ redisctl database list -o json | jq '.[] | .name' redisctl database list -q "[?status=='active'].name" -o yaml ``` -### 3. Common Workflows +### 4. Common Workflows ```bash # Initialize a new Enterprise cluster diff --git a/crates/redisctl/Cargo.toml b/crates/redisctl/Cargo.toml index 7cc451be..d249822f 100644 --- a/crates/redisctl/Cargo.toml +++ b/crates/redisctl/Cargo.toml @@ -41,6 +41,8 @@ serde_json = { workspace = true } chrono = "0.4" rpassword = { workspace = true } urlencoding = "2.1" +dialoguer = "0.11" +colored = "2.1" # Shared utility dependencies thiserror = { workspace = true } diff --git a/crates/redisctl/src/cli.rs b/crates/redisctl/src/cli.rs index c3a1a61e..35d3e654 100644 --- a/crates/redisctl/src/cli.rs +++ b/crates/redisctl/src/cli.rs @@ -69,6 +69,16 @@ pub enum Commands { #[command(subcommand)] command: AccountCommands, }, + /// Authentication testing and management + Auth { + #[command(subcommand)] + command: AuthCommands, + }, + /// Configuration management + Config { + #[command(subcommand)] + command: ConfigCommands, + }, } #[derive(Subcommand)] @@ -1585,3 +1595,36 @@ pub enum BillingCommands { data: String, }, } + +#[derive(Subcommand)] +pub enum AuthCommands { + /// Test authentication credentials + Test { + /// Profile to test (defaults to current profile) + #[arg(long)] + profile: Option, + /// Test a specific deployment type + #[arg(long, value_enum)] + deployment: Option, + }, + /// Interactive setup wizard for new profiles + Setup, +} + +#[derive(Subcommand)] +pub enum ConfigCommands { + /// Show current configuration and active profile + Show { + /// Show sensitive values (passwords, API keys) + #[arg(long)] + show_secrets: bool, + }, + /// Show configuration file path + Path, + /// Validate configuration + Validate { + /// Profile to validate (defaults to all profiles) + #[arg(long)] + profile: Option, + }, +} diff --git a/crates/redisctl/src/cloud_bin.rs b/crates/redisctl/src/cloud_bin.rs index a578adf1..0c444b50 100644 --- a/crates/redisctl/src/cloud_bin.rs +++ b/crates/redisctl/src/cloud_bin.rs @@ -60,7 +60,7 @@ fn get_cloud_profile<'a>( let env_profile = std::env::var("REDISCTL_PROFILE").ok(); let profile_name = profile_name .as_deref() - .or(config.default.as_deref()) + .or(config.default_profile.as_deref()) .or(env_profile.as_deref()) .ok_or_else(|| anyhow::anyhow!("No profile specified"))?; diff --git a/crates/redisctl/src/commands/auth.rs b/crates/redisctl/src/commands/auth.rs new file mode 100644 index 00000000..84fce505 --- /dev/null +++ b/crates/redisctl/src/commands/auth.rs @@ -0,0 +1,446 @@ +//! Authentication testing and management commands + +#![allow(dead_code)] + +use anyhow::{Context, Result}; +use colored::Colorize; +use redis_cloud::CloudClient; +use redis_enterprise::EnterpriseClient; +use serde_json::json; + +use crate::cli::AuthCommands; +use crate::config::{Config, DeploymentType, Profile, ProfileCredentials}; +/// Simple wrapper for output formatting +pub struct OutputFormatter { + pub format: crate::output::OutputFormat, + pub query: Option, +} + +impl OutputFormatter { + pub fn format(&self, data: T) -> anyhow::Result<()> { + crate::output::print_output(data, self.format, self.query.as_deref()) + } +} + +/// Execute auth commands +pub async fn execute(cmd: AuthCommands, config: &Config, output: OutputFormatter) -> Result<()> { + match cmd { + AuthCommands::Test { + profile, + deployment, + } => test_auth(profile, deployment, config, output).await, + AuthCommands::Setup => setup_wizard(config).await, + } +} + +/// Test authentication for a profile +async fn test_auth( + profile_name: Option, + deployment_override: Option, + config: &Config, + output: OutputFormatter, +) -> Result<()> { + // Get the profile to test, or use environment variables if no profile is configured + let (profile_name, profile_opt, deployment_type) = if let Some(name) = profile_name { + let p = config + .profiles + .get(&name) + .ok_or_else(|| anyhow::anyhow!("Profile '{}' not found", name))?; + let dt = deployment_override.unwrap_or(p.deployment_type); + (name, Some(p), dt) + } else { + // Find active profile with its name + let env_profile = std::env::var("REDISCTL_PROFILE").ok(); + if let Some(name) = env_profile.as_deref().or(config.default_profile.as_deref()) { + let p = config + .profiles + .get(name) + .ok_or_else(|| anyhow::anyhow!("Profile '{}' not found", name))?; + let dt = deployment_override.unwrap_or(p.deployment_type); + (name.to_string(), Some(p), dt) + } else { + // No profile configured, try to determine deployment type from environment or flag + let deployment_type = if let Some(dt) = deployment_override { + dt + } else { + // Try to detect deployment type from environment variables + if std::env::var("REDIS_CLOUD_API_KEY").is_ok() { + DeploymentType::Cloud + } else if std::env::var("REDIS_ENTERPRISE_URL").is_ok() { + DeploymentType::Enterprise + } else { + anyhow::bail!( + "No profile configured and no deployment type specified. Use --deployment flag or run 'redisctl auth setup' to create a profile." + ) + } + }; + ("environment".to_string(), None, deployment_type) + } + }; + + // Build result object to track all tests + let mut result = json!({ + "profile": profile_name, + "deployment_type": deployment_type.to_string(), + "tests": {} + }); + + match deployment_type { + DeploymentType::Cloud => test_cloud_auth(profile_opt, &mut result).await?, + DeploymentType::Enterprise => test_enterprise_auth(profile_opt, &mut result).await?, + } + + output.format(&result)?; + Ok(()) +} + +/// Test Redis Cloud authentication +async fn test_cloud_auth(profile: Option<&Profile>, result: &mut serde_json::Value) -> Result<()> { + let tests = result["tests"].as_object_mut().unwrap(); + + // Check for API credentials from profile or environment + let (api_key, api_secret, _api_url) = + if let Some(p) = profile.and_then(|p| p.cloud_credentials()) { + tests.insert("credentials_present".to_string(), json!(true)); + tests.insert("source".to_string(), json!("profile")); + (p.0.to_string(), p.1.to_string(), p.2.to_string()) + } else { + // Try environment variables + match ( + std::env::var("REDIS_CLOUD_API_KEY"), + std::env::var("REDIS_CLOUD_API_SECRET"), + ) { + (Ok(key), Ok(secret)) => { + tests.insert("credentials_present".to_string(), json!(true)); + tests.insert("source".to_string(), json!("environment")); + let url = std::env::var("REDIS_CLOUD_API_URL") + .unwrap_or_else(|_| "https://api.redislabs.com/v1".to_string()); + (key, secret, url) + } + (Err(_), _) => { + tests.insert("credentials_present".to_string(), json!(false)); + tests.insert("error".to_string(), json!("Missing API key")); + return Ok(()); + } + (_, Err(_)) => { + tests.insert("credentials_present".to_string(), json!(false)); + tests.insert("error".to_string(), json!("Missing API secret key")); + return Ok(()); + } + } + }; + + // Test API connectivity + let client = CloudClient::builder() + .api_key(api_key) + .api_secret(api_secret) + .build() + .context("Failed to create Cloud client")?; + + // Use /subscriptions endpoint to test authentication + // This is a documented endpoint that should exist for all Cloud accounts + match client.get_raw("/subscriptions").await { + Ok(subscriptions_data) => { + tests.insert("api_connectivity".to_string(), json!(true)); + tests.insert("authentication".to_string(), json!(true)); + + // Extract subscription count if available + if let Some(subscriptions) = subscriptions_data.get("subscriptions") + && let Some(arr) = subscriptions.as_array() + { + tests.insert("subscription_count".to_string(), json!(arr.len())); + + // If there are subscriptions, show the first one's name + if let Some(first) = arr.first() + && let Some(name) = first.get("name") + { + tests.insert("first_subscription".to_string(), name.clone()); + } + } + + tests.insert("status".to_string(), json!("✅ Authentication successful")); + } + Err(e) => { + tests.insert("api_connectivity".to_string(), json!(false)); + tests.insert("authentication".to_string(), json!(false)); + tests.insert("error".to_string(), json!(e.to_string())); + tests.insert("status".to_string(), json!("❌ Authentication failed")); + } + } + + Ok(()) +} + +/// Test Redis Enterprise authentication +async fn test_enterprise_auth( + profile: Option<&Profile>, + result: &mut serde_json::Value, +) -> Result<()> { + let tests = result["tests"].as_object_mut().unwrap(); + + // Check for credentials from profile or environment + let (url, username, password, insecure) = + if let Some(p) = profile.and_then(|p| p.enterprise_credentials()) { + tests.insert("credentials_present".to_string(), json!(true)); + tests.insert("source".to_string(), json!("profile")); + ( + p.0.to_string(), + p.1.to_string(), + p.2.map(|p| p.to_string()), + p.3, + ) + } else { + // Try environment variables + let url = std::env::var("REDIS_ENTERPRISE_URL") + .map_err(|_| anyhow::anyhow!("Missing Enterprise URL"))?; + let username = std::env::var("REDIS_ENTERPRISE_USER") + .map_err(|_| anyhow::anyhow!("Missing Enterprise username"))?; + let password = std::env::var("REDIS_ENTERPRISE_PASSWORD").ok(); + let insecure = std::env::var("REDIS_ENTERPRISE_INSECURE").unwrap_or_default() == "true"; + + tests.insert("credentials_present".to_string(), json!(true)); + tests.insert("source".to_string(), json!("environment")); + (url, username, password, insecure) + }; + + let password = password.ok_or_else(|| anyhow::anyhow!("Missing Enterprise password"))?; + + tests.insert("url".to_string(), json!(url)); + + // Test API connectivity + let mut builder = EnterpriseClient::builder() + .base_url(&url) + .username(&username) + .password(&password); + + if insecure { + builder = builder.insecure(true); + tests.insert("ssl_verification".to_string(), json!("disabled")); + } else { + tests.insert("ssl_verification".to_string(), json!("enabled")); + } + + let client = builder + .build() + .context("Failed to create Enterprise client")?; + + // Test with cluster info endpoint + match client.get_raw("/v1/cluster").await { + Ok(cluster_info) => { + tests.insert("api_connectivity".to_string(), json!(true)); + tests.insert("authentication".to_string(), json!(true)); + + // Extract cluster details if available + if let Some(obj) = cluster_info.as_object() { + if let Some(name) = obj.get("name") { + tests.insert("cluster_name".to_string(), name.clone()); + } + if let Some(version) = obj.get("software_version") { + tests.insert("cluster_version".to_string(), version.clone()); + } + } + + tests.insert("status".to_string(), json!("✅ Authentication successful")); + } + Err(e) => { + tests.insert("api_connectivity".to_string(), json!(false)); + tests.insert("authentication".to_string(), json!(false)); + tests.insert("error".to_string(), json!(e.to_string())); + tests.insert("status".to_string(), json!("❌ Authentication failed")); + + // Provide helpful error messages + let error_msg = e.to_string(); + if error_msg.contains("certificate") || error_msg.contains("SSL") { + tests.insert("suggestion".to_string(), json!( + "Try setting REDIS_ENTERPRISE_INSECURE=true or add insecure: true to your profile" + )); + } else if error_msg.contains("401") || error_msg.contains("Unauthorized") { + tests.insert( + "suggestion".to_string(), + json!("Check your username and password"), + ); + } else if error_msg.contains("connection") || error_msg.contains("refused") { + tests.insert( + "suggestion".to_string(), + json!("Check the URL and ensure the cluster is accessible"), + ); + } + } + } + + Ok(()) +} + +/// Interactive setup wizard for creating profiles +async fn setup_wizard(config: &Config) -> Result<()> { + use dialoguer::{Confirm, Input, Password, Select}; + + println!("\n{}", "Welcome to redisctl setup wizard!".bold().green()); + println!("This wizard will help you configure authentication for Redis Cloud or Enterprise.\n"); + + // Select deployment type + let deployment_types = vec!["Redis Cloud", "Redis Enterprise"]; + let deployment_idx = Select::new() + .with_prompt("Which Redis deployment are you using?") + .items(&deployment_types) + .default(0) + .interact()?; + + let deployment_type = match deployment_idx { + 0 => DeploymentType::Cloud, + 1 => DeploymentType::Enterprise, + _ => unreachable!(), + }; + + // Get profile name + let profile_name: String = Input::new() + .with_prompt("Profile name") + .default( + if deployment_type == DeploymentType::Cloud { + "cloud" + } else { + "enterprise" + } + .to_string(), + ) + .interact_text()?; + + let credentials = match deployment_type { + DeploymentType::Cloud => { + println!("\n{}", "Redis Cloud Configuration".bold()); + println!( + "You'll need your API credentials from: https://app.redislabs.com/#/settings/cloud-api-keys\n" + ); + + let api_key = Input::new().with_prompt("API Key").interact_text()?; + + let api_secret = Password::new().with_prompt("API Secret Key").interact()?; + + // Optionally set API URL + let api_url = if Confirm::new() + .with_prompt("Use custom API URL? (default: https://api.redislabs.com/v1)") + .default(false) + .interact()? + { + Input::new() + .with_prompt("API URL") + .default("https://api.redislabs.com/v1".to_string()) + .interact_text()? + } else { + "https://api.redislabs.com/v1".to_string() + }; + + ProfileCredentials::Cloud { + api_key, + api_secret, + api_url, + } + } + DeploymentType::Enterprise => { + println!("\n{}", "Redis Enterprise Configuration".bold()); + + let url = Input::new() + .with_prompt("Cluster URL (e.g., https://cluster.example.com:9443)") + .interact_text()?; + + let username = Input::new() + .with_prompt("Username") + .default("admin@example.com".to_string()) + .interact_text()?; + + let password = Some(Password::new().with_prompt("Password").interact()?); + + // Ask about SSL verification + let insecure = Confirm::new() + .with_prompt("Skip SSL certificate verification? (for self-signed certificates)") + .default(false) + .interact()?; + + ProfileCredentials::Enterprise { + url, + username, + password, + insecure, + } + } + }; + + let profile = Profile { + deployment_type, + credentials, + }; + + // Test the configuration + println!("\n{}", "Testing authentication...".yellow()); + + let mut test_result = json!({ + "profile": profile_name.clone(), + "deployment_type": deployment_type.to_string(), + "tests": {} + }); + + let success = match deployment_type { + DeploymentType::Cloud => { + test_cloud_auth(Some(&profile), &mut test_result) + .await + .is_ok() + && test_result["tests"]["authentication"] == json!(true) + } + DeploymentType::Enterprise => { + test_enterprise_auth(Some(&profile), &mut test_result) + .await + .is_ok() + && test_result["tests"]["authentication"] == json!(true) + } + }; + + if success { + println!("{}", "✅ Authentication successful!".green().bold()); + + // Save the profile + let mut config = config.clone(); + config.profiles.insert(profile_name.clone(), profile); + + // Set as default if it's the first profile or user wants it + if config.profiles.len() == 1 + || (config.default_profile.is_none() + && Confirm::new() + .with_prompt("Set as default profile?") + .default(true) + .interact()?) + { + config.default_profile = Some(profile_name.clone()); + } + + config.save().context("Failed to save configuration")?; + + println!( + "\n{}", + format!("Profile '{}' saved successfully!", profile_name) + .green() + .bold() + ); + println!("\nYou can now use redisctl commands like:"); + println!( + " redisctl {} database list", + if deployment_type == DeploymentType::Cloud { + "cloud" + } else { + "enterprise" + } + ); + println!(" redisctl cluster info"); + println!("\nTo test authentication anytime: redisctl auth test"); + } else { + println!("{}", "❌ Authentication failed!".red().bold()); + if let Some(error) = test_result["tests"]["error"].as_str() { + println!("Error: {}", error); + } + if let Some(suggestion) = test_result["tests"]["suggestion"].as_str() { + println!("Suggestion: {}", suggestion); + } + println!("\nPlease check your credentials and try again."); + } + + Ok(()) +} diff --git a/crates/redisctl/src/commands/config.rs b/crates/redisctl/src/commands/config.rs new file mode 100644 index 00000000..041363a4 --- /dev/null +++ b/crates/redisctl/src/commands/config.rs @@ -0,0 +1,289 @@ +//! Configuration management commands + +#![allow(dead_code)] + +use anyhow::Result; +use serde_json::json; +use std::collections::HashMap; + +use crate::cli::ConfigCommands; +use crate::config::{Config, ProfileCredentials}; +/// Simple wrapper for output formatting +pub struct OutputFormatter { + pub format: crate::output::OutputFormat, + pub query: Option, +} + +impl OutputFormatter { + pub fn format(&self, data: T) -> anyhow::Result<()> { + crate::output::print_output(data, self.format, self.query.as_deref()) + } +} + +/// Execute config commands +pub async fn execute(cmd: ConfigCommands, config: &Config, output: OutputFormatter) -> Result<()> { + match cmd { + ConfigCommands::Show { show_secrets } => show_config(config, show_secrets, output), + ConfigCommands::Path => show_path(output), + ConfigCommands::Validate { profile } => validate_config(config, profile, output).await, + } +} + +/// Show current configuration +fn show_config(config: &Config, show_secrets: bool, output: OutputFormatter) -> Result<()> { + // Find active profile name + let env_profile = std::env::var("REDISCTL_PROFILE").ok(); + let active_profile_name = env_profile.as_deref().or(config.default_profile.as_deref()); + + let mut result = json!({ + "config_path": Config::config_path()?.to_string_lossy(), + "default_profile": config.default_profile, + "active_profile": active_profile_name, + "profiles": {} + }); + + // Add profile details + let profiles = result["profiles"].as_object_mut().unwrap(); + for (name, profile) in &config.profiles { + let mut profile_info = json!({ + "name": name, + "deployment_type": profile.deployment_type.to_string(), + }); + + match &profile.credentials { + ProfileCredentials::Cloud { + api_key, + api_secret, + api_url, + } => { + profile_info["cloud_api_url"] = json!(api_url); + profile_info["cloud_api_key"] = if show_secrets { + json!(api_key) + } else { + json!(if api_key.len() > 8 { + format!("{}...{}", &api_key[..4], &api_key[api_key.len() - 4..]) + } else { + "***".to_string() + }) + }; + profile_info["cloud_api_secret"] = if show_secrets { + json!(api_secret) + } else { + json!("***") + }; + } + ProfileCredentials::Enterprise { + url, + username, + password, + insecure, + } => { + profile_info["enterprise_url"] = json!(url); + profile_info["enterprise_username"] = json!(username); + profile_info["enterprise_password"] = if show_secrets { + json!(password) + } else { + json!(password.as_ref().map(|_| "***")) + }; + profile_info["enterprise_insecure"] = json!(insecure); + } + } + + profiles.insert(name.clone(), profile_info); + } + + // Add environment variable status + let mut env_vars = HashMap::new(); + + // Check profile selection env var + if let Ok(profile) = std::env::var("REDISCTL_PROFILE") { + env_vars.insert("REDISCTL_PROFILE", profile); + } + + // Check Cloud env vars + if let Ok(key) = std::env::var("REDIS_CLOUD_API_KEY") { + env_vars.insert( + "REDIS_CLOUD_API_KEY", + if show_secrets { + key + } else if key.len() > 8 { + format!("{}...{}", &key[..4], &key[key.len() - 4..]) + } else { + "***".to_string() + }, + ); + } + if std::env::var("REDIS_CLOUD_API_SECRET").is_ok() { + env_vars.insert( + "REDIS_CLOUD_API_SECRET", + if show_secrets { + std::env::var("REDIS_CLOUD_API_SECRET").unwrap() + } else { + "***".to_string() + }, + ); + } + + // Check Enterprise env vars + if let Ok(url) = std::env::var("REDIS_ENTERPRISE_URL") { + env_vars.insert("REDIS_ENTERPRISE_URL", url); + } + if let Ok(user) = std::env::var("REDIS_ENTERPRISE_USER") { + env_vars.insert("REDIS_ENTERPRISE_USER", user); + } + if std::env::var("REDIS_ENTERPRISE_PASSWORD").is_ok() { + env_vars.insert( + "REDIS_ENTERPRISE_PASSWORD", + if show_secrets { + std::env::var("REDIS_ENTERPRISE_PASSWORD").unwrap() + } else { + "***".to_string() + }, + ); + } + if let Ok(insecure) = std::env::var("REDIS_ENTERPRISE_INSECURE") { + env_vars.insert("REDIS_ENTERPRISE_INSECURE", insecure); + } + + if !env_vars.is_empty() { + result["environment_variables"] = json!(env_vars); + } + + // Add configuration priority explanation + result["priority_order"] = json!([ + "1. Command-line flags (--profile)", + "2. Environment variables (REDISCTL_PROFILE, REDIS_*)", + "3. Profile configuration", + "4. Default profile" + ]); + + output.format(&result)?; + Ok(()) +} + +/// Show configuration file path +fn show_path(output: OutputFormatter) -> Result<()> { + let path = Config::config_path()?; + let exists = path.exists(); + + let result = json!({ + "path": path.to_string_lossy(), + "exists": exists, + "directory": path.parent().map(|p| p.to_string_lossy()), + }); + + output.format(&result)?; + Ok(()) +} + +/// Validate configuration +async fn validate_config( + config: &Config, + profile_name: Option, + output: OutputFormatter, +) -> Result<()> { + let mut results = Vec::new(); + + if let Some(name) = profile_name { + // Validate specific profile + let profile = config + .profiles + .get(&name) + .ok_or_else(|| anyhow::anyhow!("Profile '{}' not found", name))?; + + let validation = validate_profile(&name, profile); + results.push(validation); + } else { + // Validate all profiles + for (name, profile) in &config.profiles { + let validation = validate_profile(name, profile); + results.push(validation); + } + } + + let all_valid = results.iter().all(|r| r["valid"] == json!(true)); + + let result = json!({ + "all_valid": all_valid, + "profiles": results, + "config_file": Config::config_path()?.to_string_lossy(), + "config_file_exists": Config::config_path()?.exists(), + }); + + output.format(&result)?; + + if !all_valid { + std::process::exit(1); + } + + Ok(()) +} + +/// Validate a single profile +fn validate_profile(name: &str, profile: &crate::config::Profile) -> serde_json::Value { + let mut issues = Vec::new(); + let mut warnings = Vec::new(); + + match &profile.credentials { + ProfileCredentials::Cloud { + api_key, + api_secret, + api_url, + } => { + // Check for API key + if api_key.is_empty() && std::env::var("REDIS_CLOUD_API_KEY").is_err() { + issues.push("Missing API key (set in profile or REDIS_CLOUD_API_KEY env var)"); + } + + // Check for API secret + if api_secret.is_empty() && std::env::var("REDIS_CLOUD_API_SECRET").is_err() { + issues.push( + "Missing API secret key (set in profile or REDIS_CLOUD_API_SECRET env var)", + ); + } + + // Check API URL format + if !api_url.starts_with("http://") && !api_url.starts_with("https://") { + issues.push("Invalid API URL format (must start with http:// or https://)"); + } + } + ProfileCredentials::Enterprise { + url, + username, + password, + insecure, + } => { + // Check for URL + if url.is_empty() && std::env::var("REDIS_ENTERPRISE_URL").is_err() { + issues.push("Missing cluster URL (set in profile or REDIS_ENTERPRISE_URL env var)"); + } else if !url.starts_with("http://") && !url.starts_with("https://") { + issues.push("Invalid cluster URL format (must start with http:// or https://)"); + } + + // Check for username + if username.is_empty() && std::env::var("REDIS_ENTERPRISE_USER").is_err() { + issues.push("Missing username (set in profile or REDIS_ENTERPRISE_USER env var)"); + } + + // Check for password + if password.is_none() && std::env::var("REDIS_ENTERPRISE_PASSWORD").is_err() { + issues + .push("Missing password (set in profile or REDIS_ENTERPRISE_PASSWORD env var)"); + } + + // Warn about insecure mode + if *insecure || std::env::var("REDIS_ENTERPRISE_INSECURE").unwrap_or_default() == "true" + { + warnings.push("SSL certificate verification is disabled"); + } + } + } + + json!({ + "profile": name, + "deployment_type": profile.deployment_type.to_string(), + "valid": issues.is_empty(), + "issues": issues, + "warnings": warnings, + }) +} diff --git a/crates/redisctl/src/commands/mod.rs b/crates/redisctl/src/commands/mod.rs index c304383d..5ab8144f 100644 --- a/crates/redisctl/src/commands/mod.rs +++ b/crates/redisctl/src/commands/mod.rs @@ -1,5 +1,7 @@ pub mod api; +pub mod auth; pub mod cloud; pub mod cloud_billing; +pub mod config; pub mod enterprise; pub mod profile; diff --git a/crates/redisctl/src/commands/profile.rs b/crates/redisctl/src/commands/profile.rs index 885ebcda..c0c2394a 100644 --- a/crates/redisctl/src/commands/profile.rs +++ b/crates/redisctl/src/commands/profile.rs @@ -20,7 +20,7 @@ pub async fn handle_profile_command( serde_json::json!({ "name": name, "deployment_type": profile.deployment_type, - "is_default": config.default.as_ref() == Some(name) + "is_default": config.default_profile.as_ref() == Some(name) }) }) .collect(); @@ -30,7 +30,7 @@ pub async fn handle_profile_command( let env_profile = std::env::var("REDISCTL_PROFILE").ok(); let profile_name = name .as_deref() - .or(config.default.as_deref()) + .or(config.default_profile.as_deref()) .or(env_profile.as_deref()) .ok_or_else(|| { anyhow::anyhow!("No profile specified and no default profile set") @@ -62,7 +62,7 @@ pub async fn handle_profile_command( }) } }, - "is_default": config.default.as_deref() == Some(profile_name) + "is_default": config.default_profile.as_deref() == Some(profile_name) }); print_output(profile_info, output_format, None)?; @@ -121,8 +121,8 @@ pub async fn handle_profile_command( ProfileCommands::Remove { name } => { if config.remove_profile(&name).is_some() { // If we're removing the default profile, clear the default - if config.default.as_ref() == Some(&name) { - config.default = None; + if config.default_profile.as_ref() == Some(&name) { + config.default_profile = None; } config.save()?; println!("Profile '{}' removed successfully", name); @@ -132,7 +132,7 @@ pub async fn handle_profile_command( } ProfileCommands::Default { name } => { if config.profiles.contains_key(&name) { - config.default = Some(name.clone()); + config.default_profile = Some(name.clone()); config.save()?; println!("Default profile set to '{}'", name); } else { diff --git a/crates/redisctl/src/config.rs b/crates/redisctl/src/config.rs index 5da29bbe..7bb009ab 100644 --- a/crates/redisctl/src/config.rs +++ b/crates/redisctl/src/config.rs @@ -9,8 +9,8 @@ use std::path::PathBuf; #[derive(Debug, Serialize, Deserialize, Default, Clone)] pub struct Config { - #[serde(default)] - pub default: Option, // Name of the default profile + #[serde(default, rename = "default_profile")] + pub default_profile: Option, // Name of the default profile #[serde(default)] pub profiles: HashMap, } @@ -22,12 +22,56 @@ pub struct Profile { pub credentials: ProfileCredentials, } +impl Profile { + pub fn name(&self) -> String { + // This is a placeholder - the actual name is stored as the key in the HashMap + String::new() + } + + pub fn cloud_credentials(&self) -> Option<(&str, &str, &str)> { + match &self.credentials { + ProfileCredentials::Cloud { + api_key, + api_secret, + api_url, + } => Some((api_key.as_str(), api_secret.as_str(), api_url.as_str())), + _ => None, + } + } + + pub fn enterprise_credentials(&self) -> Option<(&str, &str, Option<&str>, bool)> { + match &self.credentials { + ProfileCredentials::Enterprise { + url, + username, + password, + insecure, + } => Some(( + url.as_str(), + username.as_str(), + password.as_deref(), + *insecure, + )), + _ => None, + } + } +} + #[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, clap::ValueEnum)] pub enum DeploymentType { Cloud, Enterprise, } +impl std::fmt::Display for DeploymentType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + DeploymentType::Cloud => write!(f, "cloud"), + DeploymentType::Enterprise => write!(f, "enterprise"), + } + } +} + #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(untagged)] pub enum ProfileCredentials { @@ -94,12 +138,26 @@ impl Config { pub fn get_profile(&self, name: Option<&str>) -> Option<&Profile> { let env_profile = std::env::var("REDISCTL_PROFILE").ok(); let profile_name = name - .or(self.default.as_deref()) + .or(self.default_profile.as_deref()) .or(env_profile.as_deref())?; self.profiles.get(profile_name) } + pub fn get_active_profile(&self) -> Result<&Profile> { + let env_profile = std::env::var("REDISCTL_PROFILE").ok(); + let profile_name = env_profile + .as_deref() + .or(self.default_profile.as_deref()) + .ok_or_else(|| { + anyhow::anyhow!("No profile configured. Run 'redisctl auth setup' to get started.") + })?; + + self.profiles + .get(profile_name) + .ok_or_else(|| anyhow::anyhow!("Profile '{}' not found", profile_name)) + } + pub fn set_profile(&mut self, name: String, profile: Profile) { self.profiles.insert(name, profile); } @@ -114,7 +172,7 @@ impl Config { profiles } - fn config_path() -> Result { + pub fn config_path() -> Result { let proj_dirs = ProjectDirs::from("com", "redis", "redisctl") .context("Failed to determine config directory")?; diff --git a/crates/redisctl/src/enterprise_bin.rs b/crates/redisctl/src/enterprise_bin.rs index 866baf05..0277909b 100644 --- a/crates/redisctl/src/enterprise_bin.rs +++ b/crates/redisctl/src/enterprise_bin.rs @@ -69,7 +69,7 @@ fn get_enterprise_profile<'a>( let env_profile = std::env::var("REDISCTL_PROFILE").ok(); let profile_name = profile_name .as_deref() - .or(config.default.as_deref()) + .or(config.default_profile.as_deref()) .or(env_profile.as_deref()) .ok_or_else(|| anyhow::anyhow!("No profile specified"))?; diff --git a/crates/redisctl/src/router.rs b/crates/redisctl/src/router.rs index 3014bfa7..45ca9b7c 100644 --- a/crates/redisctl/src/router.rs +++ b/crates/redisctl/src/router.rs @@ -5,7 +5,7 @@ use std::borrow::Cow; use tracing::{debug, info}; use crate::cli::{Cli, Commands}; -use crate::commands::{cloud, enterprise, profile}; +use crate::commands::{auth, cloud, config, enterprise, profile}; pub async fn route_command(cli: Cli, config: &Config) -> Result<()> { let output_format = cli.output; @@ -69,6 +69,20 @@ pub async fn route_command(cli: Cli, config: &Config) -> Result<()> { ) .await } + Commands::Auth { command } => { + let output = auth::OutputFormatter { + format: output_format, + query: query.map(|s| s.to_string()), + }; + auth::execute(command, config, output).await + } + Commands::Config { command } => { + let output = config::OutputFormatter { + format: output_format, + query: query.map(|s| s.to_string()), + }; + config::execute(command, config, output).await + } } } @@ -211,7 +225,7 @@ fn get_profile_with_type<'a>( let env_profile = std::env::var("REDISCTL_PROFILE").ok(); let profile_name = profile_name .as_deref() - .or(config.default.as_deref()) + .or(config.default_profile.as_deref()) .or(env_profile.as_deref()); if let Some(name) = profile_name @@ -246,7 +260,7 @@ fn get_profile_for_deployment<'a>( let env_profile = std::env::var("REDISCTL_PROFILE").ok(); let profile_name = profile_name .as_deref() - .or(config.default.as_deref()) + .or(config.default_profile.as_deref()) .or(env_profile.as_deref()); // Try to get profile from config first diff --git a/docs/.mdbook-lint.toml b/docs/.mdbook-lint.toml index 8d25f20b..ffaca691 100644 --- a/docs/.mdbook-lint.toml +++ b/docs/.mdbook-lint.toml @@ -8,10 +8,31 @@ disabled-rules = [ "MDBOOK002", # Internal link validation - false positives with existing files ] -# Don't fail the build on warnings or errors during initial setup +# Don't fail the build on warnings, but show them for fixing fail-on-warnings = false fail-on-errors = false +# Enable rules that should be fixable +[rules.MD022] +# Require blank lines around headings +enabled = true + +[rules.MD032] +# Require blank lines around lists +enabled = true + +[rules.MD031] +# Require blank lines around fenced code blocks +enabled = true + +[rules.MD006] +# Lists should start at beginning of line +enabled = true + +[rules.MD047] +# Files should end with single newline +enabled = true + # Configure specific rules [rules.MD013] # Allow longer lines for code examples and CLI output diff --git a/docs/MDBOOK_LINT_BUG_REPORT.md b/docs/MDBOOK_LINT_BUG_REPORT.md new file mode 100644 index 00000000..618c3a08 --- /dev/null +++ b/docs/MDBOOK_LINT_BUG_REPORT.md @@ -0,0 +1,61 @@ +# mdbook-lint Bug Report + +Found multiple bugs in mdbook-lint v0.11.2 during redisctl documentation linting. + +## Bug 1: Configuration Rules Not Applied + +**Issue**: Rules defined in `.mdbook-lint.toml` configuration file are not being applied. + +**Expected**: Rules configured in the config file should override defaults. + +**Actual**: Default rule settings are used regardless of configuration. + +**Reproduction**: +1. Create `.mdbook-lint.toml` with: + ```toml + [rules.MD013] + line_length = 120 + ``` +2. Run `mdbook-lint lint file.md` +3. Observe that MD013 still enforces 80 character limit instead of 120 + +**Evidence**: Lines over 80 chars trigger MD013 warnings despite config setting line_length = 120. + +## Bug 2: --fix Option Not Working + +**Issue**: The `--fix` option doesn't actually fix any issues, even for rules that should be auto-fixable. + +**Expected**: `mdbook-lint lint --fix file.md` should automatically fix issues like MD022, MD032, MD031, MD047. + +**Actual**: Command shows the same warnings but doesn't modify the file. + +**Reproduction**: +1. Create test file with MD022 violations (missing blank lines after headings) +2. Run `mdbook-lint lint --fix test.md` +3. File remains unchanged despite warnings being shown + +**Test case**: +```markdown +# Heading +Text directly after heading without blank line +``` + +Should be auto-fixed to: +```markdown +# Heading + +Text directly after heading without blank line +``` + +But file remains unmodified. + +## Environment +- mdbook-lint version: 0.11.2 +- OS: macOS (Darwin 24.6.0) +- Configuration file present: `.mdbook-lint.toml` + +## Workaround +Currently fixing issues manually by editing markdown files directly. + +## Impact +These bugs prevent automated fixing and proper configuration of linting rules, requiring manual intervention for all markdown formatting issues. \ No newline at end of file diff --git a/docs/book.toml b/docs/book.toml index 8f6a2e24..3b227dd3 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -14,3 +14,7 @@ edit-url-template = "https://github.com/joshrotenberg/redisctl/edit/main/docs/{p [output.html.fold] enable = true level = 1 + +[preprocessor.lint] +command = "mdbook-lint" +renderer = ["html"] diff --git a/docs/cli-reference/README.md b/docs/cli-reference/README.md index 927c212c..92d16536 100644 --- a/docs/cli-reference/README.md +++ b/docs/cli-reference/README.md @@ -1,6 +1,6 @@ # redisctl Command Reference -``` +```text Unified Redis CLI for Cloud and Enterprise Usage: redisctl [OPTIONS] @@ -13,6 +13,8 @@ Commands: cluster Cluster operations (smart routing) user User operations (smart routing) account Account operations (smart routing to Cloud subscriptions) + auth Authentication testing and management + config Configuration management help Print this message or the help of the given subcommand(s) Options: @@ -23,5 +25,4 @@ Options: -v, --verbose... Verbose logging -h, --help Print help -V, --version Print version -``` - +```text diff --git a/docs/cli-reference/auth/README.md b/docs/cli-reference/auth/README.md new file mode 100644 index 00000000..c80a4b78 --- /dev/null +++ b/docs/cli-reference/auth/README.md @@ -0,0 +1,15 @@ +# Authentication Management Commands + +```text +Authentication testing and management + +Usage: redisctl auth + +Commands: + test Test authentication credentials + setup Interactive setup wizard for new profiles + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` diff --git a/docs/cli-reference/auth/setup.md b/docs/cli-reference/auth/setup.md new file mode 100644 index 00000000..15b16557 --- /dev/null +++ b/docs/cli-reference/auth/setup.md @@ -0,0 +1,10 @@ +# Auth Setup Command + +```text +Interactive setup wizard for new profiles + +Usage: redisctl auth setup + +Options: + -h, --help Print help +```text diff --git a/docs/cli-reference/auth/test.md b/docs/cli-reference/auth/test.md new file mode 100644 index 00000000..f8d9edf3 --- /dev/null +++ b/docs/cli-reference/auth/test.md @@ -0,0 +1,12 @@ +# Auth Test Command + +```text +Test authentication credentials + +Usage: redisctl auth test [OPTIONS] + +Options: + --profile Profile to test (defaults to current profile) + --deployment Test a specific deployment type [possible values: cloud, enterprise] + -h, --help Print help +```text diff --git a/docs/cli-reference/cloud/README.md b/docs/cli-reference/cloud/README.md index e80f7d5f..036b0c65 100644 --- a/docs/cli-reference/cloud/README.md +++ b/docs/cli-reference/cloud/README.md @@ -1,6 +1,6 @@ # Redis Cloud Commands -``` +```text Redis Cloud commands Usage: redisctl cloud @@ -31,5 +31,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/account.md b/docs/cli-reference/cloud/account.md index b409d70a..66ec0473 100644 --- a/docs/cli-reference/cloud/account.md +++ b/docs/cli-reference/cloud/account.md @@ -1,6 +1,6 @@ # Cloud Account Commands -``` +```text Account management Usage: redisctl cloud account @@ -16,5 +16,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/acl.md b/docs/cli-reference/cloud/acl.md index 3e3a6589..50bd24da 100644 --- a/docs/cli-reference/cloud/acl.md +++ b/docs/cli-reference/cloud/acl.md @@ -1,6 +1,6 @@ # Cloud ACL Commands -``` +```text ACL management Usage: redisctl cloud acl @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/api-key.md b/docs/cli-reference/cloud/api-key.md index 565c52b9..1597176d 100644 --- a/docs/cli-reference/cloud/api-key.md +++ b/docs/cli-reference/cloud/api-key.md @@ -1,6 +1,6 @@ # Cloud API Key Commands -``` +```text API Keys management Usage: redisctl cloud api-key @@ -18,5 +18,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/api.md b/docs/cli-reference/cloud/api.md index e9cb9b58..e2c89918 100644 --- a/docs/cli-reference/cloud/api.md +++ b/docs/cli-reference/cloud/api.md @@ -1,6 +1,6 @@ # Cloud API Commands -``` +```text Raw API access Usage: redisctl cloud api @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/backup.md b/docs/cli-reference/cloud/backup.md index 0772e7bc..59ff57fc 100644 --- a/docs/cli-reference/cloud/backup.md +++ b/docs/cli-reference/cloud/backup.md @@ -1,6 +1,6 @@ # Cloud Backup Commands -``` +```text Backup management Usage: redisctl cloud backup @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/billing.md b/docs/cli-reference/cloud/billing.md index 37ac2e4e..09e7575b 100644 --- a/docs/cli-reference/cloud/billing.md +++ b/docs/cli-reference/cloud/billing.md @@ -1,6 +1,6 @@ # Cloud Billing Commands -``` +```text Billing and payment management Usage: redisctl cloud billing @@ -28,5 +28,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/cloud-account.md b/docs/cli-reference/cloud/cloud-account.md index e95277d6..54774186 100644 --- a/docs/cli-reference/cloud/cloud-account.md +++ b/docs/cli-reference/cloud/cloud-account.md @@ -1,6 +1,6 @@ # Cloud Provider Account Commands -``` +```text Cloud account management Usage: redisctl cloud cloud-account @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/crdb.md b/docs/cli-reference/cloud/crdb.md index 761b729d..613fcea8 100644 --- a/docs/cli-reference/cloud/crdb.md +++ b/docs/cli-reference/cloud/crdb.md @@ -1,6 +1,6 @@ # Cloud Active-Active Commands -``` +```text Active-Active database management Usage: redisctl cloud crdb @@ -17,5 +17,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/database.md b/docs/cli-reference/cloud/database.md index 4537d0ad..da67a83a 100644 --- a/docs/cli-reference/cloud/database.md +++ b/docs/cli-reference/cloud/database.md @@ -1,6 +1,6 @@ # Cloud Database Commands -``` +```text Database management Usage: redisctl cloud database @@ -18,5 +18,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/logs.md b/docs/cli-reference/cloud/logs.md index 9bf01175..92164120 100644 --- a/docs/cli-reference/cloud/logs.md +++ b/docs/cli-reference/cloud/logs.md @@ -1,6 +1,6 @@ # Cloud Logs Commands -``` +```text Logs and audit trails Usage: redisctl cloud logs @@ -13,5 +13,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/metrics.md b/docs/cli-reference/cloud/metrics.md index e2f3fe5e..d35f4dfb 100644 --- a/docs/cli-reference/cloud/metrics.md +++ b/docs/cli-reference/cloud/metrics.md @@ -1,6 +1,6 @@ # Cloud Metrics Commands -``` +```text Metrics and monitoring Usage: redisctl cloud metrics @@ -12,5 +12,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/peering.md b/docs/cli-reference/cloud/peering.md index f77eec7e..422ab89a 100644 --- a/docs/cli-reference/cloud/peering.md +++ b/docs/cli-reference/cloud/peering.md @@ -1,6 +1,6 @@ # Cloud VPC Peering Commands -``` +```text VPC Peering management Usage: redisctl cloud peering @@ -14,5 +14,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/region.md b/docs/cli-reference/cloud/region.md index ee335802..a8d37344 100644 --- a/docs/cli-reference/cloud/region.md +++ b/docs/cli-reference/cloud/region.md @@ -1,6 +1,6 @@ # Cloud Region Commands -``` +```text Region information Usage: redisctl cloud region @@ -11,5 +11,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/sso.md b/docs/cli-reference/cloud/sso.md index 9243d369..d8c8efdf 100644 --- a/docs/cli-reference/cloud/sso.md +++ b/docs/cli-reference/cloud/sso.md @@ -1,6 +1,6 @@ # Cloud SSO/SAML Commands -``` +```text SSO/SAML management Usage: redisctl cloud sso @@ -27,5 +27,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/subscription.md b/docs/cli-reference/cloud/subscription.md index 00bb793f..4403ce54 100644 --- a/docs/cli-reference/cloud/subscription.md +++ b/docs/cli-reference/cloud/subscription.md @@ -1,6 +1,6 @@ # Cloud Subscription Commands -``` +```text Subscription management Usage: redisctl cloud subscription @@ -19,5 +19,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/task.md b/docs/cli-reference/cloud/task.md index ab205d8d..2da56930 100644 --- a/docs/cli-reference/cloud/task.md +++ b/docs/cli-reference/cloud/task.md @@ -1,6 +1,6 @@ # Cloud Task Commands -``` +```text Task monitoring Usage: redisctl cloud task @@ -13,5 +13,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/transit-gateway.md b/docs/cli-reference/cloud/transit-gateway.md index 7339e4c7..6c878b54 100644 --- a/docs/cli-reference/cloud/transit-gateway.md +++ b/docs/cli-reference/cloud/transit-gateway.md @@ -1,6 +1,6 @@ # Cloud Transit Gateway Commands -``` +```text Transit Gateway management Usage: redisctl cloud transit-gateway @@ -14,5 +14,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/cloud/user.md b/docs/cli-reference/cloud/user.md index e105d062..7cb80010 100644 --- a/docs/cli-reference/cloud/user.md +++ b/docs/cli-reference/cloud/user.md @@ -1,6 +1,6 @@ # Cloud User Commands -``` +```text User management Usage: redisctl cloud user @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/config/README.md b/docs/cli-reference/config/README.md new file mode 100644 index 00000000..fdac4da0 --- /dev/null +++ b/docs/cli-reference/config/README.md @@ -0,0 +1,16 @@ +# Configuration Management Commands + +```text +Configuration management + +Usage: redisctl config + +Commands: + show Show current configuration and active profile + path Show configuration file path + validate Validate configuration + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +```text diff --git a/docs/cli-reference/config/path.md b/docs/cli-reference/config/path.md new file mode 100644 index 00000000..5b2f87a8 --- /dev/null +++ b/docs/cli-reference/config/path.md @@ -0,0 +1,10 @@ +# Config Path Command + +```text +Show configuration file path + +Usage: redisctl config path + +Options: + -h, --help Print help +```text diff --git a/docs/cli-reference/config/show.md b/docs/cli-reference/config/show.md new file mode 100644 index 00000000..db43160b --- /dev/null +++ b/docs/cli-reference/config/show.md @@ -0,0 +1,11 @@ +# Config Show Command + +```text +Show current configuration and active profile + +Usage: redisctl config show [OPTIONS] + +Options: + --show-secrets Show sensitive values (passwords, API keys) + -h, --help Print help +```text diff --git a/docs/cli-reference/config/validate.md b/docs/cli-reference/config/validate.md new file mode 100644 index 00000000..9abbdfc3 --- /dev/null +++ b/docs/cli-reference/config/validate.md @@ -0,0 +1,11 @@ +# Config Validate Command + +```text +Validate configuration + +Usage: redisctl config validate [OPTIONS] + +Options: + --profile Profile to validate (defaults to all profiles) + -h, --help Print help +```text diff --git a/docs/cli-reference/enterprise/README.md b/docs/cli-reference/enterprise/README.md index ca4d1446..30e03670 100644 --- a/docs/cli-reference/enterprise/README.md +++ b/docs/cli-reference/enterprise/README.md @@ -1,6 +1,6 @@ # Redis Enterprise Commands -``` +```text Redis Enterprise commands Usage: redisctl enterprise @@ -24,5 +24,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/actions.md b/docs/cli-reference/enterprise/actions.md index c8ea5b7a..104bf1f1 100644 --- a/docs/cli-reference/enterprise/actions.md +++ b/docs/cli-reference/enterprise/actions.md @@ -1,6 +1,6 @@ # Enterprise Actions Commands -``` +```text Action/task management Usage: redisctl enterprise actions @@ -13,5 +13,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/alert.md b/docs/cli-reference/enterprise/alert.md index 60ee7778..6dda2b45 100644 --- a/docs/cli-reference/enterprise/alert.md +++ b/docs/cli-reference/enterprise/alert.md @@ -1,6 +1,6 @@ # Enterprise Alert Commands -``` +```text Alert management Usage: redisctl enterprise alert @@ -19,5 +19,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/api.md b/docs/cli-reference/enterprise/api.md index 3bd8556b..bd7fdb4b 100644 --- a/docs/cli-reference/enterprise/api.md +++ b/docs/cli-reference/enterprise/api.md @@ -1,6 +1,6 @@ # Enterprise API Commands -``` +```text Raw API access Usage: redisctl enterprise api @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/bootstrap.md b/docs/cli-reference/enterprise/bootstrap.md index 7cb8dadc..a5e4b2cb 100644 --- a/docs/cli-reference/enterprise/bootstrap.md +++ b/docs/cli-reference/enterprise/bootstrap.md @@ -1,6 +1,6 @@ # Enterprise Bootstrap Commands -``` +```text Bootstrap operations Usage: redisctl enterprise bootstrap @@ -12,5 +12,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/cluster.md b/docs/cli-reference/enterprise/cluster.md index f9709716..79fcc48f 100644 --- a/docs/cli-reference/enterprise/cluster.md +++ b/docs/cli-reference/enterprise/cluster.md @@ -1,6 +1,6 @@ # Enterprise Cluster Commands -``` +```text Cluster management Usage: redisctl enterprise cluster @@ -14,5 +14,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/crdb.md b/docs/cli-reference/enterprise/crdb.md index e9e678e3..89f861ff 100644 --- a/docs/cli-reference/enterprise/crdb.md +++ b/docs/cli-reference/enterprise/crdb.md @@ -1,6 +1,6 @@ # Enterprise Active-Active Commands -``` +```text Active-Active database (CRDB) management Usage: redisctl enterprise crdb @@ -16,5 +16,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/database.md b/docs/cli-reference/enterprise/database.md index 0ff2432d..1178924a 100644 --- a/docs/cli-reference/enterprise/database.md +++ b/docs/cli-reference/enterprise/database.md @@ -1,6 +1,6 @@ # Enterprise Database Commands -``` +```text Database management Usage: redisctl enterprise database @@ -18,5 +18,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/license.md b/docs/cli-reference/enterprise/license.md index 36832639..5b3c098b 100644 --- a/docs/cli-reference/enterprise/license.md +++ b/docs/cli-reference/enterprise/license.md @@ -1,6 +1,6 @@ # Enterprise License Commands -``` +```text License management Usage: redisctl enterprise license @@ -12,5 +12,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/logs.md b/docs/cli-reference/enterprise/logs.md index 5877549b..ea16bc94 100644 --- a/docs/cli-reference/enterprise/logs.md +++ b/docs/cli-reference/enterprise/logs.md @@ -1,6 +1,6 @@ # Enterprise Logs Commands -``` +```text Log management Usage: redisctl enterprise logs @@ -12,5 +12,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/module.md b/docs/cli-reference/enterprise/module.md index 273020c7..ded56d60 100644 --- a/docs/cli-reference/enterprise/module.md +++ b/docs/cli-reference/enterprise/module.md @@ -1,6 +1,6 @@ # Enterprise Module Commands -``` +```text Module management Usage: redisctl enterprise module @@ -13,5 +13,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/node.md b/docs/cli-reference/enterprise/node.md index 92baf47a..2fd6f05c 100644 --- a/docs/cli-reference/enterprise/node.md +++ b/docs/cli-reference/enterprise/node.md @@ -1,6 +1,6 @@ # Enterprise Node Commands -``` +```text Node management Usage: redisctl enterprise node @@ -16,5 +16,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/role.md b/docs/cli-reference/enterprise/role.md index c349ea0a..5ee0c6df 100644 --- a/docs/cli-reference/enterprise/role.md +++ b/docs/cli-reference/enterprise/role.md @@ -1,6 +1,6 @@ # Enterprise Role Commands -``` +```text Role management Usage: redisctl enterprise role @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/stats.md b/docs/cli-reference/enterprise/stats.md index cfdd1ebf..8c981e2c 100644 --- a/docs/cli-reference/enterprise/stats.md +++ b/docs/cli-reference/enterprise/stats.md @@ -1,6 +1,6 @@ # Enterprise Stats Commands -``` +```text Statistics and metrics Usage: redisctl enterprise stats @@ -14,5 +14,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/enterprise/user.md b/docs/cli-reference/enterprise/user.md index 3efbc2fb..b31dbfd9 100644 --- a/docs/cli-reference/enterprise/user.md +++ b/docs/cli-reference/enterprise/user.md @@ -1,6 +1,6 @@ # Enterprise User Commands -``` +```text User management Usage: redisctl enterprise user @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/index.md b/docs/cli-reference/index.md index 306edfdf..0b37f6fe 100644 --- a/docs/cli-reference/index.md +++ b/docs/cli-reference/index.md @@ -47,6 +47,17 @@ Commands for managing configuration profiles: - [Remove Profile](profile/remove.md) - [Set Default](profile/default.md) +### [Authentication Management](auth/README.md) +Commands for testing and setting up authentication: +- [Test Authentication](auth/test.md) +- [Interactive Setup](auth/setup.md) + +### [Configuration Management](config/README.md) +Commands for inspecting and validating configuration: +- [Show Configuration](config/show.md) +- [Configuration Path](config/path.md) +- [Validate Configuration](config/validate.md) + ### [Smart-Routed Commands](smart/) Commands that automatically detect deployment type: - [Database Operations](smart/database.md) @@ -84,7 +95,7 @@ Use JMESPath queries with the `-q/--query` flag to filter output: ```bash redisctl database list -q "[?status=='active'].name" redisctl user list -q "[].{email:email,role:role}" -``` +```text ## Examples diff --git a/docs/cli-reference/profile/README.md b/docs/cli-reference/profile/README.md index 59de7bed..b826b974 100644 --- a/docs/cli-reference/profile/README.md +++ b/docs/cli-reference/profile/README.md @@ -1,6 +1,6 @@ # Profile Management Commands -``` +```text Profile management Usage: redisctl profile @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/profile/default.md b/docs/cli-reference/profile/default.md index e7741d49..28fc5030 100644 --- a/docs/cli-reference/profile/default.md +++ b/docs/cli-reference/profile/default.md @@ -1,6 +1,6 @@ # Profile Default Command -``` +```text Set default profile Usage: redisctl profile default @@ -10,5 +10,4 @@ Arguments: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/profile/get.md b/docs/cli-reference/profile/get.md index 428768ba..b7ba0667 100644 --- a/docs/cli-reference/profile/get.md +++ b/docs/cli-reference/profile/get.md @@ -1,5 +1,4 @@ # Profile Get Command -``` -``` - +```text +```text diff --git a/docs/cli-reference/profile/list.md b/docs/cli-reference/profile/list.md index dfc106e7..7566be2f 100644 --- a/docs/cli-reference/profile/list.md +++ b/docs/cli-reference/profile/list.md @@ -1,11 +1,10 @@ # Profile List Command -``` +```text List all profiles Usage: redisctl profile list Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/profile/remove.md b/docs/cli-reference/profile/remove.md index 36ba899e..ec8706ef 100644 --- a/docs/cli-reference/profile/remove.md +++ b/docs/cli-reference/profile/remove.md @@ -1,6 +1,6 @@ # Profile Remove Command -``` +```text Remove a profile Usage: redisctl profile remove @@ -10,5 +10,4 @@ Arguments: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/profile/set.md b/docs/cli-reference/profile/set.md index 28d75748..41c3e8fe 100644 --- a/docs/cli-reference/profile/set.md +++ b/docs/cli-reference/profile/set.md @@ -1,6 +1,6 @@ # Profile Set Command -``` +```text Create or update a profile Usage: redisctl profile set [OPTIONS] @@ -17,5 +17,4 @@ Options: --api-secret API Secret (Cloud only) --insecure Allow insecure TLS (Enterprise only) -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/smart/account.md b/docs/cli-reference/smart/account.md index 95a37456..0ea39d33 100644 --- a/docs/cli-reference/smart/account.md +++ b/docs/cli-reference/smart/account.md @@ -1,6 +1,6 @@ # Account Commands (Smart Routing) -``` +```text Account operations (smart routing to Cloud subscriptions) Usage: redisctl account @@ -16,5 +16,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/smart/cluster.md b/docs/cli-reference/smart/cluster.md index 5533ee68..55626637 100644 --- a/docs/cli-reference/smart/cluster.md +++ b/docs/cli-reference/smart/cluster.md @@ -1,6 +1,6 @@ # Cluster Commands (Smart Routing) -``` +```text Cluster operations (smart routing) Usage: redisctl cluster @@ -14,5 +14,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/smart/database.md b/docs/cli-reference/smart/database.md index 497c8b8e..9e43550c 100644 --- a/docs/cli-reference/smart/database.md +++ b/docs/cli-reference/smart/database.md @@ -1,6 +1,6 @@ # Database Commands (Smart Routing) -``` +```text Database operations (smart routing) Usage: redisctl database @@ -18,5 +18,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/cli-reference/smart/user.md b/docs/cli-reference/smart/user.md index 28312830..5d255928 100644 --- a/docs/cli-reference/smart/user.md +++ b/docs/cli-reference/smart/user.md @@ -1,6 +1,6 @@ # User Commands (Smart Routing) -``` +```text User operations (smart routing) Usage: redisctl user @@ -15,5 +15,4 @@ Commands: Options: -h, --help Print help -``` - +```text diff --git a/docs/docs/cli-reference/README.md b/docs/docs/cli-reference/README.md new file mode 100644 index 00000000..2208589c --- /dev/null +++ b/docs/docs/cli-reference/README.md @@ -0,0 +1,29 @@ +# redisctl Command Reference + +```text +Unified Redis CLI for Cloud and Enterprise + +Usage: redisctl [OPTIONS] + +Commands: + cloud Redis Cloud commands + enterprise Redis Enterprise commands + profile Profile management + database Database operations (smart routing) + cluster Cluster operations (smart routing) + user User operations (smart routing) + account Account operations (smart routing to Cloud subscriptions) + auth Authentication testing and management + config Configuration management + help Print this message or the help of the given subcommand(s) + +Options: + -o, --output Output format [default: json] [possible values: json, yaml, table] + -q, --query JMESPath query to filter output + -p, --profile Profile name to use (overrides REDISCTL_PROFILE env var) + -d, --deployment Deployment type (auto-detected from profile if not specified) [possible values: cloud, enterprise] + -v, --verbose... Verbose logging + -h, --help Print help + -V, --version Print version +``` + diff --git a/docs/docs/cli-reference/auth/README.md b/docs/docs/cli-reference/auth/README.md new file mode 100644 index 00000000..b859a532 --- /dev/null +++ b/docs/docs/cli-reference/auth/README.md @@ -0,0 +1,16 @@ +# Authentication Management Commands + +```text +Authentication testing and management + +Usage: redisctl auth + +Commands: + test Test authentication credentials + setup Interactive setup wizard for new profiles + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/auth/setup.md b/docs/docs/cli-reference/auth/setup.md new file mode 100644 index 00000000..98fbe326 --- /dev/null +++ b/docs/docs/cli-reference/auth/setup.md @@ -0,0 +1,11 @@ +# Auth Setup Command + +```text +Interactive setup wizard for new profiles + +Usage: redisctl auth setup + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/auth/test.md b/docs/docs/cli-reference/auth/test.md new file mode 100644 index 00000000..e976824f --- /dev/null +++ b/docs/docs/cli-reference/auth/test.md @@ -0,0 +1,13 @@ +# Auth Test Command + +```text +Test authentication credentials + +Usage: redisctl auth test [OPTIONS] + +Options: + --profile Profile to test (defaults to current profile) + --deployment Test a specific deployment type [possible values: cloud, enterprise] + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/README.md b/docs/docs/cli-reference/cloud/README.md new file mode 100644 index 00000000..8944a775 --- /dev/null +++ b/docs/docs/cli-reference/cloud/README.md @@ -0,0 +1,35 @@ +# Redis Cloud Commands + +```text +Redis Cloud commands + +Usage: redisctl cloud + +Commands: + api Raw API access + subscription Subscription management + database Database management + account Account management + user User management + region Region information + task Task monitoring + acl ACL management + peering VPC Peering management + transit-gateway Transit Gateway management + backup Backup management + crdb Active-Active database management + api-key API Keys management + metrics Metrics and monitoring + logs Logs and audit trails + cloud-account Cloud account management + fixed-plan Fixed plan management + flexible-plan Flexible plan management + private-service-connect Private Service Connect + sso SSO/SAML management + billing Billing and payment management + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/account.md b/docs/docs/cli-reference/cloud/account.md new file mode 100644 index 00000000..27501903 --- /dev/null +++ b/docs/docs/cli-reference/cloud/account.md @@ -0,0 +1,20 @@ +# Cloud Account Commands + +```text +Account management + +Usage: redisctl cloud account + +Commands: + list List accounts/subscriptions + show Show account/subscription details + info Show account information (different from show) + owner Show account owner information + users List users for this account + payment-methods List payment methods + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/acl.md b/docs/docs/cli-reference/cloud/acl.md new file mode 100644 index 00000000..ef3e1884 --- /dev/null +++ b/docs/docs/cli-reference/cloud/acl.md @@ -0,0 +1,19 @@ +# Cloud ACL Commands + +```text +ACL management + +Usage: redisctl cloud acl + +Commands: + list List ACL rules + show Show ACL rule details + create Create ACL rule + update Update ACL rule + delete Delete ACL rule + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/api-key.md b/docs/docs/cli-reference/cloud/api-key.md new file mode 100644 index 00000000..2aa2fead --- /dev/null +++ b/docs/docs/cli-reference/cloud/api-key.md @@ -0,0 +1,22 @@ +# Cloud API Key Commands + +```text +API Keys management + +Usage: redisctl cloud api-key + +Commands: + list List API keys + show Show API key details + create Create API key + update Update API key + delete Delete API key + regenerate Regenerate API key + enable Enable API key + disable Disable API key + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/api.md b/docs/docs/cli-reference/cloud/api.md new file mode 100644 index 00000000..5cd92391 --- /dev/null +++ b/docs/docs/cli-reference/cloud/api.md @@ -0,0 +1,19 @@ +# Cloud API Commands + +```text +Raw API access + +Usage: redisctl cloud api + +Commands: + GET Execute GET request + POST Execute POST request + PUT Execute PUT request + PATCH Execute PATCH request + DELETE Execute DELETE request + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/backup.md b/docs/docs/cli-reference/cloud/backup.md new file mode 100644 index 00000000..93c8a0e7 --- /dev/null +++ b/docs/docs/cli-reference/cloud/backup.md @@ -0,0 +1,19 @@ +# Cloud Backup Commands + +```text +Backup management + +Usage: redisctl cloud backup + +Commands: + list List backups + show Show backup details + create Create backup + restore Restore from backup + delete Delete backup + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/billing.md b/docs/docs/cli-reference/cloud/billing.md new file mode 100644 index 00000000..fe949f72 --- /dev/null +++ b/docs/docs/cli-reference/cloud/billing.md @@ -0,0 +1,32 @@ +# Cloud Billing Commands + +```text +Billing and payment management + +Usage: redisctl cloud billing + +Commands: + info Get billing information + invoice-list List invoices + invoice-get Get invoice details + invoice-download Download invoice PDF + invoice-current Get current month invoice + payment-method-list List payment methods + payment-method-get Get payment method details + payment-method-add Add payment method + payment-method-update Update payment method + payment-method-delete Delete payment method + payment-method-default Set default payment method + cost-breakdown Get cost breakdown + usage Get usage report + history Get billing history + credits Get available credits + promo-apply Apply promo code + alert-list Get billing alerts + alert-update Update billing alerts + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/cloud-account.md b/docs/docs/cli-reference/cloud/cloud-account.md new file mode 100644 index 00000000..1a6d3b02 --- /dev/null +++ b/docs/docs/cli-reference/cloud/cloud-account.md @@ -0,0 +1,19 @@ +# Cloud Provider Account Commands + +```text +Cloud account management + +Usage: redisctl cloud cloud-account + +Commands: + list List cloud accounts + show Show cloud account details + create Create cloud account + update Update cloud account + delete Delete cloud account + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/crdb.md b/docs/docs/cli-reference/cloud/crdb.md new file mode 100644 index 00000000..b6a03fa1 --- /dev/null +++ b/docs/docs/cli-reference/cloud/crdb.md @@ -0,0 +1,21 @@ +# Cloud Active-Active Commands + +```text +Active-Active database management + +Usage: redisctl cloud crdb + +Commands: + list List Active-Active databases + show Show Active-Active database details + create Create Active-Active database + update Update Active-Active database + delete Delete Active-Active database + add-region Add region to Active-Active database + remove-region Remove region from Active-Active database + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/database.md b/docs/docs/cli-reference/cloud/database.md new file mode 100644 index 00000000..8da8b02e --- /dev/null +++ b/docs/docs/cli-reference/cloud/database.md @@ -0,0 +1,22 @@ +# Cloud Database Commands + +```text +Database management + +Usage: redisctl cloud database + +Commands: + list List databases + show Show database details + create Create database + update Update database + delete Delete database + backup Backup database + import Import data + export Export data + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/logs.md b/docs/docs/cli-reference/cloud/logs.md new file mode 100644 index 00000000..6135757a --- /dev/null +++ b/docs/docs/cli-reference/cloud/logs.md @@ -0,0 +1,17 @@ +# Cloud Logs Commands + +```text +Logs and audit trails + +Usage: redisctl cloud logs + +Commands: + database Get database logs + system Get system logs + session Get session logs + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/metrics.md b/docs/docs/cli-reference/cloud/metrics.md new file mode 100644 index 00000000..43f0668d --- /dev/null +++ b/docs/docs/cli-reference/cloud/metrics.md @@ -0,0 +1,16 @@ +# Cloud Metrics Commands + +```text +Metrics and monitoring + +Usage: redisctl cloud metrics + +Commands: + database Get database metrics + subscription Get subscription metrics + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/peering.md b/docs/docs/cli-reference/cloud/peering.md new file mode 100644 index 00000000..45be7fc1 --- /dev/null +++ b/docs/docs/cli-reference/cloud/peering.md @@ -0,0 +1,18 @@ +# Cloud VPC Peering Commands + +```text +VPC Peering management + +Usage: redisctl cloud peering + +Commands: + list List VPC peerings + show Show peering details + create Create VPC peering + delete Delete VPC peering + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/region.md b/docs/docs/cli-reference/cloud/region.md new file mode 100644 index 00000000..95da1be7 --- /dev/null +++ b/docs/docs/cli-reference/cloud/region.md @@ -0,0 +1,15 @@ +# Cloud Region Commands + +```text +Region information + +Usage: redisctl cloud region + +Commands: + list List available regions + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/sso.md b/docs/docs/cli-reference/cloud/sso.md new file mode 100644 index 00000000..63954555 --- /dev/null +++ b/docs/docs/cli-reference/cloud/sso.md @@ -0,0 +1,31 @@ +# Cloud SSO/SAML Commands + +```text +SSO/SAML management + +Usage: redisctl cloud sso + +Commands: + show Show SSO configuration + update Update SSO configuration + delete Delete SSO configuration + test Test SSO configuration + saml-show Show SAML configuration + saml-update Update SAML configuration + saml-metadata Get SAML metadata + saml-upload-cert Upload SAML certificate + user-list List SSO users + user-show Show SSO user details + user-create Create SSO user mapping + user-update Update SSO user mapping + user-delete Delete SSO user mapping + group-list List SSO groups + group-create Create SSO group mapping + group-update Update SSO group mapping + group-delete Delete SSO group mapping + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/subscription.md b/docs/docs/cli-reference/cloud/subscription.md new file mode 100644 index 00000000..0fb1f680 --- /dev/null +++ b/docs/docs/cli-reference/cloud/subscription.md @@ -0,0 +1,23 @@ +# Cloud Subscription Commands + +```text +Subscription management + +Usage: redisctl cloud subscription + +Commands: + list List subscriptions + show Show subscription details + create Create subscription + update Update subscription + delete Delete subscription + pricing Get subscription pricing + databases List subscription databases + cidr-list Get CIDR whitelist + cidr-update Update CIDR whitelist + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/task.md b/docs/docs/cli-reference/cloud/task.md new file mode 100644 index 00000000..f7603433 --- /dev/null +++ b/docs/docs/cli-reference/cloud/task.md @@ -0,0 +1,17 @@ +# Cloud Task Commands + +```text +Task monitoring + +Usage: redisctl cloud task + +Commands: + list List tasks + show Show task details + wait Wait for task completion + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/transit-gateway.md b/docs/docs/cli-reference/cloud/transit-gateway.md new file mode 100644 index 00000000..b62875d3 --- /dev/null +++ b/docs/docs/cli-reference/cloud/transit-gateway.md @@ -0,0 +1,18 @@ +# Cloud Transit Gateway Commands + +```text +Transit Gateway management + +Usage: redisctl cloud transit-gateway + +Commands: + list List Transit Gateway attachments + show Show Transit Gateway attachment details + create Create Transit Gateway attachment + delete Delete Transit Gateway attachment + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/cloud/user.md b/docs/docs/cli-reference/cloud/user.md new file mode 100644 index 00000000..0945b029 --- /dev/null +++ b/docs/docs/cli-reference/cloud/user.md @@ -0,0 +1,19 @@ +# Cloud User Commands + +```text +User management + +Usage: redisctl cloud user + +Commands: + list List users + show Show user details + create Create user + update Update user + delete Delete user + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/config/README.md b/docs/docs/cli-reference/config/README.md new file mode 100644 index 00000000..cde0c490 --- /dev/null +++ b/docs/docs/cli-reference/config/README.md @@ -0,0 +1,17 @@ +# Configuration Management Commands + +```text +Configuration management + +Usage: redisctl config + +Commands: + show Show current configuration and active profile + path Show configuration file path + validate Validate configuration + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/config/path.md b/docs/docs/cli-reference/config/path.md new file mode 100644 index 00000000..685e38a9 --- /dev/null +++ b/docs/docs/cli-reference/config/path.md @@ -0,0 +1,11 @@ +# Config Path Command + +```text +Show configuration file path + +Usage: redisctl config path + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/config/show.md b/docs/docs/cli-reference/config/show.md new file mode 100644 index 00000000..bd0a8640 --- /dev/null +++ b/docs/docs/cli-reference/config/show.md @@ -0,0 +1,12 @@ +# Config Show Command + +```text +Show current configuration and active profile + +Usage: redisctl config show [OPTIONS] + +Options: + --show-secrets Show sensitive values (passwords, API keys) + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/config/validate.md b/docs/docs/cli-reference/config/validate.md new file mode 100644 index 00000000..ec72bcef --- /dev/null +++ b/docs/docs/cli-reference/config/validate.md @@ -0,0 +1,12 @@ +# Config Validate Command + +```text +Validate configuration + +Usage: redisctl config validate [OPTIONS] + +Options: + --profile Profile to validate (defaults to all profiles) + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/README.md b/docs/docs/cli-reference/enterprise/README.md new file mode 100644 index 00000000..91a380a5 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/README.md @@ -0,0 +1,28 @@ +# Redis Enterprise Commands + +```text +Redis Enterprise commands + +Usage: redisctl enterprise + +Commands: + api Raw API access + cluster Cluster management + database Database management + node Node management + user User management + bootstrap Bootstrap operations + module Module management + role Role management + license License management + alert Alert management + crdb Active-Active database (CRDB) management + actions Action/task management + stats Statistics and metrics + logs Log management + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/actions.md b/docs/docs/cli-reference/enterprise/actions.md new file mode 100644 index 00000000..cee32c9f --- /dev/null +++ b/docs/docs/cli-reference/enterprise/actions.md @@ -0,0 +1,17 @@ +# Enterprise Actions Commands + +```text +Action/task management + +Usage: redisctl enterprise actions + +Commands: + list List all actions/tasks + show Show action details + cancel Cancel a running action + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/alert.md b/docs/docs/cli-reference/enterprise/alert.md new file mode 100644 index 00000000..208a17e2 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/alert.md @@ -0,0 +1,23 @@ +# Enterprise Alert Commands + +```text +Alert management + +Usage: redisctl enterprise alert + +Commands: + list List all alerts + show Show alert details + database List alerts for a database + node List alerts for a node + cluster List cluster alerts + clear Clear/acknowledge an alert + clear-all Clear all alerts + settings Get alert settings + update-settings Update alert settings + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/api.md b/docs/docs/cli-reference/enterprise/api.md new file mode 100644 index 00000000..3d52ff95 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/api.md @@ -0,0 +1,19 @@ +# Enterprise API Commands + +```text +Raw API access + +Usage: redisctl enterprise api + +Commands: + GET Execute GET request + POST Execute POST request + PUT Execute PUT request + PATCH Execute PATCH request + DELETE Execute DELETE request + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/bootstrap.md b/docs/docs/cli-reference/enterprise/bootstrap.md new file mode 100644 index 00000000..06e504d2 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/bootstrap.md @@ -0,0 +1,16 @@ +# Enterprise Bootstrap Commands + +```text +Bootstrap operations + +Usage: redisctl enterprise bootstrap + +Commands: + create Create initial cluster setup + status Get bootstrap status + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/cluster.md b/docs/docs/cli-reference/enterprise/cluster.md new file mode 100644 index 00000000..51147fe5 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/cluster.md @@ -0,0 +1,18 @@ +# Enterprise Cluster Commands + +```text +Cluster management + +Usage: redisctl enterprise cluster + +Commands: + info Show cluster information + nodes List cluster nodes + settings Show cluster settings + update Update cluster settings + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/crdb.md b/docs/docs/cli-reference/enterprise/crdb.md new file mode 100644 index 00000000..09717adb --- /dev/null +++ b/docs/docs/cli-reference/enterprise/crdb.md @@ -0,0 +1,20 @@ +# Enterprise Active-Active Commands + +```text +Active-Active database (CRDB) management + +Usage: redisctl enterprise crdb + +Commands: + list List all Active-Active databases + show Show CRDB details + create Create new Active-Active database + update Update CRDB configuration + delete Delete Active-Active database + tasks Get CRDB tasks + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/database.md b/docs/docs/cli-reference/enterprise/database.md new file mode 100644 index 00000000..a716da9f --- /dev/null +++ b/docs/docs/cli-reference/enterprise/database.md @@ -0,0 +1,22 @@ +# Enterprise Database Commands + +```text +Database management + +Usage: redisctl enterprise database + +Commands: + list List databases + show Show database details + create Create database + update Update database + delete Delete database + backup Backup database + import Import data + export Export data + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/license.md b/docs/docs/cli-reference/enterprise/license.md new file mode 100644 index 00000000..cdc1d9d9 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/license.md @@ -0,0 +1,16 @@ +# Enterprise License Commands + +```text +License management + +Usage: redisctl enterprise license + +Commands: + info Show license information + update Update license + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/logs.md b/docs/docs/cli-reference/enterprise/logs.md new file mode 100644 index 00000000..240e58fd --- /dev/null +++ b/docs/docs/cli-reference/enterprise/logs.md @@ -0,0 +1,16 @@ +# Enterprise Logs Commands + +```text +Log management + +Usage: redisctl enterprise logs + +Commands: + list List log entries + show Show specific log entry + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/module.md b/docs/docs/cli-reference/enterprise/module.md new file mode 100644 index 00000000..c49f190d --- /dev/null +++ b/docs/docs/cli-reference/enterprise/module.md @@ -0,0 +1,17 @@ +# Enterprise Module Commands + +```text +Module management + +Usage: redisctl enterprise module + +Commands: + list List modules + show Show module details + upload Upload module + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/node.md b/docs/docs/cli-reference/enterprise/node.md new file mode 100644 index 00000000..9f18b5a5 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/node.md @@ -0,0 +1,20 @@ +# Enterprise Node Commands + +```text +Node management + +Usage: redisctl enterprise node + +Commands: + list List nodes + show Show node details + stats Show node statistics + update Update node + add Add a new node to the cluster + remove Remove a node from the cluster + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/role.md b/docs/docs/cli-reference/enterprise/role.md new file mode 100644 index 00000000..aef1ab7e --- /dev/null +++ b/docs/docs/cli-reference/enterprise/role.md @@ -0,0 +1,19 @@ +# Enterprise Role Commands + +```text +Role management + +Usage: redisctl enterprise role + +Commands: + list List roles + show Show role details + create Create role + update Update role + delete Delete role + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/stats.md b/docs/docs/cli-reference/enterprise/stats.md new file mode 100644 index 00000000..a8e9dec4 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/stats.md @@ -0,0 +1,18 @@ +# Enterprise Stats Commands + +```text +Statistics and metrics + +Usage: redisctl enterprise stats + +Commands: + cluster Get cluster statistics + node Get node statistics + database Get database statistics + shard Get shard statistics + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/enterprise/user.md b/docs/docs/cli-reference/enterprise/user.md new file mode 100644 index 00000000..26e0a681 --- /dev/null +++ b/docs/docs/cli-reference/enterprise/user.md @@ -0,0 +1,19 @@ +# Enterprise User Commands + +```text +User management + +Usage: redisctl enterprise user + +Commands: + list List users + show Show user details + create Create user + update Update user + delete Delete user + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/index.md b/docs/docs/cli-reference/index.md new file mode 100644 index 00000000..3104bfa7 --- /dev/null +++ b/docs/docs/cli-reference/index.md @@ -0,0 +1,102 @@ +# redisctl CLI Reference + +Complete command reference for the Redis unified CLI tool. + +## Command Categories + +### [Main Commands](README.md) +The main redisctl commands and global options. + +### [Cloud Commands](cloud/README.md) +Commands for managing Redis Cloud deployments: +- [API Access](cloud/api.md) +- [Subscriptions](cloud/subscription.md) +- [Databases](cloud/database.md) +- [Users](cloud/user.md) +- [ACLs](cloud/acl.md) +- [Backups](cloud/backup.md) +- [VPC Peering](cloud/peering.md) +- [Transit Gateway](cloud/transit-gateway.md) +- [Metrics](cloud/metrics.md) +- [Logs](cloud/logs.md) +- [SSO/SAML](cloud/sso.md) +- [Billing](cloud/billing.md) +- [And more...](cloud/) + +### [Enterprise Commands](enterprise/README.md) +Commands for managing Redis Enterprise deployments: +- [API Access](enterprise/api.md) +- [Clusters](enterprise/cluster.md) +- [Databases](enterprise/database.md) +- [Nodes](enterprise/node.md) +- [Users](enterprise/user.md) +- [Bootstrap](enterprise/bootstrap.md) +- [Modules](enterprise/module.md) +- [Roles](enterprise/role.md) +- [License](enterprise/license.md) +- [Alerts](enterprise/alert.md) +- [Stats](enterprise/stats.md) +- [Logs](enterprise/logs.md) +- [And more...](enterprise/) + +### [Profile Management](profile/README.md) +Commands for managing configuration profiles: +- [List Profiles](profile/list.md) +- [Set Profile](profile/set.md) +- [Get Profile](profile/get.md) +- [Remove Profile](profile/remove.md) +- [Set Default](profile/default.md) + +### [Authentication Management](auth/README.md) +Commands for testing and setting up authentication: +- [Test Authentication](auth/test.md) +- [Interactive Setup](auth/setup.md) + +### [Configuration Management](config/README.md) +Commands for inspecting and validating configuration: +- [Show Configuration](config/show.md) +- [Configuration Path](config/path.md) +- [Validate Configuration](config/validate.md) + +### [Smart-Routed Commands](smart/) +Commands that automatically detect deployment type: +- [Database Operations](smart/database.md) +- [Cluster Operations](smart/cluster.md) +- [User Operations](smart/user.md) +- [Account Operations](smart/account.md) + +## Environment Variables + +### Redis Cloud +- `REDIS_CLOUD_API_KEY` - API key for authentication +- `REDIS_CLOUD_API_SECRET` - API secret for authentication +- `REDIS_CLOUD_API_URL` - Custom API URL (optional) + +### Redis Enterprise +- `REDIS_ENTERPRISE_URL` - Cluster API URL +- `REDIS_ENTERPRISE_USER` - Username for authentication +- `REDIS_ENTERPRISE_PASSWORD` - Password for authentication +- `REDIS_ENTERPRISE_INSECURE` - Allow insecure TLS (true/false) + +### General +- `REDISCTL_PROFILE` - Default profile to use +- `RUST_LOG` - Logging level (error, warn, info, debug, trace) + +## Output Formats + +All commands support multiple output formats via the `-o/--output` flag: +- `json` - JSON format (default) +- `yaml` - YAML format +- `table` - Human-readable table format + +## Query Filtering + +Use JMESPath queries with the `-q/--query` flag to filter output: +```bash +redisctl database list -q "[?status=='active'].name" +redisctl user list -q "[].{email:email,role:role}" +``` + +## Examples + +See the [examples directory](../../examples/) for common usage patterns. diff --git a/docs/docs/cli-reference/profile/README.md b/docs/docs/cli-reference/profile/README.md new file mode 100644 index 00000000..1d816bdf --- /dev/null +++ b/docs/docs/cli-reference/profile/README.md @@ -0,0 +1,19 @@ +# Profile Management Commands + +```text +Profile management + +Usage: redisctl profile + +Commands: + list List all profiles + show Show profile details + set Create or update a profile + remove Remove a profile + default Set default profile + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/profile/default.md b/docs/docs/cli-reference/profile/default.md new file mode 100644 index 00000000..cbf054ba --- /dev/null +++ b/docs/docs/cli-reference/profile/default.md @@ -0,0 +1,14 @@ +# Profile Default Command + +```text +Set default profile + +Usage: redisctl profile default + +Arguments: + Profile name + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/profile/get.md b/docs/docs/cli-reference/profile/get.md new file mode 100644 index 00000000..29e8bbc6 --- /dev/null +++ b/docs/docs/cli-reference/profile/get.md @@ -0,0 +1,5 @@ +# Profile Get Command + +```text +``` + diff --git a/docs/docs/cli-reference/profile/list.md b/docs/docs/cli-reference/profile/list.md new file mode 100644 index 00000000..213bfc84 --- /dev/null +++ b/docs/docs/cli-reference/profile/list.md @@ -0,0 +1,11 @@ +# Profile List Command + +```text +List all profiles + +Usage: redisctl profile list + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/profile/remove.md b/docs/docs/cli-reference/profile/remove.md new file mode 100644 index 00000000..b2a999b1 --- /dev/null +++ b/docs/docs/cli-reference/profile/remove.md @@ -0,0 +1,14 @@ +# Profile Remove Command + +```text +Remove a profile + +Usage: redisctl profile remove + +Arguments: + Profile name + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/profile/set.md b/docs/docs/cli-reference/profile/set.md new file mode 100644 index 00000000..c314f5fb --- /dev/null +++ b/docs/docs/cli-reference/profile/set.md @@ -0,0 +1,21 @@ +# Profile Set Command + +```text +Create or update a profile + +Usage: redisctl profile set [OPTIONS] + +Arguments: + Profile name + Deployment type [possible values: cloud, enterprise] + +Options: + --url Connection URL (Enterprise) or API URL (Cloud) + --username Username (Enterprise only) + --password Password (Enterprise only) + --api-key API Key (Cloud only) + --api-secret API Secret (Cloud only) + --insecure Allow insecure TLS (Enterprise only) + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/smart/account.md b/docs/docs/cli-reference/smart/account.md new file mode 100644 index 00000000..b5c109aa --- /dev/null +++ b/docs/docs/cli-reference/smart/account.md @@ -0,0 +1,20 @@ +# Account Commands (Smart Routing) + +```text +Account operations (smart routing to Cloud subscriptions) + +Usage: redisctl account + +Commands: + list List accounts/subscriptions + show Show account/subscription details + info Show account information (different from show) + owner Show account owner information + users List users for this account + payment-methods List payment methods + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/smart/cluster.md b/docs/docs/cli-reference/smart/cluster.md new file mode 100644 index 00000000..155fa18d --- /dev/null +++ b/docs/docs/cli-reference/smart/cluster.md @@ -0,0 +1,18 @@ +# Cluster Commands (Smart Routing) + +```text +Cluster operations (smart routing) + +Usage: redisctl cluster + +Commands: + info Show cluster information + nodes List cluster nodes + settings Show cluster settings + update Update cluster settings + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/smart/database.md b/docs/docs/cli-reference/smart/database.md new file mode 100644 index 00000000..d98c523e --- /dev/null +++ b/docs/docs/cli-reference/smart/database.md @@ -0,0 +1,22 @@ +# Database Commands (Smart Routing) + +```text +Database operations (smart routing) + +Usage: redisctl database + +Commands: + list List databases + show Show database details + create Create database + update Update database + delete Delete database + backup Backup database + import Import data + export Export data + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/docs/cli-reference/smart/user.md b/docs/docs/cli-reference/smart/user.md new file mode 100644 index 00000000..54066c1f --- /dev/null +++ b/docs/docs/cli-reference/smart/user.md @@ -0,0 +1,19 @@ +# User Commands (Smart Routing) + +```text +User operations (smart routing) + +Usage: redisctl user + +Commands: + list List users + show Show user details + create Create user + update Update user + delete Delete user + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help +``` + diff --git a/docs/src/introduction.md b/docs/src/introduction.md index 2a65135f..83346875 100644 --- a/docs/src/introduction.md +++ b/docs/src/introduction.md @@ -9,7 +9,9 @@ Feature-complete command-line interface and Rust library for managing Redis Ente ## Primary Components ### 1. Command-Line Interface (CLI) + The primary way to interact with Redis Enterprise clusters, featuring: + - **All Operations Exposed**: Every API endpoint accessible via intuitive commands - **Multiple Output Formats**: JSON, YAML, and Table output - **JMESPath Queries**: Powerful filtering and transformation of output @@ -25,7 +27,9 @@ redis-enterprise cluster info --query 'name' ``` ### 2. Rust Library + For programmatic access and building custom tools: + - **Type-Safe API**: Full Rust type system integration - **Builder Pattern**: Fluent API for complex configurations - **Async/Await**: Built on Tokio for high performance @@ -55,21 +59,25 @@ let databases = client.databases().list().await?; ## Quick Links ### Getting Started + - [Installation Guide](./getting-started/installation.md) - [Quick Start](./getting-started/quickstart.md) - [Docker Environment](./getting-started/docker.md) ### CLI Documentation (Primary Interface) + - [CLI Commands Reference](./cli/commands.md) - [Examples](./cli/examples.md) - [Configuration](./cli/configuration.md) - [Output Formats](./cli/output-formats.md) ### Workflows + - [Cluster Bootstrap](./workflows/cluster-bootstrap.md) - [Database Creation](./workflows/database-creation.md) ### API Documentation + - [API Client Reference](./api/endpoints-overview.md) - [REST API Reference](./rest-api/cluster.md) @@ -77,4 +85,4 @@ let databases = client.databases().list().await?; - **GitHub Issues**: [Report bugs or request features](https://github.com/joshrotenberg/redis-enterprise-rs/issues) - **Redis Documentation**: [Official Redis Enterprise docs](https://redis.io/docs/latest/operate/rs/) -- **API Reference**: [REST API documentation](https://redis.io/docs/latest/operate/rs/references/rest-api/) \ No newline at end of file +- **API Reference**: [REST API documentation](https://redis.io/docs/latest/operate/rs/references/rest-api/) diff --git a/scripts/generate-cli-docs.sh b/scripts/generate-cli-docs.sh index a8828d1b..6a0cec35 100755 --- a/scripts/generate-cli-docs.sh +++ b/scripts/generate-cli-docs.sh @@ -19,7 +19,7 @@ generate_command_doc() { echo "# $title" > "$output_file" echo "" >> "$output_file" - echo '```' >> "$output_file" + echo '```text' >> "$output_file" $BINARY $cmd --help 2>/dev/null >> "$output_file" || true echo '```' >> "$output_file" echo "" >> "$output_file" @@ -83,6 +83,21 @@ generate_command_doc "profile get" "$OUTPUT_DIR/profile/get.md" "Profile Get Com generate_command_doc "profile remove" "$OUTPUT_DIR/profile/remove.md" "Profile Remove Command" generate_command_doc "profile default" "$OUTPUT_DIR/profile/default.md" "Profile Default Command" +# Generate Auth commands documentation +echo "Generating Auth commands..." +mkdir -p "$OUTPUT_DIR/auth" +generate_command_doc "auth" "$OUTPUT_DIR/auth/README.md" "Authentication Management Commands" +generate_command_doc "auth test" "$OUTPUT_DIR/auth/test.md" "Auth Test Command" +generate_command_doc "auth setup" "$OUTPUT_DIR/auth/setup.md" "Auth Setup Command" + +# Generate Config commands documentation +echo "Generating Config commands..." +mkdir -p "$OUTPUT_DIR/config" +generate_command_doc "config" "$OUTPUT_DIR/config/README.md" "Configuration Management Commands" +generate_command_doc "config show" "$OUTPUT_DIR/config/show.md" "Config Show Command" +generate_command_doc "config path" "$OUTPUT_DIR/config/path.md" "Config Path Command" +generate_command_doc "config validate" "$OUTPUT_DIR/config/validate.md" "Config Validate Command" + # Generate Smart-routed commands documentation echo "Generating smart-routed commands..." mkdir -p "$OUTPUT_DIR/smart" @@ -145,6 +160,17 @@ Commands for managing configuration profiles: - [Remove Profile](profile/remove.md) - [Set Default](profile/default.md) +### [Authentication Management](auth/README.md) +Commands for testing and setting up authentication: +- [Test Authentication](auth/test.md) +- [Interactive Setup](auth/setup.md) + +### [Configuration Management](config/README.md) +Commands for inspecting and validating configuration: +- [Show Configuration](config/show.md) +- [Configuration Path](config/path.md) +- [Validate Configuration](config/validate.md) + ### [Smart-Routed Commands](smart/) Commands that automatically detect deployment type: - [Database Operations](smart/database.md)