models

Class AmazonS3

lucee.Component
    extended by models.AmazonS3

Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com Amazon S3 REST Wrapper Written by Joe Danziger (joe@ajaxcf.com) with much help from dorioo on the Amazon S3 Forums. See the readme for more details on usage and methods. Thanks to Steve Hicks for the bucket ACL updates. Thanks to Carlos Gallupa for the EU storage location updates. Thanks to Joel Greutman for the fix on the getObject link. Thanks to Jerad Sloan for the Cache Control headers. Version 1.7 - Released: December 15, 2008 Version 2.0 - Luis Majano updated for ColdBox and extra features. You will have to create some settings in your ColdBox configuration file: s3_accessKey : The Amazon access key s3_secretKey : The Amazon secret key s3_encryption_charset : encryptyion charset (Optional, defaults to utf-8) s3_ssl : Whether to use ssl on all cals or not (Optional, defaults to false)

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    any URLEndpoint


    • access = public
    • returntype = any
    true false
    any URLEndpointHostname


    • access = public
    • returntype = any
    true false
    any accessKey


    • access = public
    • returntype = any
    true false
    any asyncManager


    • access = public
    • returntype = any
    • inject = box:AsyncManager
    true false
    any autoContentType


    • access = public
    • returntype = any
    true false
    any autoMD5


    • access = public
    • returntype = any
    true false
    any awsDomain


    • access = public
    • returntype = any
    true false
    any awsRegion


    • access = public
    • returntype = any
    true false
    any defaultACL


    • access = public
    • returntype = any
    true false
    any defaultBucketName


    • access = public
    • returntype = any
    true false
    any defaultCacheControl


    • access = public
    • returntype = any
    true false
    any defaultDelimiter


    • access = public
    • returntype = any
    true false
    any defaultEncryptionAlgorithm


    • access = public
    • returntype = any
    true false
    any defaultEncryptionKey


    • access = public
    • returntype = any
    true false
    any defaultStorageClass


    • access = public
    • returntype = any
    true false
    any defaultTimeOut


    • access = public
    • returntype = any
    true false
    any encryptionCharset


    • access = public
    • returntype = any
    true false
    any log


    • access = public
    • returntype = any
    • inject = logbox:logger:{this}
    true false
    any mimeTypes


    • access = public
    • returntype = any
    true false
    any multiPartByteThreshold


    • access = public
    • returntype = any
    true false
    any retriesOnError


    • access = public
    • returntype = any
    true false
    any secretKey


    • access = public
    • returntype = any
    true false
    any serviceName


    • access = public
    • returntype = any
    true false
    any ssl


    • access = public
    • returntype = any
    true false
    any throwOnRequestError


    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(string accessKey, string secretKey, [string awsDomain='amazonaws.com'], [string awsRegion=''], [string encryptionCharset='UTF-8'], [string signatureType='V4'], [boolean ssl='true'], [string defaultTimeOut='300'], [string defaultDelimiter='/'], [string defaultBucketName=''], [string defaultCacheControl='no-store, no-cache, must-revalidate'], [string defaultStorageClass='[runtime expression]'], [string defaultACL='[runtime expression]'], [string throwOnRequestError='true'], [numeric retriesOnError='3'], [boolean autoContentType='false'], [boolean autoMD5='false'], [string serviceName='s3'], [boolean debug='false'], [string defaultEncryptionAlgorithm=''], [string defaultEncryptionKey=''], [numeric multiPartByteThreshold='5242880'])
          Create a new S3SDK Instance.
    Method Summary
    private binary HMAC_SHA1(string signKey, string signMessage)
         NSA SHA-1 Algorithm: RFC 2104HMAC-SHA1.
    string MD5inBase64(any content)
    private any applyACLHeaders([struct headers='[runtime expression]'], any acl)
         Helper function to apply grant headers.
    any applyEncryptionHeaders([any headers], [any args])
    AmazonS3 buildUrlEndpoint()
         This function builds variables.
    boolean copyObject(string fromBucket='[runtime expression]', string fromURI, string toBucket='[runtime expression]', string toURI, [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string storageClass='[runtime expression]'], [string contentType], [boolean throwOnError='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'], [string encryptionAlgorithmSource='[runtime expression]'], [string encryptionKeySource='[runtime expression]'])
         Copies an object.
    struct createMetaHeaders([struct metaHeaders='[runtime expression]'])
         Create a structure of Amazon-enabled metadata headers.
    struct createMultiPartUpload(string bucketName, string uri, [string contentType=''], [string contentEncoding=''], [string contentDisposition=''], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires='120'], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string md5='[runtime expression]'], [string storageClass='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])
    any createSignatureUtil(string type)
    boolean deleteBucket(string bucketName='[runtime expression]', [boolean force='false'])
         Deletes a bucket.
    boolean deleteObject(string bucketName='[runtime expression]', string uri)
         Deletes an object.
    struct downloadObject(string bucketName='[runtime expression]', string uri, string filepath, [numeric HTTPTimeout='[runtime expression]'], [boolean getAsBinary='no'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])
         Gets an object from a bucket.
    array getAccessControlPolicy(string bucketName='[runtime expression]', [string uri=''])
         Gets a bucket's or object's ACL policy.
    string getAccessKey()
    string getAsyncManager()
    string getAuthenticatedURL(string bucketName='[runtime expression]', string uri, [string minutesValid='60'], [boolean useSSL='[runtime expression]'], [string method='GET'], [any acl=''], [struct metaHeaders='[runtime expression]'], [string contentType], [string encryptionKey='[runtime expression]'], [struct responseHeaders='[runtime expression]'])
         Returns a query string authenticated URL to an object in S3.
    string getAutoContentType()
    string getAutoMD5()
    string getAwsDomain()
    string getAwsRegion()
    array getBucket(string bucketName='[runtime expression]', [string prefix=''], [string marker=''], [string maxKeys=''], [string delimiter='[runtime expression]'])
         Lists information about the objects of a bucket.
    string getBucketLocation(string bucketName='[runtime expression]')
         Get the S3 region for the bucket provided.
    string getBucketVersionStatus(string bucketName='[runtime expression]')
         Get the versioning status of a bucket.
    string getDefaultACL()
    string getDefaultBucketName()
    string getDefaultCacheControl()
    string getDefaultDelimiter()
    string getDefaultEncryptionAlgorithm()
    string getDefaultEncryptionKey()
    string getDefaultStorageClass()
    string getDefaultTimeOut()
    string getEncryptionCharset()
    string getFileMimeType(string filePath)
         Determines mime type from the file extension.
    string getLog()
    string getMimeTypes()
    string getMultiPartByteThreshold()
    struct getObject(string bucketName='[runtime expression]', string uri, [string encryptionKey='[runtime expression]'])
         Get an object's metadata information.
    struct getObjectACL(string bucketName='[runtime expression]', string uri, [any throwOnError='false'])
         Get an object's ACL information.
    struct getObjectInfo(string bucketName='[runtime expression]', string uri, [string encryptionKey='[runtime expression]'])
         Get an object's metadata information.
    string getRetriesOnError()
    string getSecretKey()
    string getServiceName()
    string getSsl()
    string getThrowOnRequestError()
    string getURLEndpoint()
    string getURLEndpointHostname()
    boolean hasBucket(string bucketName='[runtime expression]')
         Checks for the existance of a bucket.
    array listBuckets()
         List all the buckets associated with the Amazon credentials.
    boolean objectExists(string bucketName='[runtime expression]', string uri)
         Check if an object exists in the bucket.
    boolean putBucket(string bucketName='[runtime expression]', [string acl='[runtime expression]'], [string location='USA'])
         Create a new bucket.
    string putObject(string bucketName='[runtime expression]', string uri, [any data=''], [string contentDisposition=''], [string contentType='[runtime expression]'], [string contentEncoding=''], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires=''], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string md5='[runtime expression]'], [string storageClass='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])
         Puts an object into a bucket.
    string putObjectFile(string bucketName='[runtime expression]', string filepath, [string uri=''], [string contentType=''], [string contentEncoding=''], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires=''], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string md5='[runtime expression]'], [string storageClass='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])
         Puts an object from a local file in to a bucket.
    string putObjectFolder(string bucketName='[runtime expression]', [string uri=''], [string contentType='binary/octet-stream'], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires=''], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'])
         Puts an folder in to a bucket.
    boolean renameObject([string oldBucketName='[runtime expression]'], string oldFileKey, [string newBucketName='[runtime expression]'], string newFileKey, [any acl], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])
         Renames an object by copying then deleting original.
    private any requireBucketName([any bucketName])
         Helper function to catch missing bucket name.
    private struct s3Request([string method='GET'], [string resource=''], [any body=''], [struct headers='[runtime expression]'], [struct parameters='[runtime expression]'], [string filename=''], [numeric timeout='[runtime expression]'], [boolean parseResponse='true'], [boolean getAsBinary='no'], [boolean throwOnError='[runtime expression]'], [numeric tryCount='1'])
         Make a request to Amazon S3.
    AmazonS3 setAWSDomain(string domain)
    AmazonS3 setAWSRegion(string region)
    void setAccessControlPolicy(string bucketName='[runtime expression]', [string uri=''], [any acl])
         Sets a bucket's or object's ACL policy.
    any setAccessKey(any accessKey)
    any setAsyncManager(any asyncManager)
    AmazonS3 setAuth(string accessKey, string secretKey)
         Set the Amazon Credentials.
    any setAutoContentType(any autoContentType)
    any setAutoMD5(any autoMD5)
    boolean setBucketVersionStatus(string bucketName='[runtime expression]', [boolean version='true'])
         Set versioning status for a bucket.
    any setDefaultACL(any defaultACL)
    any setDefaultBucketName(any defaultBucketName)
    any setDefaultCacheControl(any defaultCacheControl)
    any setDefaultDelimiter(any defaultDelimiter)
    any setDefaultEncryptionAlgorithm(any defaultEncryptionAlgorithm)
    any setDefaultEncryptionKey(any defaultEncryptionKey)
    any setDefaultStorageClass(any defaultStorageClass)
    any setDefaultTimeOut(any defaultTimeOut)
    any setEncryptionCharset(any encryptionCharset)
    any setLog(any log)
    any setMimeTypes(any mimeTypes)
    any setMultiPartByteThreshold(any multiPartByteThreshold)
    any setRetriesOnError(any retriesOnError)
    AmazonS3 setSSL([boolean useSSL='true'])
         Set the ssl flag.
    any setSecretKey(any secretKey)
    any setServiceName(any serviceName)
    any setThrowOnRequestError(any throwOnRequestError)
    any setURLEndpoint(any URLEndpoint)
    any setURLEndpointHostname(any URLEndpointHostname)
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init(string accessKey, string secretKey, [string awsDomain='amazonaws.com'], [string awsRegion=''], [string encryptionCharset='UTF-8'], [string signatureType='V4'], [boolean ssl='true'], [string defaultTimeOut='300'], [string defaultDelimiter='/'], [string defaultBucketName=''], [string defaultCacheControl='no-store, no-cache, must-revalidate'], [string defaultStorageClass='[runtime expression]'], [string defaultACL='[runtime expression]'], [string throwOnRequestError='true'], [numeric retriesOnError='3'], [boolean autoContentType='false'], [boolean autoMD5='false'], [string serviceName='s3'], [boolean debug='false'], [string defaultEncryptionAlgorithm=''], [string defaultEncryptionKey=''], [numeric multiPartByteThreshold='5242880'])

    Create a new S3SDK Instance

    Parameters:
    accessKey - The Amazon access key.
    secretKey - The Amazon secret key.
    awsDomain - The Domain used S3 Service (amazonws.com, digitalocean.com, storage.googleapis.com). Defaults to amazonws.com
    awsRegion - The Amazon region. Defaults to us-east-1 for amazonaws.com
    encryptionCharset - The charset for the encryption. Defaults to UTF-8.
    signatureType
    ssl - True if the request should use SSL. Defaults to true.
    defaultTimeOut - Default HTTP timeout for all requests. Defaults to 300.
    defaultDelimiter - Delimter to use for getBucket calls. "/" is standard to treat keys as file paths
    defaultBucketName - Bucket name to use by default
    defaultCacheControl - Default caching policy for objects. Defaults to: no-store, no-cache, must-revalidate
    defaultStorageClass - Default storage class for objects that affects cost, access speed and durability. Defaults to STANDARD.
    defaultACL - Default access control policy for objects and buckets. Defaults to public-read.
    throwOnRequestError - If an exception should be thrown for request errors. Defaults to true.
    retriesOnError
    autoContentType - Tries to determine content type of file by file extension. Defaults to false.
    autoMD5 - Calculates MD5 hash of content automatically. Defaults to false.
    serviceName
    debug - Used to turn debugging on or off outside of logbox. Defaults to false.
    defaultEncryptionAlgorithm - The default server side encryption algorithm to use. Usually "AES256". Not needed if using custom defaultEncryptionKey
    defaultEncryptionKey - The default base64 encoded AES 356 bit key for server side encryption.
    multiPartByteThreshold

    Property Detail

    URLEndpoint

    property any URLEndpoint

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    URLEndpointHostname

    property any URLEndpointHostname

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    accessKey

    property any accessKey

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    asyncManager

    property any asyncManager

    Attributes:
    access - public
    required - false
    returntype - any
    inject - box:AsyncManager
    serializable - true

    autoContentType

    property any autoContentType

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    autoMD5

    property any autoMD5

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    awsDomain

    property any awsDomain

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    awsRegion

    property any awsRegion

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultACL

    property any defaultACL

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultBucketName

    property any defaultBucketName

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultCacheControl

    property any defaultCacheControl

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultDelimiter

    property any defaultDelimiter

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultEncryptionAlgorithm

    property any defaultEncryptionAlgorithm

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultEncryptionKey

    property any defaultEncryptionKey

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultStorageClass

    property any defaultStorageClass

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    defaultTimeOut

    property any defaultTimeOut

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    encryptionCharset

    property any encryptionCharset

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    log

    property any log

    Attributes:
    access - public
    required - false
    returntype - any
    inject - logbox:logger:{this}
    serializable - true

    mimeTypes

    property any mimeTypes

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    multiPartByteThreshold

    property any multiPartByteThreshold

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    retriesOnError

    property any retriesOnError

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    secretKey

    property any secretKey

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    serviceName

    property any serviceName

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    ssl

    property any ssl

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    throwOnRequestError

    property any throwOnRequestError

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    HMAC_SHA1

    private binary HMAC_SHA1(string signKey, string signMessage)

    NSA SHA-1 Algorithm: RFC 2104HMAC-SHA1

    Parameters:
    signKey
    signMessage

    MD5inBase64

    public string MD5inBase64(any content)

    Parameters:
    content

    applyACLHeaders

    private any applyACLHeaders([struct headers='[runtime expression]'], any acl)

    Helper function to apply grant headers

    Parameters:
    headers
    acl

    applyEncryptionHeaders

    public any applyEncryptionHeaders([any headers], [any args])

    Parameters:
    headers
    args

    buildUrlEndpoint

    public AmazonS3 buildUrlEndpoint()

    This function builds variables.UrlEndpoint and variables.URLEndpointHostname according to credentials and ssl configuration, usually called after init() for you automatically.


    copyObject

    public boolean copyObject(string fromBucket='[runtime expression]', string fromURI, string toBucket='[runtime expression]', string toURI, [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string storageClass='[runtime expression]'], [string contentType], [boolean throwOnError='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'], [string encryptionAlgorithmSource='[runtime expression]'], [string encryptionKeySource='[runtime expression]'])

    Copies an object. Defaults to STANDARD. Defaults to STANDARD.

    Parameters:
    fromBucket - The source bucket
    fromURI - The source URI
    toBucket - The destination bucket
    toURI - The destination URI
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()
    metaHeaders - Additonal metadata headers to add.
    storageClass - Sets the S3 storage class which affects cost, access speed and durability.
    contentType - The file content type. Defaults to binary/octet-stream.
    throwOnError - Flag to throw exceptions on any error or not, default is true
    encryptionAlgorithm - The server side encryption algorithm to use. Usually "AES256". Not needed if using custom encryptionKey
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    encryptionAlgorithmSource - The server side encryption algorithm to use for the source file. Usually "AES256". Not needed if using custom encryptionKeySource
    encryptionKeySource - The base64 encoded AES 356 bit key used to encrypt the source file
    Returns:
    True if the object was copied correctly.

    createMetaHeaders

    public struct createMetaHeaders([struct metaHeaders='[runtime expression]'])

    Create a structure of Amazon-enabled metadata headers.

    Parameters:
    metaHeaders - Headers to convert to the Amazon meta headers.
    Returns:
    A struct of Amazon-enabled metadata headers.

    createMultiPartUpload

    public struct createMultiPartUpload(string bucketName, string uri, [string contentType=''], [string contentEncoding=''], [string contentDisposition=''], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires='120'], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string md5='[runtime expression]'], [string storageClass='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])

    Parameters:
    bucketName
    uri
    contentType
    contentEncoding
    contentDisposition
    HTTPTimeout
    cacheControl
    expires
    acl
    metaHeaders
    md5
    storageClass
    encryptionAlgorithm
    encryptionKey

    createSignatureUtil

    public any createSignatureUtil(string type)

    Parameters:
    type

    deleteBucket

    public boolean deleteBucket(string bucketName='[runtime expression]', [boolean force='false'])

    Deletes a bucket.

    Parameters:
    bucketName - The name of the bucket to delete.
    force - If true, delete the contents of the bucket before deleting the bucket.
    Returns:
    True, if the bucket was deleted successfully.

    deleteObject

    public boolean deleteObject(string bucketName='[runtime expression]', string uri)

    Deletes an object.

    Parameters:
    bucketName - The bucket name the object resides in.
    uri - The file object uri to delete.
    Returns:
    Returns true if the object is deleted successfully.

    downloadObject

    public struct downloadObject(string bucketName='[runtime expression]', string uri, string filepath, [numeric HTTPTimeout='[runtime expression]'], [boolean getAsBinary='no'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])

    Gets an object from a bucket.

    Parameters:
    bucketName - The bucket in which to store the object.
    uri - The destination uri key to use when saving the object.
    filepath - The file path write the object to, if no filename given filename from uri is used.
    HTTPTimeout - The HTTP timeout to use.
    getAsBinary - Treat the response body as binary instead of text.
    encryptionAlgorithm - The server side encryption algorithm to use. Usually "AES256". Not needed if using custom encryptionKey
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    Returns:
    The object's eTag.

    getAccessControlPolicy

    public array getAccessControlPolicy(string bucketName='[runtime expression]', [string uri=''])

    Gets a bucket's or object's ACL policy.

    Parameters:
    bucketName - The bucket to get the ACL.
    uri - An optional resource uri to get the ACL.
    Returns:
    An array containing the ACL for the given resource.

    getAccessKey

    public string getAccessKey()


    getAsyncManager

    public string getAsyncManager()


    getAuthenticatedURL

    public string getAuthenticatedURL(string bucketName='[runtime expression]', string uri, [string minutesValid='60'], [boolean useSSL='[runtime expression]'], [string method='GET'], [any acl=''], [struct metaHeaders='[runtime expression]'], [string contentType], [string encryptionKey='[runtime expression]'], [struct responseHeaders='[runtime expression]'])

    Returns a query string authenticated URL to an object in S3.

    Parameters:
    bucketName - The bucket the object resides in.
    uri - The uri to the object to create a link for.
    minutesValid - The minutes the link is valid for. Defaults to 60 minutes.
    useSSL - Use SSL for the returned url.
    method - HTTP method that will be used
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL(). If omitted, any ACL will be allowed when PUTting the file.
    metaHeaders - Additonal metadata headers to add.
    contentType - The object content type for PUT. If omitted, any content-type will be allowed when PUTting the file.
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    responseHeaders - A struct of headers to be forced for the HTTP response of GET requests. Valid options are content-type, content-language, expires, cache-control, content-disposition, content-encoding
    Returns:
    An authenticated url to the resource.

    getAutoContentType

    public string getAutoContentType()


    getAutoMD5

    public string getAutoMD5()


    getAwsDomain

    public string getAwsDomain()


    getAwsRegion

    public string getAwsRegion()


    getBucket

    public array getBucket(string bucketName='[runtime expression]', [string prefix=''], [string marker=''], [string maxKeys=''], [string delimiter='[runtime expression]'])

    Lists information about the objects of a bucket.

    Parameters:
    bucketName - The bucket name to list.
    prefix - Limits the response to keys which begin with the indicated prefix, if any.
    marker - Indicates where in the bucket to begin listing, if any.
    maxKeys - The maximum number of keys you'd like to see in the response body, if any.
    delimiter - The delimiter to use in the keys, if any.
    Returns:
    The bucket contents.

    getBucketLocation

    public string getBucketLocation(string bucketName='[runtime expression]')

    Get the S3 region for the bucket provided.

    Parameters:
    bucketName - The bucket for which to fetch the region.
    Returns:
    The region code for the bucket.

    getBucketVersionStatus

    public string getBucketVersionStatus(string bucketName='[runtime expression]')

    Get the versioning status of a bucket.

    Parameters:
    bucketName - The bucket for which to fetch the versioning status.
    Returns:
    The bucket version status or an empty string if there is none.

    getDefaultACL

    public string getDefaultACL()


    getDefaultBucketName

    public string getDefaultBucketName()


    getDefaultCacheControl

    public string getDefaultCacheControl()


    getDefaultDelimiter

    public string getDefaultDelimiter()


    getDefaultEncryptionAlgorithm

    public string getDefaultEncryptionAlgorithm()


    getDefaultEncryptionKey

    public string getDefaultEncryptionKey()


    getDefaultStorageClass

    public string getDefaultStorageClass()


    getDefaultTimeOut

    public string getDefaultTimeOut()


    getEncryptionCharset

    public string getEncryptionCharset()


    getFileMimeType

    public string getFileMimeType(string filePath)

    Determines mime type from the file extension

    Parameters:
    filePath - The path to the file stored in S3.
    Returns:
    string

    getLog

    public string getLog()


    getMimeTypes

    public string getMimeTypes()


    getMultiPartByteThreshold

    public string getMultiPartByteThreshold()


    getObject

    public struct getObject(string bucketName='[runtime expression]', string uri, [string encryptionKey='[runtime expression]'])

    Get an object's metadata information.

    Parameters:
    bucketName - The bucket the object resides in.
    uri - The object URI to retrieve the info.
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    Returns:
    The object's metadata information.

    getObjectACL

    public struct getObjectACL(string bucketName='[runtime expression]', string uri, [any throwOnError='false'])

    Get an object's ACL information. Also a top level "grants" key which is a struct containing keys FULL_CONTROL, WRITE, WRITE_ACP, READ, and READ_ACP. Each of which is an array containing zero or more structs representing a grantee which is represented as a struct with an ID, emailAddress, or URI key based on type.

    Parameters:
    bucketName - The bucket the object resides in.
    uri - The object URI to retrieve the info.
    throwOnError - Flag to throw exceptions on any error or not, default is true
    Returns:
    The object's ACL information. A struct containing a top level "owner" key which is a struct with "ID" and "Displayname" keys.

    getObjectInfo

    public struct getObjectInfo(string bucketName='[runtime expression]', string uri, [string encryptionKey='[runtime expression]'])

    Get an object's metadata information.

    Parameters:
    bucketName - The bucket the object resides in.
    uri - The object URI to retrieve the info.
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    Returns:
    The object's metadata information.

    getRetriesOnError

    public string getRetriesOnError()


    getSecretKey

    public string getSecretKey()


    getServiceName

    public string getServiceName()


    getSsl

    public string getSsl()


    getThrowOnRequestError

    public string getThrowOnRequestError()


    getURLEndpoint

    public string getURLEndpoint()


    getURLEndpointHostname

    public string getURLEndpointHostname()


    hasBucket

    public boolean hasBucket(string bucketName='[runtime expression]')

    Checks for the existance of a bucket

    Parameters:
    bucketName - The bucket to check for its existance.
    Returns:
    True if the bucket exists.

    listBuckets

    public array listBuckets()

    List all the buckets associated with the Amazon credentials.

    Returns:
    true

    objectExists

    public boolean objectExists(string bucketName='[runtime expression]', string uri)

    Check if an object exists in the bucket

    Parameters:
    bucketName - The bucket the object resides in.
    uri - The object URI to check on.
    Returns:
    True/false whether the object exists

    putBucket

    public boolean putBucket(string bucketName='[runtime expression]', [string acl='[runtime expression]'], [string location='USA'])

    Create a new bucket.

    Parameters:
    bucketName - The name for the new bucket.
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()
    location - The bucket location.
    Returns:
    True if the bucket was created successfully.

    putObject

    public string putObject(string bucketName='[runtime expression]', string uri, [any data=''], [string contentDisposition=''], [string contentType='[runtime expression]'], [string contentEncoding=''], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires=''], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string md5='[runtime expression]'], [string storageClass='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])

    Puts an object into a bucket. This can be binary, string, or anything you'd like. Example: public,max-age=864000 ( 10 days ). For more info look here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html##sec14.9 Defaults to public-read. was sent correctly. Set to "auto" to calculate the md5 in the client. Defaults to STANDARD.

    Parameters:
    bucketName - The bucket in which to store the object.
    uri - The destination uri key to use when saving the object.
    data - The content to save as data.
    contentDisposition - The content-disposition header to use when downloading the file.
    contentType - The file/data content type. Defaults to text/plain.
    contentEncoding - The file content encoding, useful to gzip data.
    HTTPTimeout - The HTTP timeout to use.
    cacheControl - The caching header to send. Defaults to no caching.
    expires - Sets the expiration header of the object in days.
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()
    metaHeaders - Additonal metadata headers to add.
    md5 - Set the MD5 hash which allows aws to checksum the object
    storageClass - Sets the S3 storage class which affects cost, access speed and durability.
    encryptionAlgorithm - The server side encryption algorithm to use. Usually "AES256". Not needed if using custom encryptionKey
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    Returns:
    The object's eTag.

    putObjectFile

    public string putObjectFile(string bucketName='[runtime expression]', string filepath, [string uri=''], [string contentType=''], [string contentEncoding=''], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires=''], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'], [string md5='[runtime expression]'], [string storageClass='[runtime expression]'], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])

    Puts an object from a local file in to a bucket. If not provided, the name of the file will be used. Example: public,max-age=864000 ( 10 days ). For more info look here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html##sec14.9 Defaults to public-read. was sent correctly. Set to "auto" to calculate the md5 in the client. Defaults to STANDARD.

    Parameters:
    bucketName - The bucket in which to store the object.
    filepath - The absolute file path to read in the binary.
    uri - The destination uri key to use when saving the object.
    contentType - The file content type. Defaults to binary/octet-stream.
    contentEncoding - The file content encoding, useful to gzip data.
    HTTPTimeout - The HTTP timeout to use
    cacheControl - The caching header to send. Defaults to no caching.
    expires - Sets the expiration header of the object in days.
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()
    metaHeaders - Additonal metadata headers to add.
    md5 - Set the MD5 hash which allows aws to checksum the object
    storageClass - Sets the S3 storage class which affects cost, access speed and durability.
    encryptionAlgorithm - The server side encryption algorithm to use. Usually "AES256". Not needed if using custom encryptionKey
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    Returns:
    The file's eTag

    putObjectFolder

    public string putObjectFolder(string bucketName='[runtime expression]', [string uri=''], [string contentType='binary/octet-stream'], [numeric HTTPTimeout='[runtime expression]'], [string cacheControl='[runtime expression]'], [string expires=''], [any acl='[runtime expression]'], [struct metaHeaders='[runtime expression]'])

    Puts an folder in to a bucket. If not provided, the name of the folder will be used. Example: public,max-age=864000 ( 10 days ). For more info look here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html##sec14.9 Defaults to public-read.

    Parameters:
    bucketName - The bucket in which to store the object.
    uri - The destination uri key to use when saving the object.
    contentType - The folder content type. Defaults to binary/octet-stream.
    HTTPTimeout - The HTTP timeout to use
    cacheControl - The caching header to send. Defaults to no caching.
    expires - Sets the expiration header of the object in days.
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()
    metaHeaders - Additonal metadata headers to add.
    Returns:
    The folder's eTag

    renameObject

    public boolean renameObject([string oldBucketName='[runtime expression]'], string oldFileKey, [string newBucketName='[runtime expression]'], string newFileKey, [any acl], [string encryptionAlgorithm='[runtime expression]'], [string encryptionKey='[runtime expression]'])

    Renames an object by copying then deleting original.

    Parameters:
    oldBucketName - The source bucket.
    oldFileKey - The source URI.
    newBucketName - The destination bucket.
    newFileKey - The destination URI.
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()
    encryptionAlgorithm - The server side encryption algorithm to use. Usually "AES256". Not needed if using custom encryptionKey
    encryptionKey - The base64 encoded AES 356 bit key for server side encryption.
    Returns:
    True if the rename operation is successful.

    requireBucketName

    private any requireBucketName([any bucketName])

    Helper function to catch missing bucket name

    Parameters:
    bucketName

    s3Request

    private struct s3Request([string method='GET'], [string resource=''], [any body=''], [struct headers='[runtime expression]'], [struct parameters='[runtime expression]'], [string filename=''], [numeric timeout='[runtime expression]'], [boolean parseResponse='true'], [boolean getAsBinary='no'], [boolean throwOnError='[runtime expression]'], [numeric tryCount='1'])

    Make a request to Amazon S3.

    Parameters:
    method - The HTTP method for the request.
    resource - The resource to hit in the Amazon S3 service.
    body - The body content of the request, if passed.
    headers - A struct of HTTP headers to send.
    parameters - A struct of HTTP URL parameters to send.
    filename
    timeout - The default CFHTTP timeout.
    parseResponse
    getAsBinary
    throwOnError - Flag to throw exceptions on any error or not, default is true
    tryCount
    Returns:
    The response information.

    setAWSDomain

    public AmazonS3 setAWSDomain(string domain)

    Parameters:
    domain

    setAWSRegion

    public AmazonS3 setAWSRegion(string region)

    Parameters:
    region

    setAccessControlPolicy

    public void setAccessControlPolicy(string bucketName='[runtime expression]', [string uri=''], [any acl])

    Sets a bucket's or object's ACL policy.

    Parameters:
    bucketName - The bucket to set the ACL.
    uri - An optional resource uri to set the ACL.
    acl - The security policy to use. Specify a canned ACL like "public-read" as a string, or provide a struct in the format of the "grants" key returned by getObjectACL()

    setAccessKey

    public any setAccessKey(any accessKey)

    Parameters:
    accessKey

    setAsyncManager

    public any setAsyncManager(any asyncManager)

    Parameters:
    asyncManager

    setAuth

    public AmazonS3 setAuth(string accessKey, string secretKey)

    Set the Amazon Credentials.

    Parameters:
    accessKey - The Amazon access key.
    secretKey - The Amazon secret key.
    Returns:
    The AmazonS3 Instance.

    setAutoContentType

    public any setAutoContentType(any autoContentType)

    Parameters:
    autoContentType

    setAutoMD5

    public any setAutoMD5(any autoMD5)

    Parameters:
    autoMD5

    setBucketVersionStatus

    public boolean setBucketVersionStatus(string bucketName='[runtime expression]', [boolean version='true'])

    Set versioning status for a bucket.

    Parameters:
    bucketName - The bucket to set the versioning status.
    version - The status for the versioning property.
    Returns:
    True if the request was successful.

    setDefaultACL

    public any setDefaultACL(any defaultACL)

    Parameters:
    defaultACL

    setDefaultBucketName

    public any setDefaultBucketName(any defaultBucketName)

    Parameters:
    defaultBucketName

    setDefaultCacheControl

    public any setDefaultCacheControl(any defaultCacheControl)

    Parameters:
    defaultCacheControl

    setDefaultDelimiter

    public any setDefaultDelimiter(any defaultDelimiter)

    Parameters:
    defaultDelimiter

    setDefaultEncryptionAlgorithm

    public any setDefaultEncryptionAlgorithm(any defaultEncryptionAlgorithm)

    Parameters:
    defaultEncryptionAlgorithm

    setDefaultEncryptionKey

    public any setDefaultEncryptionKey(any defaultEncryptionKey)

    Parameters:
    defaultEncryptionKey

    setDefaultStorageClass

    public any setDefaultStorageClass(any defaultStorageClass)

    Parameters:
    defaultStorageClass

    setDefaultTimeOut

    public any setDefaultTimeOut(any defaultTimeOut)

    Parameters:
    defaultTimeOut

    setEncryptionCharset

    public any setEncryptionCharset(any encryptionCharset)

    Parameters:
    encryptionCharset

    setLog

    public any setLog(any log)

    Parameters:
    log

    setMimeTypes

    public any setMimeTypes(any mimeTypes)

    Parameters:
    mimeTypes

    setMultiPartByteThreshold

    public any setMultiPartByteThreshold(any multiPartByteThreshold)

    Parameters:
    multiPartByteThreshold

    setRetriesOnError

    public any setRetriesOnError(any retriesOnError)

    Parameters:
    retriesOnError

    setSSL

    public AmazonS3 setSSL([boolean useSSL='true'])

    Set the ssl flag. Alters the internal URL endpoint accordingly.

    Parameters:
    useSSL - True if SSL should be used for the requests.
    Returns:
    The AmazonS3 instance.

    setSecretKey

    public any setSecretKey(any secretKey)

    Parameters:
    secretKey

    setServiceName

    public any setServiceName(any serviceName)

    Parameters:
    serviceName

    setThrowOnRequestError

    public any setThrowOnRequestError(any throwOnRequestError)

    Parameters:
    throwOnRequestError

    setURLEndpoint

    public any setURLEndpoint(any URLEndpoint)

    Parameters:
    URLEndpoint

    setURLEndpointHostname

    public any setURLEndpointHostname(any URLEndpointHostname)

    Parameters:
    URLEndpointHostname