API for aws.sdk.s3
-
Full namespace name:
aws.sdk.s3
Overview
Functions to access the Amazon S3 storage service.
Each function takes a map of credentials as its first argument. The
credentials map should contain an :access-key key and a :secret-key key.
Public Variables and Functions
Mappable
var
Convert a value into a Clojure map.
ToPutRequest
var
A protocol for constructing a map that represents an S3 put request.
bucket-exists?
function
Usage: (bucket-exists? cred name)
Returns true if the supplied bucket name already exists in S3.
copy-object
function
Usage: (copy-object cred bucket src-key dest-key)
(copy-object cred src-bucket src-key dest-bucket dest-key)
Copy an existing S3 object to another key.
create-bucket
function
Usage: (create-bucket cred name)
Create a new S3 bucket with the supplied name.
delete-bucket
function
Usage: (delete-bucket cred name)
Delete the S3 bucket with the supplied name.
delete-object
function
Usage: (delete-object cred bucket key)
Delete an object from an S3 bucket.
get-object
function
Usage: (get-object cred bucket key)
Get an object from an S3 bucket. The object is returned as a map with the
following keys:
:content - an InputStream to the content
:metadata - a map of the object's metadata
:bucket - the name of the bucket
:key - the object's key
get-object-acl
function
Usage: (get-object-acl cred bucket key)
Returns object ACL (AccessControlList)
function
Usage: (get-object-metadata cred bucket key)
Get an object's metadata from a bucket. The metadata is a map with the
following keys:
:cache-control - the CacheControl HTTP header
:content-disposition - the ContentDisposition HTTP header
:content-encoding - the character encoding of the content
:content-length - the length of the content in bytes
:content-md5 - the MD5 hash of the content
:content-type - the mime-type of the content
:etag - the HTTP ETag header
:last-modified - the last modified date
:server-side-encryption - the server-side encryption algorithm
list-objects
function
Usage: (list-objects cred bucket & [options])
List the objects in an S3 bucket. A optional map of options may be supplied.
Available options are:
:delimiter - read only keys up to the next delimiter (such as a '/')
:marker - read objects after this key
:max-keys - read only this many objects
:prefix - read only objects with this prefix
The object listing will be returned as a map containing the following keys:
:bucket - the name of the bucket
:prefix - the supplied prefix (or nil if none supplied)
:objects - a list of objects
:common-prefixes - the common prefixes of keys omitted by the delimiter
:max-keys - the maximum number of objects to be returned
:truncated? - true if the list of objects was truncated
:marker - the marker of the listing
:next-marker - the next marker of the listing
object-exists?
function
Usage: (object-exists? cred bucket key)
Returns true if an object exists in the supplied bucket and key.
put-object
function
Usage: (put-object cred bucket key value & options)
Put a value into an S3 bucket at the specified key. The value can be
a String, InputStream or File (or anything that implements the ToPutRequest
protocol).
options is a list of key value pairs for setting ACL or object meta data:
Acl options:
:canned-acl - :public-read-write, :public-read, :private [default]
Meta data options:
:cache-control - cache control HTTP header
:content-disposition - content disposition HTTP header
:content-type - content type HTTP header
additional key value pairs are set as user meta data on the object
(s3/put-object cred "my-bucket" "some-key" "some-value"
:content-type "image/png"
:canned-acl :public-read
"metadata-key" "metadata-value")
put-request
function
Usage: (put-request x)
Convert a value into a put request.
set-object-acl
function
Usage: (set-object-acl cred bucket key canned-acl)
Sets object ACL to one of CannedAccessControlList where canned-acl is one of:
- :private
- :public-read
- :public-read-write
see: http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/CannedAccessControlList.html
to-map
function
Usage: (to-map x)
Return a map of the value.