PawsX-DynamoDB-DocumentClient
view release on metacpan or search on metacpan
NAME
PawsX::DynamoDB::DocumentClient - a simplified way of working with AWS
DynamoDB items that uses Paws under the hood.
SYNOPSIS
use PawsX::DynamoDB::DocumentClient;
my $dynamodb = PawsX::DynamoDB::DocumentClient->new();
$dynamodb->put(
TableName => 'users',
Item => {
user_id => 24,
email => 'bob@example.com',
roles => ['admin', 'finance'],
},
);
my $user = $dynamodb->get(
TableName => 'users',
Key => {
user_id => 24,
},
);
DESCRIPTION
Paws (in this author's opinion) is the best and most up-to-date way of
working with AWS. However, reading and writing DynamoDB items via Paws'
low-level API calls can involve a lot of busy work formatting your data
structures to include DynamoDB types.
This module simplifies some DynamoDB operations by automatically
converting back and forth between simpler Perl data structures and the
request/response data structures used by Paws.
For more information about how types are mananged, see
Net::Amazon::DynamoDB::Marshaler.
This module is based on a similar class in the AWS JavaScript SDK
<http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html>.
outputs
By default, the methods below return plain values (or nothing) that
make normal use cases simpler, as opposed to the output objects that
Paws generates. For example, get() returns a hashref of the item's
data, as opposed to a Paws::DynamoDB::GetItemOutput object.
For use cases where you need more extensive output data, every method
supports a return_paws_output flag, which will return the Paws object
instead.
my $item = $dynamodb->get(
TableName => 'users',
Key => {
user_id => 1000,
},
);
# $item looks like { user_id => 1000, email => 'foo@bar.com', ... }
my $output = $dynamodb->get(
TableName => 'users',
Key => {
user_id => 1000,
},
return_paws_output => 1,
);
# $output isa Paws::DynamoDB::GetItemOutput
force_type
All methods take in an optional force_type parameter, which gets passed
to Net::Amazon::DynamoDB::Marshaler for when you need to override its
default typing. See the description of force_type in that module's
documentation for more details.
METHODS
new
my $dynamodb = PawsX::DynamoDB::DocumentClient->new(
region => 'us-east-1',
);
This class method returns a new PawsX::DynamoDB::DocumentClient object.
It accepts the following parameters:
paws
( run in 1.822 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )