Google API Gateway:通过 gcloud CLI 分配配置

问题描述

我正在寻找一种方法自动更新 Google Api Gateway 的配置,即在一个步骤中更改现有“API Gateway”实例的配置。

到目前为止我已经尝试过,假设新的 API 配置名称是“my-new-config”,API 网关名称是“my-gateway”:

  1. > gcloud beta api-gateway gateways update my-gateway --api-config=my-new-config --location=us-central1
    输出
    ERROR: (gcloud.beta.api-gateway.gateways.update) INVALID_ARGUMENT: update_mask does not contain any field paths
  2. > gcloud beta api-gateway gateways update my-gateway --api-config=my-new-config --location=us-central1 --display-name random-string-for-display-name
    输出
    命令成功执行,但未应用配置更改。

gcloud 版本:333.0.0
操作系统:Debian linux
我已在 Google 的问题跟踪器 (one,two) 中创建了 2 个票证,但 3 周后它们没有任何活动。

解决方法

尝试使用 aplha 而不是 beta 并指定 de API ID 标志 (--api):

gcloud alpha api-gateway gateways update my-gateway --api=api-id --api-config=my-new-config --location=us-central1

,

您在第 2 步中遗漏了 --api 标志,这似乎是必需的。看起来没有指定,它不会提出正确的请求。