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.
Delete a file from a Google Cloud Storage bucket.
@spec fullname(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: String.t()
A wrapper for Waffle.Definition.Versioning.resolve_file_name/3
.
@spec path_for(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: String.t()
Returns the full file path for the upload destination.
@spec put(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: object_or_error()
@spec put(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: object_or_error()
Put a Waffle file in a Google Cloud Storage bucket.
@spec storage_dir( Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta() ) :: String.t()
Returns the storage directory within a bucket to store the file under.
@spec url( Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta(), Keyword.t() ) :: String.t()
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
.