GSoC 2020 : Automated code generation using Google cloud Client based SDKs

This article covers about the phase one of the Node Cloud GCP plugin class generation process

Rajitha Warusavitarana
Leopards Lab
Published in
2 min readJul 15, 2020

--

Welcome to another article about the Node Cloud project. In the previous article, I explained about the Monorepo repo architecture and how it is applied in the Node Cloud project with the help of Lerna. The aim of this article is to explain first phase of the JavaScript class generation process of the Node Cloud GCP plugin.

If you haven’t read my article “Diving into Google Cloud SDKs”, it is recommended to read it before continuing this article as it covers the initial research conducted about the Google Cloud SDKs. In that article I mentioned that multiple transformers and parsers will be implemented to cover all the Google Cloud SDKs. In the previous week, I completed the data extraction of Google Cloud client based SDKs(e.g. -monitoring SDK, kubernetes SDK) and implemented a transformer to generate JavaScript classes based on that data.

The above diagram shows the high level concept of the process. Most of the client based SDKs contains several versions as I mentioned in the “Diving into Google Cloud SDKs” article. The versions needs to be specified in the node-cloud.yml file.

E.g.-

The Type definition files listed in the node-cloud.yml is parsed and then the necessary data for code generation is extracted. The transformer generates the JavaScript classes according to the extracted data. There are some functions generated which will not call any requests to cloud. This is because of there are some particular calls that needs to be done with the Google Cloud SDKs to prepare data for a request call.

E.g.- projectPath function listed in the above yml file.

There are other types of Google Cloud SDKs that needs to be handled in the code generation process. I am currently working on it and I will give an update of that in the next week. So that’s pretty much it for this article. Stay tuned for more updates about the Node Cloud project.

Good Bye…

--

--