| 1 | package Net::Amazon::S3::Operation::Objects::List::Response; | ||||||||||
| 2 | # ABSTRACT: An internal class to list a bucket (List Objects Version 1) | ||||||||||
| 3 | 99 | $Net::Amazon::S3::Operation::Objects::List::Response::VERSION = '0.99'; | |||||||||
| 4 | 99 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 99 | extends 'Net::Amazon::S3::Response'; | |||||||||
| 7 | |||||||||||
| 8 | sub bucket { | ||||||||||
| 9 | 5 | ▶ | $_[0]->_data->{bucket}; | ||||||||
|
Subroutine
bucket: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | sub prefix { | ||||||||||
| 13 | 5 | ▶ | $_[0]->_data->{prefix}; | ||||||||
|
Subroutine
prefix: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | sub marker { | ||||||||||
| 17 | 5 | ▶ | $_[0]->_data->{marker}; | ||||||||
|
Subroutine
marker: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | sub next_marker { | ||||||||||
| 21 | 8 | ▶ | $_[0]->_data->{next_marker}; | ||||||||
|
Subroutine
next_marker: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | sub max_keys { | ||||||||||
| 25 | 5 | ▶ | $_[0]->_data->{max_keys}; | ||||||||
|
Subroutine
max_keys: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | sub is_truncated { | ||||||||||
| 29 | 8 | ▶ | $_[0]->_data->{is_truncated}; | ||||||||
|
Subroutine
is_truncated: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | sub contents { | ||||||||||
| 33 | 9 | ▶ | @{ $_[0]->_data->{contents} }; | ||||||||
|
Subroutine
contents: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub common_prefixes { | ||||||||||
| 37 | 2 | ▶ | @{ $_[0]->_data->{common_prefixes} }; | ||||||||
|
Subroutine
common_prefixes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | sub _parse_data { | ||||||||||
| 41 | 9 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_parse_data: called CC=5 SCAR=16.1
| |||||||||||
| 42 | |||||||||||
| 43 | 9 | my $xpc = $self->xpath_context; | |||||||||
| 44 | |||||||||||
| 45 | 9 | 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 | for my $content ($xpc->findnodes ("/s3:ListBucketResult/s3:Contents")) { | |||||||||
| 57 | 12 | push @{ $data->{contents} }, { | |||||||||
| 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 | $data->{contents}[-1]{etag} =~ s/^"|"$//g; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 9 | for my $delimiter ($xpc->findnodes ("/s3:ListBucketResult/s3:Delimiter")) { | |||||||||
| 72 | 4 | $data->{delimiter} = $xpc->findvalue ('.', $delimiter); | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 9 | ▶ | if (defined $data->{delimiter}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | 4 | my $strip_delim = length $data->{delimiter}; | |||||||||
| 77 | |||||||||||
| 78 | 4 | for my $common_prefix ($xpc->findnodes ("/s3:ListBucketResult/s3:CommonPrefixes")) { | |||||||||
| 79 | 6 | my $prefix = $xpc->findvalue ('./s3:Prefix', $common_prefix); | |||||||||
| 80 | 6 | $prefix = substr $prefix, 0, -$strip_delim; | |||||||||
| 81 | 6 | push @{ $data->{common_prefixes} }, $prefix; | |||||||||
| 82 | } | ||||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 9 | return $data; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | 99 | 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.99 | ||||||||||
| 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 | ||||||||||