View Source Waffle.Storage.Google (Waffle backend for Google Cloud Storage v0.0.2)

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

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.

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

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

Link to this section Functions

@spec bucket(Waffle.Types.definition()) :: String.t()

Returns the bucket for file uploads.

@spec conn() :: Tesla.Env.client()

Constructs a new connection.

Link to this function

delete(definition, version, meta)

View Source

Delete a file from a Google Cloud Storage bucket.

Link to this function

fullname(definition, version, meta)

View Source

A wrapper for Waffle.Definition.Versioning.resolve_file_name/3.

Link to this function

path_for(definition, version, meta)

View Source

Returns the full file path for the upload destination.

Link to this function

put(definition, version, meta)

View Source

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.

Link to this function

url(definition, version, meta, opts \\ [])

View Source

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.