Inputs
For example, we have a few services.
- Account service
- Product service
- Payment service
Each service is a separate Google Cloud Function. Each service has its own HTTP API. For example, the account service has:
- https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/account/sign-up
- https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/account/sign-in
- https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/account/reset-password
- etc
Each service has its own swagger documentation endpoint /docs
.
Question
How can I make my Cloud Functions private (without public access) and place them behind some API Gateway?
Notes
Google offers Endpoints for Cloud Functions (see https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions ). But, as I understand it, Endpoints allow you to define only the yaml OpenAPI file.
In this yaml file, I can define something like this:
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: HOST
schemes:
- https
produces:
- application/json
paths:
/hello:
get:
summary: Greet a user
operationId: hello
x-google-backend:
address: https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/helloGET
responses:
'200':
description: A successful response
schema:
type: string
But in my case, I need to have ability to proxy my cloud functions (like reverse proxy).