Skip to content

Conversation

@joshrotenberg
Copy link
Collaborator

Summary

Add support for the new Redis Cloud cost-report API endpoints announced at https://redis.io/docs/latest/operate/rc/api/examples/generate-cost-report/

Changes

Library (redis-cloud)

  • Add cost_report module with CostReportHandler
  • Add CostReportCreateRequest with builder pattern for ergonomic request construction
  • Add CostReportFormat (csv/json), SubscriptionType (pro/essentials), and Tag types
  • Add get_bytes() method to CloudClient for downloading binary content

CLI (redisctl)

  • Add cloud cost-report generate command with comprehensive filtering options:
    • --start-date / --end-date (YYYY-MM-DD format, max 40 days range)
    • --format (csv or json, defaults to csv)
    • --subscription (filter by subscription IDs, repeatable)
    • --database (filter by database IDs, repeatable)
    • --subscription-type (pro or essentials)
    • --region (filter by regions, repeatable)
    • --tag (filter by key:value tags, repeatable)
    • Async operation support (--wait, --wait-timeout)
  • Add cloud cost-report download command with --output option

Tests

  • Add CLI help tests for cost-report commands

API Endpoints

  • POST /cost-report - Generate cost reports in FOCUS format
  • GET /cost-report/{costReportId} - Download generated reports

Usage Examples

# Generate a cost report for January 2025
redisctl cloud cost-report generate --start-date 2025-01-01 --end-date 2025-01-31

# Generate with filters and wait for completion
redisctl cloud cost-report generate --start-date 2025-01-01 --end-date 2025-01-31 \
  --subscription 123 --region us-east-1 --tag team:marketing --wait

# Download the report
redisctl cloud cost-report download cost-report-12345-abcdef --output report.csv

Notes

  • The cost report API is currently in Beta
  • Reports are in FOCUS (FinOps Cost and Usage Specification) format
  • Maximum date range is 40 days

Closes #478

Add support for the new Redis Cloud cost-report API endpoints:

- POST /cost-report - Generate cost reports in FOCUS format
- GET /cost-report/{costReportId} - Download generated reports

Library changes (redis-cloud):
- Add cost_report module with CostReportHandler
- Add CostReportCreateRequest with builder pattern
- Add CostReportFormat, SubscriptionType, Tag types
- Add get_bytes() method to CloudClient for binary downloads

CLI changes (redisctl):
- Add 'cloud cost-report generate' command with filters:
  - Date range (start-date, end-date)
  - Format (csv, json)
  - Subscription IDs, database IDs
  - Subscription type (pro, essentials)
  - Regions and tags
- Add 'cloud cost-report download' command
- Add CLI help tests

The cost report API is currently in Beta.
@joshrotenberg joshrotenberg merged commit 94cdfdd into main Dec 9, 2025
16 checks passed
@joshrotenberg joshrotenberg deleted the feat/cost-report-api branch December 9, 2025 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants