The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Amazon::DynamoDB::20120810 - interact with DynamoDB using API version 20120810

VERSION

version 0.005

DESCRIPTION

new

Instantiates the API object.

Expects the following named parameters:

  • implementation - the object which provides a Future-returning request method, see WebService::Amazon::DynamoDB::NaHTTP for example.

  • uri - the base URI for constructing requests

  • security - 'iam' or 'key'

  • access_key - the access key for signing requests (only for security=key)

  • secret_key - the secret key for signing requests (only for security=key)

  • role - the role to use for requests (only for security=iam, usually autodetected from EC2 instance metadata)

  • algorithm - which signing algorithm to use, default AWS4-HMAC-SHA256

security_token

create_table

Creates a new table. It may take some time before the table is marked as active - use "wait_for_table" to poll until the status changes.

Named parameters:

  • table - the table name

  • read_capacity - expected read capacity units (optional, default 5)

  • write_capacity - expected write capacity units (optional, default 5)

  • fields - an arrayref specifying the fields, in pairs of (name, type), where type is N for numeric, S for string, SS for string sequence, B for binary etc.

  • primary - the primary keys as an arrayref of pairs indicating (name, type), default type is hash so ['pkey'] would create a single HASH primary key

describe_table

Describes the given table.

Takes a single named parameter:

  • table - the table name

and returns the table spec.

delete_table

Delete a table entirely.

Takes a single named parameter:

  • table - the table name

wait_for_table

Waits for the given table to be marked as active.

Takes a single named parameter:

  • table - the table name

each_table

Run code for all current tables.

Takes a coderef as the first parameter, will call this for each table found.

list_tables

Returns a Future which will resolve with a list of all tables.

Takes no parameters.

 $ddb->list_tables->on_done(sub {
  my @tbl = @_;
  print "Table: $_\n" for @tbl;
 });

put_item

Writes a single item to the table.

Takes the following named parameters:

  • table - the table name

  • fields - the field spec, as a { key => value } hashref

update_item

Updates a single item in the table.

Takes the following named parameters:

  • table - the table name

  • item - the item to update, as a{ key => value } hashref

  • fields - the field spec, as a { key => value } hashref

delete_item

Deletes a single item from the table.

Takes the following named parameters:

  • table - the table name

  • item - the item to delete, as a { key => value } hashref

batch_get_item

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:

  • items - the search spec, as { table => { attribute => 'value', ... }, ... }

scan

Scan a table for values with an optional filter expression.

METHODS - Internal

The following methods are intended for internal use and are documented purely for completeness - for normal operations see "METHODS" instead.

FUNCTIONS - Internal

type_for_value

Returns an appropriate type (N, S, SS etc.) for the given value.

Rules are similar to JSON - if you want numeric, numify (0+$value), otherwise you'll get a string.

type_and_value

Returns a pair of (type, value), using "type_for_value".

INHERITED METHODS

WebService::Amazon::DynamoDB

cached_iam_credentials, credentials, find_iam_role, iam, make_request, retrieve_iam_credentials, security, uri

AUTHOR

Tom Molesworth <cpan@perlsite.co.uk>

LICENSE

Copyright Tom Molesworth 2013-2015. Licensed under the same terms as Perl itself.