| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::Amazon::S3::Operation::Objects::List::Response; | 
| 2 |  |  |  |  |  |  | # ABSTRACT: An internal class to list a bucket (List Objects Version 1) | 
| 3 |  |  |  |  |  |  | $Net::Amazon::S3::Operation::Objects::List::Response::VERSION = '0.98'; | 
| 4 | 96 |  |  | 96 |  | 815 | use Moose; | 
|  | 96 |  |  |  |  | 250 |  | 
|  | 96 |  |  |  |  | 963 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | extends 'Net::Amazon::S3::Response'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub bucket { | 
| 9 | 5 |  |  | 5 | 0 | 155 | $_[0]->_data->{bucket}; | 
| 10 |  |  |  |  |  |  | } | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub prefix { | 
| 13 | 5 |  |  | 5 | 0 | 136 | $_[0]->_data->{prefix}; | 
| 14 |  |  |  |  |  |  | } | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub marker { | 
| 17 | 5 |  |  | 5 | 0 | 134 | $_[0]->_data->{marker}; | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub next_marker { | 
| 21 | 8 |  |  | 8 | 0 | 214 | $_[0]->_data->{next_marker}; | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | sub max_keys { | 
| 25 | 5 |  |  | 5 | 0 | 130 | $_[0]->_data->{max_keys}; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub is_truncated { | 
| 29 | 8 |  |  | 8 | 0 | 226 | $_[0]->_data->{is_truncated}; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | sub contents { | 
| 33 | 9 |  |  | 9 | 0 | 33 | @{ $_[0]->_data->{contents} }; | 
|  | 9 |  |  |  |  | 258 |  | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | sub common_prefixes { | 
| 37 | 2 |  |  | 2 | 0 | 5 | @{ $_[0]->_data->{common_prefixes} }; | 
|  | 2 |  |  |  |  | 54 |  | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | sub _parse_data { | 
| 41 | 9 |  |  | 9 |  | 183 | my ($self) = @_; | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 9 |  |  |  |  | 258 | my $xpc = $self->xpath_context; | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 9 |  |  |  |  | 37 | my $data = { | 
| 46 |  |  |  |  |  |  | bucket       => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:Name"), | 
| 47 |  |  |  |  |  |  | prefix       => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:Prefix"), | 
| 48 |  |  |  |  |  |  | marker       => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:Marker"), | 
| 49 |  |  |  |  |  |  | next_marker  => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:NextMarker"), | 
| 50 |  |  |  |  |  |  | max_keys     => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:MaxKeys"), | 
| 51 |  |  |  |  |  |  | is_truncated => scalar $xpc->findvalue ("/s3:ListBucketResult/s3:IsTruncated") eq 'true', | 
| 52 |  |  |  |  |  |  | contents     => [], | 
| 53 |  |  |  |  |  |  | common_prefixes => [], | 
| 54 |  |  |  |  |  |  | }; | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 9 |  |  |  |  | 3267 | for my $content ($xpc->findnodes ("/s3:ListBucketResult/s3:Contents")) { | 
| 57 | 12 |  |  |  |  | 939 | push @{ $data->{contents} }, { | 
|  | 12 |  |  |  |  | 46 |  | 
| 58 |  |  |  |  |  |  | key             => scalar $xpc->findvalue ("./s3:Key",          $content), | 
| 59 |  |  |  |  |  |  | last_modified   => scalar $xpc->findvalue ("./s3:LastModified", $content), | 
| 60 |  |  |  |  |  |  | etag            => scalar $xpc->findvalue ("./s3:ETag",         $content), | 
| 61 |  |  |  |  |  |  | size            => scalar $xpc->findvalue ("./s3:Size",         $content), | 
| 62 |  |  |  |  |  |  | storage_class   => scalar $xpc->findvalue ("./s3:StorageClass", $content), | 
| 63 |  |  |  |  |  |  | owner => { | 
| 64 |  |  |  |  |  |  | id          => $xpc->findvalue ("./s3:Owner/s3:ID",           $content), | 
| 65 |  |  |  |  |  |  | displayname => $xpc->findvalue ("./s3:Owner/s3:DisplayName",  $content), | 
| 66 |  |  |  |  |  |  | }, | 
| 67 |  |  |  |  |  |  | }; | 
| 68 | 12 |  |  |  |  | 4843 | $data->{contents}[-1]{etag} =~ s/^"|"$//g; | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 | 9 |  |  |  |  | 625 | for my $delimiter ($xpc->findnodes ("/s3:ListBucketResult/s3:Delimiter")) { | 
| 72 | 4 |  |  |  |  | 150 | $data->{delimiter} = $xpc->findvalue ('.', $delimiter); | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 9 | 100 |  |  |  | 565 | if (defined $data->{delimiter}) { | 
| 76 | 4 |  |  |  |  | 53 | my $strip_delim = length $data->{delimiter}; | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 4 |  |  |  |  | 14 | for my $common_prefix ($xpc->findnodes ("/s3:ListBucketResult/s3:CommonPrefixes")) { | 
| 79 | 6 |  |  |  |  | 146 | my $prefix = $xpc->findvalue ('./s3:Prefix', $common_prefix); | 
| 80 | 6 |  |  |  |  | 363 | $prefix = substr $prefix, 0, -$strip_delim; | 
| 81 | 6 |  |  |  |  | 87 | push @{ $data->{common_prefixes} }, $prefix; | 
|  | 6 |  |  |  |  | 28 |  | 
| 82 |  |  |  |  |  |  | } | 
| 83 |  |  |  |  |  |  | } | 
| 84 |  |  |  |  |  |  |  | 
| 85 | 9 |  |  |  |  | 209 | return $data; | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | 1; | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | __END__ | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =pod | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =encoding UTF-8 | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =head1 NAME | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | Net::Amazon::S3::Operation::Objects::List::Response - An internal class to list a bucket (List Objects Version 1) | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =head1 VERSION | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | version 0.98 | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | Implements operation L<< ListObjects|https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html >. | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =head1 AUTHOR | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | Branislav Zahradník <barney@cpan.org> | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 117 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =cut |