I'm using the zones.list API (https://cloud.google.com/compute/docs/reference/rest/v1/zones/list) to list all zones in my project.
Every time I run this, it returns all 106 zones (which is literally the total number of possible zones).
My query:
Is there a filter I can use that will only return zones that has resources in it?
For example, my project has 4 zones with compute instances in them. I need the API to only return the names of those 4 zones, instead of all 106. I tried the filters mentioned in the above API documentation. None seemed to work.
Reason for my requirement: I'm trying to build an automation using our automation engine. It will make API calls and return the list of GCE instances in all projects, and perform other actions on them. Zone is a mandatory input field in the instances.list API call. I'm fetching the zones using the above API (zones.list), which returns all 106 zones every time. 500+ projects and 105 zones in each project => Takes a heavy toll on the automation's efficiency.
Please advise. Thanks.