Digital Ocean NodeSDK

Making a SDK for cloud-Week 7 & 8 GSoC’21

Mohit Bhat
Leopards Lab
Published in
3 min readAug 17, 2021

--

Hey welcome to another blog where I will be talking about making changes to Digital Ocean SDK and my week 7 and 8 updates

The DO-Wrapper SDK

As you know the Nodecloud Digital Ocean plugin is being built on top of Do-Wrapper SDK. Few services were there which are present in Digital Ocean APIv2 but not implemented in do-wrapper node SDK. This included VPC, PAAS(Apps) module and few others. Out of non implemented features only VPC and PAAS are of our use and as a part of GSoC i had to implement the same.

How Modules are built

Modules are nothing but a node project with some configurations. You can make a node file with some code you export and then can publish to npm. Other projects then can use your code in there projects. Modules in my sense is shared code/Logic.

Talking about the do-wrapper SDK, it uses typescript and to build the module, after compilation modules are stored in dist folder.

dist stands for distribution, Mainly mode modules have src and dist folder. Src comprising of the sources code and dist containing the distributive code, which is published and usable by other as a package

The do-wrapper modules has files written in typescript. There is one types folder which contains interfaces defining parameters that are to passed while calling functions and a modules folder where the actual implementation of functions and classes are there.

The working of do-wrapper SDK

The SDK has a request-helper file which contains functions to call digital ocean API and submitting request to pass and get data.

This file is then used in base-module.ts file which is extended by all services classes. It contains functions like getpaginatedRequest, execute request etc.

My week 7 updates

In this week I worked on understanding the do-wrapper and then implemented VPC module. Following functions were implemented:

  • getAll(To get all VPC’s)
  • create(To create a VPC)
  • getById(To get details of VPC by id)
  • delete(To delete VPC)
  • update(To update a VPC)

Basically when we make such module we extend the baseModule and then make attribute defining the path which this module has to request on. The path get appended on the DO-api url and then we pass the parameter and call the execute request function.

The week 8 updates

In this week I implemented the PAAS(APP’s) module in the SDK. Following features were implemented:

  • getAll(To get all App’s)
  • create(To create a APP)
  • getById(To get details of APP by id)
  • delete(To delete APP)
  • update(To update a APP)
  • createAppDeployment(To deploy APP)
  • getAllDeployments(To get all deployed APP’s)
  • cancelDeployment(To cancel an ongoing deployment)
  • getAppDeployment(To get details of deployment of an APP)

In these two week’s I learnt how to make SDK and implemented a class init. It was really an amazing learning experience to work on an SDK.

Next two weeks are ending and will be working on improving the documentation, writing examples and fixing any issues that arise!

Till then GoodBye✌️ and Have Fun!😋

Follow me here…. Linkedin, Github, Twitter

--

--

Mohit Bhat
Leopards Lab

Blockchain & Full Stack Developer | GSoC’21 @ SCoReLab | Certified Ethereum Developer | Ethereum India Fellow | SIH2020 Finalist | Postman Student Expert