Amazon-DynamoDB

 view release on metacpan or  search on metacpan

lib/Amazon/DynamoDB.pm  view on Meta::CPAN

     version        => '20120810',

     access_key     => 'access_key',
     secret_key     => 'secret_key',
     # or you specify to use an IAM role
     use_iam_role   => 1, 

     host => 'dynamodb.us-east-1.amazonaws.com',
     scope => 'us-east-1/dynamodb/aws4_request',
     ssl => 1,
     debug => 1);

  $ddb->batch_get_item(
     sub {
       my $tbl = shift;
       my $data = shift;
       print "Batch get: $tbl had " . join(',', %$data) . "\n";
     },
     RequestItems => {
       $table_name => { 
         Keys => [

lib/Amazon/DynamoDB/20120810.pm  view on Meta::CPAN

}

sub implementation { shift->{implementation} }
sub host { shift->{host} }
sub port { shift->{port} }
sub ssl { shift->{ssl} }
sub algorithm { 'AWS4-HMAC-SHA256' }
sub scope { shift->{scope} }
sub access_key { shift->{access_key} }
sub secret_key { shift->{secret_key} }
sub debug_failures { shift->{debug} }

sub max_retries { shift->{max_retries} }





method create_table(TableNameType :$TableName!,
                    Int :$ReadCapacityUnits = 2, 
                    Int :$WriteCapacityUnits = 2,

lib/Amazon/DynamoDB/20120810.pm  view on Meta::CPAN

                                }
                            }
                        }
                    }
                    
                    if (defined($self->max_retries()) && $current_retry > $self->max_retries()) {
                        $do_retry = 0;
                    }

                    if (!$do_retry) {
                        if ($self->debug_failures()) {
                            print "DynamoDB Failure: $status\n";
                            if (defined($resp)) {
                                print "response:\n";
                                print $resp->as_string() . "\n";
                            }
                            if (defined($req)) {
                                print "Request:\n";
                                print $req->as_string() . "\n";
                            }
                        }

lib/Amazon/DynamoDB/20120810.pm  view on Meta::CPAN

=item * ssl - true for HTTPS, false for HTTP

=item * algorithm - which signing algorithm to use, default AWS4-HMAC-SHA256

=item * scope - the scope for requests, typically C<region/host/aws4_request>

=item * access_key - the access key for signing requests

=item * secret_key - the secret key for signing requests

=item * debug_failures - print errors if they occur

=item * max_retries - maximum number of retries for a request

=back

=head2 create_table

Creates a new table. It may take some time before the table is marked
as active - use L</wait_for_table_status> to poll until the status changes.

t/TestSettings.pm  view on Meta::CPAN

sub get_ddb {
    my %options = @_;
    my $ddb = Amazon::DynamoDB->new(
        implementation => 'Amazon::DynamoDB::LWP',
        version        => '20120810',
        access_key     => $ENV{AWS_ACCESS_KEY},
        secret_key     => $ENV{AWS_SECRET_KEY},
        host => 'dynamodb.us-east-1.amazonaws.com',
        scope => 'us-east-1/dynamodb/aws4_request',
        ssl => 1,
        debug_failures => 1,
        %options);
    return $ddb;
}

sub random_table_name {
    return 'table_test_' . String::Random::random_string('ccccccc');
}

1;



( run in 1.223 second using v1.01-cache-2.11-cpan-49f99fa48dc )