Hello everyone,
I’ve come here to present one of my ongoing projects in Elixir GCloudex (aka Google Cloud for Elixir).
What is GCloudex?
GCloudex is a set/collection of wrappers and clients for the various Google Cloud Platform services’s API’s. It is meant to be friendly, easy to use and configure. If you know ex_aws or erl_cloud then you can see GCloudex as a similar project but for Google Cloud Plaftorm instead of Amazon Web Services.
Why am I building GCloudex
I’m working on an Elixir library/application for my Master’s Thesis and I need to use several Google Cloud Platform API’s. I searched around on GitHub and just found a couple of wrappers for maybe one or two API’s and even those were incomplete. I knew about ex_aws so I thought “Why not build something similar myself?”. I’m going to need those wrappers and I’d like to contribute to the Elixir community so I decided to kill two birds with one stone (joking I don’t really kill birds )
What do you need to use GCloudex
First you need a Google Cloud Platform account. You may get one for free for two months (not really free but they give you $300 to spend which can be a lot).
Then to use GCloudex in any of your Elixir applications you just need to install it like in the README and then download the credentials JSON file from your Google Cloud console. Put that file in the your_app/config
directory and name it creds.json
.
Finally put inside the config file you want (like dev.exs
) the following line:
config :goth, json: "config/creds.json" |> Path.expand |> File.read!
This will enable the Goth application to use your credentials to authenticate the API requests (please inform me if you can’t get this to work for some reason).
I still have to post a comprehensive and easy config guide on GitHub’s README
What is the Roadmap?
Right now I’ve got clients for two API’s:
-
Google Cloud Storage
-
Google Cloud SQL
They’re working pretty much correctly but I haven’t got around to any rigorous testing.
The next API I’m going to implement/wrap is Google Compute Engine and then either Google Cloud Datastore or Google Cloud Big Table. I plan to implement as many API’s as possible but I’m giving priority to those I need for my Msc. Thesis and those that are more popular.
Contributions
I’m open to contributions (and I welcome them). I’m thinking about creating a contributions file or a guideline. So far my main concern is to keep the structure and logic between all API’s as similar as possible.
Examples
iex(3)> GCloudex.CloudStorage.Client.list_buckets
{:ok,
%HTTPoison.Response{body: "<?xml version='1.0' encoding='UTF-8'?><ListAllMyBucketsResult xmlns='http://doc.s3.amazonaws.com/2006-03-01'><Owner><ID>00b4903a979d00a888b29e9968887baaefca546bc5f81b377fc6f3ecdfb8ae5a</ID></Owner><Buckets><Bucket><Name>firstbucket_sasha</Name><CreationDate>2016-03-04T12:10:22.716Z</CreationDate></Bucket><Bucket><Name>sasha_new_storage_new</Name><CreationDate>2016-04-10T10:51:03.588Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult>",
headers: [{"X-GUploader-UploadID",
"AEnB2Up6ahrHSbuGVAU_tIeQcC8P8GcW-zPx5wlXa4eMGk8n89ebqPg9V56dRh5rAh8ATH15hMYghFfQkc001IqZDhHNgZzKjQ"},
{"Content-Type", "application/xml; charset=UTF-8"},
{"Content-Length", "445"}, {"Date", "Tue, 19 Apr 2016 16:35:35 GMT"},
{"Expires", "Tue, 19 Apr 2016 16:35:35 GMT"},
{"Cache-Control", "private, max-age=0"}, {"Server", "UploadServer"}],
status_code: 200}}