File Coverage

blib/lib/Net/Amazon/S3/Operation/Bucket/Location/Response.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 2 0.0
condition 0 3 0.0
subroutine 1 3 33.3
pod 0 1 0.0
total 4 18 22.2


line stmt bran cond sub pod time code
1             package Net::Amazon::S3::Operation::Bucket::Location::Response;
2             # ABSTRACT: An internal class to handle bucket location response
3             $Net::Amazon::S3::Operation::Bucket::Location::Response::VERSION = '0.98';
4 96     96   776 use Moose;
  96         242  
  96         918  
5              
6             extends 'Net::Amazon::S3::Response';
7              
8             sub location {
9 0     0 0   $_[0]->_data->{location};
10             }
11              
12             sub _parse_data {
13 0     0     my ($self) = @_;
14              
15 0           my $xpc = $self->xpath_context;
16              
17 0           my $data = {
18             location => scalar $xpc->findvalue ("//s3:LocationConstraint"),
19             };
20              
21             # S3 documentation: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html
22             # When the bucket's region is US East (N. Virginia),
23             # Amazon S3 returns an empty string for the bucket's region
24             $data->{location} = 'us-east-1'
25 0 0 0       if defined $data->{location} && $data->{location} eq '';
26              
27 0           return $data;
28             }
29              
30             1;
31              
32             __END__
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Net::Amazon::S3::Operation::Bucket::Location::Response - An internal class to handle bucket location response
41              
42             =head1 VERSION
43              
44             version 0.98
45              
46             =head1 DESCRIPTION
47              
48             Implements operation L<< GetBucketLocation|https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLocation.html >>
49              
50             =head1 AUTHOR
51              
52             Branislav Zahradník <barney@cpan.org>
53              
54             =head1 COPYRIGHT AND LICENSE
55              
56             This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník.
57              
58             This is free software; you can redistribute it and/or modify it under
59             the same terms as the Perl 5 programming language system itself.
60              
61             =cut