Skip to content

Latest commit

 

History

History

storage

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Google Cloud Storage Samples

This project includes samples for running Google Cloud Storage

Installing Dependencies

Install the dependencies, namely google_api_storage, using Mix:

mix deps.get

Authentication

Authentication is typically done through Application Default Credentials which means you do not have to change the code to authenticate as long as your environment has credentials. Start by creating a Service Account key file. This file can be used to authenticate to Google Cloud Platform services from any environment. To use the file, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path to the key file, for example:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json

Running the Samples

Use Interactive Elixir and Mix to compile and run the samples

iex -S mix

Now you can run the samples! For example, to list your cloud storage buckets, type the following into the Interactive Elixir shell:

iex(1)> GoogleApi.Storage.Samples.list_buckets("YOUR_PROJECT_ID")
your_bucket_1
your_bucket_2
:ok