Google Cloud,带有过滤器的 compute.instances.aggregatedList 失败

Jac*_*ssa 5 google-api google-cloud-platform google-apis-explorer

compute.instances.aggregatedList 的谷歌云 API 包括过滤器参数。 https://cloud.google.com/compute/docs/reference/rest/beta/instances/aggregatedList

我使用 (status eq "RUNNING") 作为过滤器来查看我所有正在运行的实例。

我想要一个更详细的标准,例如使用标签和/或其他术语的标准,但是即使是 Google 文档术语(使用 OR 运算符)也会返回错误,例如 - 即使是 Google 文档示例:(cpuPlatform = "Intel Skylake") 或 (cpuPlatform = "Intel Broadwell") 失败并出现错误 400:

"message": "字段 'filter' 的值无效:' (cpuPlatform = \"Intel Skylake\") OR (cpuPlatform = \"Intel Broadwell\")'。列表过滤器表达式无效。"

看起来好像不接受“=”符号,也不接受 AND/OR 运算符。此 API 的正确格式是什么。

Lax*_*sad 5

当我在 google-api-python-client 中使用“=”而不是“eq”时,我遇到了同样的问题。我需要使用标签来过滤聚合实例列表。一开始我用的是

filter="labels.projectid=test-project"
Run Code Online (Sandbox Code Playgroud)

它在聚合列表中返回 400 错误,但如果查询特定区域的实例则成功。

当我使用过滤器时,我成功地获得了列表

filter="labels.projectid eq \"test-project\""
Run Code Online (Sandbox Code Playgroud)

或者

filter = "labels.projectid eq test-project"
Run Code Online (Sandbox Code Playgroud)

我什至使用谷歌提供的 REST-Client 对其进行了测试,并且它有效。参考: https: //issuetracker.google.com/80238913