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

Add Pagination to Delete Commands #543

Merged
merged 10 commits into from
Sep 25, 2024
Merged

Add Pagination to Delete Commands #543

merged 10 commits into from
Sep 25, 2024

Conversation

ben-githubs
Copy link
Contributor

Background

The delete command cannot handle more than 100 IDs being passed at any given time, so this PR adds some basic pagination to that command. This is necessary because we intend to start deprecating rules and ask customers to run delete against a masterlist of IDs which will grow over time.

Changes

  • added a batching function
  • modified PublicAPIClient.delete_saved_queries and PublicAPIClient.delete_detections to invoke the GQL endpoint in batches of 100 or less

Testing

  • tested manually by invoking pat delete with 150 detection IDs and 150 query names
  • added 3 unit tests for the _batched function

@le4ker le4ker force-pushed the ben/delete-pagination branch from e233c65 to cce690a Compare September 19, 2024 14:57
le4ker
le4ker previously approved these changes Sep 19, 2024
@arielkr256 arielkr256 requested a review from darwayne September 25, 2024 18:33
@ben-githubs ben-githubs enabled auto-merge (squash) September 25, 2024 20:51
@ben-githubs ben-githubs merged commit 8e27e06 into main Sep 25, 2024
6 checks passed
@ben-githubs ben-githubs deleted the ben/delete-pagination branch September 25, 2024 20:54
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.

3 participants