I want to get a list of instances through GCP rest API by filtering the ones which have aliasIpRanges within ipCidrRange.
I tried networkInterfaces.aliasIpRanges.ipCidrRange = <requiredrange>
, which works with GCP Python SDK, but doesn't work directly with rest API call.
It says Invalid value for field 'filter': 'networkInterfaces.aliasIpRanges.ipCidrRange=\"\"'. Invalid list filter expression.
There is a public issue about the 'instances.list' method of the rest API. You can use the 'gcloud' CLI as a workaround until the bug gets fixed, and here are one example based in your API query.
gcloud compute instances list --project [PROJECT_NAME] --filter='networkInterfaces.aliasIpRanges.ipCidrRange="[REQUIRED_RANGE]"'