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