Skip to content

Commit

Permalink
IE-3315: Revised filtering for GCP BU Folder ID's
Browse files Browse the repository at this point in the history
  • Loading branch information
WCierkowski committed Apr 22, 2024
1 parent c8eec25 commit 10018cd
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 10018cd

Please sign in to comment.