Skip to content

Commit

Permalink
Merge pull request #284 from newscorp-ghfb/Story/IE-3315-Google-One-P…
Browse files Browse the repository at this point in the history
…rojects-Issue

IE-3315: Added filter to project query
  • Loading branch information
CarloGiannattasio authored Apr 22, 2024
2 parents 968995c + 8fb1859 commit 605ac03
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/c7n_org/scripts/gcpprojects.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ def main(output, exclude, buid, appscript):
"""
client = Session().client('cloudresourcemanager', 'v1', 'projects')

query_params = {'filter': f"parent.type:folder parent.id:{buid}"} if buid else {}
results = []
for page in client.execute_paged_query('list', {}):
for page in client.execute_paged_query('list', query_params):

for project in page.get('projects', []):

if buid and project["parent"]["id"] != buid:
continue

# Exclude App Script GCP Projects
if appscript == False:
if 'sys-' in project['projectId']:
Expand Down

0 comments on commit 605ac03

Please sign in to comment.