Bazel build rules for generating cloud endpoints config from service-annotated .proto files?

114 views
Skip to first unread message

Patrick Shields

unread,
Mar 27, 2018, 11:55:59 AM3/27/18
to Google Cloud Endpoints
I was looking into using Google Cloud Endpoints with a set of gRPC services specified in service-annotated .proto files. I was looking for a tool (ideally Bazel build rules) for converting the service definitions from the .proto files into a configuration file that can be used with Google Cloud Endpoints. I wasn't able to find a way to do this without writing my own genrule and script to hack something together. Is there a better way to do this? I think it makes sense for the .proto files to be the source of truth and to have a build rule to reproducibly generate the config file from the .proto sources. 

Wesley Wong

unread,
Apr 3, 2018, 5:18:33 PM4/3/18
to Google Cloud Endpoints
Hi Patrick,

Are you able to go into more details as to why you want to generate a configuration file that can be used with Endpoints rather than the usual flow?

You could do:
.proto files -> protoc -> .pb file -> gcloud endpoints services deploy api_descriptor.pb api_config.yaml --validate-only

The gcloud command will return you a configuration file that works with Endpoints.

There's also this tool, which will help generate a configuration file that works with Endpoints:

Thanks,
Wesley

Patrick Shields

unread,
Apr 3, 2018, 5:34:56 PM4/3/18
to Google Cloud Endpoints
Hi Wesley,

> Are you able to go into more details as to why you want to generate a configuration file that can be used with Endpoints rather than the usual flow?

I think using `gcloud endpoints services deploy <pb_descriptor_file> <config_yaml_file>` should work for my use case--thanks! The primary reference I was using was https://cloud.google.com/endpoints/docs/frameworks/python/get-started-frameworks-python, which has a step for generating an OpenAPI configuration file. At some point, I started thinking that generating an OpenAPI configuration file was the only way to configure Cloud Endpoints. Thanks for resolving my confusion.

Wesley Wong

unread,
Apr 3, 2018, 5:51:11 PM4/3/18
to Patrick Shields, Google Cloud Endpoints
Glad to hear your confusion has been resolved.

Cheers,
Wesley

--
You received this message because you are subscribed to the Google Groups "Google Cloud Endpoints" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-endp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-endpoints/e070a502-610c-4459-b119-ff0be98ab40d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages