我正在尝试根据区域和名称条件列出我的计算磁盘。
但是,以下命令:
data
a )不会返回任何结果,尽管存在 IS 这样的磁盘
▶ gcloud compute disks list --filter="zone=europe-west4-a AND name=redash-postgres-data"
WARNING: --filter : operator evaluation is changing for consistency across Google APIs. zone=europe-west4-a currently does not match but will match in the near future. Run `gcloud topic filters` for details.
Listed 0 items.
b ),我们应该如何制定查询条件,以便根据上述警告为将来提供证明?我使用的示例是通过运行上述警告消息所建议的▶ gcloud compute disks list
NAME LOCATION LOCATION_SCOPE SIZE_GB TYPE STATUS
redash-postgres-data us-east4-b zone 50 pd-standard READY
gke-redash-test-cluster-redash-pool1-4db01a9f-1986 europe-west4-a zone 100 pd-standard READY
gke-redash-test-cluster-redash-pool1-4db01a9f-t34m europe-west4-a zone 100 pd-standard READY
redash-postgres-data europe-west4-a zone 60 pd-standard READY
来自帮助返回的信息
答案 0 :(得分:3)
编辑:Kolban @链接的documentation实际上还提到了与简单模式匹配并允许使用短区域名称的另一种语法:
--filter="zone:( us-east4-a )"
因此您的gcloud命令实际上可以如下所示:
gcloud compute disks list --filter="zone:( us-east4-a) AND name=redash-postgres-data"
通过gcloud compute disks describe disk_name
检查磁盘资源时,您会看到,在其他信息旁边,该区域被描述为完全合格的URL:
https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/us-east4-a
使用此完整URL过滤list
命令将起作用:
gcloud compute disks list --filter="zone=https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/us-east4-a AND name=redash-postgres-data"