如何在computeService.Zones.List(项目)中添加过滤器Google Cloud Platform API

问题描述 投票:0回答:1

我正在尝试过滤Google Cloud Platform API中的区域列表

但我无法在Google中找到任何说明在API中添加过滤器的文档:

req := computeService.Zones.List(project)

上面的代码行将列出Google Cloud Compute中的区域

在命令行中我们也可以这样做

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

谢谢,希德

go google-cloud-platform
1个回答
1
投票

在以下情况下它会帮助某人:

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

© www.soinside.com 2019 - 2024. All rights reserved.