mergAWS

mergAWS is an iOS and MacOS X external that adds functions and command for using amazon web services.

Documentation

command mergAWSSetCredentials pAccessKeyID,pSecretAccessKey

Set you Amazon Web Services credentials

Parameters:

  • pAccessKeyID - your access key ID
  • pSecretAccessKey - your secret access key

SimpleDB

command mergAWSSimpleDBCreateDomain pDomain

Create a new domain. This command is non-blocking and a success notification will be sent to the calling object via the mergAWSSimpleDBDomainCreated message.

Parameters:

  • pDomain - the domain name

message mergAWSSimpleDBDomainCreated pDomain

Parameters:

  • pDomain -

command mergAWSSimpleDBListDomains [pNextToken]

List all the domains associated with your account. This command is non-blocking and the domains will be returned to the calling object via the mergAWSSimpleDBDomains message. In the event there are many domains in your account then results will be split and pNextToken may be used to request the next set of results.

Parameters:

  • pNextToken - (optional with "" default)

message mergAWSSimpleDBDomains pDomains,pNextToken

Sent the the LiveCode object that called the mergAWSSimpleDBListDomains command.

Parameters:

  • pDomains - A list of domains from the account.
  • pNextToken - If there are too many domains to return in a single response then the pNextToken can be used to repeat the request.

command mergAWSSimpleDBDeleteDomain pDomain

Delete the specified domain. This command is non-blocking and a success notification will be sent to the calling object via the mergAWSSimpleDBDomainDeleted message.

Parameters:

  • pDomain - a domain name

message mergAWSSimpleDBDomainDeleted pDomain

Sent the the LiveCode object that called the mergAWSSimpleDBDeleteDomain command.

Parameters:

  • pDomain - The domain name deleted.

function mergAWSSimpleDBCreateItems

Create an items object to be used for a put or delete.

Returns a pointer to the items in memory

command mergAWSSimpleDBReleaseItems pItemsPointer

Release the items object from memory. Objects should be released from memory when you no longer need to access them to free resources.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems. This parameter is an inout style parameter which means it must be a variable (not a constant or custom property) and it's value may be altered by the external.

command mergAWSSimpleDBAddItem pItemsPointer,pItemName

Add an item to an items object.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems
  • pItemName - an item name

command mergAWSSimpleDBAddAttribute pItemsPointer,pItemName,pAttributeName,pAttributeValue,[pReplace]

Add an attribute to an item in an items object.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems
  • pItemName - an item name
  • pAttributeName - an attribute name
  • pAttributeValue - an attribute value
  • pReplace - (optional with "true" default) if true then when the items are put to the server the value will replace the value for an existing attribute otherwise it will create another attribute of the same name
    • true
    • false

command mergAWSSimpleDBPut pDomain,pItemsPointer

Put the items represented by the items object to the server in a specified domain. This command is non-blocking and a success notification will be sent to the calling object via the mergAWSSimpleDBPutCompleted message.

Parameters:

  • pDomain - The name of the domain on the server. The domain should already exist.
  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems

message mergAWSSimpleDBPutCompleted pDomain

Sent the the LiveCode object that called the mergAWSSimpleDBPut command.

Parameters:

  • pDomain - The domain the items were put to.

command mergAWSSimpleDBDelete pDomain,pItemsPointer

Delete from the server the items represented by the items object from a specified domain. This command is non-blocking and a success notification will be sent to the calling object via the mergAWSSimpleDBDeleteCompleted message.

Parameters:

  • pDomain - The name of the domain on the server. The domain should already exist.
  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems

message mergAWSSimpleDBDeleteCompleted pDomain

Sent the the LiveCode object that called the mergAWSSimpleDBDelete command.

Parameters:

  • pDomain - The domain the items were put to.

command mergAWSSimpleDBQuery pQueryString,[pNextToken]

Select data from the server with a SQL like query. An example might be SELECT * FROM `MyDomainName`. This command is non-blocking and a query object will be sent to the calling object via the mergAWSSimpleDBQueryResponse message. More information about SimpleDB queries is available here.

Parameters:

  • pQueryString - a SQL like query.
  • pNextToken - (optional with "" default) If the query results are too large the server will only return partial results. The mergAWSSimpleDBSelectResponse message also sends a pNextToken parameter in these instances and you can use that to perform a second query to get the remainder of the results.

message mergAWSSimpleDBQueryResponse pDomain,pItemsPointer

Sent the the LiveCode object that called the mergAWSSimpleDBQuery command.

Parameters:

  • pDomain - The domain the items were put to.
  • pItemsPointer - The pointer to the query object in memory. The items object has all attributes pre-set with replace being true.

function mergAWSSimpleDBListItems pItemsPointer

List the items returned in the items object.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems

Returns the item names returned by the query

function mergAWSSimpleDBAttributeCount pItemsPointer,pItemName

Get the number of attributes for a specified item in a query object.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems
  • pItemName - an item name

Returns the number of attributes

function mergAWSSimpleDBAttributeName pItemsPointer,pItemName,pAttributeNumber

Get the name of the attribute for a specifed item in a query object.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems
  • pItemName - an item name
  • pAttributeNumber - a number between 1 and the results of mergAWSSimpleDBAttributeCount()

Returns the name of the attribute

function mergAWSSimpleDBAttributeValue pItemsPointer,pItemName,pAttributeNumber

Get the value of the attribute for a specifed item in a query object.

Parameters:

  • pItemsPointer - a pointer to an items object in memory as returned by mergAWSSimpleDBQueryCompleted, mergAWSSimpleDBGetItemCompleted or mergAWSSimpleDBCreateItems
  • pItemName - an item name
  • pAttributeNumber - a number between 1 and the results of mergAWSSimpleDBAttributeCount()

Returns the value of the attribute

command mergAWSSimpleDBGetItem pDomain,pItemName

Get the item in a specified domain. This command is non-blocking and a success notification will be sent to the calling object via the mergAWSSimpleDBGetItemCompleted message.

Parameters:

  • pDomain - The name of the domain on the server. The domain should already exist.
  • pItemName - the name of the item to get from the server

message mergAWSSimpleDBGetItemCompleted pDomain,pItemName,pItemsPointer

Sent the the LiveCode object that called the mergAWSSimpleDBGetItem command.

Parameters:

  • pDomain - The domain the items were put to.
  • pItemName - The name of the item.
  • pItemsPointer - A pointer to an items object in memory. The items object has all attributes pre-set with replace being true.

S3

command mergAWSS3GetBuckets

Get a list of buckets

message mergAWSS3Buckets pBuckets

Sent the the LiveCode object that called the mergAWSS3GetBuckets command.

Parameters:

  • pBuckets - A list of bucket names with one on each line.

command mergAWSS3CreateBucket pBucket

Create a bucket

Parameters:

  • pBucket - The name of an bucket to create on S3. A bucket can be thought of as a folder.

message mergAWSS3BucketCreated pBucket

Sent the the LiveCode object that called the mergAWSS3CreateBucket command.

Parameters:

  • pBucket - The name of an bucket created on S3. A bucket can be thought of as a folder.

command mergAWSS3DeleteBucket pBucket

Delete a bucket

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.

message mergAWSS3BucketDeleted pBucket

Sent the the LiveCode object that called the mergAWSS3DeleteBucket command.

Parameters:

  • pBucket - The name of an bucket deleted on S3. A bucket can be thought of as a folder.

command mergAWSS3GetObjectsInBucket pBucket

Get a list of object keys in a bucket

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.

message mergAWSS3ObjectsInBucket pBucket,pObjects

Sent the the LiveCode object that called the mergAWSS3GetObjectsInBucket command.

Parameters:

  • pBucket - The name of an bucket deleted on S3. A bucket can be thought of as a folder.
  • pObjects - A list of object keys with one on each line.

command mergAWSS3PutObjectFromFile pBucket,pKey,pFilePath

Put a file into a specified bucket with a given key. This option is better for large files because the data isn't all held in memory and passed to mergAWS.

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.
  • pFilePath - The file path of the file to upload to S3

command mergAWSS3PutObject pBucket,pKey,pData

Put a file into a specified bucket with a given key

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.
  • pData - The data to put in the object.

message mergAWSS3ObjectPut pBucket,pKey

Sent the the LiveCode object that called the mergAWSS3PutObjectFromFile or mergAWSS3PutObject command.

Parameters:

  • pBucket - The name of an bucket deleted on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.

command mergAWSS3GetObjectToFile pBucket,pKey,pFilePath

Get an object from S3 and write it to a local file. This option is better for large files because the data isn't all held in memory and passed to your app.

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.
  • pFilePath - The file path to save the S3 object to.

command mergAWSS3GetObject pBucket,pKey

Get the object data from a specified bucket and key

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.

message mergAWSS3Object pBucket,pKey,pData

Sent the the LiveCode object that called the mergAWSS3GetObjectToFile or mergAWSS3GetObject command.

Parameters:

  • pBucket - The name of an bucket deleted on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.
  • pData - The data for the object. This parameter is not sent if mergAWSS3GetObjectToFile was called.

command mergAWSS3DeleteObject pBucket,pKey

Delete the object from a specified bucket and key

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.

message mergAWSS3ObjectDeleted pBucket,pKey

Sent the the LiveCode object that called the mergAWSS3DeleteObject command.

Parameters:

  • pBucket - The name of an bucket deleted on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.

command mergAWSS3GetPresignedURL pBucket,pKey,[pContentType],[pExpiry],[pProtocol],[pHTTPVerb]

Get a url that you can use in a browser etc.

Parameters:

  • pBucket - The name of an existing bucket on S3. A bucket can be thought of as a folder.
  • pKey - The key for the object. A key can be thought of as a file name.
  • pContentType - (optional with "image/jpeg" default) / The content type you want the browser to treat the data as.
  • pExpiry - (optional with 86400 default) The number of seconds from now you want the url to be valid for. Defaults to 86400 or 1 day.
  • pProtocol - (optional with "HTTPS" default) The protocol you want to use
    • HTTPS
    • HTTP
  • pHTTPVerb - (optional with "GET" default) The HTTP verb you want to use
    • GET
    • PUT
    • HEAD
    • - * section General

Progress

message mergAWSProgress pStatus,pParam1,pParam2

Sent the the LiveCode object that called one of the mergAWSSimpleDB commands.

Parameters:

  • pStatus - The current status of the request. The status will be one of:|uploading|downloading|error
  • pParam1 - The value of pParam1 will be different depending on the status. If the status is uploading the value will be the remaining bytes to upload. If it's downloading it will be the bytes received. If it's error then it will be an error message.
  • pParam2 - The value of pParam2 will be different depending on the status. If the status is uploading the total bytes to upload. If it's downloading it will be the total bytes expected to download. Unfortunately SimpleDB seems to send an expected content length of -1 so this parameter should not be relied on.