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             # ABSTRACT: An internal class to delete multiple objects from a bucket
2             $Net::Amazon::S3::Operation::Objects::Delete::Request::VERSION = '0.991';
3             use Moose 0.85;
4 99     99   638 use Carp qw/croak/;
  99         1935  
  99         628  
5 99     99   521340  
  99         252  
  99         21499  
6             extends 'Net::Amazon::S3::Request::Bucket';
7              
8             has 'keys' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
9              
10             with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_md5';
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             my ($self) = @_;
18              
19 10     10   23 return $self->_build_xml (Delete => [
20             { Quiet => 'true' },
21             map +{ Object => [ { Key => $_ } ] }, @{ $self->keys }
22             ]);
23 10         28 }
  10         290  
24              
25             my ($self) = @_;
26              
27             croak "The maximum number of keys is 1000"
28 11     11 0 6876 if (scalar(@{$self->keys}) > 1000);
29             }
30              
31 11 100       21 1;
  11         391  
32              
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Net::Amazon::S3::Operation::Objects::Delete::Request - An internal class to delete multiple objects from a bucket
41              
42             =head1 VERSION
43              
44             version 0.991
45              
46             =head1 SYNOPSIS
47              
48             my $http_request = Net::Amazon::S3::Operation::Objects::Delete::Request->new (
49             s3 => $s3,
50             bucket => $bucket,
51             keys => [$key1, $key2],
52             );
53              
54             =head1 DESCRIPTION
55              
56             This module deletes multiple objects from a bucket.
57              
58             Implements operation L<< DeleteObjects|https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html >>
59              
60             =for test_synopsis no strict 'vars'
61              
62             =head1 METHODS
63              
64             =head2 http_request
65              
66             This method returns a HTTP::Request object.
67              
68             =head1 AUTHOR
69              
70             Branislav Zahradník <barney@cpan.org>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             This software is copyright (c) 2022 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník.
75              
76             This is free software; you can redistribute it and/or modify it under
77             the same terms as the Perl 5 programming language system itself.
78              
79             =cut