Behaviours: application
.
etag() = {etag, iodata()}
expires() = {expires, {Name::iodata(), DateTime::calendar:datetime()}}
get_option() = etag()
option() = {access_key, binary()} | {secret_access_key, binary()} | {region, binary()} | {host, binary()} | {connection_timeout, pos_integer()} | {max_connections, pos_integer()}
close/1 | |
get/2 | Equivalent to get(Bucket, Key, []) . |
get/3 | Get an object from a bucket. |
open/2 | Open a bucket. |
put/3 |
close(Bucket) -> any()
get(Bucket, Key) -> any()
Equivalent to get(Bucket, Key, [])
.
See also: get/3.
get(Bucket::iodata(), Key::iodata(), Options::[get_option()]) -> {Data::iodata() | not_mofified | not_found, Properties::[property()]}
Get an object from a bucket.
Returns the data for a key in an open bucket (must have been opened with
open/2
). If available, the properties will contain the ETag value
and the expiration information associated with the key.
If an ETag is supplied (with the option {etag, ETag}
), it is possible that
the key has not been modified since the last time. In this case,
not_modified
is then returned instead of the data.
open(Bucket::iodata(), Options::[option()]) -> ok
Open a bucket.
Valid options are:
-
access_key
: Amazon AWS access key (mandatory) -
secret_access_key
: Amazon AWS secret access key (mandatory) -
region
: Amazon AWS S3 region (mandatory) -
host
: Host endpoint to connect to (defaults tos3-REGION.amazonaws.com
) -
connection_timeout
: The connection timeout for requests in milliseconds (defaults to5000
) -
max_connections
: Max simultaneous connections to S3 (defaults to20
)
put(Bucket, Key, Data) -> any()