https://myfunction.com
https://myfunction.com/thisroute
update1
似乎,就像我们可以使用端点服务一样。但是它仍然不清楚是否可以与GCF一起使用。 cloud端点充当云功能的API网关。
cloud函数https:// [cloud_function_region] .cloudfunctions.net/my-function
,cloud shell中的set项目ID
gcloud config set project [PROJECT_ID]
部门ESPV2 Beta到云运行。用要用于服务的名称替换gcloud run deploy CLOUD_RUN_SERVICE_NAME \
--image="gcr.io/endpoints-release/endpoints-runtime-serverless:2" \
--allow-unauthenticated \
--platform managed
在执行命令的末尾,它将具有类似的详细信息
https://cloud_run_service_name-65zrpjcu3q-uk.a.run.app
注意主机名从上述命令(
cloud_run_service_name-65zrpjcu3q-uk.a.run.app
)openapiSpecconfig:
swagger: '2.0'
info:
title: Cloud Endpoints + GCF
description: Sample API on Cloud Endpoints with a Google Cloud Functions backend
version: 1.0.0
host: CLOUD_RUN_SERVICE_NAME-65zrpjcu3q-uk.a.run.app
schemes:
- https
produces:
- application/json
paths:
/thisroute:
get:
summary: Custom function route
x-google-backend:
address: https://[CLOUD_FUNCTION_REGION].cloudfunctions.net/my-function
responses:
'200':
description: A successful response
schema:
type: string
gcloud endpoints services deploy api.yaml
现在,云功能请求可以通过端点路由https://cloud_run_service_name-65zrpjcu3q-uk.a.run.app/thisroute。
hore的步骤
如果您使用的firebase函数几乎相同,则可以做到! https://firebase.google.com/docs/hosting/functions
在我的脑海中,目前最优雅的解决方案是创建基于Cloud Pub/sub的简单代理应用程序,您可以在GAP,GKE或新的Cloud运行上运行它,以便您扩展到0。 logic可以动态,如下:
使用一些内部逻辑阅读请求的URL在这一点上,您应该问自己,与在GAE / GKE上运行应用程序相比,这是否真的很有用,并且可能会有不同的服务来分解疑虑,因为成本上可能会更便宜。 如果您想解决“ API网关”问题的SaaS解决方案,您也可以查看
apigee我认为最好不要使用HTTP调用机制,因为它不需要任何身份验证。 尝试使用其他选项 -
https://cloud.google.com/functions/docs/calling