Siddharth
Siddharth

Reputation: 73

How to add filter in computeService.Zones.List(project) Google Cloud Platform API

I am trying to filter the zone list, in the Google Cloud Platform API

But I am not able to find any documentation in Google saying to put filter in the API:

req := computeService.Zones.List(project)

Above line of code will list the Zone in the Google Cloud Compute

in command line we can do the same

gcloud compute zones list --filter="name:us-"

Thanks, Sid

Upvotes: 0

Views: 935

Answers (1)

Siddharth
Siddharth

Reputation: 73

It will help someone in case:

req := computeService.Zones.List("ProjectName")
if err := req.Filter("name=us*").Pages(ctx, func(page *compute.ZoneList) error {
//Your code
}

Upvotes: 1

Related Questions