File Coverage

blib/lib/Net/Amazon/S3/Operation/Objects/Delete/Request.pm
Criterion Covered Total %
statement 12 12 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 18 19 94.7


line stmt bran cond sub pod time code
1             package Net::Amazon::S3::Operation::Objects::Delete::Request;
2             # ABSTRACT: An internal class to delete multiple objects from a bucket
3             $Net::Amazon::S3::Operation::Objects::Delete::Request::VERSION = '0.98';
4 96     96   748 use Moose 0.85;
  96         2662  
  96         806  
5 96     96   663245 use Carp qw/croak/;
  96         299  
  96         27356  
6              
7             extends 'Net::Amazon::S3::Request::Bucket';
8              
9             has 'keys' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
10              
11             with 'Net::Amazon::S3::Request::Role::HTTP::Method::POST';
12             with 'Net::Amazon::S3::Request::Role::Query::Action::Delete';
13             with 'Net::Amazon::S3::Request::Role::XML::Content';
14              
15             __PACKAGE__->meta->make_immutable;
16              
17             sub _request_content {
18 10     10   31 my ($self) = @_;
19              
20             return $self->_build_xml (Delete => [
21             { Quiet => 'true' },
22 10         51 map +{ Object => [ { Key => $_ } ] }, @{ $self->keys }
  10         386  
23             ]);
24             }
25              
26             sub BUILD {
27 11     11 0 8274 my ($self) = @_;
28              
29             croak "The maximum number of keys is 1000"
30 11 100       27 if (scalar(@{$self->keys}) > 1000);
  11         477  
31             }
32              
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             Net::Amazon::S3::Operation::Objects::Delete::Request - An internal class to delete multiple objects from a bucket
44              
45             =head1 VERSION
46              
47             version 0.98
48              
49             =head1 SYNOPSIS
50              
51             my $http_request = Net::Amazon::S3::Operation::Objects::Delete::Request->new (
52             s3 => $s3,
53             bucket => $bucket,
54             keys => [$key1, $key2],
55             );
56              
57             =head1 DESCRIPTION
58              
59             This module deletes multiple objects from a bucket.
60              
61             Implements operation L<< DeleteObjects|https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html >>
62              
63             =for test_synopsis no strict 'vars'
64              
65             =head1 METHODS
66              
67             =head2 http_request
68              
69             This method returns a HTTP::Request object.
70              
71             =head1 AUTHOR
72              
73             Branislav ZahradnĂ­k <barney@cpan.org>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav ZahradnĂ­k.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut