diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml new file mode 100644 index 00000000..5af715b9 --- /dev/null +++ b/.github/workflows/mdbook.yml @@ -0,0 +1,75 @@ +name: Deploy mdBook to GitHub Pages + +on: + push: + branches: + - main + paths: + - 'docs/**' + - '.github/workflows/mdbook.yml' + pull_request: + paths: + - 'docs/**' + - '.github/workflows/mdbook.yml' + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup mdBook + uses: peaceiris/actions-mdbook@v2 + with: + mdbook-version: 'latest' + + - name: Cache mdbook-lint + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/mdbook-lint + key: mdbook-lint-${{ runner.os }} + + - name: Install mdbook-lint + run: | + command -v mdbook-lint || cargo install mdbook-lint + + - name: Lint book (informational only) + run: | + cd docs + mdbook-lint lint src || echo "Linting completed with warnings" + continue-on-error: true + + - name: Build book + run: | + cd docs + mdbook build + + - name: Upload artifact + if: github.event_name != 'pull_request' + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs/book + + deploy: + if: github.event_name != 'pull_request' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/docs/.mdbook-lint.toml b/docs/.mdbook-lint.toml new file mode 100644 index 00000000..8d25f20b --- /dev/null +++ b/docs/.mdbook-lint.toml @@ -0,0 +1,33 @@ +# mdbook-lint configuration for redisctl documentation +# https://github.com/joshrotenberg/mdbook-lint + +# Temporarily disable rules with known issues +disabled-rules = [ + "MDBOOK010", # Math block detection - false positives with $ in shell code blocks (issue #141) + "MDBOOK005", # Orphaned files - incorrectly checking outside src directory (issue #142) + "MDBOOK002", # Internal link validation - false positives with existing files +] + +# Don't fail the build on warnings or errors during initial setup +fail-on-warnings = false +fail-on-errors = false + +# Configure specific rules +[rules.MD013] +# Allow longer lines for code examples and CLI output +line_length = 120 + +[rules.MD024] +# Allow duplicate headings in different sections +enabled = true + +[rules.MD041] +# Require first line to be a heading +enabled = true + +# Future configuration options when issues are resolved: +# [rules.MDBOOK005] +# search-path = "src" # Only check within src directory +# +# [rules.MDBOOK010] +# skip-code-blocks = true # Skip math detection in code blocks \ No newline at end of file diff --git a/docs/CONFIGURATION_AUDIT.md b/docs/CONFIGURATION_AUDIT.md new file mode 100644 index 00000000..18ceb1dd --- /dev/null +++ b/docs/CONFIGURATION_AUDIT.md @@ -0,0 +1,286 @@ +# Configuration & Authentication Audit + +## Current State Analysis + +### Authentication Methods Priority Order + +1. **Command-line flags** (highest priority) + - `--profile ` - Use specific profile + - `--deployment ` - Force deployment type + +2. **Environment Variables** (second priority) + - `REDISCTL_PROFILE` - Default profile name + - Cloud-specific: + - `REDIS_CLOUD_API_KEY` - API key + - `REDIS_CLOUD_API_SECRET` - API secret + - `REDIS_CLOUD_API_URL` - Custom API URL (optional) + - Enterprise-specific: + - `REDIS_ENTERPRISE_URL` - Cluster URL + - `REDIS_ENTERPRISE_USER` - Username + - `REDIS_ENTERPRISE_PASSWORD` - Password + - `REDIS_ENTERPRISE_INSECURE` - Allow insecure TLS (true/false) + +3. **Profile Configuration** (third priority) + - Location varies by OS: + - Linux: `~/.config/redisctl/config.toml` + - macOS: `~/Library/Application Support/com.redis.redisctl/config.toml` + - Windows: `%APPDATA%\redis\redisctl\config.toml` + - TOML format with profiles section + +4. **Default Profile** (lowest priority) + - Set via `redisctl profile default ` + - Stored in config file + +### Current Pain Points + +1. **Discovery Issues** + - Users don't know where config file is stored + - No way to print config file location + - No command to show current active configuration + +2. **Setup Complexity** + - No guided setup for first-time users + - Manual profile creation requires knowing all fields + - No validation during setup + +3. **Error Messages** + - Generic "authentication failed" doesn't guide to solution + - No suggestion to run setup wizard + - Doesn't indicate which auth method was attempted + +4. **Security Concerns** + - Passwords stored in plain text in config + - No support for credential helpers or keychains + - Environment variables expose secrets in process list + +5. **Testing & Validation** + - No way to test credentials without running actual command + - No dry-run mode to show what would be executed + - Can't verify connection before saving profile + +## Proposed Improvements + +### 1. Interactive Setup Wizard + +```bash +# First-time setup +$ redisctl setup +Welcome to redisctl! Let's configure your Redis connection. + +? What type of Redis deployment? (Use arrow keys) +❯ Redis Cloud + Redis Enterprise + +? Enter your Redis Cloud API credentials: + API Key: ******** + API Secret: ******** + +? Test connection? (Y/n) Y +✓ Successfully connected to Redis Cloud! + +? Save as profile? (Y/n) Y +? Profile name: (production) +? Set as default profile? (Y/n) Y + +Configuration saved! You can now use: redisctl database list +``` + +### 2. Authentication Testing Command + +```bash +# Test current configuration +$ redisctl auth test +Testing authentication... +✓ Profile: production (default) +✓ Type: Redis Cloud +✓ API URL: https://api.redislabs.com/v1 +✓ Credentials: Valid +✓ Permissions: Read/Write +✓ Account: acme-corp (ID: 12345) + +# Test specific profile +$ redisctl auth test --profile staging +Testing authentication... +✗ Profile: staging +✗ Type: Redis Enterprise +✗ URL: https://cluster.example.com:9443 +✗ Error: Connection refused + + Suggestions: + - Check if the cluster URL is correct + - Verify the cluster is accessible from your network + - Try with --insecure flag if using self-signed certificates +``` + +### 3. Configuration Management Commands + +```bash +# Show configuration details +$ redisctl config show +Active Configuration: + Source: Environment Variables + Type: Redis Enterprise + URL: https://localhost:9443 + User: admin@redis.local + +Available Profiles: + - production (Cloud) [default] + - staging (Enterprise) + - local (Enterprise) + +# Show config file location +$ redisctl config path +/Users/alice/Library/Application Support/com.redis.redisctl/config.toml + +# Edit config file +$ redisctl config edit +# Opens in $EDITOR + +# Export configuration (without secrets) +$ redisctl config export +profiles: + production: + type: cloud + api_url: https://api.redislabs.com/v1 + # Credentials hidden - set via environment or prompt +``` + +### 4. Improved Error Messages + +```bash +$ redisctl database list +Error: Authentication failed for Redis Cloud + +The API returned: 401 Unauthorized +Current configuration source: Environment variables + +Possible solutions: +1. Check your API credentials: + - REDIS_CLOUD_API_KEY is set but may be incorrect + - REDIS_CLOUD_API_SECRET is set but may be incorrect + +2. Run setup wizard: + redisctl setup + +3. Test your credentials: + redisctl auth test + +4. Use a different profile: + redisctl database list --profile + +For more help: redisctl help auth +``` + +### 5. Secure Credential Storage + +```bash +# Use system keychain (macOS) +$ redisctl config set production --use-keychain +Password will be stored in macOS Keychain + +# Use credential helper +$ redisctl config set production --credential-helper "pass show redis/production" + +# Use 1Password CLI +$ redisctl config set production --credential-helper "op read op://Redis/production/password" + +# Prompt for password +$ redisctl config set production --prompt-password +Password will be requested when needed +``` + +### 6. Environment Detection + +```bash +# Auto-detect Redis Enterprise in Docker +$ redisctl detect +Detected Redis Enterprise at https://localhost:9443 +Would you like to configure a profile for this cluster? (Y/n) + +# Auto-detect from kubectl context +$ redisctl detect --k8s +Detected Redis Enterprise Operator in namespace 'redis' +Found cluster: prod-cluster-redis-enterprise +Would you like to configure a profile? (Y/n) +``` + +## Implementation Plan + +### Phase 1: Core Improvements (Priority: High) +1. Add `auth test` command for credential validation +2. Implement `config show` and `config path` commands +3. Improve error messages with actionable suggestions +4. Add `--dry-run` flag to show what would be executed + +### Phase 2: Setup Wizard (Priority: High) +1. Create interactive setup wizard using `dialoguer` or `inquire` +2. Add connection testing during setup +3. Support profile creation and editing +4. Add migration from existing .env files + +### Phase 3: Security Enhancements (Priority: Medium) +1. Integrate with system keychains (keyring-rs) +2. Support credential helpers +3. Add password prompting option +4. Implement secure token refresh for OAuth + +### Phase 4: Advanced Features (Priority: Low) +1. Auto-detection of local Redis instances +2. Kubernetes integration for operator detection +3. Import from existing redis-cli configurations +4. Export to other formats (env, docker-compose) + +## Benefits + +1. **Reduced Setup Time** + - From 10+ minutes reading docs to 1 minute wizard + - No need to find correct environment variable names + +2. **Fewer Support Issues** + - Clear error messages reduce confusion + - Built-in testing prevents misconfiguration + - Guided setup reduces errors + +3. **Better Security** + - Passwords not stored in plain text + - Integration with existing credential stores + - Reduced exposure in environment variables + +4. **Improved Developer Experience** + - Similar to `aws configure` or `gcloud init` + - Familiar patterns from other CLI tools + - Progressive disclosure of complexity + +## Success Metrics + +- Setup time for new users < 2 minutes +- Authentication error resolution < 1 minute +- 50% reduction in auth-related support issues +- 90% of users successfully connect on first attempt + +## Comparison with Curl + +### Current curl approach: +```bash +# Users need to: +# 1. Find API endpoint documentation +# 2. Figure out authentication headers +# 3. Construct complex curl commands +# 4. Parse JSON responses manually + +curl -X GET https://api.redislabs.com/v1/subscriptions \ + -H "x-api-key: $REDIS_CLOUD_API_KEY" \ + -H "x-api-secret-key: $REDIS_CLOUD_API_SECRET" \ + -H "Content-Type: application/json" | jq '.' +``` + +### With improved redisctl: +```bash +# One-time setup +redisctl setup + +# Then just: +redisctl cloud subscription list +``` + +The difference is dramatic - from error-prone manual API calls to simple, validated commands. \ No newline at end of file diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md new file mode 100644 index 00000000..92680fb5 --- /dev/null +++ b/docs/EXAMPLES.md @@ -0,0 +1,555 @@ +# redisctl Examples + +Comprehensive examples for common Redis Cloud and Enterprise operations. + +## Table of Contents + +- [Authentication & Configuration](#authentication--configuration) +- [Database Operations](#database-operations) +- [Cluster Management](#cluster-management) +- [User & ACL Management](#user--acl-management) +- [Backup & Recovery](#backup--recovery) +- [Monitoring & Metrics](#monitoring--metrics) +- [Networking & Security](#networking--security) +- [Advanced Workflows](#advanced-workflows) + +## Authentication & Configuration + +### Setting up profiles + +```bash +# Create a Redis Cloud profile +redisctl profile set cloud-prod \ + --deployment-type cloud \ + --api-key YOUR_API_KEY \ + --api-secret YOUR_API_SECRET + +# Create a Redis Enterprise profile +redisctl profile set enterprise-dev \ + --deployment-type enterprise \ + --url https://cluster.example.com:9443 \ + --username admin@example.com \ + --password SecurePassword123 + +# Set default profile +redisctl profile default cloud-prod + +# List all profiles +redisctl profile list +``` + +### Using environment variables + +```bash +# Redis Cloud +export REDIS_CLOUD_API_KEY="your-key" +export REDIS_CLOUD_API_SECRET="your-secret" + +# Redis Enterprise +export REDIS_ENTERPRISE_URL="https://cluster:9443" +export REDIS_ENTERPRISE_USER="admin@example.com" +export REDIS_ENTERPRISE_PASSWORD="password" +export REDIS_ENTERPRISE_INSECURE="true" # For self-signed certificates +``` + +## Database Operations + +### Creating databases + +```bash +# Create a Redis Cloud database +redisctl cloud database create \ + --subscription-id 12345 \ + --name "production-cache" \ + --memory-limit-gb 10 \ + --throughput-measurement-by operations-per-second \ + --throughput-measurement-value 10000 + +# Create a Redis Enterprise database +redisctl enterprise database create cache-db \ + --memory-limit 1024 \ + --modules search,json + +# Create database with specific configuration +redisctl enterprise database create session-store \ + --memory-limit 2048 \ + --replication \ + --persistence aof \ + --eviction-policy allkeys-lru +``` + +### Listing and filtering databases + +```bash +# List all databases +redisctl database list + +# List with table output +redisctl database list -o table + +# Filter active databases using JMESPath +redisctl database list -q "[?status=='active'].{name:name,memory:memory_size,port:port}" + +# Show specific database details +redisctl enterprise database show 1 -o yaml + +# Get database endpoints +redisctl cloud database list \ + --subscription-id 12345 \ + -q "[].{name:name,endpoint:public_endpoint}" +``` + +### Database updates + +```bash +# Update memory limit +redisctl enterprise database update 1 \ + --memory-limit 2048 + +# Enable replication +redisctl cloud database update \ + --subscription-id 12345 \ + --database-id 67890 \ + --replication true + +# Change eviction policy +redisctl enterprise database update cache-db \ + --eviction-policy volatile-lru +``` + +## Cluster Management + +### Initialize Enterprise cluster + +```bash +# Bootstrap new cluster +redisctl enterprise bootstrap create \ + --name "production-cluster" \ + --username admin@company.com \ + --password SecurePassword123 + +# Check bootstrap status +redisctl enterprise bootstrap status + +# Get cluster information +redisctl enterprise cluster info -o table + +# Update cluster settings +redisctl enterprise cluster update \ + --name "production-cluster-v2" +``` + +### Node management + +```bash +# List all nodes +redisctl enterprise node list -o table + +# Show node details +redisctl enterprise node show 1 + +# Join node to cluster +redisctl enterprise node join \ + --cluster-url https://master:9443 \ + --username admin \ + --password password + +# Remove node from cluster +redisctl enterprise node remove 3 +``` + +## User & ACL Management + +### User management + +```bash +# Create user (Cloud) +redisctl cloud user create \ + --email developer@company.com \ + --first-name John \ + --last-name Doe \ + --role db-member + +# Create user (Enterprise) +redisctl enterprise user create \ + --email ops@company.com \ + --password TempPass123 \ + --role db-viewer + +# List users with specific roles +redisctl user list -q "[?role=='admin'].email" + +# Update user role +redisctl enterprise user update ops@company.com \ + --role admin +``` + +### ACL management + +```bash +# Create ACL rule (Cloud) +redisctl cloud acl create \ + --subscription-id 12345 \ + --database-id 67890 \ + --name "read-only-acl" \ + --rule "+@read ~*" + +# Create Redis ACL (Enterprise) +redisctl enterprise redis-acl create \ + --name "app-acl" \ + --acl "+@all -@dangerous ~app:*" + +# List ACLs +redisctl cloud acl list \ + --subscription-id 12345 \ + --database-id 67890 \ + -o table + +# Associate ACL with user +redisctl cloud acl-user create \ + --subscription-id 12345 \ + --database-id 67890 \ + --username app-user \ + --password SecurePass123 \ + --acl-id acl-123 +``` + +## Backup & Recovery + +### Creating backups + +```bash +# Create Cloud backup +redisctl cloud backup create \ + --subscription-id 12345 \ + --database-id 67890 + +# Create Enterprise backup +redisctl enterprise database backup 1 + +# List backups +redisctl cloud backup list \ + --subscription-id 12345 \ + --database-id 67890 \ + -o table + +# Backup with custom location (Enterprise) +redisctl enterprise database export 1 \ + --export-location s3://bucket/backups/ +``` + +### Restoring from backup + +```bash +# Restore Cloud database +redisctl cloud backup restore \ + --subscription-id 12345 \ + --database-id 67890 \ + --backup-id backup-123 + +# Import data (Enterprise) +redisctl enterprise database import 1 \ + --source-url redis://source-cluster:6379 \ + --source-password SourcePass123 +``` + +## Monitoring & Metrics + +### Getting metrics + +```bash +# Cloud database metrics +redisctl cloud metrics database \ + --subscription-id 12345 \ + --database-id 67890 \ + --metric used-memory \ + --from "2024-01-01T00:00:00Z" \ + --to "2024-01-02T00:00:00Z" + +# Enterprise statistics +redisctl enterprise stats database 1 \ + --metric all \ + --interval 1hour + +# Cluster statistics +redisctl enterprise stats cluster \ + --metric cpu,memory,network +``` + +### Monitoring alerts + +```bash +# List alerts (Enterprise) +redisctl enterprise alert list -o table + +# Get alert details +redisctl enterprise alert show alert-123 + +# Clear alert +redisctl enterprise alert clear alert-123 + +# Set alert settings +redisctl enterprise alert settings \ + --database-id 1 \ + --threshold-memory 90 \ + --threshold-cpu 80 +``` + +### Viewing logs + +```bash +# Cloud system logs +redisctl cloud logs list \ + --limit 100 \ + -q "[?level=='error'].{time:timestamp,message:message}" + +# Enterprise event logs +redisctl enterprise logs list \ + --severity error \ + --limit 50 \ + -o table +``` + +## Networking & Security + +### VPC Peering (Cloud) + +```bash +# Create VPC peering +redisctl cloud peering create \ + --subscription-id 12345 \ + --aws-account-id 123456789012 \ + --region us-east-1 \ + --vpc-id vpc-12345 \ + --vpc-cidr 10.0.0.0/16 + +# List peerings +redisctl cloud peering list \ + --subscription-id 12345 \ + -o table + +# Accept peering +redisctl cloud peering accept \ + --subscription-id 12345 \ + --peering-id peer-123 +``` + +### Transit Gateway (Cloud) + +```bash +# Create Transit Gateway attachment +redisctl cloud transit-gateway create \ + --subscription-id 12345 \ + --aws-account-id 123456789012 \ + --tgw-id tgw-12345 \ + --cidrs "10.0.0.0/24,10.0.1.0/24" + +# List attachments +redisctl cloud transit-gateway list \ + --subscription-id 12345 \ + -q "[?status=='active'].id" +``` + +### Private Service Connect (Cloud) + +```bash +# Create Private Service Connect +redisctl cloud private-service-connect create \ + --subscription-id 12345 \ + --gcp-project-id my-project \ + --service-attachment sa-12345 +``` + +## Advanced Workflows + +### Database migration + +```bash +# Export from source database +redisctl enterprise database export 1 \ + --export-location /tmp/backup.rdb + +# Import to target database +redisctl enterprise database import 2 \ + --source-url file:///tmp/backup.rdb +``` + +### Active-Active (CRDB) setup + +```bash +# Create Active-Active database (Cloud) +redisctl cloud crdb create \ + --subscription-id 12345 \ + --name "global-cache" \ + --memory-limit-gb 10 \ + --regions us-east-1,eu-west-1,ap-southeast-1 + +# Create Active-Active database (Enterprise) +redisctl enterprise crdb create \ + --name "multi-region-db" \ + --memory-limit 1024 \ + --participating-clusters cluster1,cluster2,cluster3 +``` + +### Module management + +```bash +# List available modules +redisctl enterprise module list -o table + +# Upload custom module +redisctl enterprise module upload \ + --name custom-module \ + --version 1.0.0 \ + --file /path/to/module.so + +# Add module to database +redisctl enterprise database update 1 \ + --modules search,json,custom-module +``` + +### License management + +```bash +# Get license information +redisctl enterprise license get -o yaml + +# Update license +redisctl enterprise license update \ + --license-file /path/to/license.key + +# Check license expiration +redisctl enterprise license get \ + -q "expiration_date" +``` + +## Scripting & Automation + +### Batch operations + +```bash +# Delete all inactive databases +for db in $(redisctl database list -q "[?status=='inactive'].uid" -o json | jq -r '.[]'); do + redisctl enterprise database delete $db --force +done + +# Backup all databases +redisctl database list -q "[].uid" | while read db_id; do + echo "Backing up database $db_id" + redisctl enterprise database backup $db_id +done +``` + +### Health checks + +```bash +# Check cluster health +if redisctl enterprise cluster info -q "alert_count" | grep -q "0"; then + echo "Cluster healthy" +else + echo "Cluster has alerts" + redisctl enterprise alert list -o table +fi + +# Monitor database memory usage +redisctl database list -q "[?used_memory_percent>90].{name:name,usage:used_memory_percent}" -o table +``` + +### CI/CD integration + +```bash +# Deploy new database in CI pipeline +#!/bin/bash +set -e + +# Create database +DB_ID=$(redisctl enterprise database create staging-db \ + --memory-limit 512 \ + --output json \ + -q "uid") + +echo "Created database: $DB_ID" + +# Wait for database to be active +while [ "$(redisctl enterprise database show $DB_ID -q status)" != "active" ]; do + echo "Waiting for database to be active..." + sleep 5 +done + +echo "Database $DB_ID is active" + +# Get connection details +ENDPOINT=$(redisctl enterprise database show $DB_ID -q endpoint) +echo "Database endpoint: $ENDPOINT" +``` + +## Docker Usage + +### Using Docker image + +```bash +# Run command with Docker +docker run --rm \ + -e REDIS_CLOUD_API_KEY="your-key" \ + -e REDIS_CLOUD_API_SECRET="your-secret" \ + joshrotenberg/redisctl:latest \ + cloud subscription list + +# Interactive shell +docker run -it --rm \ + -e REDIS_ENTERPRISE_URL="https://cluster:9443" \ + -e REDIS_ENTERPRISE_USER="admin" \ + -e REDIS_ENTERPRISE_PASSWORD="password" \ + --entrypoint /bin/sh \ + joshrotenberg/redisctl:latest +``` + +### Docker Compose development + +```bash +# Start local Redis Enterprise for testing +docker compose up -d + +# Run CLI against local cluster +docker compose exec init-cluster redisctl enterprise cluster info + +# Create test database +docker compose exec create-db redisctl enterprise database create test +``` + +## Troubleshooting + +### Debug output + +```bash +# Enable debug logging +RUST_LOG=debug redisctl database list + +# Verbose output +redisctl -vvv cloud subscription list + +# Show raw API responses +redisctl cloud api GET /subscriptions +``` + +### Common issues + +```bash +# SSL certificate issues (Enterprise) +export REDIS_ENTERPRISE_INSECURE=true +redisctl enterprise cluster info + +# Authentication failures +# Check credentials +redisctl profile get current + +# Test API access directly +redisctl enterprise api GET /v1/cluster +``` + +## Additional Resources + +- [Full Command Reference](cli-reference/index.md) +- [API Documentation](https://docs.redis.com/latest/rs/references/rest-api/) +- [GitHub Repository](https://github.com/joshrotenberg/redisctl) +- [Rust Library Documentation](https://docs.rs/redisctl) \ No newline at end of file diff --git a/docs/book.toml b/docs/book.toml index eeb331dc..bc7b13d0 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -2,15 +2,19 @@ authors = ["Josh Rotenberg"] language = "en" src = "src" -title = "Redis Enterprise API Documentation" +title = "redisctl Documentation" [output.html] default-theme = "light" preferred-dark-theme = "ayu" -git-repository-url = "https://github.com/joshrotenberg/redis-enterprise-rs" +git-repository-url = "https://github.com/joshrotenberg/redisctl" git-repository-icon = "fa-github" -edit-url-template = "https://github.com/joshrotenberg/redis-enterprise-rs/edit/main/docs/{path}" +edit-url-template = "https://github.com/joshrotenberg/redisctl/edit/main/docs/{path}" [output.html.fold] enable = true level = 1 + +# mdbook-lint can be run manually via CLI +# Disabled as preprocessor due to configuration issues +# Run with: mdbook-lint lint src diff --git a/docs/cli-reference/README.md b/docs/cli-reference/README.md new file mode 100644 index 00000000..927c212c --- /dev/null +++ b/docs/cli-reference/README.md @@ -0,0 +1,27 @@ +# redisctl Command Reference + +``` +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) + 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/cli-reference/cloud/README.md b/docs/cli-reference/cloud/README.md new file mode 100644 index 00000000..e80f7d5f --- /dev/null +++ b/docs/cli-reference/cloud/README.md @@ -0,0 +1,35 @@ +# Redis Cloud Commands + +``` +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/cli-reference/cloud/account.md b/docs/cli-reference/cloud/account.md new file mode 100644 index 00000000..b409d70a --- /dev/null +++ b/docs/cli-reference/cloud/account.md @@ -0,0 +1,20 @@ +# Cloud Account Commands + +``` +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/cli-reference/cloud/acl.md b/docs/cli-reference/cloud/acl.md new file mode 100644 index 00000000..3e3a6589 --- /dev/null +++ b/docs/cli-reference/cloud/acl.md @@ -0,0 +1,19 @@ +# Cloud ACL Commands + +``` +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/cli-reference/cloud/api-key.md b/docs/cli-reference/cloud/api-key.md new file mode 100644 index 00000000..565c52b9 --- /dev/null +++ b/docs/cli-reference/cloud/api-key.md @@ -0,0 +1,22 @@ +# Cloud API Key Commands + +``` +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/cli-reference/cloud/api.md b/docs/cli-reference/cloud/api.md new file mode 100644 index 00000000..e9cb9b58 --- /dev/null +++ b/docs/cli-reference/cloud/api.md @@ -0,0 +1,19 @@ +# Cloud API Commands + +``` +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/cli-reference/cloud/backup.md b/docs/cli-reference/cloud/backup.md new file mode 100644 index 00000000..0772e7bc --- /dev/null +++ b/docs/cli-reference/cloud/backup.md @@ -0,0 +1,19 @@ +# Cloud Backup Commands + +``` +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/cli-reference/cloud/billing.md b/docs/cli-reference/cloud/billing.md new file mode 100644 index 00000000..37ac2e4e --- /dev/null +++ b/docs/cli-reference/cloud/billing.md @@ -0,0 +1,32 @@ +# Cloud Billing Commands + +``` +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/cli-reference/cloud/cloud-account.md b/docs/cli-reference/cloud/cloud-account.md new file mode 100644 index 00000000..e95277d6 --- /dev/null +++ b/docs/cli-reference/cloud/cloud-account.md @@ -0,0 +1,19 @@ +# Cloud Provider Account Commands + +``` +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/cli-reference/cloud/crdb.md b/docs/cli-reference/cloud/crdb.md new file mode 100644 index 00000000..761b729d --- /dev/null +++ b/docs/cli-reference/cloud/crdb.md @@ -0,0 +1,21 @@ +# Cloud Active-Active Commands + +``` +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/cli-reference/cloud/database.md b/docs/cli-reference/cloud/database.md new file mode 100644 index 00000000..4537d0ad --- /dev/null +++ b/docs/cli-reference/cloud/database.md @@ -0,0 +1,22 @@ +# Cloud Database Commands + +``` +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/cli-reference/cloud/logs.md b/docs/cli-reference/cloud/logs.md new file mode 100644 index 00000000..9bf01175 --- /dev/null +++ b/docs/cli-reference/cloud/logs.md @@ -0,0 +1,17 @@ +# Cloud Logs Commands + +``` +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/cli-reference/cloud/metrics.md b/docs/cli-reference/cloud/metrics.md new file mode 100644 index 00000000..e2f3fe5e --- /dev/null +++ b/docs/cli-reference/cloud/metrics.md @@ -0,0 +1,16 @@ +# Cloud Metrics Commands + +``` +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/cli-reference/cloud/peering.md b/docs/cli-reference/cloud/peering.md new file mode 100644 index 00000000..f77eec7e --- /dev/null +++ b/docs/cli-reference/cloud/peering.md @@ -0,0 +1,18 @@ +# Cloud VPC Peering Commands + +``` +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/cli-reference/cloud/region.md b/docs/cli-reference/cloud/region.md new file mode 100644 index 00000000..ee335802 --- /dev/null +++ b/docs/cli-reference/cloud/region.md @@ -0,0 +1,15 @@ +# Cloud Region Commands + +``` +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/cli-reference/cloud/sso.md b/docs/cli-reference/cloud/sso.md new file mode 100644 index 00000000..9243d369 --- /dev/null +++ b/docs/cli-reference/cloud/sso.md @@ -0,0 +1,31 @@ +# Cloud SSO/SAML Commands + +``` +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/cli-reference/cloud/subscription.md b/docs/cli-reference/cloud/subscription.md new file mode 100644 index 00000000..00bb793f --- /dev/null +++ b/docs/cli-reference/cloud/subscription.md @@ -0,0 +1,23 @@ +# Cloud Subscription Commands + +``` +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/cli-reference/cloud/task.md b/docs/cli-reference/cloud/task.md new file mode 100644 index 00000000..ab205d8d --- /dev/null +++ b/docs/cli-reference/cloud/task.md @@ -0,0 +1,17 @@ +# Cloud Task Commands + +``` +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/cli-reference/cloud/transit-gateway.md b/docs/cli-reference/cloud/transit-gateway.md new file mode 100644 index 00000000..7339e4c7 --- /dev/null +++ b/docs/cli-reference/cloud/transit-gateway.md @@ -0,0 +1,18 @@ +# Cloud Transit Gateway Commands + +``` +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/cli-reference/cloud/user.md b/docs/cli-reference/cloud/user.md new file mode 100644 index 00000000..e105d062 --- /dev/null +++ b/docs/cli-reference/cloud/user.md @@ -0,0 +1,19 @@ +# Cloud User Commands + +``` +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/cli-reference/enterprise/README.md b/docs/cli-reference/enterprise/README.md new file mode 100644 index 00000000..ca4d1446 --- /dev/null +++ b/docs/cli-reference/enterprise/README.md @@ -0,0 +1,28 @@ +# Redis Enterprise Commands + +``` +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/cli-reference/enterprise/actions.md b/docs/cli-reference/enterprise/actions.md new file mode 100644 index 00000000..c8ea5b7a --- /dev/null +++ b/docs/cli-reference/enterprise/actions.md @@ -0,0 +1,17 @@ +# Enterprise Actions Commands + +``` +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/cli-reference/enterprise/alert.md b/docs/cli-reference/enterprise/alert.md new file mode 100644 index 00000000..60ee7778 --- /dev/null +++ b/docs/cli-reference/enterprise/alert.md @@ -0,0 +1,23 @@ +# Enterprise Alert Commands + +``` +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/cli-reference/enterprise/api.md b/docs/cli-reference/enterprise/api.md new file mode 100644 index 00000000..3bd8556b --- /dev/null +++ b/docs/cli-reference/enterprise/api.md @@ -0,0 +1,19 @@ +# Enterprise API Commands + +``` +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/cli-reference/enterprise/bootstrap.md b/docs/cli-reference/enterprise/bootstrap.md new file mode 100644 index 00000000..7cb8dadc --- /dev/null +++ b/docs/cli-reference/enterprise/bootstrap.md @@ -0,0 +1,16 @@ +# Enterprise Bootstrap Commands + +``` +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/cli-reference/enterprise/cluster.md b/docs/cli-reference/enterprise/cluster.md new file mode 100644 index 00000000..f9709716 --- /dev/null +++ b/docs/cli-reference/enterprise/cluster.md @@ -0,0 +1,18 @@ +# Enterprise Cluster Commands + +``` +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/cli-reference/enterprise/crdb.md b/docs/cli-reference/enterprise/crdb.md new file mode 100644 index 00000000..e9e678e3 --- /dev/null +++ b/docs/cli-reference/enterprise/crdb.md @@ -0,0 +1,20 @@ +# Enterprise Active-Active Commands + +``` +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/cli-reference/enterprise/database.md b/docs/cli-reference/enterprise/database.md new file mode 100644 index 00000000..0ff2432d --- /dev/null +++ b/docs/cli-reference/enterprise/database.md @@ -0,0 +1,22 @@ +# Enterprise Database Commands + +``` +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/cli-reference/enterprise/license.md b/docs/cli-reference/enterprise/license.md new file mode 100644 index 00000000..36832639 --- /dev/null +++ b/docs/cli-reference/enterprise/license.md @@ -0,0 +1,16 @@ +# Enterprise License Commands + +``` +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/cli-reference/enterprise/logs.md b/docs/cli-reference/enterprise/logs.md new file mode 100644 index 00000000..5877549b --- /dev/null +++ b/docs/cli-reference/enterprise/logs.md @@ -0,0 +1,16 @@ +# Enterprise Logs Commands + +``` +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/cli-reference/enterprise/module.md b/docs/cli-reference/enterprise/module.md new file mode 100644 index 00000000..273020c7 --- /dev/null +++ b/docs/cli-reference/enterprise/module.md @@ -0,0 +1,17 @@ +# Enterprise Module Commands + +``` +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/cli-reference/enterprise/node.md b/docs/cli-reference/enterprise/node.md new file mode 100644 index 00000000..92baf47a --- /dev/null +++ b/docs/cli-reference/enterprise/node.md @@ -0,0 +1,20 @@ +# Enterprise Node Commands + +``` +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/cli-reference/enterprise/role.md b/docs/cli-reference/enterprise/role.md new file mode 100644 index 00000000..c349ea0a --- /dev/null +++ b/docs/cli-reference/enterprise/role.md @@ -0,0 +1,19 @@ +# Enterprise Role Commands + +``` +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/cli-reference/enterprise/stats.md b/docs/cli-reference/enterprise/stats.md new file mode 100644 index 00000000..cfdd1ebf --- /dev/null +++ b/docs/cli-reference/enterprise/stats.md @@ -0,0 +1,18 @@ +# Enterprise Stats Commands + +``` +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/cli-reference/enterprise/user.md b/docs/cli-reference/enterprise/user.md new file mode 100644 index 00000000..3efbc2fb --- /dev/null +++ b/docs/cli-reference/enterprise/user.md @@ -0,0 +1,19 @@ +# Enterprise User Commands + +``` +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/cli-reference/index.md b/docs/cli-reference/index.md new file mode 100644 index 00000000..306edfdf --- /dev/null +++ b/docs/cli-reference/index.md @@ -0,0 +1,91 @@ +# 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) + +### [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/cli-reference/profile/README.md b/docs/cli-reference/profile/README.md new file mode 100644 index 00000000..59de7bed --- /dev/null +++ b/docs/cli-reference/profile/README.md @@ -0,0 +1,19 @@ +# Profile Management Commands + +``` +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/cli-reference/profile/default.md b/docs/cli-reference/profile/default.md new file mode 100644 index 00000000..e7741d49 --- /dev/null +++ b/docs/cli-reference/profile/default.md @@ -0,0 +1,14 @@ +# Profile Default Command + +``` +Set default profile + +Usage: redisctl profile default + +Arguments: + Profile name + +Options: + -h, --help Print help +``` + diff --git a/docs/cli-reference/profile/get.md b/docs/cli-reference/profile/get.md new file mode 100644 index 00000000..428768ba --- /dev/null +++ b/docs/cli-reference/profile/get.md @@ -0,0 +1,5 @@ +# Profile Get Command + +``` +``` + diff --git a/docs/cli-reference/profile/list.md b/docs/cli-reference/profile/list.md new file mode 100644 index 00000000..dfc106e7 --- /dev/null +++ b/docs/cli-reference/profile/list.md @@ -0,0 +1,11 @@ +# Profile List Command + +``` +List all profiles + +Usage: redisctl profile list + +Options: + -h, --help Print help +``` + diff --git a/docs/cli-reference/profile/remove.md b/docs/cli-reference/profile/remove.md new file mode 100644 index 00000000..36ba899e --- /dev/null +++ b/docs/cli-reference/profile/remove.md @@ -0,0 +1,14 @@ +# Profile Remove Command + +``` +Remove a profile + +Usage: redisctl profile remove + +Arguments: + Profile name + +Options: + -h, --help Print help +``` + diff --git a/docs/cli-reference/profile/set.md b/docs/cli-reference/profile/set.md new file mode 100644 index 00000000..28d75748 --- /dev/null +++ b/docs/cli-reference/profile/set.md @@ -0,0 +1,21 @@ +# Profile Set Command + +``` +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/cli-reference/smart/account.md b/docs/cli-reference/smart/account.md new file mode 100644 index 00000000..95a37456 --- /dev/null +++ b/docs/cli-reference/smart/account.md @@ -0,0 +1,20 @@ +# Account Commands (Smart Routing) + +``` +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/cli-reference/smart/cluster.md b/docs/cli-reference/smart/cluster.md new file mode 100644 index 00000000..5533ee68 --- /dev/null +++ b/docs/cli-reference/smart/cluster.md @@ -0,0 +1,18 @@ +# Cluster Commands (Smart Routing) + +``` +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/cli-reference/smart/database.md b/docs/cli-reference/smart/database.md new file mode 100644 index 00000000..497c8b8e --- /dev/null +++ b/docs/cli-reference/smart/database.md @@ -0,0 +1,22 @@ +# Database Commands (Smart Routing) + +``` +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/cli-reference/smart/user.md b/docs/cli-reference/smart/user.md new file mode 100644 index 00000000..28312830 --- /dev/null +++ b/docs/cli-reference/smart/user.md @@ -0,0 +1,19 @@ +# User Commands (Smart Routing) + +``` +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/SUMMARY.md b/docs/src/SUMMARY.md index 2b79b6cc..4ee4a126 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -15,6 +15,59 @@ - [Commands](./cli/commands.md) - [Output Formats](./cli/output-formats.md) - [Examples](./cli/examples.md) +- [Detailed Examples](./cli/examples-detailed.md) + +# CLI Command Reference + +- [Overview](./cli-reference/index.md) +- [Profile Commands](./cli-reference/profile/README.md) + - [list](./cli-reference/profile/list.md) + - [get](./cli-reference/profile/get.md) + - [set](./cli-reference/profile/set.md) + - [remove](./cli-reference/profile/remove.md) + - [default](./cli-reference/profile/default.md) + +- [Smart Commands]() + - [database](./cli-reference/smart/database.md) + - [user](./cli-reference/smart/user.md) + - [cluster](./cli-reference/smart/cluster.md) + - [account](./cli-reference/smart/account.md) + +- [Cloud Commands](./cli-reference/cloud/README.md) + - [api](./cli-reference/cloud/api.md) + - [subscription](./cli-reference/cloud/subscription.md) + - [database](./cli-reference/cloud/database.md) + - [user](./cli-reference/cloud/user.md) + - [account](./cli-reference/cloud/account.md) + - [backup](./cli-reference/cloud/backup.md) + - [acl](./cli-reference/cloud/acl.md) + - [api-key](./cli-reference/cloud/api-key.md) + - [billing](./cli-reference/cloud/billing.md) + - [cloud-account](./cli-reference/cloud/cloud-account.md) + - [crdb](./cli-reference/cloud/crdb.md) + - [logs](./cli-reference/cloud/logs.md) + - [metrics](./cli-reference/cloud/metrics.md) + - [peering](./cli-reference/cloud/peering.md) + - [region](./cli-reference/cloud/region.md) + - [sso](./cli-reference/cloud/sso.md) + - [task](./cli-reference/cloud/task.md) + - [transit-gateway](./cli-reference/cloud/transit-gateway.md) + +- [Enterprise Commands](./cli-reference/enterprise/README.md) + - [api](./cli-reference/enterprise/api.md) + - [bootstrap](./cli-reference/enterprise/bootstrap.md) + - [cluster](./cli-reference/enterprise/cluster.md) + - [database](./cli-reference/enterprise/database.md) + - [user](./cli-reference/enterprise/user.md) + - [role](./cli-reference/enterprise/role.md) + - [node](./cli-reference/enterprise/node.md) + - [module](./cli-reference/enterprise/module.md) + - [actions](./cli-reference/enterprise/actions.md) + - [alert](./cli-reference/enterprise/alert.md) + - [crdb](./cli-reference/enterprise/crdb.md) + - [license](./cli-reference/enterprise/license.md) + - [logs](./cli-reference/enterprise/logs.md) + - [stats](./cli-reference/enterprise/stats.md) # Workflows - [Cluster Bootstrap](./workflows/cluster-bootstrap.md) diff --git a/docs/src/cli-reference/README.md b/docs/src/cli-reference/README.md new file mode 100644 index 00000000..927c212c --- /dev/null +++ b/docs/src/cli-reference/README.md @@ -0,0 +1,27 @@ +# redisctl Command Reference + +``` +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) + 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/src/cli-reference/cloud/README.md b/docs/src/cli-reference/cloud/README.md new file mode 100644 index 00000000..e80f7d5f --- /dev/null +++ b/docs/src/cli-reference/cloud/README.md @@ -0,0 +1,35 @@ +# Redis Cloud Commands + +``` +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/src/cli-reference/cloud/account.md b/docs/src/cli-reference/cloud/account.md new file mode 100644 index 00000000..b409d70a --- /dev/null +++ b/docs/src/cli-reference/cloud/account.md @@ -0,0 +1,20 @@ +# Cloud Account Commands + +``` +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/src/cli-reference/cloud/acl.md b/docs/src/cli-reference/cloud/acl.md new file mode 100644 index 00000000..3e3a6589 --- /dev/null +++ b/docs/src/cli-reference/cloud/acl.md @@ -0,0 +1,19 @@ +# Cloud ACL Commands + +``` +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/src/cli-reference/cloud/api-key.md b/docs/src/cli-reference/cloud/api-key.md new file mode 100644 index 00000000..565c52b9 --- /dev/null +++ b/docs/src/cli-reference/cloud/api-key.md @@ -0,0 +1,22 @@ +# Cloud API Key Commands + +``` +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/src/cli-reference/cloud/api.md b/docs/src/cli-reference/cloud/api.md new file mode 100644 index 00000000..e9cb9b58 --- /dev/null +++ b/docs/src/cli-reference/cloud/api.md @@ -0,0 +1,19 @@ +# Cloud API Commands + +``` +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/src/cli-reference/cloud/backup.md b/docs/src/cli-reference/cloud/backup.md new file mode 100644 index 00000000..0772e7bc --- /dev/null +++ b/docs/src/cli-reference/cloud/backup.md @@ -0,0 +1,19 @@ +# Cloud Backup Commands + +``` +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/src/cli-reference/cloud/billing.md b/docs/src/cli-reference/cloud/billing.md new file mode 100644 index 00000000..37ac2e4e --- /dev/null +++ b/docs/src/cli-reference/cloud/billing.md @@ -0,0 +1,32 @@ +# Cloud Billing Commands + +``` +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/src/cli-reference/cloud/cloud-account.md b/docs/src/cli-reference/cloud/cloud-account.md new file mode 100644 index 00000000..e95277d6 --- /dev/null +++ b/docs/src/cli-reference/cloud/cloud-account.md @@ -0,0 +1,19 @@ +# Cloud Provider Account Commands + +``` +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/src/cli-reference/cloud/crdb.md b/docs/src/cli-reference/cloud/crdb.md new file mode 100644 index 00000000..761b729d --- /dev/null +++ b/docs/src/cli-reference/cloud/crdb.md @@ -0,0 +1,21 @@ +# Cloud Active-Active Commands + +``` +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/src/cli-reference/cloud/database.md b/docs/src/cli-reference/cloud/database.md new file mode 100644 index 00000000..4537d0ad --- /dev/null +++ b/docs/src/cli-reference/cloud/database.md @@ -0,0 +1,22 @@ +# Cloud Database Commands + +``` +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/src/cli-reference/cloud/logs.md b/docs/src/cli-reference/cloud/logs.md new file mode 100644 index 00000000..9bf01175 --- /dev/null +++ b/docs/src/cli-reference/cloud/logs.md @@ -0,0 +1,17 @@ +# Cloud Logs Commands + +``` +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/src/cli-reference/cloud/metrics.md b/docs/src/cli-reference/cloud/metrics.md new file mode 100644 index 00000000..e2f3fe5e --- /dev/null +++ b/docs/src/cli-reference/cloud/metrics.md @@ -0,0 +1,16 @@ +# Cloud Metrics Commands + +``` +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/src/cli-reference/cloud/peering.md b/docs/src/cli-reference/cloud/peering.md new file mode 100644 index 00000000..f77eec7e --- /dev/null +++ b/docs/src/cli-reference/cloud/peering.md @@ -0,0 +1,18 @@ +# Cloud VPC Peering Commands + +``` +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/src/cli-reference/cloud/region.md b/docs/src/cli-reference/cloud/region.md new file mode 100644 index 00000000..ee335802 --- /dev/null +++ b/docs/src/cli-reference/cloud/region.md @@ -0,0 +1,15 @@ +# Cloud Region Commands + +``` +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/src/cli-reference/cloud/sso.md b/docs/src/cli-reference/cloud/sso.md new file mode 100644 index 00000000..9243d369 --- /dev/null +++ b/docs/src/cli-reference/cloud/sso.md @@ -0,0 +1,31 @@ +# Cloud SSO/SAML Commands + +``` +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/src/cli-reference/cloud/subscription.md b/docs/src/cli-reference/cloud/subscription.md new file mode 100644 index 00000000..00bb793f --- /dev/null +++ b/docs/src/cli-reference/cloud/subscription.md @@ -0,0 +1,23 @@ +# Cloud Subscription Commands + +``` +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/src/cli-reference/cloud/task.md b/docs/src/cli-reference/cloud/task.md new file mode 100644 index 00000000..ab205d8d --- /dev/null +++ b/docs/src/cli-reference/cloud/task.md @@ -0,0 +1,17 @@ +# Cloud Task Commands + +``` +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/src/cli-reference/cloud/transit-gateway.md b/docs/src/cli-reference/cloud/transit-gateway.md new file mode 100644 index 00000000..7339e4c7 --- /dev/null +++ b/docs/src/cli-reference/cloud/transit-gateway.md @@ -0,0 +1,18 @@ +# Cloud Transit Gateway Commands + +``` +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/src/cli-reference/cloud/user.md b/docs/src/cli-reference/cloud/user.md new file mode 100644 index 00000000..e105d062 --- /dev/null +++ b/docs/src/cli-reference/cloud/user.md @@ -0,0 +1,19 @@ +# Cloud User Commands + +``` +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/src/cli-reference/enterprise/README.md b/docs/src/cli-reference/enterprise/README.md new file mode 100644 index 00000000..ca4d1446 --- /dev/null +++ b/docs/src/cli-reference/enterprise/README.md @@ -0,0 +1,28 @@ +# Redis Enterprise Commands + +``` +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/src/cli-reference/enterprise/actions.md b/docs/src/cli-reference/enterprise/actions.md new file mode 100644 index 00000000..c8ea5b7a --- /dev/null +++ b/docs/src/cli-reference/enterprise/actions.md @@ -0,0 +1,17 @@ +# Enterprise Actions Commands + +``` +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/src/cli-reference/enterprise/alert.md b/docs/src/cli-reference/enterprise/alert.md new file mode 100644 index 00000000..60ee7778 --- /dev/null +++ b/docs/src/cli-reference/enterprise/alert.md @@ -0,0 +1,23 @@ +# Enterprise Alert Commands + +``` +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/src/cli-reference/enterprise/api.md b/docs/src/cli-reference/enterprise/api.md new file mode 100644 index 00000000..3bd8556b --- /dev/null +++ b/docs/src/cli-reference/enterprise/api.md @@ -0,0 +1,19 @@ +# Enterprise API Commands + +``` +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/src/cli-reference/enterprise/bootstrap.md b/docs/src/cli-reference/enterprise/bootstrap.md new file mode 100644 index 00000000..7cb8dadc --- /dev/null +++ b/docs/src/cli-reference/enterprise/bootstrap.md @@ -0,0 +1,16 @@ +# Enterprise Bootstrap Commands + +``` +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/src/cli-reference/enterprise/cluster.md b/docs/src/cli-reference/enterprise/cluster.md new file mode 100644 index 00000000..f9709716 --- /dev/null +++ b/docs/src/cli-reference/enterprise/cluster.md @@ -0,0 +1,18 @@ +# Enterprise Cluster Commands + +``` +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/src/cli-reference/enterprise/crdb.md b/docs/src/cli-reference/enterprise/crdb.md new file mode 100644 index 00000000..e9e678e3 --- /dev/null +++ b/docs/src/cli-reference/enterprise/crdb.md @@ -0,0 +1,20 @@ +# Enterprise Active-Active Commands + +``` +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/src/cli-reference/enterprise/database.md b/docs/src/cli-reference/enterprise/database.md new file mode 100644 index 00000000..0ff2432d --- /dev/null +++ b/docs/src/cli-reference/enterprise/database.md @@ -0,0 +1,22 @@ +# Enterprise Database Commands + +``` +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/src/cli-reference/enterprise/license.md b/docs/src/cli-reference/enterprise/license.md new file mode 100644 index 00000000..36832639 --- /dev/null +++ b/docs/src/cli-reference/enterprise/license.md @@ -0,0 +1,16 @@ +# Enterprise License Commands + +``` +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/src/cli-reference/enterprise/logs.md b/docs/src/cli-reference/enterprise/logs.md new file mode 100644 index 00000000..5877549b --- /dev/null +++ b/docs/src/cli-reference/enterprise/logs.md @@ -0,0 +1,16 @@ +# Enterprise Logs Commands + +``` +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/src/cli-reference/enterprise/module.md b/docs/src/cli-reference/enterprise/module.md new file mode 100644 index 00000000..273020c7 --- /dev/null +++ b/docs/src/cli-reference/enterprise/module.md @@ -0,0 +1,17 @@ +# Enterprise Module Commands + +``` +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/src/cli-reference/enterprise/node.md b/docs/src/cli-reference/enterprise/node.md new file mode 100644 index 00000000..92baf47a --- /dev/null +++ b/docs/src/cli-reference/enterprise/node.md @@ -0,0 +1,20 @@ +# Enterprise Node Commands + +``` +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/src/cli-reference/enterprise/role.md b/docs/src/cli-reference/enterprise/role.md new file mode 100644 index 00000000..c349ea0a --- /dev/null +++ b/docs/src/cli-reference/enterprise/role.md @@ -0,0 +1,19 @@ +# Enterprise Role Commands + +``` +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/src/cli-reference/enterprise/stats.md b/docs/src/cli-reference/enterprise/stats.md new file mode 100644 index 00000000..cfdd1ebf --- /dev/null +++ b/docs/src/cli-reference/enterprise/stats.md @@ -0,0 +1,18 @@ +# Enterprise Stats Commands + +``` +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/src/cli-reference/enterprise/user.md b/docs/src/cli-reference/enterprise/user.md new file mode 100644 index 00000000..3efbc2fb --- /dev/null +++ b/docs/src/cli-reference/enterprise/user.md @@ -0,0 +1,19 @@ +# Enterprise User Commands + +``` +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/src/cli-reference/index.md b/docs/src/cli-reference/index.md new file mode 100644 index 00000000..306edfdf --- /dev/null +++ b/docs/src/cli-reference/index.md @@ -0,0 +1,91 @@ +# 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) + +### [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/src/cli-reference/profile/README.md b/docs/src/cli-reference/profile/README.md new file mode 100644 index 00000000..59de7bed --- /dev/null +++ b/docs/src/cli-reference/profile/README.md @@ -0,0 +1,19 @@ +# Profile Management Commands + +``` +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/src/cli-reference/profile/default.md b/docs/src/cli-reference/profile/default.md new file mode 100644 index 00000000..e7741d49 --- /dev/null +++ b/docs/src/cli-reference/profile/default.md @@ -0,0 +1,14 @@ +# Profile Default Command + +``` +Set default profile + +Usage: redisctl profile default + +Arguments: + Profile name + +Options: + -h, --help Print help +``` + diff --git a/docs/src/cli-reference/profile/get.md b/docs/src/cli-reference/profile/get.md new file mode 100644 index 00000000..428768ba --- /dev/null +++ b/docs/src/cli-reference/profile/get.md @@ -0,0 +1,5 @@ +# Profile Get Command + +``` +``` + diff --git a/docs/src/cli-reference/profile/list.md b/docs/src/cli-reference/profile/list.md new file mode 100644 index 00000000..dfc106e7 --- /dev/null +++ b/docs/src/cli-reference/profile/list.md @@ -0,0 +1,11 @@ +# Profile List Command + +``` +List all profiles + +Usage: redisctl profile list + +Options: + -h, --help Print help +``` + diff --git a/docs/src/cli-reference/profile/remove.md b/docs/src/cli-reference/profile/remove.md new file mode 100644 index 00000000..36ba899e --- /dev/null +++ b/docs/src/cli-reference/profile/remove.md @@ -0,0 +1,14 @@ +# Profile Remove Command + +``` +Remove a profile + +Usage: redisctl profile remove + +Arguments: + Profile name + +Options: + -h, --help Print help +``` + diff --git a/docs/src/cli-reference/profile/set.md b/docs/src/cli-reference/profile/set.md new file mode 100644 index 00000000..28d75748 --- /dev/null +++ b/docs/src/cli-reference/profile/set.md @@ -0,0 +1,21 @@ +# Profile Set Command + +``` +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/src/cli-reference/smart/account.md b/docs/src/cli-reference/smart/account.md new file mode 100644 index 00000000..95a37456 --- /dev/null +++ b/docs/src/cli-reference/smart/account.md @@ -0,0 +1,20 @@ +# Account Commands (Smart Routing) + +``` +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/src/cli-reference/smart/cluster.md b/docs/src/cli-reference/smart/cluster.md new file mode 100644 index 00000000..5533ee68 --- /dev/null +++ b/docs/src/cli-reference/smart/cluster.md @@ -0,0 +1,18 @@ +# Cluster Commands (Smart Routing) + +``` +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/src/cli-reference/smart/database.md b/docs/src/cli-reference/smart/database.md new file mode 100644 index 00000000..497c8b8e --- /dev/null +++ b/docs/src/cli-reference/smart/database.md @@ -0,0 +1,22 @@ +# Database Commands (Smart Routing) + +``` +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/src/cli-reference/smart/user.md b/docs/src/cli-reference/smart/user.md new file mode 100644 index 00000000..28312830 --- /dev/null +++ b/docs/src/cli-reference/smart/user.md @@ -0,0 +1,19 @@ +# User Commands (Smart Routing) + +``` +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/cli/examples-detailed.md b/docs/src/cli/examples-detailed.md new file mode 100644 index 00000000..bc140465 --- /dev/null +++ b/docs/src/cli/examples-detailed.md @@ -0,0 +1,555 @@ +# redisctl Examples + +Comprehensive examples for common Redis Cloud and Enterprise operations. + +## Table of Contents + +- [Authentication & Configuration](#authentication-configuration) +- [Database Operations](#database-operations) +- [Cluster Management](#cluster-management) +- [User & ACL Management](#user-acl-management) +- [Backup & Recovery](#backup-recovery) +- [Monitoring & Metrics](#monitoring-metrics) +- [Networking & Security](#networking-security) +- [Advanced Workflows](#advanced-workflows) + +## Authentication & Configuration + +### Setting up profiles + +```bash +# Create a Redis Cloud profile +redisctl profile set cloud-prod \ + --deployment-type cloud \ + --api-key YOUR_API_KEY \ + --api-secret YOUR_API_SECRET + +# Create a Redis Enterprise profile +redisctl profile set enterprise-dev \ + --deployment-type enterprise \ + --url https://cluster.example.com:9443 \ + --username admin@example.com \ + --password SecurePassword123 + +# Set default profile +redisctl profile default cloud-prod + +# List all profiles +redisctl profile list +``` + +### Using environment variables + +```bash +# Redis Cloud +export REDIS_CLOUD_API_KEY="your-key" +export REDIS_CLOUD_API_SECRET="your-secret" + +# Redis Enterprise +export REDIS_ENTERPRISE_URL="https://cluster:9443" +export REDIS_ENTERPRISE_USER="admin@example.com" +export REDIS_ENTERPRISE_PASSWORD="password" +export REDIS_ENTERPRISE_INSECURE="true" # For self-signed certificates +``` + +## Database Operations + +### Creating databases + +```bash +# Create a Redis Cloud database +redisctl cloud database create \ + --subscription-id 12345 \ + --name "production-cache" \ + --memory-limit-gb 10 \ + --throughput-measurement-by operations-per-second \ + --throughput-measurement-value 10000 + +# Create a Redis Enterprise database +redisctl enterprise database create cache-db \ + --memory-limit 1024 \ + --modules search,json + +# Create database with specific configuration +redisctl enterprise database create session-store \ + --memory-limit 2048 \ + --replication \ + --persistence aof \ + --eviction-policy allkeys-lru +``` + +### Listing and filtering databases + +```bash +# List all databases +redisctl database list + +# List with table output +redisctl database list -o table + +# Filter active databases using JMESPath +redisctl database list -q "[?status=='active'].{name:name,memory:memory_size,port:port}" + +# Show specific database details +redisctl enterprise database show 1 -o yaml + +# Get database endpoints +redisctl cloud database list \ + --subscription-id 12345 \ + -q "[].{name:name,endpoint:public_endpoint}" +``` + +### Database updates + +```bash +# Update memory limit +redisctl enterprise database update 1 \ + --memory-limit 2048 + +# Enable replication +redisctl cloud database update \ + --subscription-id 12345 \ + --database-id 67890 \ + --replication true + +# Change eviction policy +redisctl enterprise database update cache-db \ + --eviction-policy volatile-lru +``` + +## Cluster Management + +### Initialize Enterprise cluster + +```bash +# Bootstrap new cluster +redisctl enterprise bootstrap create \ + --name "production-cluster" \ + --username admin@company.com \ + --password SecurePassword123 + +# Check bootstrap status +redisctl enterprise bootstrap status + +# Get cluster information +redisctl enterprise cluster info -o table + +# Update cluster settings +redisctl enterprise cluster update \ + --name "production-cluster-v2" +``` + +### Node management + +```bash +# List all nodes +redisctl enterprise node list -o table + +# Show node details +redisctl enterprise node show 1 + +# Join node to cluster +redisctl enterprise node join \ + --cluster-url https://master:9443 \ + --username admin \ + --password password + +# Remove node from cluster +redisctl enterprise node remove 3 +``` + +## User & ACL Management + +### User management + +```bash +# Create user (Cloud) +redisctl cloud user create \ + --email developer@company.com \ + --first-name John \ + --last-name Doe \ + --role db-member + +# Create user (Enterprise) +redisctl enterprise user create \ + --email ops@company.com \ + --password TempPass123 \ + --role db-viewer + +# List users with specific roles +redisctl user list -q "[?role=='admin'].email" + +# Update user role +redisctl enterprise user update ops@company.com \ + --role admin +``` + +### ACL management + +```bash +# Create ACL rule (Cloud) +redisctl cloud acl create \ + --subscription-id 12345 \ + --database-id 67890 \ + --name "read-only-acl" \ + --rule "+@read ~*" + +# Create Redis ACL (Enterprise) +redisctl enterprise redis-acl create \ + --name "app-acl" \ + --acl "+@all -@dangerous ~app:*" + +# List ACLs +redisctl cloud acl list \ + --subscription-id 12345 \ + --database-id 67890 \ + -o table + +# Associate ACL with user +redisctl cloud acl-user create \ + --subscription-id 12345 \ + --database-id 67890 \ + --username app-user \ + --password SecurePass123 \ + --acl-id acl-123 +``` + +## Backup & Recovery + +### Creating backups + +```bash +# Create Cloud backup +redisctl cloud backup create \ + --subscription-id 12345 \ + --database-id 67890 + +# Create Enterprise backup +redisctl enterprise database backup 1 + +# List backups +redisctl cloud backup list \ + --subscription-id 12345 \ + --database-id 67890 \ + -o table + +# Backup with custom location (Enterprise) +redisctl enterprise database export 1 \ + --export-location s3://bucket/backups/ +``` + +### Restoring from backup + +```bash +# Restore Cloud database +redisctl cloud backup restore \ + --subscription-id 12345 \ + --database-id 67890 \ + --backup-id backup-123 + +# Import data (Enterprise) +redisctl enterprise database import 1 \ + --source-url redis://source-cluster:6379 \ + --source-password SourcePass123 +``` + +## Monitoring & Metrics + +### Getting metrics + +```bash +# Cloud database metrics +redisctl cloud metrics database \ + --subscription-id 12345 \ + --database-id 67890 \ + --metric used-memory \ + --from "2024-01-01T00:00:00Z" \ + --to "2024-01-02T00:00:00Z" + +# Enterprise statistics +redisctl enterprise stats database 1 \ + --metric all \ + --interval 1hour + +# Cluster statistics +redisctl enterprise stats cluster \ + --metric cpu,memory,network +``` + +### Monitoring alerts + +```bash +# List alerts (Enterprise) +redisctl enterprise alert list -o table + +# Get alert details +redisctl enterprise alert show alert-123 + +# Clear alert +redisctl enterprise alert clear alert-123 + +# Set alert settings +redisctl enterprise alert settings \ + --database-id 1 \ + --threshold-memory 90 \ + --threshold-cpu 80 +``` + +### Viewing logs + +```bash +# Cloud system logs +redisctl cloud logs list \ + --limit 100 \ + -q "[?level=='error'].{time:timestamp,message:message}" + +# Enterprise event logs +redisctl enterprise logs list \ + --severity error \ + --limit 50 \ + -o table +``` + +## Networking & Security + +### VPC Peering (Cloud) + +```bash +# Create VPC peering +redisctl cloud peering create \ + --subscription-id 12345 \ + --aws-account-id 123456789012 \ + --region us-east-1 \ + --vpc-id vpc-12345 \ + --vpc-cidr 10.0.0.0/16 + +# List peerings +redisctl cloud peering list \ + --subscription-id 12345 \ + -o table + +# Accept peering +redisctl cloud peering accept \ + --subscription-id 12345 \ + --peering-id peer-123 +``` + +### Transit Gateway (Cloud) + +```bash +# Create Transit Gateway attachment +redisctl cloud transit-gateway create \ + --subscription-id 12345 \ + --aws-account-id 123456789012 \ + --tgw-id tgw-12345 \ + --cidrs "10.0.0.0/24,10.0.1.0/24" + +# List attachments +redisctl cloud transit-gateway list \ + --subscription-id 12345 \ + -q "[?status=='active'].id" +``` + +### Private Service Connect (Cloud) + +```bash +# Create Private Service Connect +redisctl cloud private-service-connect create \ + --subscription-id 12345 \ + --gcp-project-id my-project \ + --service-attachment sa-12345 +``` + +## Advanced Workflows + +### Database migration + +```bash +# Export from source database +redisctl enterprise database export 1 \ + --export-location /tmp/backup.rdb + +# Import to target database +redisctl enterprise database import 2 \ + --source-url file:///tmp/backup.rdb +``` + +### Active-Active (CRDB) setup + +```bash +# Create Active-Active database (Cloud) +redisctl cloud crdb create \ + --subscription-id 12345 \ + --name "global-cache" \ + --memory-limit-gb 10 \ + --regions us-east-1,eu-west-1,ap-southeast-1 + +# Create Active-Active database (Enterprise) +redisctl enterprise crdb create \ + --name "multi-region-db" \ + --memory-limit 1024 \ + --participating-clusters cluster1,cluster2,cluster3 +``` + +### Module management + +```bash +# List available modules +redisctl enterprise module list -o table + +# Upload custom module +redisctl enterprise module upload \ + --name custom-module \ + --version 1.0.0 \ + --file /path/to/module.so + +# Add module to database +redisctl enterprise database update 1 \ + --modules search,json,custom-module +``` + +### License management + +```bash +# Get license information +redisctl enterprise license get -o yaml + +# Update license +redisctl enterprise license update \ + --license-file /path/to/license.key + +# Check license expiration +redisctl enterprise license get \ + -q "expiration_date" +``` + +## Scripting & Automation + +### Batch operations + +```bash +# Delete all inactive databases +for db in $(redisctl database list -q "[?status=='inactive'].uid" -o json | jq -r '.[]'); do + redisctl enterprise database delete $db --force +done + +# Backup all databases +redisctl database list -q "[].uid" | while read db_id; do + echo "Backing up database $db_id" + redisctl enterprise database backup $db_id +done +``` + +### Health checks + +```bash +# Check cluster health +if redisctl enterprise cluster info -q "alert_count" | grep -q "0"; then + echo "Cluster healthy" +else + echo "Cluster has alerts" + redisctl enterprise alert list -o table +fi + +# Monitor database memory usage +redisctl database list -q "[?used_memory_percent>90].{name:name,usage:used_memory_percent}" -o table +``` + +### CI/CD integration + +```bash +# Deploy new database in CI pipeline +#!/bin/bash +set -e + +# Create database +DB_ID=$(redisctl enterprise database create staging-db \ + --memory-limit 512 \ + --output json \ + -q "uid") + +echo "Created database: $DB_ID" + +# Wait for database to be active +while [ "$(redisctl enterprise database show $DB_ID -q status)" != "active" ]; do + echo "Waiting for database to be active..." + sleep 5 +done + +echo "Database $DB_ID is active" + +# Get connection details +ENDPOINT=$(redisctl enterprise database show $DB_ID -q endpoint) +echo "Database endpoint: $ENDPOINT" +``` + +## Docker Usage + +### Using Docker image + +```bash +# Run command with Docker +docker run --rm \ + -e REDIS_CLOUD_API_KEY="your-key" \ + -e REDIS_CLOUD_API_SECRET="your-secret" \ + joshrotenberg/redisctl:latest \ + cloud subscription list + +# Interactive shell +docker run -it --rm \ + -e REDIS_ENTERPRISE_URL="https://cluster:9443" \ + -e REDIS_ENTERPRISE_USER="admin" \ + -e REDIS_ENTERPRISE_PASSWORD="password" \ + --entrypoint /bin/sh \ + joshrotenberg/redisctl:latest +``` + +### Docker Compose development + +```bash +# Start local Redis Enterprise for testing +docker compose up -d + +# Run CLI against local cluster +docker compose exec init-cluster redisctl enterprise cluster info + +# Create test database +docker compose exec create-db redisctl enterprise database create test +``` + +## Troubleshooting + +### Debug output + +```bash +# Enable debug logging +RUST_LOG=debug redisctl database list + +# Verbose output +redisctl -vvv cloud subscription list + +# Show raw API responses +redisctl cloud api GET /subscriptions +``` + +### Common issues + +```bash +# SSL certificate issues (Enterprise) +export REDIS_ENTERPRISE_INSECURE=true +redisctl enterprise cluster info + +# Authentication failures +# Check credentials +redisctl profile get current + +# Test API access directly +redisctl enterprise api GET /v1/cluster +``` + +## Additional Resources + +- [Full Command Reference](cli-reference/index.md) +- [API Documentation](https://docs.redis.com/latest/rs/references/rest-api/) +- [GitHub Repository](https://github.com/joshrotenberg/redisctl) +- [Rust Library Documentation](https://docs.rs/redisctl) \ No newline at end of file diff --git a/scripts/generate-cli-docs.sh b/scripts/generate-cli-docs.sh new file mode 100755 index 00000000..a8828d1b --- /dev/null +++ b/scripts/generate-cli-docs.sh @@ -0,0 +1,192 @@ +#!/bin/bash +# Generate comprehensive CLI documentation for redisctl + +set -e + +OUTPUT_DIR="docs/cli-reference" +BINARY="cargo run --bin redisctl --" + +echo "Generating CLI documentation..." + +# Create output directory +mkdir -p "$OUTPUT_DIR" + +# Function to generate markdown for a command +generate_command_doc() { + local cmd="$1" + local output_file="$2" + local title="$3" + + echo "# $title" > "$output_file" + echo "" >> "$output_file" + echo '```' >> "$output_file" + $BINARY $cmd --help 2>/dev/null >> "$output_file" || true + echo '```' >> "$output_file" + echo "" >> "$output_file" +} + +# Generate main command documentation +echo "Generating main command reference..." +generate_command_doc "" "$OUTPUT_DIR/README.md" "redisctl Command Reference" + +# Generate Cloud commands documentation +echo "Generating Cloud commands..." +mkdir -p "$OUTPUT_DIR/cloud" + +generate_command_doc "cloud" "$OUTPUT_DIR/cloud/README.md" "Redis Cloud Commands" +generate_command_doc "cloud api" "$OUTPUT_DIR/cloud/api.md" "Cloud API Commands" +generate_command_doc "cloud subscription" "$OUTPUT_DIR/cloud/subscription.md" "Cloud Subscription Commands" +generate_command_doc "cloud database" "$OUTPUT_DIR/cloud/database.md" "Cloud Database Commands" +generate_command_doc "cloud account" "$OUTPUT_DIR/cloud/account.md" "Cloud Account Commands" +generate_command_doc "cloud user" "$OUTPUT_DIR/cloud/user.md" "Cloud User Commands" +generate_command_doc "cloud region" "$OUTPUT_DIR/cloud/region.md" "Cloud Region Commands" +generate_command_doc "cloud task" "$OUTPUT_DIR/cloud/task.md" "Cloud Task Commands" +generate_command_doc "cloud acl" "$OUTPUT_DIR/cloud/acl.md" "Cloud ACL Commands" +generate_command_doc "cloud peering" "$OUTPUT_DIR/cloud/peering.md" "Cloud VPC Peering Commands" +generate_command_doc "cloud transit-gateway" "$OUTPUT_DIR/cloud/transit-gateway.md" "Cloud Transit Gateway Commands" +generate_command_doc "cloud backup" "$OUTPUT_DIR/cloud/backup.md" "Cloud Backup Commands" +generate_command_doc "cloud crdb" "$OUTPUT_DIR/cloud/crdb.md" "Cloud Active-Active Commands" +generate_command_doc "cloud api-key" "$OUTPUT_DIR/cloud/api-key.md" "Cloud API Key Commands" +generate_command_doc "cloud metrics" "$OUTPUT_DIR/cloud/metrics.md" "Cloud Metrics Commands" +generate_command_doc "cloud logs" "$OUTPUT_DIR/cloud/logs.md" "Cloud Logs Commands" +generate_command_doc "cloud cloud-account" "$OUTPUT_DIR/cloud/cloud-account.md" "Cloud Provider Account Commands" +generate_command_doc "cloud sso" "$OUTPUT_DIR/cloud/sso.md" "Cloud SSO/SAML Commands" +generate_command_doc "cloud billing" "$OUTPUT_DIR/cloud/billing.md" "Cloud Billing Commands" + +# Generate Enterprise commands documentation +echo "Generating Enterprise commands..." +mkdir -p "$OUTPUT_DIR/enterprise" + +generate_command_doc "enterprise" "$OUTPUT_DIR/enterprise/README.md" "Redis Enterprise Commands" +generate_command_doc "enterprise api" "$OUTPUT_DIR/enterprise/api.md" "Enterprise API Commands" +generate_command_doc "enterprise cluster" "$OUTPUT_DIR/enterprise/cluster.md" "Enterprise Cluster Commands" +generate_command_doc "enterprise database" "$OUTPUT_DIR/enterprise/database.md" "Enterprise Database Commands" +generate_command_doc "enterprise node" "$OUTPUT_DIR/enterprise/node.md" "Enterprise Node Commands" +generate_command_doc "enterprise user" "$OUTPUT_DIR/enterprise/user.md" "Enterprise User Commands" +generate_command_doc "enterprise bootstrap" "$OUTPUT_DIR/enterprise/bootstrap.md" "Enterprise Bootstrap Commands" +generate_command_doc "enterprise module" "$OUTPUT_DIR/enterprise/module.md" "Enterprise Module Commands" +generate_command_doc "enterprise role" "$OUTPUT_DIR/enterprise/role.md" "Enterprise Role Commands" +generate_command_doc "enterprise license" "$OUTPUT_DIR/enterprise/license.md" "Enterprise License Commands" +generate_command_doc "enterprise alert" "$OUTPUT_DIR/enterprise/alert.md" "Enterprise Alert Commands" +generate_command_doc "enterprise crdb" "$OUTPUT_DIR/enterprise/crdb.md" "Enterprise Active-Active Commands" +generate_command_doc "enterprise actions" "$OUTPUT_DIR/enterprise/actions.md" "Enterprise Actions Commands" +generate_command_doc "enterprise stats" "$OUTPUT_DIR/enterprise/stats.md" "Enterprise Stats Commands" +generate_command_doc "enterprise logs" "$OUTPUT_DIR/enterprise/logs.md" "Enterprise Logs Commands" + +# Generate Profile commands documentation +echo "Generating Profile commands..." +mkdir -p "$OUTPUT_DIR/profile" +generate_command_doc "profile" "$OUTPUT_DIR/profile/README.md" "Profile Management Commands" +generate_command_doc "profile list" "$OUTPUT_DIR/profile/list.md" "Profile List Command" +generate_command_doc "profile set" "$OUTPUT_DIR/profile/set.md" "Profile Set Command" +generate_command_doc "profile get" "$OUTPUT_DIR/profile/get.md" "Profile Get Command" +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 Smart-routed commands documentation +echo "Generating smart-routed commands..." +mkdir -p "$OUTPUT_DIR/smart" +generate_command_doc "database" "$OUTPUT_DIR/smart/database.md" "Database Commands (Smart Routing)" +generate_command_doc "cluster" "$OUTPUT_DIR/smart/cluster.md" "Cluster Commands (Smart Routing)" +generate_command_doc "user" "$OUTPUT_DIR/smart/user.md" "User Commands (Smart Routing)" +generate_command_doc "account" "$OUTPUT_DIR/smart/account.md" "Account Commands (Smart Routing)" + +echo "Documentation generation complete!" +echo "Output directory: $OUTPUT_DIR" + +# Generate index file +cat > "$OUTPUT_DIR/index.md" << 'EOF' +# 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) + +### [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. +EOF + +echo "Index file generated at $OUTPUT_DIR/index.md" \ No newline at end of file