File Coverage

blib/lib/Net/Amazon/S3/Operation/Object/Upload/Complete/Request.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 19 20 95.0


line stmt bran cond sub pod time code
1             # ABSTRACT: An internal class to complete a multipart upload
2             $Net::Amazon::S3::Operation::Object::Upload::Complete::Request::VERSION = '0.991';
3             use Moose 0.85;
4 99     99   645 use Carp qw/croak/;
  99         2038  
  99         629  
5 99     99   523585  
  99         264  
  99         24878  
6             extends 'Net::Amazon::S3::Request::Object';
7              
8             with 'Net::Amazon::S3::Request::Role::HTTP::Method::POST';
9             with 'Net::Amazon::S3::Request::Role::Query::Param::Upload_id';
10             with 'Net::Amazon::S3::Request::Role::XML::Content';
11              
12             has 'etags' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
13             has 'part_numbers' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
14              
15             __PACKAGE__->meta->make_immutable;
16              
17             my ($self) = @_;
18              
19 2     2   6 return $self->_build_xml (CompleteMultipartUpload => [
20             map +{ Part => [
21             { PartNumber => $self->part_numbers->[$_] },
22             { ETag => $self->etags->[$_] },
23             ]}, 0 .. (@{$self->part_numbers} - 1)
24             ]);
25 2         7 }
  2         70  
26              
27             my ($self) = @_;
28              
29             croak "must have an equally sized list of etags and part numbers"
30 3     3 0 9981 unless scalar(@{$self->part_numbers}) == scalar(@{$self->etags});
31             }
32              
33 3 100       8 1;
  3         126  
  3         107  
34              
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             Net::Amazon::S3::Operation::Object::Upload::Complete::Request - An internal class to complete a multipart upload
43              
44             =head1 VERSION
45              
46             version 0.991
47              
48             =head1 SYNOPSIS
49              
50             my $request = Net::Amazon::S3::Operation::Object::Upload::Complete::Request->new (
51             s3 => $s3,
52             bucket => $bucket,
53             etags => \@etags,
54             part_numbers => \@part_numbers,
55             );
56              
57             =head1 DESCRIPTION
58              
59             This module completes a multipart upload.
60              
61             Implements operation L<< CompleteMultipartUpload|https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.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) 2022 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