简体   繁体   English

是否有 Google Cloud Run node.js 包/示例/文档?

[英]Is there a Google Cloud Run node.js package / samples / docs?

I've been searching the web, npm, SO, the google cloud docs site, and anywhere else I can think of for a node.js package for Google Cloud Run, so that I can deploy a GCR container programmatically, to no avail.我一直在搜索网络、npm、SO、google cloud docs 站点,以及我能想到的任何其他地方,以获取用于 Google Cloud Run 的 node.js 包,以便我可以以编程方式部署 GCR 容器,但无济于事。 Is there one I'm missing?有我失踪的吗?

It appears the only way to invoke Google Cloud Run API's is via the REST API [1].似乎调用 Google Cloud Run API 的唯一方法是通过 REST API [1]。 There does not appear to be a guide on how to call these API's.似乎没有关于如何调用这些 API 的指南。

I can more or less deduce how to do this by logging the http calls from the gcloud SDK command [2], but surely there is a better way?我可以通过记录来自 gcloud SDK 命令 [2] 的 http 调用或多或少地推断出如何做到这一点,但肯定有更好的方法吗?

[1] https://cloud.google.com/run/docs/reference/rest [1] https://cloud.google.com/run/docs/reference/rest

[2] gcloud run deploy <service-name> --platform managed --image gcr.io/<project>/<service-name> --log-http [2] gcloud run deploy <service-name> --platform managed --image gcr.io/<project>/<service-name> --log-http

In short: Does not exist yet.简而言之:尚不存在。

Since Cloud Run is relatively new, and is GA since last November , it seems that package you are looking does not exists yet.由于 Cloud Run 相对较新,并且从去年 11 月开始GA ,因此您正在寻找的软件包似乎还不存在。

From here what I can tell you is that you can:从这里我可以告诉你的是,你可以:

  1. File a Feature Request in the Cloud Run Issue Tracker , so the team developing the product will be aware that there are people asking for this.Cloud Run Issue Tracker 中提交功能请求,以便开发产品的团队知道有人要求这样做。
  2. Build your own basic client library.构建您自己的基本客户端库。 Here you have a Google tutorial for creating a simple library using a Google API .这里有一个使用 Google API 创建简单库Google 教程 I'm afraid this one would be time consuming, but faster than waiting for the Feature Request that I mentioned in 1恐怕这会很耗时,但比等待我在 1 中提到的功能请求要快

UPDATE更新

Google support has replied here . Google 支持已在此处回复。

I think this may be the API you are looking for.我认为可能是您正在寻找的 API。 Please say if otherwise.否则请说。

Notice this seems to be a generic code-generated Nodejs client library, and documentation is pretty lacking.请注意,这似乎是一个通用代码生成的 Nodejs 客户端库,并且文档非常缺乏。 No examples either.也没有例子。

When you are stuck with Client library, because the library doesn't exists or it's not up-to-date, you can use the discovery API当您使用客户端库时,由于库不存在或不是最新的,您可以使用发现 API

On Cloud Run documentation you have the reference of the endpoint: https://run.googleapis.com/ $discovery/rest?version=v1Cloud Run 文档中,您可以参考端点: https : //run.googleapis.com/$discovery/rest ?version=v1

For using it in NodeJS, you can use the googleapis library要在 NodeJS 中使用它,您可以使用googleapis 库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM