Waffle.Storage.Google.CloudStorage (Waffle GCS v0.2.0) 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

Specs

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

Link to this section Functions

Specs

Returns the bucket for file uploads.

Link to this function

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

View Source

Specs

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

Specs

Delete a file from a Google Cloud Storage bucket.

Link to this function

fullname(definition, version, meta)

View Source

Specs

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

Link to this function

path_for(definition, version, meta)

View Source

Specs

Returns the full file path for the upload destination.

Link to this function

put(definition, version, meta)

View Source

Specs

Put a Waffle file in a Google Cloud Storage bucket.

Link to this function

storage_dir(definition, version, meta)

View Source

Specs

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

Link to this function

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

View Source

Specs

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.