Skip to content

Commit

Permalink
Update gcpprojects.py
Browse files Browse the repository at this point in the history
Added troubleshooting code to analyze output for NUK.
  • Loading branch information
WCierkowski authored Jun 21, 2024
1 parent e140398 commit 9318e08
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/c7n_org/scripts/gcpprojects.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ def main(output, exclude, buid, appscript):
Generate a c7n-org gcp projects config file
"""
client = Session().client('cloudresourcemanager', 'v1', 'projects')
print("Client:", client)
print("**********************************************")


query_params = {'filter': f"parent.type:folder parent.id:{buid}"} if buid else {}
print("Query Params:", query_params)
print("**********************************************")

results = []
for page in client.execute_paged_query('list', query_params):
print("Page:", response)
print("**********************************************")

for project in page.get('projects', []):
print("Project:", project)
print("**********************************************")

# Exclude App Script GCP Projects
if appscript == False:
Expand All @@ -53,4 +63,4 @@ def main(output, exclude, buid, appscript):
yaml.safe_dump({'projects': results}, default_flow_style=False))

if __name__ == '__main__':
main()
main()

0 comments on commit 9318e08

Please sign in to comment.