Skip to content

Support @file syntax for JMESPath queries #593

@joshrotenberg

Description

@joshrotenberg

Summary

Add support for loading JMESPath queries from files using @filename syntax, similar to how --data @file.json works.

Proposed

# Load query from file
redisctl cloud cost-report download $ID -q @queries/top-resources.jmespath

# Still support inline queries
redisctl cloud cost-report download $ID -q 'sum([].BilledCost)'

Use case: Canned FOCUS queries

Ship a set of pre-built queries for common cost analysis patterns:

queries/focus/
├── top-n-resources.jmespath
├── cost-by-region.jmespath
├── cost-by-resource-name.jmespath
├── cost-by-charge-category.jmespath
└── zero-cost-resources.jmespath

Example cost-by-region.jmespath:

group_by(@, \`RegionName\`) | items(@) | [*].{region: [0], total: sum([1][*].BilledCost)} | sort_by(@, &total) | reverse(@)

Users get powerful analysis without memorizing complex JMESPath syntax.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliRelated to CLI UX and commandscloudRelated to Redis Cloud functionalityenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions