Amazon::DynamoDB::20120810 - interact with DynamoDB using API version 20120810
version 0.004
Instantiates the API object.
Expects the following named parameters:
implementation - the object which provides a Future-returning request method, see Amazon::DynamoDB::NaHTTP for example.
request
host - the host (IP or hostname) to communicate with
port - the port to use for HTTP(S) requests
ssl - true for HTTPS, false for HTTP
algorithm - which signing algorithm to use, default AWS4-HMAC-SHA256
scope - the scope for requests, typically region/host/aws4_request
region/host/aws4_request
access_key - the access key for signing requests
secret_key - the secret key for signing requests
debug_failures - print errors if they occur
max_retries - maximum number of retries for a request
Creates a new table. It may take some time before the table is marked as active - use "wait_for_table_status" to poll until the status changes.
Amazon Documentation:
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html
$ddb->create_table( TableName => $table_name, ReadCapacityUnits => 2, WriteCapacityUnits => 2, AttributeDefinitions => { user_id => 'N', date => 'N', }, KeySchema => ['user_id', 'date'], LocalSecondaryIndexes => [ { IndexName => 'UserDateIndex', KeySchema => ['user_id', 'date'], Projection => { ProjectionType => 'KEYS_ONLY', }, ProvisionedThroughput => { ReadCapacityUnits => 2, WriteCapacityUnits => 2, } } ] );
Describes the given table.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html
$ddb->describe_table(TableName => $table_name);
Delete a table entirely.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteTable.html
$ddb->delete_table(TableName => $table_name)
Waits for the given table to be marked as active.
TableName - the table name
WaitInterval - default wait interval in seconds.
DesiredStatus - status to expect before completing. Defaults to ACTIVE
$ddb->wait_for_table_status(TableName => $table_name);
Run code for all current tables.
Takes a coderef as the first parameter, will call this for each table found.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html
my @all_tables; $ddb->each_table( sub { my $table_name =shift; push @all_tables, $table_name; });
Writes a single item to the table.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html
$ddb->put_item( TableName => $table_name, Item => { name => 'Test Name' }, ReturnValues => 'ALL_OLD');
Updates a single item in the table.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
$ddb->update_item( TableName => $table_name, Key => { user_id => 2 }, AttributeUpdates => { name => { Action => 'PUT', Value => "Rusty Conover-3", }, favorite_color => { Action => 'DELETE' }, test_numbers => { Action => 'DELETE', Value => [500] }, added_number => { Action => 'ADD', Value => 5, }, subtracted_number => { Action => 'ADD', Value => -5, }, });
Deletes a single item from the table.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html
$ddb->delete_item( TableName => $table_name, Key => { user_id => 5 });
Retrieve an items from one tables.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html
my $found_item; my $get = $ddb->get_item( sub { $found_item = shift; }, TableName => $table_name, Key => { user_id => 6 });
Put or delete a collection of items.
Has no restriction on the number of items able to be processed at one time.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
$ddb->batch_write_item( RequestItems => { books => [ { DeleteRequest => { book_id => 3000, } }, ], users => [ { PutRequest => { user_id => 3000, name => "Test batch write", } }, { PutRequest => { user_id => 3001, name => "Test batch write", } } ] });
Retrieve a batch of items from one or more tables.
Takes a coderef which will be called for each found item, followed by these named parameters:
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html
$ddb->batch_get_item( sub { my ($table, $item) = @_; }, RequestItems => { $table_name => { ConsistentRead => 'true', AttributesToGet => ['user_id', 'name'], Keys => [ { user_id => 1, }, ], } })
Query a table or an index.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
$ddb->query( sub { my $item = shift; }, KeyConditions => { user_id => { ComparisonOperator => "EQ" AttributeValueList => 1, }, }, AttributesToGet => ["user_id"], TableName => $table_name );
Scan a table for values with an optional filter expression.
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
$ddb->scan( sub { my $item = shift; push @found_items, $item; }, TableName => $table_name, ScanFilter => { user_id => { ComparisonOperator => 'NOT_NULL', } });
The following methods are intended for internal use and are documented purely for completeness - for normal operations see "METHODS" instead.
Generates an HTTP::Request.
Returns an appropriate type (N, S, SS etc.) and stringified/encoded value for the given value.
DynamoDB only uses strings even if there is a Numeric value specified, so while the type will be expressed as a Number the value will be stringified.
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html
Rusty Conover <rusty@luckydinosaur.com>
Based on code by:
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2013. Licensed under the same terms as Perl itself. Copyright 2014 Rusty Conover, Lucky Dinosaur, LLC. Licensed under the same terms as Perl itself.
2 POD Errors
The following errors were encountered while parsing the POD:
=back without =over
You forgot a '=back' before '=head2'
To install Amazon::DynamoDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Amazon::DynamoDB
CPAN shell
perl -MCPAN -e shell install Amazon::DynamoDB
For more information on module installation, please visit the detailed CPAN module installation guide.