Waffle GCS v0.1.0 Waffle.Storage.Google.CloudStorage View Source

The main storage integration for Waffle, this acts primarily as a wrapper around Google.Api.Storage.V1. To use this module with Waffle, simply set your :storage config appropriately:

config :waffle, storage: Waffle.Storage.Google.CloudStorage

Ensure you have a valid bucket set, either through the configs or as an environment variable, otherwise all calls will fail. The credentials available through Goth must have the appropriate level of access to the bucket, otherwise some (or all) calls may fail.

Link to this section Summary

Functions

Returns the bucket for file uploads.

Constructs a new connection object with scoped authentication. If no scope is provided, the devstorage.full_control scope is used as a default.

Delete a file from a Google Cloud Storage bucket.

Returns the full file path for the upload destination.

Put a Waffle file in a Google Cloud Storage bucket.

Returns the storage directory within a bucket to store the file under.

Retrieve the public URL for a file in a Google Cloud Storage bucket. Uses Waffle.Storage.Google.UrlV2 by default, which uses v2 signing if a signed URL is requested, but this can be overriden in the options list or in the application configs by setting :url_builder to any module that imlements the behavior of Waffle.Storage.Google.Url.

Link to this section Types

Link to this type

object_or_error()

View Source
object_or_error() ::
  {:ok, GoogleApi.Storage.V1.Model.Object.t()} | {:error, Tesla.Env.t()}

Link to this section Functions

Returns the bucket for file uploads.

Link to this function

conn(scope \\ "https://www.googleapis.com/auth/devstorage.full_control")

View Source
conn(String.t()) :: Tesla.Env.client()

Constructs a new connection object with scoped authentication. If no scope is provided, the devstorage.full_control scope is used as a default.

Link to this function

delete(definition, version, meta)

View Source

Delete a file from a Google Cloud Storage bucket.

Returns the full file path for the upload destination.

Put a Waffle file in a Google Cloud Storage bucket.

Link to this function

storage_dir(definition, version, meta)

View Source

Returns the storage directory within a bucket to store the file under.

Retrieve the public URL for a file in a Google Cloud Storage bucket. Uses Waffle.Storage.Google.UrlV2 by default, which uses v2 signing if a signed URL is requested, but this can be overriden in the options list or in the application configs by setting :url_builder to any module that imlements the behavior of Waffle.Storage.Google.Url.