{"id":93,"date":"2023-05-22T18:57:36","date_gmt":"2023-05-22T17:57:36","guid":{"rendered":"https:\/\/livingdevops.com\/?p=93"},"modified":"2025-04-03T16:57:52","modified_gmt":"2025-04-03T15:57:52","slug":"google-cloud-resource-manager-listing-projects-python","status":"publish","type":"post","link":"https:\/\/livingdevops.com\/gcp\/google-cloud-resource-manager-listing-projects-python\/","title":{"rendered":"How to List All Projects in Google Cloud Organization Using Python and gcloud"},"content":{"rendered":"\n<h2 class=\"wp-block-heading has-palette-color-3-color has-text-color has-link-color wp-elements-d9ad4c19fd4f1e642fd67053dd45ec8b\">GCP Project: Listing all projects under a Google Cloud organization with Python<\/h2>\n\n\n\n<p>When working on Google Cloud Platform, we often need to list all GCP projects under an organization. This is a common task for cloud administrators, and there are two main approaches to do this: using the <code>gcloud<\/code> command-line tool or Python with the Resource Manager API.<\/p>\n\n\n\n<p>In this comprehensive guide, I&#8217;ll walk you through both methods step-by-step, focusing on how to efficiently retrieve a complete list of all projects across your entire GCP organization.<\/p>\n\n\n\n<p>But before we start, let me talk about GCP Org Hierarchy, which is important to understand before we write the code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/livingdevops.com\/wp-content\/uploads\/2023\/05\/gcp-org-hirearcy-1024x755.jpg\" alt=\"gcp list all projects in organization\" class=\"wp-image-754\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">GCP Resource Hierarchy Structure<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Organization<\/strong> (Blue) &#8211; The top-level node and root of the hierarchy\n<ul class=\"wp-block-list\">\n<li>Represents an entire company or organization<\/li>\n\n\n\n<li>Allows centralized visibility and control<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Folders<\/strong> (Orange) &#8211; Grouping mechanism for organizing resources\n<ul class=\"wp-block-list\">\n<li>Can be nested (like Team A folder inside Development)<\/li>\n\n\n\n<li>Often represent departments, teams, or environments<\/li>\n\n\n\n<li>Create logical boundaries for applying policies<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Projects<\/strong> (Green) &#8211; Containers for Google Cloud resources\n<ul class=\"wp-block-list\">\n<li>All resources must belong to a project<\/li>\n\n\n\n<li>Projects can exist directly under an organization or within folders<\/li>\n\n\n\n<li>Provide isolation boundaries for billing and access control<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Resources<\/strong> (Red) &#8211; The actual cloud services\n<ul class=\"wp-block-list\">\n<li>Virtual machines, databases, storage buckets, etc.<\/li>\n\n\n\n<li>Always belong to a project<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Key Points About the Hierarchy<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Inheritance<\/strong>: IAM policies and organization policies flow down the hierarchy<\/li>\n\n\n\n<li><strong>Flexibility<\/strong>: Projects can be directly under the organization or nested in folders<\/li>\n\n\n\n<li><strong>Isolation<\/strong>: Projects provide isolation for resources and billing<\/li>\n\n\n\n<li><strong>Organization<\/strong>: The diagram shows common patterns like having separate folders for Development, Production, and Infrastructure<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Using gcloud to List All Projects in an Organization<\/h2>\n\n\n\n<p>The quickest way to list all projects in your GCP organization is using the <code>gcloud<\/code> command-line tool. Let&#8217;s start with this approach.<\/p>\n\n\n\n<pre class=\"wp-block-code has-pale-cyan-blue-background-color has-background\"><code># List all projects in the organization\ngcloud projects list --filter=\"parent.id:&#91;ORGANIZATION_ID]\" --format=\"table(projectId,name,projectNumber)\"\n<\/code><\/pre>\n\n\n\n<p>Replace <code>[ORGANIZATION_ID]<\/code> with your actual organization ID (without the &#8220;organizations\/&#8221; prefix).<\/p>\n\n\n\n<p>This command will list all projects that are directly under your organization, but it won&#8217;t show projects nested inside folders. To get a complete list including all projects in folders, we need a different approach.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Python is Better for Listing All Projects in a GCP Organization<\/h2>\n\n\n\n<p>While the <code>gcloud<\/code> command is simple, it has limitations when dealing with complex organizational structures. Here&#8217;s why Python with the Resource Manager API is better:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Complete hierarchy traversal<\/strong>: Python can recursively go through all folders and subfolders<\/li>\n\n\n\n<li><strong>Customizable output<\/strong>: You can format and filter the results exactly as needed<\/li>\n\n\n\n<li><strong>Automation-friendly<\/strong>: Easy to integrate with other systems and scheduled tasks<\/li>\n\n\n\n<li><strong>Complex filtering<\/strong>: Apply advanced filters based on any project property<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Using Python to List All Projects in a GCP Organization<\/h2>\n\n\n\n<p>Now, let&#8217;s dive into the Python approach, which will give us a complete view of all projects across the entire organization hierarchy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create a Service Account with the Right Permissions<\/h3>\n\n\n\n<p>First, we need to create a service account with appropriate permissions to view the organization structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Set the project in cloud shell\ngcloud config set project someproject\n\n# Create a service account\ngcloud iam service-accounts create rm-svc \\\n    --description=\"Service account for listing GCP projects\" \\\n    --display-name=\"resource-manager-list\"\n\n# Assign organization-level permission to the service account\ngcloud organizations add-iam-policy-binding \\ \nORGANIZATION_ID --member=\"serviceAccount:rm-svc@someproject.iam.gserviceaccount.com\" \\\n --role=\"roles\/resourcemanager.folderViewer\"\n\n# Create a key for the service account\ngcloud iam service-accounts keys create rm-svc.json --iam-account  \\\nrm-svc@someproject.iam.gserviceaccount.com\n<\/code><\/pre>\n\n\n\n<p>The key file will look something like this (with actual values instead of placeholders):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"type\": \"service_account\",\n  \"project_id\": \"someproject\",\n  \"private_key_id\": \"...\",\n  \"private_key\": \"...\",\n  \"client_email\": \"rm-svc@someproject.iam.gserviceaccount.com\",\n  \"client_id\": \"...\",\n  \"auth_uri\": \"https:\/\/accounts.google.com\/o\/oauth2\/auth\",\n  \"token_uri\": \"https:\/\/oauth2.googleapis.com\/token\",\n  \"auth_provider_x509_cert_url\": \"https:\/\/www.googleapis.com\/oauth2\/v1\/certs\",\n  \"client_x509_cert_url\": \"...\"\n}\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>Note<\/strong>: There are many better ways to run the code than creating keys, such as using short-lived credentials, but I want to keep it simple for demo purposes.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Authenticate as the Service Account<\/h3>\n\n\n\n<p>Next, we&#8217;ll impersonate the service account to run our Python code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud auth activate-service-account --key-file=rm-svc.json\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Install the Required Python Library<\/h3>\n\n\n\n<p>We need to install the Python client for the Resource Manager:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Assuming you already have Python and pip installed\npip install google-cloud-resource-manager \n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Write the Python Script to List All GCP Projects<\/h3>\n\n\n\n<p>Create a file named <code>list_all_gcp_projects.py<\/code> with the following code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from google.cloud import resourcemanager_v3\n\ndef get_folders(\n    parent_id = \"organizations\/ORGANIZATION_ID\",\n    folders = None):\n    \"\"\"\n    Recursively retrieves all folders in the organization.\n    \n    This function walks through the entire folder hierarchy starting\n    from the organization and collects all folder IDs, including nested folders.\n    \n    Args:\n        parent_id: The starting point (organization ID or folder ID)\n        folders: Accumulator list for recursion\n        \n    Returns:\n        List containing all folder IDs in the organization\n    \"\"\"\n    if folders is None:\n        folders = &#91;]\n\n    # Create a client for accessing folders\n    client = resourcemanager_v3.FoldersClient()\n    \n    # Prepare the request to list folders under the parent\n    request = resourcemanager_v3.ListFoldersRequest(\n        parent=parent_id,\n    )\n\n    # Get all folders under the parent\n    page_result = client.list_folders(request=request)\n    \n    # For each folder found, add it to our list and then search its subfolders\n    for folder in page_result:\n        folders.append(folder.name)\n        # Recursive call to find subfolders\n        get_folders(parent_id=folder.name, folders=folders)\n        \n    return folders\n\ndef search_projects(folder_id):\n    \"\"\"\n    Finds all projects under a specific folder.\n    \n    Args:\n        folder_id: The folder ID to search under\n        \n    Returns:\n        List of project objects found in the folder\n    \"\"\"\n    # Create a client for accessing projects\n    client = resourcemanager_v3.ProjectsClient()\n\n    # Create a query to find projects under the specified folder\n    query = f\"parent:{folder_id}\"\n    request = resourcemanager_v3.SearchProjectsRequest(query=query)\n    \n    # Get all projects under the folder\n    page_result = client.search_projects(request=request)\n    \n    # Collect all projects into a list\n    search_result = &#91;]\n    for project in page_result:\n        search_result.append(project)\n        \n    return search_result\n\ndef search_org_projects(org_id):\n    \"\"\"\n    Finds all projects directly under the organization (not in folders).\n    \n    Args:\n        org_id: The organization ID to search under\n        \n    Returns:\n        List of project objects found directly under the organization\n    \"\"\"\n    # Create a client for accessing projects\n    client = resourcemanager_v3.ProjectsClient()\n\n    # Create a query to find projects directly under the organization\n    query = f\"parent:{org_id}\"\n    request = resourcemanager_v3.SearchProjectsRequest(query=query)\n    \n    # Get all projects under the organization\n    page_result = client.search_projects(request=request)\n    \n    # Collect all projects into a list\n    search_result = &#91;]\n    for project in page_result:\n        search_result.append(project)\n        \n    return search_result\n\ndef list_all_projects():\n    \"\"\"\n    Lists all projects in the entire organization.\n    \n    This function:\n    1. Gets all projects directly under the organization\n    2. Gets all folders in the organization\n    3. Gets all projects in each folder\n    4. Combines the results and filters for active projects\n    \n    Returns:\n        List of all active project IDs in the organization\n    \"\"\"\n    active_projects = &#91;]\n    organization_id = \"organizations\/ORGANIZATION_ID\"\n    \n    # Step 1: Get projects directly under the organization\n    print(f\"Searching for projects directly under the organization...\")\n    org_projects = search_org_projects(organization_id)\n    for project in org_projects:\n        if str(project.state) == \"State.ACTIVE\":\n            active_projects.append(project.project_id)\n    \n    print(f\"Found {len(active_projects)} projects directly under the organization\")\n    \n    # Step 2 &amp; 3: Get all folders and the projects within them\n    print(f\"Searching for folders in the organization...\")\n    folders = get_folders(parent_id=organization_id, folders=None)\n    print(f\"Found {len(folders)} folders to check\")\n    \n    # Step 4: Find projects in each folder\n    for i, folder in enumerate(folders):\n        print(f\"Searching folder {i+1}\/{len(folders)}: {folder}\")\n        folder_projects = search_projects(folder)\n        \n        for project in folder_projects:\n            if str(project.state) == \"State.ACTIVE\":\n                active_projects.append(project.project_id)\n    \n    return active_projects\n\nif __name__ == \"__main__\":\n    print(\"Starting search for all GCP projects in the organization...\")\n    projects = list_all_projects()\n    print(f\"\\nSummary: Found {len(projects)} active projects in the organization\")\n    print(\"\\nProject list:\")\n    for project in projects:\n        print(f\"- {project}\")\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>Important<\/strong>: Replace <code>ORGANIZATION_ID<\/code> with your actual Google Cloud Organization ID in two places in the script.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Run the Script<\/h3>\n\n\n\n<p>Now we can run our Python script to list all GCP projects:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 list_all_gcp_projects.py\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">How the Python Script Works: Code Breakdown<\/h2>\n\n\n\n<p>Let&#8217;s understand how the script works in detail:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. The Folder Traversal Function<\/h3>\n\n\n\n<p>The <code>get_folders()<\/code> function is the foundation of our solution. It uses recursion to walk through the entire folder hierarchy:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def get_folders(parent_id = \"organizations\/ORGANIZATION_ID\", folders = None):\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Starting point<\/strong>: It begins with the organization and recursively explores all folders<\/li>\n\n\n\n<li><strong>Recursion<\/strong>: For each folder found, it calls itself to find sub-folders<\/li>\n\n\n\n<li><strong>Accumulation<\/strong>: It builds a list of all folder IDs during the process<\/li>\n<\/ul>\n\n\n\n<p>This recursive approach ensures we discover all folders regardless of how deeply nested they are in the organization.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. The Project Search Functions<\/h3>\n\n\n\n<p>We have two project search functions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def search_projects(folder_id):\n    # Find projects in a folder\n    \ndef search_org_projects(org_id):\n    # Find projects directly under the organization\n<\/code><\/pre>\n\n\n\n<p>These functions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a Resource Manager client<\/li>\n\n\n\n<li>Build a query to find projects under a specific parent<\/li>\n\n\n\n<li>Execute the query and collect the results<\/li>\n<\/ul>\n\n\n\n<p>The key difference is that one searches folders, while the other searches directly under the organization.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. The Main List Function<\/h3>\n\n\n\n<p>The <code>list_all_projects()<\/code> function brings everything together:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def list_all_projects():\n<\/code><\/pre>\n\n\n\n<p>This function:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Finds projects directly under the organization<\/li>\n\n\n\n<li>Gets all folders in the organization<\/li>\n\n\n\n<li>Searches each folder for projects<\/li>\n\n\n\n<li>Filters out any non-active projects<\/li>\n\n\n\n<li>Returns a complete list of active project IDs<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">4. The Output<\/h3>\n\n\n\n<p>The script provides detailed progress information:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Shows how many projects are directly under the organization<\/li>\n\n\n\n<li>Reports the total number of folders found<\/li>\n\n\n\n<li>Shows progress as it searches each folder<\/li>\n\n\n\n<li>Provides a final summary and complete project list<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Enhancing the Script for More Information<\/h2>\n\n\n\n<p>The basic script gives us a list of project IDs, but what if we want more details? Let&#8217;s enhance it to include more information:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def list_projects_with_details():\n    \"\"\"\n    Lists all projects with additional details.\n    \n    Returns:\n        Dictionary of project details by project ID\n    \"\"\"\n    project_details = {}\n    organization_id = \"organizations\/ORGANIZATION_ID\"\n    \n    # Get projects directly under the organization\n    org_projects = search_org_projects(organization_id)\n    for project in org_projects:\n        if str(project.state) == \"State.ACTIVE\":\n            project_details&#91;project.project_id] = {\n                \"name\": project.display_name,\n                \"number\": project.project_number,\n                \"parent\": \"organization\",\n                \"create_time\": project.create_time.isoformat(),\n                \"labels\": dict(project.labels)\n            }\n    \n    # Get all folders\n    folders = get_folders(parent_id=organization_id, folders=None)\n    folder_names = {}\n    \n    # Get folder names for better reporting\n    client = resourcemanager_v3.FoldersClient()\n    for folder_path in folders:\n        folder_id = folder_path.split('\/')&#91;-1]\n        request = resourcemanager_v3.GetFolderRequest(name=folder_path)\n        folder = client.get_folder(request=request)\n        folder_names&#91;folder_path] = folder.display_name\n    \n    # Get projects in each folder\n    for folder in folders:\n        folder_projects = search_projects(folder)\n        for project in folder_projects:\n            if str(project.state) == \"State.ACTIVE\":\n                project_details&#91;project.project_id] = {\n                    \"name\": project.display_name,\n                    \"number\": project.project_number,\n                    \"parent\": f\"folder:{folder_names.get(folder, folder)}\",\n                    \"create_time\": project.create_time.isoformat(),\n                    \"labels\": dict(project.labels)\n                }\n    \n    return project_details\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Exporting Results to CSV for Reporting<\/h2>\n\n\n\n<p>Let&#8217;s add a function to export our results to a CSV file for easy reporting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import csv\nfrom datetime import datetime\n\ndef export_to_csv(project_details):\n    \"\"\"\n    Export project details to a CSV file\n    \n    Args:\n        project_details: Dictionary of project details\n    \"\"\"\n    timestamp = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\n    filename = f\"gcp_projects_{timestamp}.csv\"\n    \n    with open(filename, 'w', newline='') as csvfile:\n        fieldnames = &#91;\"project_id\", \"name\", \"number\", \"parent\", \"create_time\", \"labels\"]\n        writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n        \n        writer.writeheader()\n        for project_id, details in project_details.items():\n            row = {\"project_id\": project_id}\n            row.update(details)\n            # Convert labels dictionary to string\n            row&#91;\"labels\"] = \", \".join(&#91;f\"{k}={v}\" for k, v in details&#91;\"labels\"].items()])\n            writer.writerow(row)\n    \n    print(f\"Exported project data to {filename}\")\n\n# Using it in the main function\nif __name__ == \"__main__\":\n    print(\"Getting detailed information for all GCP projects...\")\n    project_details = list_projects_with_details()\n    print(f\"Found {len(project_details)} active projects\")\n    \n    # Export to CSV\n    export_to_csv(project_details)\n    \n    # Print summary\n    print(\"\\nProject summary:\")\n    for project_id, details in project_details.items():\n        print(f\"- {project_id} ({details&#91;'name']}): {details&#91;'parent']}\")\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Common Issues and Troubleshooting<\/h2>\n\n\n\n<p>When listing projects across a GCP organization, you might encounter these common issues:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Permission Denied Errors<\/h3>\n\n\n\n<p>If you see <code>Permission Denied<\/code> errors, check:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The service account has the correct roles (<code>resourcemanager.folderViewer<\/code> and <code>resourcemanager.projectViewer<\/code>)<\/li>\n\n\n\n<li>You&#8217;ve activated the service account correctly<\/li>\n\n\n\n<li>The organization policy allows the service account to access the resources<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Missing Projects<\/h3>\n\n\n\n<p>If projects are missing from your results:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure the script recursively searches all folders (our implementation does this)<\/li>\n\n\n\n<li>Check if you&#8217;re filtering out projects that aren&#8217;t in the &#8220;ACTIVE&#8221; state<\/li>\n\n\n\n<li>Verify that the service account has access to all folders<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. Rate Limiting<\/h3>\n\n\n\n<p>For very large organizations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add delays between API calls using <code>time.sleep()<\/code><\/li>\n\n\n\n<li>Implement exponential backoff for retries<\/li>\n\n\n\n<li>Consider paginating results for better performance<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Applications for GCP Project Listing<\/h2>\n\n\n\n<p>Here are some real-world use cases for listing all projects in your GCP organization:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Resource Inventory<\/strong>: Create a complete inventory of all your GCP resources<\/li>\n\n\n\n<li><strong>Cost Management<\/strong>: Identify orphaned or unused projects to reduce costs<\/li>\n\n\n\n<li><strong>Security Audits<\/strong>: Ensure all projects comply with security policies<\/li>\n\n\n\n<li><strong>Compliance Reporting<\/strong>: Generate reports for compliance requirements<\/li>\n\n\n\n<li><strong>Project Governance<\/strong>: Enforce naming conventions and organizational structure<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion: Choosing the Right Approach<\/h2>\n\n\n\n<p>We&#8217;ve explored two methods for listing all projects in a Google Cloud organization:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Using gcloud<\/strong>: Simple but limited to direct children of the organization<\/li>\n\n\n\n<li><strong>Using Python<\/strong>: More complex but provides a complete view of all projects<\/li>\n<\/ol>\n\n\n\n<p>For most real-world scenarios, the Python approach is superior because it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Handles complex organizational structures with nested folders<\/li>\n\n\n\n<li>Provides detailed information about each project<\/li>\n\n\n\n<li>Can be automated and integrated with other systems<\/li>\n\n\n\n<li>Allows for custom filtering and processing of results<\/li>\n<\/ul>\n\n\n\n<p>With the Python script provided, you can now efficiently list all projects across your entire GCP organization, regardless of how complex your hierarchy is.<\/p>\n\n\n\n<p>We can use the Resource Manager API to do so much more than this &#8211; from managing project hierarchies to implementing custom governance policies. The possibilities are vast!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GCP Project: Listing all projects under a Google Cloud organization with Python When working on Google Cloud Platform, we often need to list all GCP projects under an organization. This is a common task for cloud administrators, and there are two main approaches to do this: using the gcloud command-line tool or Python with the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":95,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-93","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gcp","category-python"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/comments?post=93"}],"version-history":[{"count":7,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":755,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/posts\/93\/revisions\/755"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/media\/95"}],"wp:attachment":[{"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/livingdevops.com\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}