google-cloud-storage - Google Cloud API Gateway 端点如何从 Cloud Storage 文件传送数据?

标签 google-cloud-storage google-cloud-iam google-cloud-api-gateway

我正在构建一个大型 API,该 API 将使用 Google Cloud API Gateway 将各种端点路由到不同的服务——有些可能是无服务器的 Cloud Functions,其他的将由我们 Kubernetes 集群中的 Rails 应用程序提供服务,等等。
我们将选择一些需要来自客户端的未经身份验证的访问的信息端点,这些信息很少会改变——大约每隔几个月一次。我希望将这些端点的内容写入谷歌云存储(在一个世界可读的存储桶中),然后允许 API 网关配置将特定端点指向它们(世界可读的存储桶不会满足本项目的安全标准)。
我为 API 网关创建了一个自定义服务帐户,并给它一个 存储对象查看器 相关存储桶的角色。
但是,在使用该服务帐户创建 API 配置并在 Postman 中请求端点后,我看到的是 Google 登录页面的 HTML,而不是我预期的 JSON 输出。
我的 OpenAPI 配置中的端点定义:

paths:
  /products:
    get:
      x-google-backend:
        address: https://storage.cloud.google.com/<BUCKET_NAME>/products.json
      summary: List of products in JSON format
      operationId: listProductsJson
      produces:
        - application/json
      responses:
        "200":
          description: a product list
          schema:
            type: array
            items:
              $ref: '#/definitions/Product'
这是 postman 的回应:
Postman screen grab showing Google login HTML
有没有办法让这个设置工作,甚至调试这里发生的事情?我看到人们对 Cloud Functions 和 JWT 有类似的困扰 aud值(value),但遵循对他们有用的方法似乎对 Cloud Storage 没有任何影响。
任何帮助将非常感激! (我是 GCloud 世界的新手,所以如果有人有这些主要是静态端点的替代实现,那也很酷。)

最佳答案

您没有使用正确的 URL。使用 https://storage.googleapis.com/<BUCKET_NAME>/products.json而不是 https://storage.cloud.google.com/<BUCKET_NAME>/products.json

关于google-cloud-storage - Google Cloud API Gateway 端点如何从 Cloud Storage 文件传送数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67181297/

相关文章:

reactjs - 尝试从新的 Google Cloud API Gateway 获取时出现 CORS 错误

scala - 如何使用 Spark-Scala 本地程序从谷歌云存储中读取简单的文本文件

api - 谷歌云平台 : List available projects using api

google-cloud-platform - Google API Gateway 和 Cloud Endpoints 的区别

google-cloud-platform - 通过 VPC/VPN 的 Google 托管服务(BigQuery、云存储等)

google-cloud-platform - 在 Terraform for GCP 中允许帐户和角色时出错

google-cloud-platform - Google Cloud (API GATEWAY) 自定义域

amazon-s3 - Airflow/minio : How do I use minio as a local S3 proxy for data sent from Airflow?

erlang - 如何使用 Elixir 或 Erlang 创建谷歌云存储签名 URL?

python - 来自 GAE 的 Cloud Storage API 请求 - 403 访问未配置