Buckets.Location (buckets v1.0.0-rc.2)
Represents a storage location for a Buckets.Object.
The config field can be either:
- A keyword list with adapter configuration
- A Cloud module atom that implements the Buckets.Cloud behaviour
Summary
Functions
Gets the configuration from a Location.
Creates a new Location struct with the given path and configuration.
Types
Functions
Link to this function
get_config(location)
Gets the configuration from a Location.
If the config is a keyword list, returns it as-is. If the config is a Cloud module, calls the module's config/0 function.
Link to this function
new(path, config)
Creates a new Location struct with the given path and configuration.
Parameters
path
- The storage path for the object (e.g., "uploads/123/file.pdf")config
- Either:- A keyword list with adapter configuration
- A Cloud module atom that implements the Buckets.Cloud behaviour
Examples
# With explicit configuration
location = Location.new("uploads/file.pdf", [
adapter: Buckets.Adapters.S3,
bucket: "my-bucket",
region: "us-east-1"
])
# With Cloud module reference
location = Location.new("uploads/file.pdf", MyApp.Cloud)
Returns
A %Buckets.Location{}
struct with the path and configuration set.