Mura CMS 6.1

mura.content.file
Class s3

railo-context.Component
        extended by mura.content.file.s3

public class s3
extends railo-context.Component

Constructor Summary
init(string awsKey, string awsSecret, [string localCacheDir], [string awsEndpoint='s3.amazonaws.com'])
 
Method Summary
private string cacheFilenameFromBucketAndKey(string bucket, string objectKey)
 void deleteCacheFor(string bucket, string objectKey)
 void deleteS3File(string bucket, string objectKey)
private void deleteS3FileInternal(string bucket, string objectKey, numeric attemptCount)
 string getFileFromS3(string bucket, string objectKey, [string localFilePath])
          Brings a file from S3 down local, and returns the fully qualified local path
private string getRequestSignature(string verb, string bucket, string objectKey, string dateOrExpiration, [string contentType=''], [string contentMd5=''], [string canonicalizedAmzHeaders=''])
 struct putFileOnS3(any binaryFileData, string contentType, string bucket, string objectKey, [boolean isPublic='true'])
          I put a file on S3, and return the HTTP response from the PUT
 boolean s3FileExists(string bucket, string objectKey)
 string s3Url(string bucket, string objectKey, [string requestType='vhost'], [numeric timeout='900'], [string verb='GET'])
 
Methods inherited from class railo-context.Component
 

Constructor Detail

init

public init(string awsKey, string awsSecret, [string localCacheDir], [string awsEndpoint='s3.amazonaws.com'])

Parameters:
awsKey
awsSecret
localCacheDir - If omitted, no local caching is done. If provided, this directory is used for local caching of S3 assets. Note that if local caching is enabled, this CFC assumes it is the only entity managing the S3 storage and therefore that S3 never needs to be checked for updates (other than those made though this CFC). If you update S3 via other means, you cannot safely use the local cache.
awsEndpoint
Method Detail

cacheFilenameFromBucketAndKey

private string cacheFilenameFromBucketAndKey(string bucket, string objectKey)

Parameters:
bucket
objectKey

deleteCacheFor

public void deleteCacheFor(string bucket, string objectKey)

Parameters:
bucket
objectKey

deleteS3File

public void deleteS3File(string bucket, string objectKey)

Parameters:
bucket
objectKey

deleteS3FileInternal

private void deleteS3FileInternal(string bucket, string objectKey, numeric attemptCount)

Parameters:
bucket
objectKey
attemptCount

getFileFromS3

public string getFileFromS3(string bucket, string objectKey, [string localFilePath])
Brings a file from S3 down local, and returns the fully qualified local path

Parameters:
bucket
objectKey
localFilePath - If omitted a temp file will be created

getRequestSignature

private string getRequestSignature(string verb, string bucket, string objectKey, string dateOrExpiration, [string contentType=''], [string contentMd5=''], [string canonicalizedAmzHeaders=''])

Parameters:
verb
bucket
objectKey
dateOrExpiration
contentType
contentMd5
canonicalizedAmzHeaders - A newline-delimited list of headers, in lexographical order, duplicates collapsed, and no extraneous whitespace. See Amazon's description of 'CanonicalizedAmzHeaders' for specifics.

putFileOnS3

public struct putFileOnS3(any binaryFileData, string contentType, string bucket, string objectKey, [boolean isPublic='true'])
I put a file on S3, and return the HTTP response from the PUT

Parameters:
binaryFileData
contentType
bucket
objectKey
isPublic

s3FileExists

public boolean s3FileExists(string bucket, string objectKey)

Parameters:
bucket
objectKey

s3Url

public string s3Url(string bucket, string objectKey, [string requestType='vhost'], [numeric timeout='900'], [string verb='GET'])

Parameters:
bucket
objectKey
requestType - Must be one of 'regular', 'ssl', 'vhost', or 'cname'. 'Vhost' and 'cname' are only valid if your bucket name conforms to the S3 virtual host conventions, and cname requires a CNAME record configured in your DNS.
timeout - The number of seconds the URL is good for. Defaults to 900 (15 minutes).
verb - The HTTP verb to use. Only GET (the default) and HEAD make sense.

Mura CMS 6.1