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
bucket(Waffle.Types.definition()) :: String.t()
Returns the bucket for file uploads.
conn(scope \\ "https://www.googleapis.com/auth/devstorage.full_control")
View SourceSpecs
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.
Specs
delete(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: object_or_error()
Delete a file from a Google Cloud Storage bucket.
Specs
fullname(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: String.t()
A wrapper for Waffle.Definition.Versioning.resolve_file_name/3
.
Specs
path_for(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: String.t()
Returns the full file path for the upload destination.
Specs
put(Waffle.Types.definition(), Waffle.Types.version(), Waffle.Types.meta()) :: object_or_error()
Put a Waffle file in a Google Cloud Storage bucket.
Specs
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.
Specs
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
.