Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query parser consolidation draft #1

Closed
wants to merge 13 commits into from

Conversation

mattheidelbaugh
Copy link
Owner

@mattheidelbaugh mattheidelbaugh commented May 15, 2024

Closes cloud-custodian#9469, cloud-custodian#9408

  • Consolidate all query parsing to use the QueryParser class in utils.py. All previously valid policy queries should still be valid.
  • Server-side filtering can now be done via both the query Filters and query parameters simultaneously for resources whose enum_spec function supports it
  • Implicit query filters provided without a Filters key are still supported via the implicit_qfilter_translate function in the QueryParser class. This will raise a PolicyValidation error if query parameters and query filters are mixed without listing the query filters properly under the 'Filters' key
  • For Directories, name and directoryArn are not valid query parameters. They're from the API response, so they were removed. Additionally, directory queries are bugged in their current implementation as they are placed under a 'Filters' key which causes boto3 to throw botocore.exceptions.ParamValidationError: Parameter validation failed: Unknown parameter in input: "Filters", must be one of: NextToken, MaxResults, state, so the current version of directory queries as a list of "Name", "Values" dictionaries will no longer be supported in favor of key value pairs to mirror the list_directories API structure.

New Functionality:
EC2:

  • InstanceIds, MaxResults queries
  • Query Filters for ebs-optimized, instance-type, platform

EBS Snapshots:

  • MaxResults, OwnerIds, RestorableByUserIds, and SnapshotIds queries

Sagemaker Jobs:

  • CreationTimeAfter, CreationTimeBefore, LastModifiedBefore, LastModifiedAfter, MaxResults queries

IAM Policies:

  • MaxItems query
  • Ability to query for policies with Scope All or AWS

EMR:

  • CreatedBefore, CreatedAfter queries

Directory:

  • MaxResults query

There are a number of other resource types whose queries could be easily implemented or simplified in the future such as ops-item, ssm-document, codedeploy-deployment, dms-instance, etc.

@mattheidelbaugh mattheidelbaugh changed the title query parser consolidation first draft query parser consolidation draft May 15, 2024
@kapilt
Copy link

kapilt commented May 19, 2024

looks like this is targeting the wrong repo/branch re its targeting your fork vs the upstream repo.

@mattheidelbaugh
Copy link
Owner Author

looks like this is targeting the wrong repo/branch re its targeting your fork vs the upstream repo.

Oh yeah that was intentional. Been using this fork as a staging area for working draft PRs until they're fully ready to go. I'll target the upstream repo once I've finalized it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants