Gcloudex
Friendly set of wrappers for Google Cloud Platform services' API's in Elixir.
Install / Use
/learn @Overbryd/GcloudexREADME
GCloudex
Google Cloud for Elixir. Friendly set of wrappers for Google Cloud Platform services' API's.
Features
- Minimal configuration and dependencies
- Friendly way to use Google Cloud services' API's
- Function names and signatures closely mimic their REST counterparts
- HTTP requests sent using the popular HTTPoison app providing familiar HTTP responses
- Easy to extend
Installation and Configuration
GCloudex uses HTTPoison for the HTTP requests, Poison for JSON encoding/decoding and Friendly for XML parsing. The Google Authorization Tokens are retrieved using Goth. The JSON API's for the various Google Cloud services are used whenever possible or available.
-
Add gcloudex to your list of dependencies in
mix.exs:def deps do [{:gcloudex, git: "git@github.com:sashaafm/gcloudex.git"}] end -
Ensure gcloudex is started before your application:
def application do [applications: [:gcloudex]] end
Then go to the Google Cloud's website and download the credentials file for your Google Project.
Put that file in your application's config folder and rename the file to
creds.json (or whatever name you prefer). This file will be used to authenticate the requests. Be sure to add it to your .gitignore file in case you're uploading to a public repository.
Finally put inside the config file you want (like dev.exs) the following line:
config :goth,
json: "config/<filename>.json" |> Path.expand |> File.read!
That's all you need to use GCloudex.
Usages Examples
Cloud Storage:
GCloudex.CloudStorage.Client.list_buckets # => {:ok, %HTTPoison.Response{body: ..., status_code: 200}}
GCloudex.CloudStorage.CLient.put_object "bucket_name", "this_file.txt" # => {:ok, %HTTPoison.Response{body: ..., status_code: 200}}
Cloud SQL:
GCloudex.CloudSQL.Client.list_databases "instance_name" # => {:ok, %HTTPoison.Response{body: ...,status_code: 200}}
GCloudex.CloudSQL.Client-insert_databaes "instance_name", "db_name" # => {:ok, %HTTPoison.Response{body: ...,status_code: 200}}
Cloud Speech:
body = """
{
"audio": {
"uri": "gs://foo/bar.flac"
},
"config": {
"encoding":"flac",
"sampleRate": 48000,
"languageCode":"en-US",
"maxAlternatives": 1
}
}
"""
iex> GCloudex.CloudSpeech.Client.longrunningrecognize(body)
{:ok,
%HTTPoison.Response{body: "{\n \"name\": \"1234567890\"\n}\n",
headers: [...], status_code: 200}}
iex> GCloudex.CloudSpeech.Client.get("1234567890")
{:ok,
%HTTPoison.Response{body: "{\n \"name\": \"1234567890\",\n \"metadata\": {...
Roadmap
- [x] Google Cloud Storage
- [x] Google Cloud SQL
- [x] Google Compute Engine
- [X] Google Cloud Speech API (partial)
- [ ] Google Cloud Datastore
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
