Amazon-DynamoDB

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN


Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License.  However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.

  5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.

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

     implementation => 'Amazon::DynamoDB::LWP',
     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 => { 

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



sub new {
    my $class = shift;
    bless { @_ }, $class
}

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} }



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

    $self->_scan_or_query_process('Scan', $payload, $code, { ResultLimit => $Limit});
}


method make_request(Str :$target,
                    HashRef :$payload,
                ) {
    my $api_version = '20120810';
    my $host = $self->host;
    my $req = HTTP::Request->new(
        POST => (($self->ssl) ? 'https' : 'http') . '://' . $self->host . ($self->port ? (':' . $self->port) : '') . '/'
    );
    $req->header( host => $host );
    # Amazon requires ISO-8601 basic format
    my $now = time;
    my $http_date = strftime('%Y%m%dT%H%M%SZ', gmtime($now));
    my $date = strftime('%Y%m%d', gmtime($now));

    $req->protocol('HTTP/1.1');
    $req->header( 'Date' => $http_date );
    $req->header( 'x-amz-target', 'DynamoDB_'. $api_version. '.'. $target );

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


=over 4

=item * implementation - the object which provides a Future-returning C<request> method,
see L<Amazon::DynamoDB::NaHTTP> for example.

=item * host - the host (IP or hostname) to communicate with

=item * port - the port to use for HTTP(S) requests

=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

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.000 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )