strict;
use warnings;
use IO::Async;
use Net::Async::HTTP;
use HTML::TreeBuilder qw(-weak);
use JSON::MaybeXS;
my $loop = IO::Async::Loop->new;
$loop->add(
my $ua = Net::Async::HTTP->new(
fail_o
> 'tbody'), $ddb;
binmode STDOUT, ':encoding(UTF-8)';
my $json = JSON::MaybeXS->new(
pretty => 1,
canonical => 1,
);
print $json->encode({
errors => [
map {;
my @cols = map $_->as
],
exception => $cols[1],
message => $cols[2],
cause => $cols[3],
retry => $cols[4] eq 'Y' ? JSON->true : JSON->false,
}
} @rows
]
});
Future->wrap;
})->get;
ead1 DESCRIPTION
=cut
use Future;
use Future::Utils qw(try_repeat);
use POSIX qw(strftime);
use JSON::MaybeXS;
use Scalar::Util qw(reftype);
use B qw(svref_2object);
use HTTP::Request;
use WebServi
cess_key} }
sub secret_key { shift->{secret_key} }
sub api_version { '20120810' }
sub json { shift->{json} //= JSON::MaybeXS->new }
=head2 security_token
=cut
sub security_token { shift->{security_
(
# Sadly not the same key as used in DeleteTable
done => sub { my $content = shift; $self->json->decode($content)->{Table}; }
);
})
}
=head2 delete_table
Delete a table entirely.
Takes a
cut
sub make_request {
my $self = shift;
my %args = @_;
my $target = $args{target};
my $js = JSON::MaybeXS->new;
my $req = HTTP::Request->new(
POST => $self->uri
);
$req->header( host => $se
namoDB_'. $self->api_version. '.'. $target );
$req->header( 'content-type' => 'application/x-amz-json-1.0' );
my $payload = $js->encode($args{payload});
$req->content($payload);
$req->header( 'Con
r_value
Returns an appropriate type (N, S, SS etc.) for the given
value.
Rules are similar to L<JSON> - if you want numeric, numify (0+$value),
otherwise you'll get a string.
=head2 type_and_value
strict;
use warnings;
use IO::Async;
use Net::Async::HTTP;
use HTML::TreeBuilder qw(-weak);
use JSON::MaybeXS;
my $loop = IO::Async::Loop->new;
$loop->add(
my $ua = Net::Async::HTTP->new(
fail_o
> 'tbody'), $ddb;
binmode STDOUT, ':encoding(UTF-8)';
my $json = JSON::MaybeXS->new(
pretty => 1,
canonical => 1,
);
print $json->encode({
regions => [
map {;
my @cols = map $_->a