-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(api): add resource group overview endpoint and filtering #9694
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
Merged
Alan-TheGentleman
merged 23 commits into
master
from
PROWLER-37-resource-inventory-component-api
Jan 15, 2026
Merged
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
fbb8e72
docs: add ResourceGroup field specification to developer guide
AdriiiPRodri a706182
chore: rename identity to IAM
AdriiiPRodri 52750ad
feat(api): add resource group overview endpoint and filtering
AdriiiPRodri 8d03474
test(api): add unit tests
AdriiiPRodri 7b8ff8d
chore: update changelog
AdriiiPRodri 00c3f13
chore: restore v1
AdriiiPRodri 7da6735
refactor(api): remove fallback
AdriiiPRodri ab0613b
refactor(api): change to TextField
AdriiiPRodri 4a7c243
chore: remove duplicated entry
AdriiiPRodri f79f1d3
feat(api): add resource_group field to Resource model
Alan-TheGentleman 6482535
refactor(api): remove resource_group backfill migration
Alan-TheGentleman c8d8516
feat(api): add resource_groups to resources metadata endpoints
Alan-TheGentleman 4447382
refactor(api): rename resource_group to group in Resource model
Alan-TheGentleman e9fbf58
refactor(api): rename resource_group to group across Finding and Summ…
Alan-TheGentleman 04b9874
refactor(api): rename resource_group to group
AdriiiPRodri 842f4c2
Merge branch 'master' into PROWLER-37-resource-inventory-component-api
vicferpoy 9cf543f
feat: add resource group model and fields
vicferpoy 84347fd
feat: add resource group overview endpoint and filters
vicferpoy 4d4fa1b
feat: implement resource group aggregation in scan and backfill
vicferpoy 5791b03
test: add resource group feature tests
vicferpoy bdf5751
docs: update API spec and changelog for resource groups
vicferpoy cfa194d
style: apply ruff
vicferpoy a3581f5
fix: use kebab-case for response objects
vicferpoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
api/src/backend/api/migrations/0066_finding_resource_group_scanresourcegroupsummary.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| import uuid | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
| import api.db_utils | ||
| import api.rls | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("api", "0065_alibabacloud_provider"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="finding", | ||
| name="resource_group", | ||
| field=models.CharField( | ||
jfagoagas marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| blank=True, | ||
| help_text="Resource group from check metadata for efficient filtering", | ||
| max_length=50, | ||
| null=True, | ||
| ), | ||
| ), | ||
| migrations.CreateModel( | ||
| name="ScanResourceGroupSummary", | ||
josemazo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fields=[ | ||
| ( | ||
| "id", | ||
| models.UUIDField( | ||
| default=uuid.uuid4, | ||
| editable=False, | ||
| primary_key=True, | ||
| serialize=False, | ||
| ), | ||
| ), | ||
| ( | ||
| "tenant", | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| to="api.tenant", | ||
| ), | ||
| ), | ||
| ( | ||
| "inserted_at", | ||
| models.DateTimeField(auto_now_add=True), | ||
| ), | ||
| ( | ||
| "scan", | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| related_name="resource_group_summaries", | ||
| related_query_name="resource_group_summary", | ||
| to="api.scan", | ||
| ), | ||
| ), | ||
| ( | ||
| "resource_group", | ||
| models.CharField(max_length=50), | ||
| ), | ||
| ( | ||
| "severity", | ||
| api.db_utils.SeverityEnumField( | ||
| choices=[ | ||
| ("critical", "Critical"), | ||
| ("high", "High"), | ||
| ("medium", "Medium"), | ||
| ("low", "Low"), | ||
| ("informational", "Informational"), | ||
| ], | ||
| ), | ||
| ), | ||
| ( | ||
| "total_findings", | ||
| models.IntegerField( | ||
| default=0, help_text="Non-muted findings (PASS + FAIL)" | ||
| ), | ||
| ), | ||
| ( | ||
| "failed_findings", | ||
| models.IntegerField( | ||
| default=0, | ||
| help_text="Non-muted FAIL findings (subset of total_findings)", | ||
| ), | ||
| ), | ||
| ( | ||
| "new_failed_findings", | ||
| models.IntegerField( | ||
| default=0, | ||
| help_text="Non-muted FAIL with delta='new' (subset of failed_findings)", | ||
| ), | ||
| ), | ||
| ( | ||
| "resources_count", | ||
| models.IntegerField( | ||
| default=0, help_text="Count of distinct resource_uid values" | ||
| ), | ||
| ), | ||
| ], | ||
| options={ | ||
| "db_table": "scan_resource_group_summaries", | ||
| "abstract": False, | ||
| }, | ||
| ), | ||
| migrations.AddIndex( | ||
| model_name="scanresourcegroupsummary", | ||
| index=models.Index( | ||
| fields=["tenant_id", "scan"], name="srgs_tenant_scan_idx" | ||
| ), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name="scanresourcegroupsummary", | ||
| constraint=models.UniqueConstraint( | ||
| fields=("tenant_id", "scan_id", "resource_group", "severity"), | ||
| name="unique_resource_group_severity_per_scan", | ||
| ), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name="scanresourcegroupsummary", | ||
| constraint=api.rls.RowLevelSecurityConstraint( | ||
| field="tenant_id", | ||
| name="rls_on_scanresourcegroupsummary", | ||
| statements=["SELECT", "INSERT", "UPDATE", "DELETE"], | ||
| ), | ||
| ), | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.