diff -Nru libnet-amazon-s3-perl-0.84/bin/s3cl libnet-amazon-s3-perl-0.85/bin/s3cl --- libnet-amazon-s3-perl-0.84/bin/s3cl 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/bin/s3cl 2018-08-28 19:40:55.000000000 +0000 @@ -311,7 +311,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS @@ -343,7 +343,7 @@ service. It does not limit the number of requests (which may cost you more money than if you did it a different way!) and each request costs Money (although some costs from EC2 may be $0.0, -check latest from Amazon costs page) - we take NO reponsibility +check latest from Amazon costs page) - we take NO responsibility for your bill. =head1 AUTHOR diff -Nru libnet-amazon-s3-perl-0.84/CHANGES libnet-amazon-s3-perl-0.85/CHANGES --- libnet-amazon-s3-perl-0.84/CHANGES 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/CHANGES 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,11 @@ Revision history for Perl module Net::Amazon::S3: +0.85 Tue 28 Aug 2018 20:14:38 BST + - Support standard_ia and onezone_ia storage classes (thanks Michele Beltrame) + - run 'use_ok' on all modules (thanks Yanick Champoux) + - spellings (thanks Gregor Herrmann) + - LOTS of cleanup and refactoring (thanks Branislav ZahradnĂ­k) + 0.84 Mon 16 Jul 2018 17:49:10 BST - Put back credential cache code lost in Signature 4 patch (Branislav ZahradnĂ­k) diff -Nru libnet-amazon-s3-perl-0.84/cpanfile libnet-amazon-s3-perl-0.85/cpanfile --- libnet-amazon-s3-perl-0.84/cpanfile 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/cpanfile 2018-08-28 19:40:55.000000000 +0000 @@ -5,19 +5,25 @@ requires "Digest::MD5" => "0"; requires "Digest::MD5::File" => "0"; requires "Digest::SHA" => "0"; +requires "Exporter::Tiny" => "0"; requires "File::Find::Rule" => "0"; requires "File::stat" => "0"; requires "Getopt::Long" => "0"; requires "HTTP::Date" => "0"; +requires "HTTP::Response" => "0"; requires "HTTP::Status" => "0"; +requires "Hash::Util" => "0"; requires "IO::File" => "1.14"; requires "LWP" => "6.03"; requires "LWP::UserAgent::Determined" => "0"; requires "MIME::Base64" => "0"; requires "MIME::Types" => "0"; requires "Moose" => "0.85"; +requires "Moose::Object" => "0"; requires "Moose::Role" => "0"; +requires "Moose::Util" => "0"; requires "Moose::Util::TypeConstraints" => "0"; +requires "MooseX::Role::Parameterized" => "0"; requires "MooseX::StrictConstructor" => "0.16"; requires "MooseX::Types::DateTime::MoreCoercions" => "0.07"; requires "Path::Class" => "0"; @@ -25,8 +31,11 @@ requires "Ref::Util" => "0"; requires "Regexp::Common" => "0"; requires "Scalar::Util" => "0"; +requires "Sub::Override" => "0"; requires "Term::Encoding" => "0"; requires "Term::ProgressBar::Simple" => "0"; +requires "Test::Deep" => "0"; +requires "Test::More" => "0"; requires "Time::Piece" => "0"; requires "URI" => "0"; requires "URI::Escape" => "0"; @@ -34,6 +43,7 @@ requires "XML::LibXML" => "0"; requires "XML::LibXML::XPathContext" => "0"; requires "namespace::clean" => "0"; +requires "parent" => "0"; requires "sort" => "0"; requires "strict" => "0"; requires "warnings" => "0"; @@ -43,9 +53,11 @@ requires "File::Temp" => "0"; requires "FindBin" => "0"; requires "LWP::Simple" => "0"; - requires "Test::Deep" => "0"; + requires "Moose::Meta::Class" => "0"; requires "Test::Exception" => "0"; - requires "Test::More" => "0"; + requires "Test::LoadAllModules" => "0"; + requires "Test::MockTime" => "0"; + requires "Test::Warnings" => "0"; requires "lib" => "0"; requires "vars" => "0"; }; diff -Nru libnet-amazon-s3-perl-0.84/debian/changelog libnet-amazon-s3-perl-0.85/debian/changelog --- libnet-amazon-s3-perl-0.84/debian/changelog 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/changelog 2018-11-22 08:15:39.000000000 +0000 @@ -1,3 +1,16 @@ +libnet-amazon-s3-perl (0.85-1) unstable; urgency=medium + + * Import upstream version 0.85 + * Drop BUILD-redefined.patch and spelling.patch, applied upstream; refresh + pod-name.patch + * Update copyright years + * Declare compliance with Debian Policy 4.2.1 + * Add new (build-)dependencies + * Add test-loadallmodules.patch, disabling 00use.t for now + * Do not ship Shared::Example::*, but use it for testing + + -- Florian Schlichting Thu, 22 Nov 2018 09:15:39 +0100 + libnet-amazon-s3-perl (0.84-1) unstable; urgency=medium [ Salvatore Bonaccorso ] @@ -338,4 +351,3 @@ * Newer upstream release than the one mentioned in the ITP (0.32 - 0.36). -- Alexis Sukrieh Thu, 21 Sep 2006 18:15:12 +0200 - diff -Nru libnet-amazon-s3-perl-0.84/debian/control libnet-amazon-s3-perl-0.85/debian/control --- libnet-amazon-s3-perl-0.84/debian/control 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/control 2018-11-21 22:02:54.000000000 +0000 @@ -11,29 +11,33 @@ libdatetime-format-http-perl, libdigest-hmac-perl, libdigest-md5-file-perl, + libexporter-tiny-perl, libfile-find-rule-perl, libhttp-date-perl, libhttp-message-perl, liblwp-useragent-determined-perl, libmime-types-perl, libmoose-perl, + libmoosex-role-parameterized-perl, libmoosex-strictconstructor-perl, libmoosex-types-datetime-morecoercions-perl, libnamespace-clean-perl, libpath-class-perl, libref-util-perl, libregexp-common-perl, + libsub-override-perl, libterm-encoding-perl, libterm-progressbar-simple-perl, libtest-deep-perl, libtest-exception-perl, + libtest-mocktime-perl, libtest-warnings-perl, liburi-perl, libvm-ec2-security-credentialcache-perl, libwww-perl, libxml-libxml-perl, perl -Standards-Version: 4.1.5 +Standards-Version: 4.2.1 Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libnet-amazon-s3-perl Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libnet-amazon-s3-perl.git Homepage: https://pfig.github.io/net-amazon-s3/ @@ -52,11 +56,13 @@ liblwp-useragent-determined-perl, libmime-types-perl, libmoose-perl, + libmoosex-role-parameterized-perl, libmoosex-strictconstructor-perl, libmoosex-types-datetime-morecoercions-perl, libnamespace-clean-perl, libpath-class-perl, libref-util-perl, + libsub-override-perl, libregexp-common-perl, libterm-encoding-perl, libterm-progressbar-simple-perl, diff -Nru libnet-amazon-s3-perl-0.84/debian/copyright libnet-amazon-s3-perl-0.85/debian/copyright --- libnet-amazon-s3-perl-0.84/debian/copyright 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/copyright 2018-11-21 21:53:03.000000000 +0000 @@ -29,7 +29,7 @@ 2008, Roberto C. Sanchez 2009, Ryan Niebur 2011, Fabrizio Regalli - 2013-2015, Florian Schlichting + 2013-2018, Florian Schlichting License: Artistic or GPL-1+ License: Artistic diff -Nru libnet-amazon-s3-perl-0.84/debian/patches/BUILD-redefined.patch libnet-amazon-s3-perl-0.85/debian/patches/BUILD-redefined.patch --- libnet-amazon-s3-perl-0.84/debian/patches/BUILD-redefined.patch 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/patches/BUILD-redefined.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -From 9f67f9632678334c5ad0b43a130e8ae7738e305a Mon Sep 17 00:00:00 2001 -From: Branislav Zahradnik -Date: Tue, 17 Jul 2018 03:11:33 +0200 -Subject: [PATCH] Fix redefined BUILD in S3 (issue #33) - ---- - lib/Net/Amazon/S3.pm | 22 +++++++++------------- - t/00use.t | 3 ++- - 2 files changed, 11 insertions(+), 14 deletions(-) - ---- a/lib/Net/Amazon/S3.pm -+++ b/lib/Net/Amazon/S3.pm -@@ -74,19 +74,6 @@ - }, - ); - --sub BUILD { -- my ($self) = @_; -- -- if ($self->use_iam_role) { -- eval "require VM::EC2::Security::CredentialCache" or die $@; -- my $creds = VM::EC2::Security::CredentialCache->get(); -- defined($creds) || die("Unable to retrieve IAM role credentials"); -- $self->aws_access_key_id($creds->accessKeyId); -- $self->aws_secret_access_key($creds->secretAccessKey); -- $self->aws_session_token($creds->sessionToken); -- } --} -- - __PACKAGE__->meta->make_immutable; - - my $KEEP_ALIVE_CACHESIZE = 10; -@@ -121,6 +108,15 @@ - - $self->ua($ua); - $self->libxml( XML::LibXML->new ); -+ -+ if ($self->use_iam_role) { -+ eval "require VM::EC2::Security::CredentialCache" or die $@; -+ my $creds = VM::EC2::Security::CredentialCache->get(); -+ defined($creds) || die("Unable to retrieve IAM role credentials"); -+ $self->aws_access_key_id($creds->accessKeyId); -+ $self->aws_secret_access_key($creds->secretAccessKey); -+ $self->aws_session_token($creds->sessionToken); -+ } - } - - ---- a/t/00use.t -+++ b/t/00use.t -@@ -4,7 +4,8 @@ - - use lib 'lib'; - --use Test::More tests => 4; -+use Test::More tests => 4 + 1; -+use Test::Warnings; - - use_ok( 'Net::Amazon::S3' ); - use_ok( 'Net::Amazon::S3::Client' ); diff -Nru libnet-amazon-s3-perl-0.84/debian/patches/pod-name.patch libnet-amazon-s3-perl-0.85/debian/patches/pod-name.patch --- libnet-amazon-s3-perl-0.84/debian/patches/pod-name.patch 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/patches/pod-name.patch 2018-11-21 21:51:42.000000000 +0000 @@ -1,26 +1,19 @@ Description: remove duplicate NAME sections from POD Origin: vendor Author: gregor herrmann -Last-Update: 2018-07-27 +Last-Update: 2018-11-21 Forwarded: https://rt.cpan.org/Ticket/Display.html?id=125943 Bug: --- a/lib/Net/Amazon/S3/Signature.pm +++ b/lib/Net/Amazon/S3/Signature.pm -@@ -33,16 +33,12 @@ +@@ -39,10 +39,6 @@ - =head1 NAME - --Net::Amazon::S3::Signature -+Net::Amazon::S3::Signature - S3 Signature implementation base class - - =head1 VERSION - - version 0.84 + version 0.85 -=head1 NAME - --Net::Amazon::S3::Signature - S3 Signature implementation base class +-Net::Amazon::S3::Signature - =head1 METHODS @@ -32,7 +25,7 @@ =head1 NAME -Net::Amazon::S3::Signature::V4Implementation -+Net::Amazon::Signature::V4 - Implements the Amazon Web Services signature version 4, AWS4-HMAC-SHA256 ++Net::Amazon::S3::Signature::V4Implementation - Implements the Amazon Web Services signature version 4, AWS4-HMAC-SHA256 =head1 VERSION diff -Nru libnet-amazon-s3-perl-0.84/debian/patches/series libnet-amazon-s3-perl-0.85/debian/patches/series --- libnet-amazon-s3-perl-0.84/debian/patches/series 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/patches/series 2018-11-21 22:05:44.000000000 +0000 @@ -1,3 +1,2 @@ -BUILD-redefined.patch pod-name.patch -spelling.patch +test-loadallmodules.patch diff -Nru libnet-amazon-s3-perl-0.84/debian/patches/spelling.patch libnet-amazon-s3-perl-0.85/debian/patches/spelling.patch --- libnet-amazon-s3-perl-0.84/debian/patches/spelling.patch 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/patches/spelling.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -Description: fix spelling mistakes in POD -Origin: vendor -Author: gregor herrmann -Last-Update: 2018-07-27 -Forwarded: https://rt.cpan.org/Ticket/Display.html?id=125944 -Bug: https://rt.cpan.org/Ticket/Display.html?id=125944 - ---- a/bin/s3cl -+++ b/bin/s3cl -@@ -343,7 +343,7 @@ - service. It does not limit the number of requests (which may cost - you more money than if you did it a different way!) and each - request costs Money (although some costs from EC2 may be $0.0, --check latest from Amazon costs page) - we take NO reponsibility -+check latest from Amazon costs page) - we take NO responsibility - for your bill. - - =head1 AUTHOR ---- a/lib/Net/Amazon/S3.pm -+++ b/lib/Net/Amazon/S3.pm -@@ -613,7 +613,7 @@ - =item use_virtual_host - - Use the virtual host method ('bucketname.s3.amazonaws.com') instead of specifying the --bucket at the first part of the path. This is particularily useful if you want to access -+bucket at the first part of the path. This is particularly useful if you want to access - buckets not located in the US-Standard region (such as EU, Asia Pacific or South America). - See L for the pros and cons. - -@@ -653,7 +653,7 @@ - - =item acl_short (optional) - --See the set_acl subroutine for documenation on the acl_short options -+See the set_acl subroutine for documentation on the acl_short options - - =item location_constraint (option) - diff -Nru libnet-amazon-s3-perl-0.84/debian/patches/test-loadallmodules.patch libnet-amazon-s3-perl-0.85/debian/patches/test-loadallmodules.patch --- libnet-amazon-s3-perl-0.84/debian/patches/test-loadallmodules.patch 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/patches/test-loadallmodules.patch 2018-11-21 22:08:22.000000000 +0000 @@ -0,0 +1,24 @@ +Description: skip 00use.t + Test::LoadAllModules is not currently in Debian +Author: Florian Schlichting +Forwarded: not-needed + +--- a/t/00use.t ++++ /dev/null +@@ -1,16 +0,0 @@ +-#!perl +- +-use strict; +- +-use Test::More; +-use Test::Warnings; +-use Test::LoadAllModules; +- +-plan tests => 1+1; +- +-subtest 'use_ok' => sub { +- all_uses_ok( +- search_path => 'Net::Amazon::S3', +- except => [qw/ /], +- ) +-}; diff -Nru libnet-amazon-s3-perl-0.84/debian/rules libnet-amazon-s3-perl-0.85/debian/rules --- libnet-amazon-s3-perl-0.84/debian/rules 2018-07-27 19:34:53.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/rules 2018-11-21 22:12:01.000000000 +0000 @@ -13,6 +13,7 @@ $(RM) -v $(TMP)/usr/share/man/man3/Net::Amazon::S3::Role::Bucket.3pm \ $(TMP)/usr/share/man/man3/Net::Amazon::S3::Signature::V2.3pm \ $(TMP)/usr/share/man/man3/Net::Amazon::S3::Signature::V4.3pm + $(RM) -v -r $(TMP)/usr/share/perl5/Shared $(TMP)/usr/share/man/man3/Shared* override_dh_installexamples: dh_installexamples diff -Nru libnet-amazon-s3-perl-0.84/debian/tests/pkg-perl/smoke-env libnet-amazon-s3-perl-0.85/debian/tests/pkg-perl/smoke-env --- libnet-amazon-s3-perl-0.84/debian/tests/pkg-perl/smoke-env 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/tests/pkg-perl/smoke-env 2018-11-22 07:58:15.000000000 +0000 @@ -0,0 +1 @@ +PERL5LIB=$TDIR/lib:$PERL5LIB diff -Nru libnet-amazon-s3-perl-0.84/debian/tests/pkg-perl/smoke-files libnet-amazon-s3-perl-0.85/debian/tests/pkg-perl/smoke-files --- libnet-amazon-s3-perl-0.84/debian/tests/pkg-perl/smoke-files 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/debian/tests/pkg-perl/smoke-files 2018-11-21 22:28:36.000000000 +0000 @@ -0,0 +1,2 @@ +t/ +lib/Shared diff -Nru libnet-amazon-s3-perl-0.84/dist.ini libnet-amazon-s3-perl-0.85/dist.ini --- libnet-amazon-s3-perl-0.84/dist.ini 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/dist.ini 2018-08-28 19:40:55.000000000 +0000 @@ -2,7 +2,7 @@ author = Leo Lapworth license = Perl_5 copyright_holder = Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover -version = 0.84 +version = 0.85 [@Filter] -bundle = @Basic diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Bucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Bucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Bucket.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Bucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3::Bucket; -$Net::Amazon::S3::Bucket::VERSION = '0.84'; +$Net::Amazon::S3::Bucket::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; use Carp; @@ -21,27 +21,6 @@ # ABSTRACT: convenience object for working with Amazon S3 buckets -sub _uri { - my ( $self, $key ) = @_; - return ($key) - ? $self->bucket . "/" . $self->account->_urlencode($key) - : $self->bucket . "/"; -} - -sub _conf_to_headers { - my ( $self, $conf ) = @_; - $conf = {} unless defined $conf; - $conf = {%$conf}; # clone it so as not to clobber the caller's copy - - if ( $conf->{acl_short} ) { - $self->account->_validate_acl_short( $conf->{acl_short} ); - $conf->{'x-amz-acl'} = $conf->{acl_short}; - delete $conf->{acl_short}; - } - - return $conf; -} - # returns bool sub add_key { @@ -435,7 +414,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Client/Bucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Client/Bucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Client/Bucket.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Client/Bucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3::Client::Bucket; -$Net::Amazon::S3::Client::Bucket::VERSION = '0.84'; +$Net::Amazon::S3::Client::Bucket::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; use Data::Stream::Bulk::Callback; @@ -198,7 +198,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Client/Object.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Client/Object.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Client/Object.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Client/Object.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3::Client::Object; -$Net::Amazon::S3::Client::Object::VERSION = '0.84'; +$Net::Amazon::S3::Client::Object::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; use DateTime::Format::HTTP; @@ -17,7 +17,7 @@ [ qw(private public-read public-read-write authenticated-read) ]; enum 'StorageClass' => - [ qw(standard reduced_redundancy) ]; + [ qw(standard reduced_redundancy standard_ia onezone_ia) ]; has 'client' => ( is => 'ro', isa => 'Net::Amazon::S3::Client', required => 1 ); @@ -416,7 +416,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS @@ -565,7 +565,8 @@ Content-Disposition using C. You may specify the S3 storage class by setting C to either -C or C; the default is C. +C, C, C, or C; +the default is C. =head2 put_filename @@ -589,7 +590,8 @@ Content-Disposition using C. You may specify the S3 storage class by setting C to either -C or C; the default is C. +C, C, C, or C; +the default is C. User metadata may be set by providing a non-empty hashref as C. diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Client.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Client.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Client.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Client.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3::Client; -$Net::Amazon::S3::Client::VERSION = '0.84'; +$Net::Amazon::S3::Client::VERSION = '0.85'; use Moose 0.85; use HTTP::Status qw(is_error status_message); use MooseX::StrictConstructor 0.16; @@ -88,10 +88,7 @@ if ( is_error($code) ) { if ( $content_type eq 'application/xml' ) { - my $doc = $self->s3->libxml->parse_string($content); - my $xpc = XML::LibXML::XPathContext->new($doc); - $xpc->registerNs( 's3', - 'http://s3.amazonaws.com/doc/2006-03-01/' ); + my $xpc = $self->s3->_xpc_of_content ($content); if ( $xpc->findnodes('/Error') ) { my $code = $xpc->findvalue('/Error/Code'); @@ -117,11 +114,7 @@ my ( $self, $http_request, $filename ) = @_; my $http_response = $self->_send_request( $http_request, $filename ); - my $doc = $self->s3->libxml->parse_string( $http_response->content ); - my $xpc = XML::LibXML::XPathContext->new($doc); - $xpc->registerNs( 's3', 'http://s3.amazonaws.com/doc/2006-03-01/' ); - - return $xpc; + return $self->s3->_xpc_of_content( $http_response->content ); } 1; @@ -138,7 +131,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Features.pod libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Features.pod --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Features.pod 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Features.pod 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,162 @@ +# PODNAME:Net::Amazon::S3::Features +# ABSTRACT: Features available in Net::Amazon::S3 + +__CUT__ + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Features - Features available in Net::Amazon::S3 + +=head1 VERSION + +version 0.85 + +=head1 API COMPARISON + +Net::Amazon::S3 supports two APIs with different feature support. + +This document describes current behaviour. + +=head2 Error reporting + +How API signals operation error + +=over + +=item set S3 err + +Operation returns expression evaluated as false +and C<< err >> with C<< errstr >> are populated from response content + +=item set network error + +Populates S3 err with C<< network_error >> constant and S3 errstr +with http status line (eg: C<< 404 Not Found >>) and throws. + +=item confess + +Operation throws using C<< confess >> + +=back + +=head2 Feature support + +For details see corresponding C<< api-operation >> / C<< client-operation >> test file + + |-----------------------+----------------------------+--------------------------| + | operation | Net::Amazon::S3 (API) | Net::Amazon::S3::Client | + |-----------------------+----------------------------+--------------------------| + | service-buckets-list | | | + | - returns | Bucket instances in struct | Bucket instances (list) | + | - errors | set S3 err | confess | + |-----------------------+----------------------------+--------------------------| + | bucket-acl-get | | | + | - returns | response body (XML) | response body (XML) | + | | (undef on Not Found) | | + | - errors | set network error | confess | + | | (none on Not Found) | | + |-----------------------+----------------------------+--------------------------| + | bucket-acl-set | | | + | - with canned acl | yes, as acl_short | N/A | + | - with xml acl | yes, as acl_xml | N/A | + | - returns | boolean | N/A | + | - errors | set S3 err | N/A | + |-----------------------+----------------------------+--------------------------| + | bucket-create | | | + | - with region | yes | yes | + | - returns | Bucket instance | Bucket instance | + | - errors | set S3 err | confess | + |-----------------------+----------------------------+--------------------------| + | bucket-delete | | | + | - returns | boolean | true | + | - errors | set S3 err | confess | + |-----------------------+----------------------------+--------------------------| + | bucket-objects-list | | | + | - list version 1 | yes | yes | + | - list version 2 | no | no | + | - common prefixes | supported | not supported | + | - list all | list all method | yes | + | - returns | struct with list | iterator (Object list) | + | - errors | set S3 err | confess during iteration | + |-----------------------+----------------------------+--------------------------| + | bucket-objects-delete | | | + | - returns | boolean | HTTP::Response object | + | - errors | set S3 err | confess | + |-----------------------+----------------------------+--------------------------| + | object-acl-get | | | + | - returns | response body (XML) | N/A | + | | (undef on Not Found) | N/A | + | - errors | set network error | N/A | + | | (none on Not Found) | N/A | + |-----------------------+----------------------------+--------------------------| + | object-acl-set | | | + | - with canned acl | yes, as acl_short | N/A | + | - with xml acl | yes, as acl_xml | N/A | + | - returns | boolean | N/A | + | - errors | set S3 err | N/A | + |-----------------------+----------------------------+--------------------------| + | object-copy | | | + | - returns | boolean | N/A | + | - errors | set S3 err | N/A | + |-----------------------+----------------------------+--------------------------| + | object-create | | | + | - returns | boolean | empty string | + | - errors | set S3 err | confess | + |-----------------------+----------------------------+--------------------------| + | object-delete | | | + | - returns | boolean | true | + | - errors | set S3 err | confess | + |-----------------------+----------------------------+--------------------------| + | object-fetch | | | + | - returns | struct with value | value | + | | (undef on Not Found) | | + | - errors | set network error | confess | + | | (none on Not Found) | | + |-----------------------+----------------------------+--------------------------| + | object-head | | | + | - returns | boolean | N/A | + | - errors | set S3 err | N/A | + |-----------------------+----------------------------+--------------------------| + +=head2 TODO plan (asorted, not promised) + +=over + +=item normalize error reporting + +Make every operation to behave similar (especially C<< Net::Amazon::S3 >> + +=item make error reporting pluggable + +With possibility to inject user's own reporting + +=item unify features + +Both APIs should support same set of operations + +=item support all AWS S3 operations and x-amz-* headers + +https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html + +=item add async API (AnyEvent / IO::Async) + +=back + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/HTTPRequest.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/HTTPRequest.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/HTTPRequest.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/HTTPRequest.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3::HTTPRequest; -$Net::Amazon::S3::HTTPRequest::VERSION = '0.84'; +$Net::Amazon::S3::HTTPRequest::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; use HTTP::Date; @@ -125,7 +125,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/AbortMultipartUpload.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/AbortMultipartUpload.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/AbortMultipartUpload.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/AbortMultipartUpload.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,30 +1,18 @@ package Net::Amazon::S3::Request::AbortMultipartUpload; -$Net::Amazon::S3::Request::AbortMultipartUpload::VERSION = '0.84'; +$Net::Amazon::S3::Request::AbortMultipartUpload::VERSION = '0.85'; use Moose 0.85; use Digest::MD5 qw/md5 md5_hex/; use MIME::Base64; use Carp qw/croak/; use XML::LibXML; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; -with 'Net::Amazon::S3::Role::Bucket'; - -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'upload_id' => ( is => 'ro', isa => 'Str', required => 1 ); +with 'Net::Amazon::S3::Request::Role::Query::Param::Upload_id'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::DELETE'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - #build signed request - return $self->_build_http_request( - method => 'DELETE', - path => $self->_uri( $self->key ) . '?uploadId=' . $self->upload_id, - ); -} - 1; =pod @@ -37,7 +25,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Bucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Bucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Bucket.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Bucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,52 @@ +package Net::Amazon::S3::Request::Bucket; +$Net::Amazon::S3::Request::Bucket::VERSION = '0.85'; +use Moose 0.85; +use MooseX::StrictConstructor 0.16; +extends 'Net::Amazon::S3::Request::Service'; + +with 'Net::Amazon::S3::Role::Bucket'; + +override _request_path => sub { + my ($self) = @_; + + return super . $self->bucket->bucket . "/"; +}; + +__PACKAGE__->meta->make_immutable; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Bucket + +=head1 VERSION + +version 0.85 + +=head1 DESCRIPTION + +Base class for all S3 Bucket operations + +=head1 NAME + +Net::Amazon::S3::Request::Bucket + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/CompleteMultipartUpload.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/CompleteMultipartUpload.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/CompleteMultipartUpload.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/CompleteMultipartUpload.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,27 +1,26 @@ package Net::Amazon::S3::Request::CompleteMultipartUpload; -$Net::Amazon::S3::Request::CompleteMultipartUpload::VERSION = '0.84'; +$Net::Amazon::S3::Request::CompleteMultipartUpload::VERSION = '0.85'; use Moose 0.85; use Digest::MD5 qw/md5 md5_hex/; use MIME::Base64; use Carp qw/croak/; use XML::LibXML; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Upload_id'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_length'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_md5'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_type' => { content_type => 'application/xml' }; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::POST'; has 'etags' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); has 'part_numbers' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); -has 'upload_id' => ( is => 'ro', isa => 'Str', required => 1 ); __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - croak "must have an equally sized list of etags and part numbers" - unless scalar(@{$self->part_numbers}) == scalar(@{$self->etags}); +sub _request_content { + my ($self) = @_; #build XML doc my $xml_doc = XML::LibXML::Document->new('1.0','UTF-8'); @@ -36,26 +35,14 @@ $root_element->addChild($part); } - my $content = $xml_doc->toString; - - my $md5 = md5($content); + return $xml_doc->toString; +} - my $md5_base64 = encode_base64($md5); - chomp $md5_base64; +sub BUILD { + my ($self) = @_; - my $header_spec = { - 'Content-MD5' => $md5_base64, - 'Content-Length' => length $content, - 'Content-Type' => 'application/xml' - }; - - #build signed request - return $self->_build_http_request( - method => 'POST', - path => $self->_uri( $self->key ). '?uploadId='.$self->upload_id, - content => $content, - headers => $header_spec, - ); + croak "must have an equally sized list of etags and part numbers" + unless scalar(@{$self->part_numbers}) == scalar(@{$self->etags}); } 1; @@ -70,7 +57,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/CreateBucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/CreateBucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/CreateBucket.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/CreateBucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,25 +1,20 @@ package Net::Amazon::S3::Request::CreateBucket; -$Net::Amazon::S3::Request::CreateBucket::VERSION = '0.84'; +$Net::Amazon::S3::Request::CreateBucket::VERSION = '0.85'; use Moose 0.85; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Bucket'; # ABSTRACT: An internal class to create a bucket -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::PUT'; -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'location_constraint' => ( is => 'ro', isa => 'MaybeLocationConstraint', coerce => 1, required => 0 ); __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - my $headers - = ( $self->acl_short ) - ? { 'x-amz-acl' => $self->acl_short } - : {}; +sub _request_content { + my ($self) = @_; my $content = ''; if ( defined $self->location_constraint && @@ -29,12 +24,12 @@ . $self->location_constraint . ""; } +} + +sub http_request { + my $self = shift; return $self->_build_http_request( - method => 'PUT', - path => $self->_uri, - headers => $headers, - content => $content, region => 'us-east-1', ); } @@ -53,7 +48,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteBucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteBucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteBucket.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteBucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,23 +1,14 @@ package Net::Amazon::S3::Request::DeleteBucket; -$Net::Amazon::S3::Request::DeleteBucket::VERSION = '0.84'; +$Net::Amazon::S3::Request::DeleteBucket::VERSION = '0.85'; use Moose 0.85; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Bucket'; # ABSTRACT: An internal class to delete a bucket -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::DELETE'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - return $self->_build_http_request( - method => 'DELETE', - path => $self->_uri, - ); -} - 1; __END__ @@ -32,7 +23,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteMultiObject.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteMultiObject.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteMultiObject.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteMultiObject.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,24 +1,24 @@ package Net::Amazon::S3::Request::DeleteMultiObject; -$Net::Amazon::S3::Request::DeleteMultiObject::VERSION = '0.84'; +$Net::Amazon::S3::Request::DeleteMultiObject::VERSION = '0.85'; use Moose 0.85; use Digest::MD5 qw/md5 md5_hex/; use MIME::Base64; use Carp qw/croak/; -extends 'Net::Amazon::S3::Request'; - -with 'Net::Amazon::S3::Role::Bucket'; +extends 'Net::Amazon::S3::Request::Bucket'; has 'keys' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); -__PACKAGE__->meta->make_immutable; +with 'Net::Amazon::S3::Request::Role::Query::Action::Delete'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_length'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_md5'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Content_type' => { content_type => 'application/xml' }; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::POST'; -sub http_request { - my $self = shift; +__PACKAGE__->meta->make_immutable; - #croak if we get a request for over 1000 objects - croak "The maximum number of keys is 1000" - if (scalar(@{$self->keys}) > 1000); +sub _request_content { + my ($self) = @_; #build XML doc my $xml_doc = XML::LibXML::Document->new('1.0','UTF-8'); @@ -32,25 +32,14 @@ $root_element->addChild($obj_element); } - my $content = $xml_doc->toString; + return $xml_doc->toString; +} + +sub BUILD { + my ($self) = @_; - my $md5 = md5($content); - my $md5_base64 = encode_base64($md5); - chomp $md5_base64; - - my $header_spec = { - 'Content-MD5' => $md5_base64, - 'Content-Length' => length $content, - 'Content-Type' => 'application/xml' - }; - - #build signed request - return $self->_build_http_request( - method => 'POST', - path => $self->_uri . '?delete', - content => $content, - headers => $header_spec, - ); + croak "The maximum number of keys is 1000" + if (scalar(@{$self->keys}) > 1000); } 1; @@ -65,7 +54,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteMultipleObjects.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteMultipleObjects.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteMultipleObjects.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteMultipleObjects.pm 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -package Net::Amazon::S3::Request::DeleteMultipleObjects; -$Net::Amazon::S3::Request::DeleteMultipleObjects::VERSION = '0.84'; -use Moose 0.85; -use Moose::Util::TypeConstraints; -use XML::LibXML; -use Digest::MD5; -use MIME::Base64; -extends 'Net::Amazon::S3::Request'; - -# ABSTRACT: An internal class to delete multiple objects - -with 'Net::Amazon::S3::Role::Bucket'; - -has 'keys' => ( is => 'ro', isa => 'ArrayRef[Str]', required => 1 ); -__PACKAGE__->meta->make_immutable; - -sub http_request { - my $self = shift; - - my $doc = XML::LibXML::Document->new("1.0", 'utf-8'); - my $docroot = $doc->createElement("Delete"); - $doc->setDocumentElement($docroot); - - my $quiet_node = $doc->createElement("Quiet"); - $quiet_node->appendChild($doc->createTextNode('false')); - $docroot->appendChild($quiet_node); - - foreach my $key (@{$self->keys}) { - my $n = $doc->createElement('Object'); - my $k = $doc->createElement('Key'); - $k->appendChild($doc->createTextNode($key)); - $n->appendChild($k); - $docroot->appendChild($n); - } - - my $delete_content = $doc->toString(1); - my $md5_hex = Digest::MD5::md5_hex($delete_content); - my $md5 = pack( 'H*', $md5_hex ); - my $md5_base64 = encode_base64($md5); - chomp $md5_base64; - - my $conf = { - 'Content-MD5' => $md5_base64, - 'Content-Length' => length($delete_content), - }; - - return $self->_build_http_request( - method => 'POST', - path => $self->_uri() . "?delete", - headers => $conf, - content => $delete_content, - ); -} - -1; - -__END__ - -=pod - -=encoding UTF-8 - -=head1 NAME - -Net::Amazon::S3::Request::DeleteMultipleObjects - An internal class to delete multiple objects - -=head1 VERSION - -version 0.84 - -=head1 SYNOPSIS - - my $http_request = Net::Amazon::S3::Request::DeleteMultipleObjects->new( - s3 => $s3, - bucket => $bucket, - keys => $keys, - )->http_request; - -=head1 DESCRIPTION - -This module deletes multiple objects. - -=head1 NAME - -Net::Amazon::S3::Request::DeleteMultipleObjects - An internal class to delete multiple objects - -=head1 METHODS - -=head2 http_request - -This method returns a HTTP::Request object. - -=head1 AUTHOR - -Leo Lapworth - -=head1 COPYRIGHT AND LICENSE - -This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - -=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteObject.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteObject.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/DeleteObject.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/DeleteObject.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,26 +1,15 @@ package Net::Amazon::S3::Request::DeleteObject; -$Net::Amazon::S3::Request::DeleteObject::VERSION = '0.84'; +$Net::Amazon::S3::Request::DeleteObject::VERSION = '0.85'; use Moose 0.85; use Moose::Util::TypeConstraints; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; # ABSTRACT: An internal class to delete an object -with 'Net::Amazon::S3::Role::Bucket'; - -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); +with 'Net::Amazon::S3::Request::Role::HTTP::Method::DELETE'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - return $self->_build_http_request( - method => 'DELETE', - path => $self->_uri( $self->key ), - ); -} - 1; __END__ @@ -35,7 +24,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,24 +1,16 @@ package Net::Amazon::S3::Request::GetBucketAccessControl; -$Net::Amazon::S3::Request::GetBucketAccessControl::VERSION = '0.84'; +$Net::Amazon::S3::Request::GetBucketAccessControl::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Bucket'; # ABSTRACT: An internal class to get a bucket's access control -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::Query::Action::Acl'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::GET'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - return $self->_build_http_request( - method => 'GET', - path => $self->_uri('') . '?acl', - ); -} - 1; __END__ @@ -33,7 +25,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,24 +1,16 @@ package Net::Amazon::S3::Request::GetBucketLocationConstraint; -$Net::Amazon::S3::Request::GetBucketLocationConstraint::VERSION = '0.84'; +$Net::Amazon::S3::Request::GetBucketLocationConstraint::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Bucket'; # ABSTRACT: An internal class to get a bucket's location constraint -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::Query::Action::Location'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::GET'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - return $self->_build_http_request( - method => 'GET', - path => $self->_uri('') . '?location', - ); -} - 1; __END__ @@ -33,7 +25,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,26 +1,16 @@ package Net::Amazon::S3::Request::GetObjectAccessControl; -$Net::Amazon::S3::Request::GetObjectAccessControl::VERSION = '0.84'; +$Net::Amazon::S3::Request::GetObjectAccessControl::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; # ABSTRACT: An internal class to get an object's access control -with 'Net::Amazon::S3::Role::Bucket'; - -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); +with 'Net::Amazon::S3::Request::Role::Query::Action::Acl'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::GET'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - return $self->_build_http_request( - method => 'GET', - path => $self->_uri($self->key) . '?acl', - ); -} - 1; __END__ @@ -35,7 +25,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetObject.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetObject.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/GetObject.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/GetObject.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,35 +1,22 @@ package Net::Amazon::S3::Request::GetObject; -$Net::Amazon::S3::Request::GetObject::VERSION = '0.84'; +$Net::Amazon::S3::Request::GetObject::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; -with 'Net::Amazon::S3::Role::Bucket'; - -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'method' => ( is => 'ro', isa => 'HTTPMethod', required => 1 ); +with 'Net::Amazon::S3::Request::Role::HTTP::Method'; # ABSTRACT: An internal class to get an object __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - return $self->_build_http_request( - method => $self->method, - path => $self->_uri( $self->key ), - ); -} - sub query_string_authentication_uri { my ( $self, $expires, $query_form ) = @_; - my $uri = URI->new( $self->_uri( $self->key ) ); + my $uri = URI->new( $self->_request_path ); $uri->query_form( %$query_form ) if $query_form; return $self->_build_signed_request( - method => $self->method, path => $uri->as_string, )->query_string_authentication_uri($expires); } @@ -48,7 +35,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/InitiateMultipartUpload.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/InitiateMultipartUpload.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/InitiateMultipartUpload.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/InitiateMultipartUpload.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,35 +1,23 @@ package Net::Amazon::S3::Request::InitiateMultipartUpload; -$Net::Amazon::S3::Request::InitiateMultipartUpload::VERSION = '0.84'; +$Net::Amazon::S3::Request::InitiateMultipartUpload::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; -with 'Net::Amazon::S3::Role::Bucket'; - -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'headers' => ( is => 'ro', isa => 'HashRef', required => 0, default => sub { {} } ); -has 'encryption' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); + +with 'Net::Amazon::S3::Request::Role::Query::Action::Uploads'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Encryption'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::POST'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - my $headers = $self->headers; - - if ( $self->acl_short ) { - $headers->{'x-amz-acl'} = $self->acl_short; - } - if ( defined $self->encryption ) { - $headers->{'x-amz-server-side-encryption'} = $self->encryption; - } - - return $self->_build_http_request( - method => 'POST', - path => $self->_uri( $self->key ).'?uploads', - headers => $self->headers, - ); +sub _request_headers { + my ($self) = @_; + + return %{ $self->headers }; } 1; @@ -44,7 +32,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,18 +1,18 @@ package Net::Amazon::S3::Request::ListAllMyBuckets; -$Net::Amazon::S3::Request::ListAllMyBuckets::VERSION = '0.84'; +$Net::Amazon::S3::Request::ListAllMyBuckets::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Service'; # ABSTRACT: An internal class to list all buckets +with 'Net::Amazon::S3::Request::Role::HTTP::Method::GET'; + __PACKAGE__->meta->make_immutable; sub http_request { my $self = shift; return $self->_build_http_request( - method => 'GET', - path => '', use_virtual_host => 0, authorization_method => 'Net::Amazon::S3::Signature::V2', ); @@ -32,7 +32,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/ListBucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/ListBucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/ListBucket.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/ListBucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,50 +1,20 @@ package Net::Amazon::S3::Request::ListBucket; -$Net::Amazon::S3::Request::ListBucket::VERSION = '0.84'; +$Net::Amazon::S3::Request::ListBucket::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; use URI::Escape qw(uri_escape_utf8); -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Bucket'; # ABSTRACT: An internal class to list a bucket -with 'Net::Amazon::S3::Role::Bucket'; - -has 'prefix' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); -has 'delimiter' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); -has 'max_keys' => - ( is => 'ro', isa => 'Maybe[Int]', required => 0, default => 1000 ); -has 'marker' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); +with 'Net::Amazon::S3::Request::Role::Query::Param::Delimiter'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Marker'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Max_keys'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Prefix'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::GET'; __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - - my $path = $self->_uri; - - my @post; - foreach my $method ( qw(prefix delimiter max_keys marker) ) { - my $value = $self->$method; - next unless $value; - my $key = $method; - $key = 'max-keys' if $method eq 'max_keys'; - push @post, $key . "=" . $self->_urlencode($value); - } - if (@post) { - $path .= '?' . join( '&', @post ); - } - - return $self->_build_http_request( - method => 'GET', - path => $path, - ); -} - -sub _urlencode { - my ( $self, $unencoded ) = @_; - return uri_escape_utf8( $unencoded, '^A-Za-z0-9_-' ); -} - 1; __END__ @@ -59,7 +29,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/ListParts.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/ListParts.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/ListParts.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/ListParts.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,34 +1,24 @@ package Net::Amazon::S3::Request::ListParts; -$Net::Amazon::S3::Request::ListParts::VERSION = '0.84'; +$Net::Amazon::S3::Request::ListParts::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; # ABSTRACT: List the parts in a multipart upload. -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Upload_id'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::GET'; -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'upload_id' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'headers' => ( is => 'ro', isa => 'HashRef', required => 0, default => sub { {} } ); __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; - my $headers = $self->headers; - - if ( $self->acl_short ) { - $headers->{'x-amz-acl'} = $self->acl_short; - } - - return $self->_build_http_request( - method => 'GET', - path => $self->_uri( $self->key ).'?uploadId='.$self->upload_id, - headers => $self->headers, - ); +sub _request_headers { + my ($self) = @_; + + return %{ $self->headers }; } 1; @@ -45,7 +35,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 AUTHOR diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Object.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Object.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Object.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Object.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,56 @@ +package Net::Amazon::S3::Request::Object; +$Net::Amazon::S3::Request::Object::VERSION = '0.85'; +use Moose 0.85; +use MooseX::StrictConstructor 0.16; +extends 'Net::Amazon::S3::Request::Bucket'; + +has key => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +override _request_path => sub { + my ($self) = @_; + + return super . (join '/', map {$self->s3->_urlencode($_)} split /\//, $self->key); +}; + +__PACKAGE__->meta->make_immutable; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Object + +=head1 VERSION + +version 0.85 + +=head1 DESCRIPTION + +Base class for all S3 Object operations + +=head1 NAME + +Net::Amazon::S3::Request::Object + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/PutObject.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/PutObject.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/PutObject.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/PutObject.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,37 +1,31 @@ package Net::Amazon::S3::Request::PutObject; -$Net::Amazon::S3::Request::PutObject::VERSION = '0.84'; +$Net::Amazon::S3::Request::PutObject::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; # ABSTRACT: An internal class to put an object -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Encryption'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::PUT'; -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); has 'value' => ( is => 'ro', isa => 'Str|CodeRef|ScalarRef', required => 1 ); -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'headers' => ( is => 'ro', isa => 'HashRef', required => 0, default => sub { {} } ); -has 'encryption' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); __PACKAGE__->meta->make_immutable; +sub _request_headers { + my ($self) = @_; + + return %{ $self->headers }; +} + sub http_request { my $self = shift; - my $headers = $self->headers; - - if ( $self->acl_short ) { - $headers->{'x-amz-acl'} = $self->acl_short; - } - if ( defined $self->encryption ) { - $headers->{'x-amz-server-side-encryption'} = $self->encryption; - } return $self->_build_http_request( - method => 'PUT', - path => $self->_uri( $self->key ), - headers => $self->headers, content => $self->value, ); } @@ -50,7 +44,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/PutPart.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/PutPart.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/PutPart.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/PutPart.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,44 +1,31 @@ package Net::Amazon::S3::Request::PutPart; -$Net::Amazon::S3::Request::PutPart::VERSION = '0.84'; +$Net::Amazon::S3::Request::PutPart::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Upload_id'; +with 'Net::Amazon::S3::Request::Role::Query::Param::Part_number'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Copy_source'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::PUT'; -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); has 'value' => ( is => 'ro', isa => 'Str|CodeRef|ScalarRef', required => 0 ); -has 'upload_id' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'part_number' => ( is => 'ro', isa => 'Int', required => 1 ); -has 'copy_source_bucket' => ( is => 'ro', isa => 'Str', required => 0 ); -has 'copy_source_key' => ( is => 'ro', isa => 'Str', required => 0 ); -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'headers' => ( is => 'ro', isa => 'HashRef', required => 0, default => sub { {} } ); __PACKAGE__->meta->make_immutable; +sub _request_headers { + my ($self) = @_; + + return %{ $self->headers }; +} + sub http_request { my $self = shift; - my $headers = $self->headers; - - if ( $self->acl_short ) { - $headers->{'x-amz-acl'} = $self->acl_short; - } - - if(defined $self->copy_source_bucket && defined $self->copy_source_key){ - $headers->{'x-amz-copy-source'} = - $self->copy_source_bucket.'/'.$self->copy_source_key; - } return $self->_build_http_request( - method => 'PUT', - path => $self->_uri($self->key) . - '?partNumber=' . - $self->part_number . - '&uploadId=' . - $self->upload_id, - headers => $headers, content => scalar( defined( $self->value ) ? $self->value : '' ), ); } @@ -55,7 +42,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Acl_short.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Acl_short.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Acl_short.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Acl_short.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,39 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short; +$Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Header' => { + name => 'acl_short', + header => 'x-amz-acl', + isa => 'Maybe[AclShort]', + required => 0, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_length.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_length.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_length.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_length.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,41 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header::Content_length; +$Net::Amazon::S3::Request::Role::HTTP::Header::Content_length::VERSION = '0.85'; +use Moose::Role; +use Digest::MD5 qw[]; +use MIME::Base64 qw[]; + +around _request_headers => sub { + my ($inner, $self) = @_; + my $content = $self->_http_request_content; + + return ($self->$inner, ('Content-Length' => length $content)); +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header::Content_length + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_md5.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_md5.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_md5.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_md5.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,44 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header::Content_md5; +$Net::Amazon::S3::Request::Role::HTTP::Header::Content_md5::VERSION = '0.85'; +use Moose::Role; +use Digest::MD5 qw[]; +use MIME::Base64 qw[]; + +around _request_headers => sub { + my ($inner, $self) = @_; + my $content = $self->_http_request_content; + + my $value = MIME::Base64::encode_base64( Digest::MD5::md5( $content ) ); + chomp $value; + + return ($self->$inner, ('Content-MD5' => $value)); +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header::Content_md5 + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_type.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_type.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_type.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_type.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,49 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header::Content_type; +$Net::Amazon::S3::Request::Role::HTTP::Header::Content_type::VERSION = '0.85'; +use MooseX::Role::Parameterized; + +parameter content_type => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +role { + my ($params) = @_; + my $content_type = $params->content_type; + + around _request_headers => sub { + my ($inner, $self) = @_; + + return ($self->$inner, ('Content-Type' => $content_type)); + }; +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header::Content_type + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,48 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header::Copy_source; +$Net::Amazon::S3::Request::Role::HTTP::Header::Copy_source::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Header' => { + name => '_copy_source', + header => 'x-amz-copy-source', + isa => 'Maybe[Str]', + required => 0, + default => sub { + my ($self) = @_; + defined $self->copy_source_bucket && defined $self->copy_source_key + ? $self->copy_source_bucket.'/'.$self->copy_source_key + : undef; + }, +}; + +has 'copy_source_bucket' => ( is => 'ro', isa => 'Str', required => 0 ); +has 'copy_source_key' => ( is => 'ro', isa => 'Str', required => 0 ); + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header::Copy_source + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Encryption.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Encryption.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Encryption.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header/Encryption.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,39 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header::Encryption; +$Net::Amazon::S3::Request::Role::HTTP::Header::Encryption::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Header' => { + name => 'encryption', + header => 'x-amz-server-side-encryption', + isa => 'Maybe[Str]', + required => 0, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header::Encryption + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Header.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Header.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,86 @@ +package Net::Amazon::S3::Request::Role::HTTP::Header; +$Net::Amazon::S3::Request::Role::HTTP::Header::VERSION = '0.85'; +use MooseX::Role::Parameterized; + +parameter name => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +parameter header => ( + is => 'ro', + isa => 'Str', +); + +parameter constraint => ( + is => 'ro', + isa => 'Str', + init_arg => 'isa', + required => 1, +); + +parameter required => ( + is => 'ro', + isa => 'Bool', + default => 0, +); + +parameter default => ( + is => 'ro', + isa => 'Str|CodeRef', + required => 0, +); + +role { + my ($params) = @_; + + my $name = $params->name; + my $header = $params->header; + + has $name => ( + is => 'ro', + isa => $params->constraint, + (init_arg => undef) x!! $name =~ m/^_/, + required => $params->required, + (default => $params->default) x!! defined $params->default, + ); + + around _request_headers => eval <<"INLINE"; + sub { + my (\$inner, \$self) = \@_; + my \$value = \$self->$name; + + return (\$self->\$inner, (q[$header] => \$value) x!! defined \$value); + }; +INLINE +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Header + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/DELETE.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/DELETE.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/DELETE.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/DELETE.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::HTTP::Method::DELETE; +$Net::Amazon::S3::Request::Role::HTTP::Method::DELETE::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Method' => { method => 'DELETE' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Method::DELETE + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/GET.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/GET.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/GET.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/GET.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::HTTP::Method::GET; +$Net::Amazon::S3::Request::Role::HTTP::Method::GET::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Method' => { method => 'GET' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Method::GET + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/POST.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/POST.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/POST.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/POST.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::HTTP::Method::POST; +$Net::Amazon::S3::Request::Role::HTTP::Method::POST::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Method' => { method => 'POST' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Method::POST + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/PUT.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/PUT.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method/PUT.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method/PUT.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::HTTP::Method::PUT; +$Net::Amazon::S3::Request::Role::HTTP::Method::PUT::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::HTTP::Method' => { method => 'PUT' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Method::PUT + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/HTTP/Method.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/HTTP/Method.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,58 @@ +package Net::Amazon::S3::Request::Role::HTTP::Method; +$Net::Amazon::S3::Request::Role::HTTP::Method::VERSION = '0.85'; +use MooseX::Role::Parameterized; + +use Net::Amazon::S3::HTTPRequest; + +parameter method => ( + is => 'ro', + isa => 'HTTPMethod', + required => 0, +); + +role { + my ($params) = @_; + + has _http_request_method => ( + is => 'ro', + isa => 'HTTPMethod', + $params->method + ? ( + init_arg => undef, + default => $params->method, + ) + : ( + init_arg => 'method', + required => 1 + ), + ); +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::HTTP::Method + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Acl.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Acl.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Acl.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Acl.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::Query::Action::Acl; +$Net::Amazon::S3::Request::Role::Query::Action::Acl::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Action' => { action => 'acl' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Action::Acl + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Delete.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Delete.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Delete.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Delete.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::Query::Action::Delete; +$Net::Amazon::S3::Request::Role::Query::Action::Delete::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Action' => { action => 'delete' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Action::Delete + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Location.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Location.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Location.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Location.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::Query::Action::Location; +$Net::Amazon::S3::Request::Role::Query::Action::Location::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Action' => { action => 'location' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Action::Location + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Uploads.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Uploads.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action/Uploads.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action/Uploads.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,34 @@ +package Net::Amazon::S3::Request::Role::Query::Action::Uploads; +$Net::Amazon::S3::Request::Role::Query::Action::Uploads::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Action' => { action => 'uploads' }; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Action::Uploads + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Action.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Action.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,44 @@ +package Net::Amazon::S3::Request::Role::Query::Action; +$Net::Amazon::S3::Request::Role::Query::Action::VERSION = '0.85'; +use MooseX::Role::Parameterized; + +parameter action => ( + is => 'ro', + isa => 'Str', +); + +role { + my ($params) = @_; + my $action = $params->action; + + method '_request_query_action' => sub { $action }; +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Action + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Delimiter.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Delimiter.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Delimiter.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Delimiter.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,38 @@ +package Net::Amazon::S3::Request::Role::Query::Param::Delimiter; +$Net::Amazon::S3::Request::Role::Query::Param::Delimiter::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Param' => { + param => 'delimiter', + constraint => 'Maybe[Str]', + required => 0, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param::Delimiter + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Marker.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Marker.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Marker.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Marker.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,38 @@ +package Net::Amazon::S3::Request::Role::Query::Param::Marker; +$Net::Amazon::S3::Request::Role::Query::Param::Marker::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Param' => { + param => 'marker', + constraint => 'Maybe[Str]', + required => 0, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param::Marker + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Max_keys.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Max_keys.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Max_keys.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Max_keys.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,40 @@ +package Net::Amazon::S3::Request::Role::Query::Param::Max_keys; +$Net::Amazon::S3::Request::Role::Query::Param::Max_keys::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Param' => { + param => 'max_keys', + query_param => 'max-keys', + constraint => 'Maybe[Str]', + required => 0, + default => 1000, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param::Max_keys + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Part_number.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Part_number.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Part_number.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Part_number.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,39 @@ +package Net::Amazon::S3::Request::Role::Query::Param::Part_number; +$Net::Amazon::S3::Request::Role::Query::Param::Part_number::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Param' => { + param => 'part_number', + query_param => 'partNumber', + constraint => 'Int', + required => 1, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param::Part_number + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Prefix.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Prefix.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Prefix.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Prefix.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,38 @@ +package Net::Amazon::S3::Request::Role::Query::Param::Prefix; +$Net::Amazon::S3::Request::Role::Query::Param::Prefix::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Param' => { + param => 'prefix', + constraint => 'Maybe[Str]', + required => 0, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param::Prefix + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Upload_id.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Upload_id.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param/Upload_id.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param/Upload_id.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,39 @@ +package Net::Amazon::S3::Request::Role::Query::Param::Upload_id; +$Net::Amazon::S3::Request::Role::Query::Param::Upload_id::VERSION = '0.85'; +use Moose::Role; + +with 'Net::Amazon::S3::Request::Role::Query::Param' => { + param => 'upload_id', + query_param => 'uploadId', + constraint => 'Str', + required => 1, +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param::Upload_id + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Role/Query/Param.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Role/Query/Param.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,86 @@ +package Net::Amazon::S3::Request::Role::Query::Param; +$Net::Amazon::S3::Request::Role::Query::Param::VERSION = '0.85'; +use MooseX::Role::Parameterized; + +parameter param => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +parameter query_param => ( + is => 'ro', + isa => 'Str', + lazy => 1, + default => sub { $_[0]->param }, +); + +parameter constraint => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +parameter required => ( + is => 'ro', + isa => 'Bool', + default => 0, +); + +parameter default => ( + is => 'ro', + isa => 'Str|CodeRef', + required => 0, +); + +role { + my ($params) = @_; + + my $param = $params->param; + my $query_param = $params->query_param; + + has $param => ( + is => 'ro', + isa => $params->constraint, + required => $params->required, + (default => $params->default) x!! defined $params->default, + ); + + around _request_query_params => eval <<"INLINE"; + sub { + my (\$inner, \$self) = \@_; + my \$value = \$self->$param; + + return (\$self->\$inner, (q[$query_param] => \$value) x!! defined \$value); + }; +INLINE +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Role::Query::Param + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Service.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Service.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/Service.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/Service.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,44 @@ +package Net::Amazon::S3::Request::Service; +$Net::Amazon::S3::Request::Service::VERSION = '0.85'; +use Moose 0.85; +use MooseX::StrictConstructor 0.16; +extends 'Net::Amazon::S3::Request'; + +__PACKAGE__->meta->make_immutable; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Net::Amazon::S3::Request::Service + +=head1 VERSION + +version 0.85 + +=head1 DESCRIPTION + +Base class for all S3 Service operations + +=head1 NAME + +Net::Amazon::S3::Request::Service + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,20 +1,28 @@ package Net::Amazon::S3::Request::SetBucketAccessControl; -$Net::Amazon::S3::Request::SetBucketAccessControl::VERSION = '0.84'; +$Net::Amazon::S3::Request::SetBucketAccessControl::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Bucket'; # ABSTRACT: An internal class to set a bucket's access control -with 'Net::Amazon::S3::Role::Bucket'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'acl_xml' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); +with 'Net::Amazon::S3::Request::Role::Query::Action::Acl'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::PUT'; + __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; +sub _request_content { + my ($self) = @_; + + return $self->acl_xml || ''; +} + +sub BUILD { + my ($self) = @_; unless ( $self->acl_xml || $self->acl_short ) { confess "need either acl_xml or acl_short"; @@ -23,19 +31,6 @@ if ( $self->acl_xml && $self->acl_short ) { confess "can not provide both acl_xml and acl_short"; } - - my $headers - = ( $self->acl_short ) - ? { 'x-amz-acl' => $self->acl_short } - : {}; - my $xml = $self->acl_xml || ''; - - return $self->_build_http_request( - method => 'PUT', - path => $self->_uri('') . '?acl', - headers => $headers, - content => $xml, - ); } 1; @@ -52,7 +47,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,21 +1,27 @@ package Net::Amazon::S3::Request::SetObjectAccessControl; -$Net::Amazon::S3::Request::SetObjectAccessControl::VERSION = '0.84'; +$Net::Amazon::S3::Request::SetObjectAccessControl::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; -extends 'Net::Amazon::S3::Request'; +extends 'Net::Amazon::S3::Request::Object'; # ABSTRACT: An internal class to set an object's access control -with 'Net::Amazon::S3::Role::Bucket'; - -has 'key' => ( is => 'ro', isa => 'Str', required => 1 ); -has 'acl_short' => ( is => 'ro', isa => 'Maybe[AclShort]', required => 0 ); has 'acl_xml' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 ); +with 'Net::Amazon::S3::Request::Role::Query::Action::Acl'; +with 'Net::Amazon::S3::Request::Role::HTTP::Header::Acl_short'; +with 'Net::Amazon::S3::Request::Role::HTTP::Method::PUT'; + __PACKAGE__->meta->make_immutable; -sub http_request { - my $self = shift; +sub _request_content { + my ($self) = @_; + + return $self->acl_xml || ''; +} + +sub BUILD { + my ($self) = @_; unless ( $self->acl_xml || $self->acl_short ) { confess "need either acl_xml or acl_short"; @@ -24,19 +30,6 @@ if ( $self->acl_xml && $self->acl_short ) { confess "can not provide both acl_xml and acl_short"; } - - my $headers - = ( $self->acl_short ) - ? { 'x-amz-acl' => $self->acl_short } - : {}; - my $xml = $self->acl_xml || ''; - - return $self->_build_http_request( - method => 'PUT', - path => $self->_uri( $self->key ) . '?acl', - headers => $headers, - content => $xml, - ); } 1; @@ -53,7 +46,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Request.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Request.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3::Request; -$Net::Amazon::S3::Request::VERSION = '0.84'; +$Net::Amazon::S3::Request::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; use Moose::Util::TypeConstraints; @@ -85,26 +85,71 @@ has 's3' => ( is => 'ro', isa => 'Net::Amazon::S3', required => 1 ); +has '_http_request_content' => ( + is => 'ro', + init_arg => undef, + isa => 'Maybe[Str]', + lazy => 1, + builder => '_request_content', +); + __PACKAGE__->meta->make_immutable; -sub _uri { - my ( $self, $key ) = @_; - my $bucket = $self->bucket->bucket; - - my $uri = (defined($key)) - ? $bucket . "/" . (join '/', map {$self->s3->_urlencode($_)} split /\//, $key) - : $bucket . "/"; +sub _request_content { + ''; +} - # Although Amazon's Signature 4 test suite explicitely handles // it appears - # it's inconsistent with their implementation so removing it here - $uri =~ s{//+}{/}g; +sub _request_path { + ''; +} + +sub _request_headers { +} - return $uri; +sub _request_query_action { +} + +sub _request_query_params { +} + +sub _request_query_string { + my ($self) = @_; + + my %query_params = $self->_request_query_params; + + my @parts = ( + ($self->_request_query_action) x!! $self->_request_query_action, + map "$_=${\ $self->s3->_urlencode( $query_params{$_} ) }", sort keys %query_params, + ); + + return '' unless @parts; + return '?' . join '&', @parts; +} + +sub _http_request_path { + my ($self) = @_; + + return $self->_request_path . $self->_request_query_string; +} + +sub _http_request_headers { + my ($self) = @_; + + return +{ $self->_request_headers }; } sub _build_signed_request { my ($self, %params) = @_; + $params{path} = $self->_http_request_path unless exists $params{path}; + $params{method} = $self->_http_request_method unless exists $params{method}; + $params{headers} = $self->_http_request_headers unless exists $params{headers}; + $params{content} = $self->_http_request_content unless exists $params{content} or ! defined $self->_http_request_content; + + # Although Amazon's Signature 4 test suite explicitely handles // it appears + # it's inconsistent with their implementation so removing it here + $params{path} =~ s{//+}{/}g; + return Net::Amazon::S3::HTTPRequest->new( %params, s3 => $self->s3, @@ -118,6 +163,12 @@ return $self->_build_signed_request( %params )->http_request; } +sub http_request { + my $self = shift; + + return $self->_build_http_request; +} + 1; __END__ @@ -132,7 +183,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Role/Bucket.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Role/Bucket.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Role/Bucket.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Role/Bucket.pm 2018-08-28 19:40:55.000000000 +0000 @@ -3,7 +3,7 @@ use warnings; package Net::Amazon::S3::Role::Bucket; -$Net::Amazon::S3::Role::Bucket::VERSION = '0.84'; +$Net::Amazon::S3::Role::Bucket::VERSION = '0.85'; use Moose::Role; use Scalar::Util; @@ -44,7 +44,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 AUTHOR diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature/V2.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature/V2.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature/V2.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature/V2.pm 2018-08-28 19:40:55.000000000 +0000 @@ -3,7 +3,7 @@ use warnings; package Net::Amazon::S3::Signature::V2; -$Net::Amazon::S3::Signature::V2::VERSION = '0.84'; +$Net::Amazon::S3::Signature::V2::VERSION = '0.85'; use Moose; use URI::Escape qw( uri_escape_utf8 ); use HTTP::Date qw[ time2str ]; @@ -164,7 +164,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 AUTHOR diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature/V4Implementation.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature/V4Implementation.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature/V4Implementation.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature/V4Implementation.pm 2018-08-28 19:40:55.000000000 +0000 @@ -315,7 +315,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature/V4.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature/V4.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature/V4.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature/V4.pm 2018-08-28 19:40:55.000000000 +0000 @@ -3,7 +3,7 @@ use warnings; package Net::Amazon::S3::Signature::V4; -$Net::Amazon::S3::Signature::V4::VERSION = '0.84'; +$Net::Amazon::S3::Signature::V4::VERSION = '0.85'; use Moose; use Net::Amazon::S3::Signature::V4Implementation; @@ -106,7 +106,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 AUTHOR diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3/Signature.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3/Signature.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,9 +1,9 @@ - +#ABSTRACT: S3 Signature implementation base class use strict; use warnings; package Net::Amazon::S3::Signature; -$Net::Amazon::S3::Signature::VERSION = '0.84'; +$Net::Amazon::S3::Signature::VERSION = '0.85'; use Moose; has http_request => ( @@ -33,15 +33,15 @@ =head1 NAME -Net::Amazon::S3::Signature +Net::Amazon::S3::Signature - S3 Signature implementation base class =head1 VERSION -version 0.84 +version 0.85 =head1 NAME -Net::Amazon::S3::Signature - S3 Signature implementation base class +Net::Amazon::S3::Signature =head1 METHODS diff -Nru libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3.pm libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3.pm --- libnet-amazon-s3-perl-0.84/lib/Net/Amazon/S3.pm 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Net/Amazon/S3.pm 2018-08-28 19:40:55.000000000 +0000 @@ -1,5 +1,5 @@ package Net::Amazon::S3; -$Net::Amazon::S3::VERSION = '0.84'; +$Net::Amazon::S3::VERSION = '0.85'; use Moose 0.85; use MooseX::StrictConstructor 0.16; @@ -74,19 +74,6 @@ }, ); -sub BUILD { - my ($self) = @_; - - if ($self->use_iam_role) { - eval "require VM::EC2::Security::CredentialCache" or die $@; - my $creds = VM::EC2::Security::CredentialCache->get(); - defined($creds) || die("Unable to retrieve IAM role credentials"); - $self->aws_access_key_id($creds->accessKeyId); - $self->aws_secret_access_key($creds->secretAccessKey); - $self->aws_session_token($creds->sessionToken); - } -} - __PACKAGE__->meta->make_immutable; my $KEEP_ALIVE_CACHESIZE = 10; @@ -121,6 +108,15 @@ $self->ua($ua); $self->libxml( XML::LibXML->new ); + + if ($self->use_iam_role) { + eval "require VM::EC2::Security::CredentialCache" or die $@; + my $creds = VM::EC2::Security::CredentialCache->get(); + defined($creds) || die("Unable to retrieve IAM role credentials"); + $self->aws_access_key_id($creds->accessKeyId); + $self->aws_secret_access_key($creds->secretAccessKey); + $self->aws_session_token($creds->sessionToken); + } } @@ -455,7 +451,7 @@ =head1 VERSION -version 0.84 +version 0.85 =head1 SYNOPSIS @@ -617,7 +613,7 @@ =item use_virtual_host Use the virtual host method ('bucketname.s3.amazonaws.com') instead of specifying the -bucket at the first part of the path. This is particularily useful if you want to access +bucket at the first part of the path. This is particularly useful if you want to access buckets not located in the US-Standard region (such as EU, Asia Pacific or South America). See L for the pros and cons. @@ -657,7 +653,7 @@ =item acl_short (optional) -See the set_acl subroutine for documenation on the acl_short options +See the set_acl subroutine for documentation on the acl_short options =item location_constraint (option) diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/ACL.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/ACL.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/ACL.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/ACL.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,60 @@ +package Shared::Examples::Net::Amazon::S3::ACL; +$Shared::Examples::Net::Amazon::S3::ACL::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +our @EXPORT_OK = ( + qw[ acl_xml ], +); + +sub acl_xml { + <<'XML'; + + + 75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a + CustomersName@amazon.com + + + + + 75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a + CustomersName@amazon.com + + FULL_CONTROL + + + +XML +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::ACL + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/API.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/API.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/API.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/API.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,284 @@ +package Shared::Examples::Net::Amazon::S3::API; +$Shared::Examples::Net::Amazon::S3::API::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +use Hash::Util; +use Test::Deep; +use Test::More; + +use Net::Amazon::S3; +use Shared::Examples::Net::Amazon::S3; + +our @EXPORT_OK = ( + qw[ expect_signed_uri ], + qw[ expect_api_list_all_my_buckets ], + qw[ expect_api_bucket_acl_get ], + qw[ expect_api_bucket_acl_set ], + qw[ expect_api_bucket_create ], + qw[ expect_api_bucket_delete ], + qw[ expect_api_bucket_objects_list ], + qw[ expect_api_bucket_objects_delete ], + qw[ expect_api_object_acl_get ], + qw[ expect_api_object_acl_set ], + qw[ expect_api_object_create ], + qw[ expect_api_object_delete ], + qw[ expect_api_object_fetch ], + qw[ expect_api_object_head ], +); + +sub _exporter_expand_sub { + my ($self, $name, $args, $globals) = @_; + + my $s3_operation = $name; + $s3_operation =~ s/_api_/_operation_/; + + return +( $name => eval <<"GEN_SUB" ); + sub { + push \@_, -shared_examples => __PACKAGE__; + goto \\& Shared::Examples::Net::Amazon::S3::$s3_operation; + } +GEN_SUB +} + +sub _default_with_api { + my ($self, $params) = @_; + + $params->{with_s3} ||= Shared::Examples::Net::Amazon::S3::s3_api_with_signature_2 (); +} + +sub _mock_http_response { + my (undef, %params) = @_; + + $params{with_response_code} ||= HTTP::Status::HTTP_OK; + + my %headers = ( + content_type => 'application/xml', + %{ $params{with_response_headers} || {} }, + ); + + my $guard = Sub::Override->new; + $guard->replace ( + 'Net::Amazon::S3::_do_http' => sub { + ${ $params{into} } = $_[1]; + HTTP::Response->new ( + $params{with_response_code}, + HTTP::Status::status_message ($params{with_response_code}), + [ %headers ], + $params{with_response_data}, + ), + } + ); + + $guard; +} + +sub expect_signed_uri { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_s3 ], + qw[ with_bucket ], + qw[ with_region ], + qw[ with_key ], + qw[ with_expire_at ], + qw[ expect_uri ], + ; + + my $got = Net::Amazon::S3::Bucket + ->new ({ + account => $params{with_s3}, + bucket => $params{with_bucket}, + region => $params{with_region}, + }) + ->query_string_authentication_uri ( + $params{with_key}, + $params{with_expire_at} + ); + + cmp_deeply $got, $params{expect_uri}, $title; +} + +sub operation_list_all_my_buckets { + my ($self, %params) = @_; + + $self->buckets; +} + +sub operation_bucket_acl_get { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->get_acl + ; +} + +sub operation_bucket_acl_set { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->set_acl ({ + (acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, + (acl_xml => $params{with_acl_xml}) x!! exists $params{with_acl_xml}, + }) + ; +} + +sub operation_bucket_create { + my ($self, %params) = @_; + + $self + ->add_bucket ({ + bucket => $params{with_bucket}, + (acl_short => $params{with_acl}) x!! exists $params{with_acl}, + (location_constraint => $params{with_region}) x!! exists $params{with_region}, + }) + ; +} + +sub operation_bucket_delete { + my ($self, %params) = @_; + + $self + ->delete_bucket ({ + bucket => $params{with_bucket}, + }) + ; +} + +sub operation_bucket_objects_list { + my ($self, %params) = @_; + + $self + ->list_bucket ({ + bucket => $params{with_bucket}, + delimiter => $params{with_delimiter}, + max_keys => $params{with_max_keys}, + marker => $params{with_marker}, + prefix => $params{with_prefix}, + }) + ; +} + +sub operation_bucket_objects_delete { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->delete_multi_object (@{ $params{with_keys} }) + ; +} + +sub operation_object_acl_get { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->get_acl ($params{with_key}) + ; +} + +sub operation_object_acl_set { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->set_acl ({ + key => $params{with_key}, + (acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, + (acl_xml => $params{with_acl_xml}) x!! exists $params{with_acl_xml}, + }) + ; +} + +sub operation_object_create { + my ($self, %params) = @_; + + my $headers = { %{ $params{with_headers} || {} } }; + + $headers->{$_} = $params{"with_$_"} + for grep exists $params{"with_$_"}, + qw[ cache_control ], + qw[ content_disposition ], + qw[ content_encoding ], + qw[ content_type ], + qw[ expires ], + ; + + $headers->{x_amz_storage_class} = $params{with_storage_class} + if $params{with_storage_class}; + + $headers->{"x_amz_meta_\L$_"} = $params{with_user_metadata}{$_} + for keys %{ $params{with_user_metadata} || {} }; + + $self + ->bucket ($params{with_bucket}) + ->add_key ( + $params{with_key}, + $params{with_value}, + $headers, + ) + ; +} + +sub operation_object_delete { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->delete_key ($params{with_key}) + ; +} + +sub operation_object_fetch { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->get_key ($params{with_key}, 'GET') + ; +} + +sub operation_object_head { + my ($self, %params) = @_; + + $self + ->bucket ($params{with_bucket}) + ->head_key ($params{with_key}) + ; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::API + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Client.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Client.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Client.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Client.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,238 @@ +package Shared::Examples::Net::Amazon::S3::Client; +$Shared::Examples::Net::Amazon::S3::Client::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +use Hash::Util; +use HTTP::Response; +use HTTP::Status; +use Sub::Override; +use Test::Deep; +use Test::More; + +use Net::Amazon::S3::Client; +use Shared::Examples::Net::Amazon::S3; + +our @EXPORT_OK = ( + qw[ expect_signed_uri ], + qw[ expect_client_list_all_my_buckets ], + qw[ expect_client_bucket_acl_get ], + qw[ expect_client_bucket_create ], + qw[ expect_client_bucket_delete ], + qw[ expect_client_bucket_objects_list ], + qw[ expect_client_bucket_objects_delete ], + qw[ expect_client_object_create ], + qw[ expect_client_object_delete ], + qw[ expect_client_object_fetch ], +); + +sub _exporter_expand_sub { + my ($self, $name, $args, $globals) = @_; + + my $s3_operation = $name; + $s3_operation =~ s/_client_/_operation_/; + + return +( $name => eval <<"GEN_SUB" ); + sub { + push \@_, -shared_examples => __PACKAGE__; + goto \\& Shared::Examples::Net::Amazon::S3::$s3_operation; + } +GEN_SUB +} + +sub _default_with_api { + my ($self, $params) = @_; + + $params->{with_client} ||= Net::Amazon::S3::Client->new ( + s3 => Shared::Examples::Net::Amazon::S3::s3_api_with_signature_2 () + ); +} + +sub _mock_http_response { + my ($self, %params) = @_; + + $params{with_response_code} ||= HTTP::Status::HTTP_OK; + + my %headers = ( + content_type => 'application/xml', + %{ $params{with_response_headers} || {} }, + ); + + my $guard = Sub::Override->new; + $guard->replace ( + 'Net::Amazon::S3::Client::_send_request_raw' => sub { + ${ $params{into} } = $_[1]; + HTTP::Response->new ( + $params{with_response_code}, + HTTP::Status::status_message ($params{with_response_code}), + [ %headers ], + $params{with_response_data}, + ), + } + ); + + $guard; +} + +sub expect_signed_uri { + my ($title, %params) = @_; + + Hash::Util::lock_keys %params, + qw[ with_client ], + qw[ with_bucket ], + qw[ with_region ], + qw[ with_key ], + qw[ with_expire_at ], + qw[ expect_uri ], + ; + + my $guard = Sub::Override->new ( + 'Net::Amazon::S3::Bucket::region' => sub { $params{with_region } }, + ); + + my $got = $params{with_client} + ->bucket ( + name => $params{with_bucket}, + ) + ->object ( + key => $params{with_key}, + expires => $params{with_expire_at}, + ) + ->query_string_authentication_uri + ; + + cmp_deeply $got, $params{expect_uri}, $title; +} + +sub operation_list_all_my_buckets { + my ($self, %params) = @_; + + [ $_[0]->buckets ]; +} + +sub operation_bucket_acl_get { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->acl + ; +} + +sub operation_bucket_create { + my ($self, %params) = @_; + + $self->create_bucket( + name => $params{with_bucket}, + (acl_short => $params{with_acl}) x!! exists $params{with_acl}, + (location_constraint => $params{with_region}) x!! exists $params{with_region}, + ); +} + +sub operation_bucket_delete { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->delete + ; +} + +sub operation_bucket_objects_list { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->list ({ + bucket => $params{with_bucket}, + delimiter => $params{with_delimiter}, + max_keys => $params{with_max_keys}, + marker => $params{with_marker}, + prefix => $params{with_prefix}, + }) + ; +} + +sub operation_bucket_objects_delete { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->delete_multi_object (@{ $params{with_keys} }) + ; +} + +sub operation_object_create { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->object ( + key => $params{with_key}, + map +($_ => $params{"with_$_"}), + grep exists $params{"with_$_"}, ( + qw[ cache_control ], + qw[ content_disposition ], + qw[ content_encoding ], + qw[ content_type ], + qw[ expires ], + qw[ storage_class ], + qw[ user_metadata ], + ) + ) + ->${\ (ref $params{with_value} ? 'put_filename' : 'put' ) } ( + ref $params{with_value} ? ${ $params{with_value} } : $params{with_value} + ) + ; +} + +sub operation_object_delete { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->object (key => $params{with_key}) + ->delete + ; +} + +sub operation_object_fetch { + my ($self, %params) = @_; + + $self + ->bucket (name => $params{with_bucket}) + ->object (key => $params{with_key}) + ->get + ; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Client + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Error.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Error.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Error.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Error.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,87 @@ +package Shared::Examples::Net::Amazon::S3::Error; +$Shared::Examples::Net::Amazon::S3::Error::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +use HTTP::Status; + +our @EXPORT_OK = ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_bucket_already_exists ], + qw[ fixture_error_bucket_not_empty ], + qw[ fixture_error_invalid_bucket_name ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +sub _error_fixture { + my ($error_code, $http_status) = @_; + + my $error_message = $error_code; + $error_message =~ s/ (?<=[[:lower:]]) ([[:upper:]])/ \L$1\E/gx; + +( + with_response_code => $http_status, + with_response_data => <<"XML", + + + $error_code + $error_message error message + /some-resource + 4442587FB7D0A2F9 + +XML + ); +} + +sub fixture_error_access_denied { + _error_fixture AccessDenied => HTTP::Status::HTTP_FORBIDDEN; +} + +sub fixture_error_bucket_already_exists { + _error_fixture BucketAlreadyExists => HTTP::Status::HTTP_CONFLICT; +} + +sub fixture_error_bucket_not_empty { + _error_fixture BucketNotEmpty => HTTP::Status::HTTP_CONFLICT; +} + +sub fixture_error_invalid_bucket_name { + _error_fixture InvalidBucketName => HTTP::Status::HTTP_BAD_REQUEST; +} + +sub fixture_error_no_such_bucket { + _error_fixture NoSuchBucket => HTTP::Status::HTTP_NOT_FOUND; +} + +sub fixture_error_no_such_key { + _error_fixture NoSuchKey => HTTP::Status::HTTP_NOT_FOUND; +} + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Error + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Create.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Create.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Create.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Create.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,47 @@ +package Shared::Examples::Net::Amazon::S3::Operation::Bucket::Create; +$Shared::Examples::Net::Amazon::S3::Operation::Bucket::Create::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +our @EXPORT_OK = ( + qw[ create_bucket_in_ca_central_1_content_xml ], +); + +sub create_bucket_in_ca_central_1_content_xml { + <<'EOXML'; + + ca-central-1 + +EOXML +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Operation::Bucket::Create + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/Delete.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/Delete.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/Delete.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/Delete.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,47 @@ +package Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::Delete; +$Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::Delete::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +our @EXPORT_OK = ( + qw[ fixture_response_quiet_without_errors ], +); + +sub fixture_response_quiet_without_errors { + with_response_data => <<'EOXML'; + + + +EOXML +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::Delete + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/List.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/List.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/List.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/List.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,197 @@ +package Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::List; +$Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::List::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +our @EXPORT_OK = ( + qw[ list_bucket_objects_v1 ], + qw[ list_bucket_objects_v1_with_filter_truncated ], + qw[ list_bucket_objects_v1_with_filter ], + qw[ list_bucket_objects_v1_with_delimiter ], + qw[ list_bucket_objects_v1_with_prefix_and_delimiter ], +); + +sub list_bucket_objects_v1 { + <<'EOXML'; + + + some-bucket + + + 1000 + false + + my-image.jpg + 2009-10-12T17:50:30.000Z + "fba9dede5f27731c9771645a39863328" + 434234 + STANDARD + + 75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a + mtd@amazon.com + + + + my-third-image.jpg + 2009-10-12T17:50:30.000Z + "1b2cf535f27731c974343645a3985328" + 64994 + STANDARD_IA + + 75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a + mtd@amazon.com + + + +EOXML +} + +sub list_bucket_objects_v1_with_filter_truncated { + <<'EOXML'; + + + some-bucket + N + Ned + 40 + true + + Nelson + 2006-01-01T12:00:00.000Z + "828ef3fdfa96f00ad9f27c383fc9ac7f" + 5 + STANDARD + + bcaf161ca5fb16fd081034f + webfile + + + + Neo + 2006-01-01T12:00:00.000Z + "828ef3fdfa96f00ad9f27c383fc9ac7f" + 4 + STANDARD + + bcaf1ffd86a5fb16fd081034f + webfile + + + +EOXML +} + +sub list_bucket_objects_v1_with_filter { + <<'EOXML'; + + + some-bucket + N + Ned + 40 + false + + Nelson + 2006-01-01T12:00:00.000Z + "828ef3fdfa96f00ad9f27c383fc9ac7f" + 5 + STANDARD + + bcaf161ca5fb16fd081034f + webfile + + + + Neo + 2006-01-01T12:00:00.000Z + "828ef3fdfa96f00ad9f27c383fc9ac7f" + 4 + STANDARD + + bcaf1ffd86a5fb16fd081034f + webfile + + + +EOXML +} + +sub list_bucket_objects_v1_with_delimiter { + <<'EOXML'; + + + some-bucket + + + 1000 + / + false + + sample.jpg + 2011-02-26T01:56:20.000Z + "bf1d737a4d46a19f3bced6905cc8b902" + 142863 + + canonical-user-id + display-name + + STANDARD + + + photos/ + + +EOXML +} + +sub list_bucket_objects_v1_with_prefix_and_delimiter { + <<'EOXML'; + + + some-bucket + photos/2006/ + + 1000 + / + false + + + photos/2006/February/ + + + photos/2006/January/ + + +EOXML +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::List + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Service/Buckets/List.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Service/Buckets/List.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Operation/Service/Buckets/List.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Operation/Service/Buckets/List.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,83 @@ +package Shared::Examples::Net::Amazon::S3::Operation::Service::Buckets::List; +$Shared::Examples::Net::Amazon::S3::Operation::Service::Buckets::List::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +our @EXPORT_OK = ( + 'buckets_list_without_displayname', + 'buckets_list_with_displayname', +); + +sub buckets_list_without_displayname { + <<'XML'; + + + + bcaf1ffd86f461ca5fb16fd081034f + + + + quotes + 2006-02-03T16:45:09.000Z + + + samples + 2006-02-03T16:41:58.000Z + + + +XML +} + +sub buckets_list_with_displayname { + <<'XML'; + + + + bcaf1ffd86f461ca5fb16fd081034f + webfile + + + + quotes + 2006-02-03T16:45:09.000Z + + + samples + 2006-02-03T16:41:58.000Z + + + +XML +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Operation::Service::Buckets::List + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Request.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Request.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3/Request.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3/Request.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,211 @@ +package Shared::Examples::Net::Amazon::S3::Request; +$Shared::Examples::Net::Amazon::S3::Request::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +use Test::More; +use Test::Deep; + +use Moose qw[]; +use Moose::Object; +use Moose::Util; +use XML::LibXML; + +use Net::Amazon::S3; +use Net::Amazon::S3::Bucket; + +our @EXPORT_OK = ( + qw[ behaves_like_net_amazon_s3_request ], + qw[ expect_request_class ], + qw[ expect_request_instance ], +); + +sub _canonical_xml { + my ($xml) = @_; + + return $xml unless $xml; + return $xml if ref $xml; + + my $canonical = eval { + XML::LibXML->load_xml ( + string => $xml, + no_blanks => 1, + )->toStringC14N + }; + + return $xml unless defined $canonical; + return $canonical; +} + +sub _test_meta_build_http_request { + my ($self, %params) = @_; + + return $self->_build_signed_request (%params); +} + +sub _test_class { + my ($request_class, %params) = @_; + + $params{superclasses} ||= []; + $params{methods}{_build_http_request} = \& _test_meta_build_http_request; + + push @{ $params{superclasses} }, $request_class; + + return Moose::Meta::Class->create_anon_class (%params); +} + +sub expect_request_class { + my ($request_class) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + return use_ok $request_class; +} + +sub expect_request_instance { + my (%params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my %with = map +( substr ($_, 5) => delete $params{$_} ), + grep m/^with_/, + keys %params + ; + + $with{s3} = bless {}, 'Net::Amazon::S3'; + + my $test_class = _test_class $params{request_class}, + map +( $_ => $params{$_} ), + grep exists $params{$_}, + qw [ roles ], + ; + + my $request = eval { $test_class->name->new (%with) }; + my $error = $@; + + if (exists $params{throws}) { + if (defined $request) { + fail "create instance should fail"; + } else { + cmp_deeply $error, $params{throws}, "create instance should fail"; + } + } else { + ok defined $request, "should create (mocked) instance of $params{request_class}" + or diag $error; + } + + return $request; +} + +sub expect_request_path { + my ($request, $expected) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + return cmp_deeply + $request->http_request->path, + $expected, + "it builds expected request path" + ; +} + +sub expect_request_method { + my ($request, $expected) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + return cmp_deeply + $request->http_request->method, + $expected, + "it builds expected request method" + ; +} + +sub expect_request_headers { + my ($request, $expected) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + return cmp_deeply + $request->http_request->headers, + $expected, + "it builds expected request headers" + ; +} + +sub expect_request_content { + my ($request, $expected) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + # XML builders doesn't need to produce whitespaces for readability + # wherease test expectation should be as readable as possible + # compare canonicalized xml strings than + + return is + _canonical_xml ($request->http_request->content), + _canonical_xml ($expected), + "it builds expected request XML content" + ; +} + +sub behaves_like_net_amazon_s3_request { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + subtest $title => sub { + plan tests => 2 + scalar grep exists $params{$_}, + qw[ expect_request_path ], + qw[ expect_request_method ], + qw[ expect_request_headers ], + qw[ expect_request_content ], + ; + + expect_request_class $params{request_class}; + my $request = expect_request_instance %params; + + expect_request_path $request => $params{expect_request_path} + if exists $params{expect_request_path}; + + expect_request_method $request => $params{expect_request_method} + if exists $params{expect_request_method}; + + expect_request_headers $request => $params{expect_request_headers} + if exists $params{expect_request_headers}; + + expect_request_content $request => $params{expect_request_content} + if exists $params{expect_request_content}; + }; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3::Request + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3.pm libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3.pm --- libnet-amazon-s3-perl-0.84/lib/Shared/Examples/Net/Amazon/S3.pm 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/lib/Shared/Examples/Net/Amazon/S3.pm 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,449 @@ +package Shared::Examples::Net::Amazon::S3; +$Shared::Examples::Net::Amazon::S3::VERSION = '0.85'; +use strict; +use warnings; + +use parent qw[ Exporter::Tiny ]; + +use Hash::Util; +use Ref::Util ( + qw[ is_regexpref ], +); + +use Test::Deep; +use Test::More; + +use Net::Amazon::S3; + +use Shared::Examples::Net::Amazon::S3::API; +use Shared::Examples::Net::Amazon::S3::Client; +use Shared::Examples::Net::Amazon::S3::Request; + +our @EXPORT_OK = ( + qw[ s3_api_with_signature_4 ], + qw[ s3_api_with_signature_2 ], + qw[ expect_net_amazon_s3_feature ], + qw[ expect_net_amazon_s3_operation ], + qw[ expect_operation_list_all_my_buckets ], + qw[ expect_operation_bucket_create ], + qw[ expect_operation_bucket_delete ], +); + +sub s3_api_with_signature_4 { + Net::Amazon::S3->new ( + aws_access_key_id => 'AKIDEXAMPLE', + aws_secret_access_key => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', + authorization_method => 'Net::Amazon::S3::Signature::V4', + secure => 1, + use_virtual_host => 1, + ); +} + +sub s3_api_with_signature_2 { + Net::Amazon::S3->new ( + aws_access_key_id => 'AKIDEXAMPLE', + aws_secret_access_key => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', + authorization_method => 'Net::Amazon::S3::Signature::V2', + secure => 1, + use_virtual_host => 1, + ); +} + +sub expect_net_amazon_s3_feature { + my ($title, %params) = @_; + + my $s3 = delete $params{with_s3}; + my $feature = delete $params{feature}; + my $expectation = "expect_$feature"; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + subtest $title => sub { + plan tests => 2; + + if (my $code = Shared::Examples::Net::Amazon::S3::API->can ($expectation)) { + $code->( "using S3 API" => ( + with_s3 => $s3, + %params + )); + } else { + fail "Net::Amazon::S3 feature expectation $expectation not found"; + } + + if (my $code = Shared::Examples::Net::Amazon::S3::Client->can ($expectation)) { + $code->( "using S3 Client" => ( + with_client => Net::Amazon::S3::Client->new (s3 => $s3), + %params + )); + } else { + fail "Net::Amazon::S3::Client feature expectation $expectation not found"; + } + }; +} + +sub _keys_operation { + return ( + qw[ -shared_examples ], + qw[ with_s3 ], + qw[ with_client ], + qw[ shared_examples ], + qw[ with_response_code ], + qw[ with_response_data ], + qw[ with_response_headers ], + qw[ expect_s3_err ], + qw[ expect_s3_errstr ], + qw[ expect_data ], + qw[ expect_request ], + qw[ expect_request_content ], + qw[ expect_request_headers ], + qw[ throws ], + ); +} + +sub _expect_request { + my ($request, $expect, $title) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my ($method, $uri) = %$expect; + cmp_deeply + $request, + all ( + methods (method => $method), + methods (uri => methods (as_string => $uri)), + ), + $title || 'expect request' + ; +} + +sub _expect_request_content { + my ($request, $expected, $title) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my $got = Shared::Examples::Net::Amazon::S3::Request::_canonical_xml ($request->content); + $expected = Shared::Examples::Net::Amazon::S3::Request::_canonical_xml ($expected); + + cmp_deeply $got, $expected, $title || "expect request content"; +} + +sub _expect_request_headers { + my ($request, $expected, $title) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my %got = map +($_ => scalar $request->header ($_)), keys %$expected; + + cmp_deeply + \ %got, + $expected, + $title || "expect request headers" + ; +} + +sub _expect_s3_err { + my ($got, $expected, $title) = @_; + + SKIP: { + skip "Net::Amazon::S3->err test irrelevant for Client", 1 + if eq_deeply $got, obj_isa ('Net::Amazon::S3::Client'); + + cmp_deeply $got, methods (err => $expected), $title || 'expect S3->err'; + } +} + +sub _expect_s3_errstr { + my ($got, $expected, $title) = @_; + + SKIP: { + skip "Net::Amazon::S3->errstr test irrelevant for Client", 1 + if eq_deeply $got, obj_isa ('Net::Amazon::S3::Client'); + + cmp_deeply $got, methods (errstr => $expected), $title || 'expect S3->errstr'; + } +} + +sub _expect_operation { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my $class = delete $params{-shared_examples}; + my $operation = delete $params{-operation}; + + my $api = $class->_default_with_api (\%params); + my $guard = $class->_mock_http_response (%params, into => \ (my $request)); + + if (my $code = $class->can ($operation)) { + subtest $title => sub { + plan tests => 1 + + int (!! exists $params{expect_request}) + + int (!! exists $params{expect_request_content}) + + int (!! exists $params{expect_request_headers}) + + int (!! exists $params{expect_s3_err}) + + int (!! exists $params{expect_s3_errstr}) + ; + + my $got; + my $lives = eval { $got = $api->$code (%params); 1 }; + my $error = $@; + + if ($lives) { + exists $params{throws} + ? fail "operation expected to throw but lives" + : cmp_deeply $got, $params{expect_data}, "expect operation return data" + ; + } + else { + $params{throws} = re $params{throws} + if is_regexpref $params{throws}; + $params{throws} = obj_isa $params{throws} + if defined $params{throws} && ! ref $params{throws}; + + defined $params{throws} + ? cmp_deeply $error, $params{throws}, "it should throw" + : do { fail "operation expected to live but died" ; diag $error } + ; + } + + _expect_request $request, $params{expect_request} + if exists $params{expect_request}; + _expect_request_content $request, $params{expect_request_content} + if exists $params{expect_request_content}; + _expect_request_headers ($request, $params{expect_request_headers}) + if exists $params{expect_request_headers}; + + _expect_s3_err $api, $params{expect_s3_err} + if exists $params{expect_s3_err}; + _expect_s3_errstr $api, $params{expect_s3_errstr} + if exists $params{expect_s3_errstr}; + }; + } else { + fail $title or diag "Operation ${class}::$operation not found"; + } +} + +sub expect_operation_list_all_my_buckets { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_list_all_my_buckets'; +} + +sub expect_operation_bucket_acl_get { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_bucket_acl_get'; +} + +sub expect_operation_bucket_acl_set { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_acl_xml ], + qw[ with_acl_short ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_bucket_acl_set'; +} + +sub expect_operation_bucket_create { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_acl ], + qw[ with_region ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_bucket_create'; +} + +sub expect_operation_bucket_delete { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_bucket_delete'; +} + +sub expect_operation_bucket_objects_list { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_delimiter ], + qw[ with_max_keys ], + qw[ with_marker ], + qw[ with_prefix ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_bucket_objects_list'; +} + +sub expect_operation_bucket_objects_delete { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_keys ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_bucket_objects_delete'; +} + +sub expect_operation_object_acl_get { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_key ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_object_acl_get'; +} + +sub expect_operation_object_acl_set { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_key ], + qw[ with_acl_xml ], + qw[ with_acl_short ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_object_acl_set'; +} + +sub expect_operation_object_create { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_headers ], + qw[ with_key ], + qw[ with_value ], + qw[ with_cache_control ], + qw[ with_content_disposition ], + qw[ with_content_encoding ], + qw[ with_content_type ], + qw[ with_expires ], + qw[ with_storage_class ], + qw[ with_user_metadata ], + + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_object_create'; +} + +sub expect_operation_object_delete { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_key ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_object_delete'; +} + +sub expect_operation_object_fetch { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_key ], + + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_object_fetch'; +} + +sub expect_operation_object_head { + my ($title, %params) = @_; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + + Hash::Util::lock_keys %params, + qw[ with_bucket ], + qw[ with_key ], + _keys_operation, + ; + + _expect_operation $title, %params, -operation => 'operation_object_head'; +} + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Shared::Examples::Net::Amazon::S3 + +=head1 VERSION + +version 0.85 + +=head1 AUTHOR + +Leo Lapworth + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2018 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -Nru libnet-amazon-s3-perl-0.84/Makefile.PL libnet-amazon-s3-perl-0.85/Makefile.PL --- libnet-amazon-s3-perl-0.84/Makefile.PL 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/Makefile.PL 2018-08-28 19:40:55.000000000 +0000 @@ -26,19 +26,25 @@ "Digest::MD5" => 0, "Digest::MD5::File" => 0, "Digest::SHA" => 0, + "Exporter::Tiny" => 0, "File::Find::Rule" => 0, "File::stat" => 0, "Getopt::Long" => 0, "HTTP::Date" => 0, + "HTTP::Response" => 0, "HTTP::Status" => 0, + "Hash::Util" => 0, "IO::File" => "1.14", "LWP" => "6.03", "LWP::UserAgent::Determined" => 0, "MIME::Base64" => 0, "MIME::Types" => 0, "Moose" => "0.85", + "Moose::Object" => 0, "Moose::Role" => 0, + "Moose::Util" => 0, "Moose::Util::TypeConstraints" => 0, + "MooseX::Role::Parameterized" => 0, "MooseX::StrictConstructor" => "0.16", "MooseX::Types::DateTime::MoreCoercions" => "0.07", "Path::Class" => 0, @@ -46,8 +52,11 @@ "Ref::Util" => 0, "Regexp::Common" => 0, "Scalar::Util" => 0, + "Sub::Override" => 0, "Term::Encoding" => 0, "Term::ProgressBar::Simple" => 0, + "Test::Deep" => 0, + "Test::More" => 0, "Time::Piece" => 0, "URI" => 0, "URI::Escape" => 0, @@ -55,6 +64,7 @@ "XML::LibXML" => 0, "XML::LibXML::XPathContext" => 0, "namespace::clean" => 0, + "parent" => 0, "sort" => 0, "strict" => 0, "warnings" => 0 @@ -63,13 +73,15 @@ "File::Temp" => 0, "FindBin" => 0, "LWP::Simple" => 0, - "Test::Deep" => 0, + "Moose::Meta::Class" => 0, "Test::Exception" => 0, - "Test::More" => 0, + "Test::LoadAllModules" => 0, + "Test::MockTime" => 0, + "Test::Warnings" => 0, "lib" => 0, "vars" => 0 }, - "VERSION" => "0.84", + "VERSION" => "0.85", "test" => { "TESTS" => "t/*.t" } @@ -84,13 +96,16 @@ "Digest::MD5" => 0, "Digest::MD5::File" => 0, "Digest::SHA" => 0, + "Exporter::Tiny" => 0, "File::Find::Rule" => 0, "File::Temp" => 0, "File::stat" => 0, "FindBin" => 0, "Getopt::Long" => 0, "HTTP::Date" => 0, + "HTTP::Response" => 0, "HTTP::Status" => 0, + "Hash::Util" => 0, "IO::File" => "1.14", "LWP" => "6.03", "LWP::Simple" => 0, @@ -98,8 +113,12 @@ "MIME::Base64" => 0, "MIME::Types" => 0, "Moose" => "0.85", + "Moose::Meta::Class" => 0, + "Moose::Object" => 0, "Moose::Role" => 0, + "Moose::Util" => 0, "Moose::Util::TypeConstraints" => 0, + "MooseX::Role::Parameterized" => 0, "MooseX::StrictConstructor" => "0.16", "MooseX::Types::DateTime::MoreCoercions" => "0.07", "Path::Class" => 0, @@ -107,11 +126,15 @@ "Ref::Util" => 0, "Regexp::Common" => 0, "Scalar::Util" => 0, + "Sub::Override" => 0, "Term::Encoding" => 0, "Term::ProgressBar::Simple" => 0, "Test::Deep" => 0, "Test::Exception" => 0, + "Test::LoadAllModules" => 0, + "Test::MockTime" => 0, "Test::More" => 0, + "Test::Warnings" => 0, "Time::Piece" => 0, "URI" => 0, "URI::Escape" => 0, @@ -120,6 +143,7 @@ "XML::LibXML::XPathContext" => 0, "lib" => 0, "namespace::clean" => 0, + "parent" => 0, "sort" => 0, "strict" => 0, "vars" => 0, diff -Nru libnet-amazon-s3-perl-0.84/MANIFEST libnet-amazon-s3-perl-0.85/MANIFEST --- libnet-amazon-s3-perl-0.84/MANIFEST 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/MANIFEST 2018-08-28 19:40:55.000000000 +0000 @@ -17,14 +17,15 @@ lib/Net/Amazon/S3/Client.pm lib/Net/Amazon/S3/Client/Bucket.pm lib/Net/Amazon/S3/Client/Object.pm +lib/Net/Amazon/S3/Features.pod lib/Net/Amazon/S3/HTTPRequest.pm lib/Net/Amazon/S3/Request.pm lib/Net/Amazon/S3/Request/AbortMultipartUpload.pm +lib/Net/Amazon/S3/Request/Bucket.pm lib/Net/Amazon/S3/Request/CompleteMultipartUpload.pm lib/Net/Amazon/S3/Request/CreateBucket.pm lib/Net/Amazon/S3/Request/DeleteBucket.pm lib/Net/Amazon/S3/Request/DeleteMultiObject.pm -lib/Net/Amazon/S3/Request/DeleteMultipleObjects.pm lib/Net/Amazon/S3/Request/DeleteObject.pm lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm @@ -34,8 +35,34 @@ lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm lib/Net/Amazon/S3/Request/ListBucket.pm lib/Net/Amazon/S3/Request/ListParts.pm +lib/Net/Amazon/S3/Request/Object.pm lib/Net/Amazon/S3/Request/PutObject.pm lib/Net/Amazon/S3/Request/PutPart.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header/Acl_short.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_length.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_md5.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header/Content_type.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Header/Encryption.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Method.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Method/DELETE.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Method/GET.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Method/POST.pm +lib/Net/Amazon/S3/Request/Role/HTTP/Method/PUT.pm +lib/Net/Amazon/S3/Request/Role/Query/Action.pm +lib/Net/Amazon/S3/Request/Role/Query/Action/Acl.pm +lib/Net/Amazon/S3/Request/Role/Query/Action/Delete.pm +lib/Net/Amazon/S3/Request/Role/Query/Action/Location.pm +lib/Net/Amazon/S3/Request/Role/Query/Action/Uploads.pm +lib/Net/Amazon/S3/Request/Role/Query/Param.pm +lib/Net/Amazon/S3/Request/Role/Query/Param/Delimiter.pm +lib/Net/Amazon/S3/Request/Role/Query/Param/Marker.pm +lib/Net/Amazon/S3/Request/Role/Query/Param/Max_keys.pm +lib/Net/Amazon/S3/Request/Role/Query/Param/Part_number.pm +lib/Net/Amazon/S3/Request/Role/Query/Param/Prefix.pm +lib/Net/Amazon/S3/Request/Role/Query/Param/Upload_id.pm +lib/Net/Amazon/S3/Request/Service.pm lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm lib/Net/Amazon/S3/Role/Bucket.pm @@ -43,8 +70,60 @@ lib/Net/Amazon/S3/Signature/V2.pm lib/Net/Amazon/S3/Signature/V4.pm lib/Net/Amazon/S3/Signature/V4Implementation.pm +lib/Shared/Examples/Net/Amazon/S3.pm +lib/Shared/Examples/Net/Amazon/S3/ACL.pm +lib/Shared/Examples/Net/Amazon/S3/API.pm +lib/Shared/Examples/Net/Amazon/S3/Client.pm +lib/Shared/Examples/Net/Amazon/S3/Error.pm +lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Create.pm +lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/Delete.pm +lib/Shared/Examples/Net/Amazon/S3/Operation/Bucket/Objects/List.pm +lib/Shared/Examples/Net/Amazon/S3/Operation/Service/Buckets/List.pm +lib/Shared/Examples/Net/Amazon/S3/Request.pm perlcritic.rc t/00use.t t/01api.t t/02client.t t/03token.t +t/api-bucket-acl-get.t +t/api-bucket-acl-set.t +t/api-bucket-create.t +t/api-bucket-delete.t +t/api-bucket-objects-delete.t +t/api-bucket-objects-list.t +t/api-object-acl-get.t +t/api-object-acl-set.t +t/api-object-create.t +t/api-object-delete.t +t/api-object-fetch.t +t/api-object-head.t +t/api-service-buckets-list.t +t/client-bucket-acl-get.t +t/client-bucket-create.t +t/client-bucket-delete.t +t/client-bucket-objects-delete.t +t/client-bucket-objects-list.t +t/client-object-create.t +t/client-object-delete.t +t/client-object-fetch.t +t/client-service-buckets-list.t +t/query-string-authentication-uri.t +t/request-abort-multipart-upload.t +t/request-complete-multipart-upload.t +t/request-create-bucket.t +t/request-delete-bucket.t +t/request-delete-multi-object.t +t/request-delete-object.t +t/request-get-bucket-access-control.t +t/request-get-bucket-location-constraint.t +t/request-get-object-access-control.t +t/request-get-object.t +t/request-initiate-multipart-upload.t +t/request-list-all-buckets.t +t/request-list-bucket.t +t/request-list-parts.t +t/request-put-object.t +t/request-put-part.t +t/request-set-bucket-access-control.t +t/request-set-object-access-control.t +t/request.t diff -Nru libnet-amazon-s3-perl-0.84/META.json libnet-amazon-s3-perl-0.85/META.json --- libnet-amazon-s3-perl-0.84/META.json 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/META.json 2018-08-28 19:40:55.000000000 +0000 @@ -31,19 +31,25 @@ "Digest::MD5" : "0", "Digest::MD5::File" : "0", "Digest::SHA" : "0", + "Exporter::Tiny" : "0", "File::Find::Rule" : "0", "File::stat" : "0", "Getopt::Long" : "0", "HTTP::Date" : "0", + "HTTP::Response" : "0", "HTTP::Status" : "0", + "Hash::Util" : "0", "IO::File" : "1.14", "LWP" : "6.03", "LWP::UserAgent::Determined" : "0", "MIME::Base64" : "0", "MIME::Types" : "0", "Moose" : "0.85", + "Moose::Object" : "0", "Moose::Role" : "0", + "Moose::Util" : "0", "Moose::Util::TypeConstraints" : "0", + "MooseX::Role::Parameterized" : "0", "MooseX::StrictConstructor" : "0.16", "MooseX::Types::DateTime::MoreCoercions" : "0.07", "Path::Class" : "0", @@ -51,8 +57,11 @@ "Ref::Util" : "0", "Regexp::Common" : "0", "Scalar::Util" : "0", + "Sub::Override" : "0", "Term::Encoding" : "0", "Term::ProgressBar::Simple" : "0", + "Test::Deep" : "0", + "Test::More" : "0", "Time::Piece" : "0", "URI" : "0", "URI::Escape" : "0", @@ -60,6 +69,7 @@ "XML::LibXML" : "0", "XML::LibXML::XPathContext" : "0", "namespace::clean" : "0", + "parent" : "0", "sort" : "0", "strict" : "0", "warnings" : "0" @@ -70,9 +80,11 @@ "File::Temp" : "0", "FindBin" : "0", "LWP::Simple" : "0", - "Test::Deep" : "0", + "Moose::Meta::Class" : "0", "Test::Exception" : "0", - "Test::More" : "0", + "Test::LoadAllModules" : "0", + "Test::MockTime" : "0", + "Test::Warnings" : "0", "lib" : "0", "vars" : "0" } @@ -89,7 +101,7 @@ "web" : "https://github.com/rustyconover/net-amazon-s3" } }, - "version" : "0.84", + "version" : "0.85", "x_contributors" : [ "Aaron Crane ", "Ali Anari ", @@ -101,6 +113,7 @@ "Leo Lapworth ", "Leon Brocard ", "Michele Beltrame ", + "Michele Beltrame ", "Miquel Ruiz ", "Panu Ervamaa ", "Pavel A. Karoukin ", @@ -119,7 +132,8 @@ "Struan Bartlett ", "Stuart Skelton ", "Tom Hukins ", - "toritori0318 " + "toritori0318 ", + "Yanick Champoux " ] } diff -Nru libnet-amazon-s3-perl-0.84/META.yml libnet-amazon-s3-perl-0.85/META.yml --- libnet-amazon-s3-perl-0.84/META.yml 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/META.yml 2018-08-28 19:40:55.000000000 +0000 @@ -6,9 +6,11 @@ File::Temp: '0' FindBin: '0' LWP::Simple: '0' - Test::Deep: '0' + Moose::Meta::Class: '0' Test::Exception: '0' - Test::More: '0' + Test::LoadAllModules: '0' + Test::MockTime: '0' + Test::Warnings: '0' lib: '0' vars: '0' configure_requires: @@ -30,19 +32,25 @@ Digest::MD5: '0' Digest::MD5::File: '0' Digest::SHA: '0' + Exporter::Tiny: '0' File::Find::Rule: '0' File::stat: '0' Getopt::Long: '0' HTTP::Date: '0' + HTTP::Response: '0' HTTP::Status: '0' + Hash::Util: '0' IO::File: '1.14' LWP: '6.03' LWP::UserAgent::Determined: '0' MIME::Base64: '0' MIME::Types: '0' Moose: '0.85' + Moose::Object: '0' Moose::Role: '0' + Moose::Util: '0' Moose::Util::TypeConstraints: '0' + MooseX::Role::Parameterized: '0' MooseX::StrictConstructor: '0.16' MooseX::Types::DateTime::MoreCoercions: '0.07' Path::Class: '0' @@ -50,8 +58,11 @@ Ref::Util: '0' Regexp::Common: '0' Scalar::Util: '0' + Sub::Override: '0' Term::Encoding: '0' Term::ProgressBar::Simple: '0' + Test::Deep: '0' + Test::More: '0' Time::Piece: '0' URI: '0' URI::Escape: '0' @@ -59,13 +70,14 @@ XML::LibXML: '0' XML::LibXML::XPathContext: '0' namespace::clean: '0' + parent: '0' sort: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/rustyconover/net-amazon-s3/issues repository: https://github.com/rustyconover/net-amazon-s3 -version: '0.84' +version: '0.85' x_contributors: - 'Aaron Crane ' - 'Ali Anari ' @@ -77,6 +89,7 @@ - 'Leo Lapworth ' - 'Leon Brocard ' - 'Michele Beltrame ' + - 'Michele Beltrame ' - 'Miquel Ruiz ' - 'Panu Ervamaa ' - 'Pavel A. Karoukin ' @@ -96,3 +109,4 @@ - 'Stuart Skelton ' - 'Tom Hukins ' - 'toritori0318 ' + - 'Yanick Champoux ' diff -Nru libnet-amazon-s3-perl-0.84/README libnet-amazon-s3-perl-0.85/README --- libnet-amazon-s3-perl-0.84/README 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/README 2018-08-28 19:40:55.000000000 +0000 @@ -1,7 +1,7 @@ This archive contains the distribution Net-Amazon-S3, -version 0.84: +version 0.85: Use the Amazon S3 - Simple Storage Service diff -Nru libnet-amazon-s3-perl-0.84/README.mkdn libnet-amazon-s3-perl-0.85/README.mkdn --- libnet-amazon-s3-perl-0.84/README.mkdn 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/README.mkdn 2018-08-28 19:40:55.000000000 +0000 @@ -4,7 +4,7 @@ # VERSION -version 0.84 +version 0.85 # SYNOPSIS @@ -164,7 +164,7 @@ - use\_virtual\_host Use the virtual host method ('bucketname.s3.amazonaws.com') instead of specifying the - bucket at the first part of the path. This is particularily useful if you want to access + bucket at the first part of the path. This is particularly useful if you want to access buckets not located in the US-Standard region (such as EU, Asia Pacific or South America). See [http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html](http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html) for the pros and cons. @@ -200,7 +200,7 @@ - acl\_short (optional) - See the set\_acl subroutine for documenation on the acl\_short options + See the set\_acl subroutine for documentation on the acl\_short options - location\_constraint (option) diff -Nru libnet-amazon-s3-perl-0.84/t/00use.t libnet-amazon-s3-perl-0.85/t/00use.t --- libnet-amazon-s3-perl-0.84/t/00use.t 2018-07-16 16:49:40.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/00use.t 2018-08-28 19:40:55.000000000 +0000 @@ -1,12 +1,16 @@ #!perl -use warnings; + use strict; -use lib 'lib'; +use Test::More; +use Test::Warnings; +use Test::LoadAllModules; -use Test::More tests => 4; +plan tests => 1+1; -use_ok( 'Net::Amazon::S3' ); -use_ok( 'Net::Amazon::S3::Client' ); -use_ok( 'Net::Amazon::S3::Client::Bucket' ); -use_ok( 'Net::Amazon::S3::Client::Object' ); +subtest 'use_ok' => sub { + all_uses_ok( + search_path => 'Net::Amazon::S3', + except => [qw/ /], + ) +}; diff -Nru libnet-amazon-s3-perl-0.84/t/api-bucket-acl-get.t libnet-amazon-s3-perl-0.85/t/api-bucket-acl-get.t --- libnet-amazon-s3-perl-0.84/t/api-bucket-acl-get.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-bucket-acl-get.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,46 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_bucket_acl_get ], +); + +use Shared::Examples::Net::Amazon::S3::ACL ( + qw[ acl_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_api_bucket_acl_get 'get bucket acl' => ( + with_bucket => 'some-bucket', + with_response_data => acl_xml, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_data => acl_xml, +); + +expect_api_bucket_acl_get 'with error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?acl' }, + throws => qr/^Net::Amazon::S3: Amazon responded with 403 Forbidden/i, + expect_s3_err => 'network_error', + expect_s3_errstr => '403 Forbidden', +); + +expect_api_bucket_acl_get 'with error bucket not found' => ( + with_bucket => 'some-bucket', + fixture_error_no_such_bucket, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_data => undef, + expect_s3_err => undef, + expect_s3_errstr => undef, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-bucket-acl-set.t libnet-amazon-s3-perl-0.85/t/api-bucket-acl-set.t --- libnet-amazon-s3-perl-0.84/t/api-bucket-acl-set.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-bucket-acl-set.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,64 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_bucket_acl_set ], +); + +use Shared::Examples::Net::Amazon::S3::ACL ( + qw[ acl_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_api_bucket_acl_set 'set bucket acl via canned acl header' => ( + with_bucket => 'some-bucket', + with_acl_short => 'private', + with_response_data => acl_xml, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_request_content => '', + expect_request_headers => { + x_amz_acl => 'private', + }, + expect_data => bool (1), +); + +expect_api_bucket_acl_set 'set bucket acl via xml acl' => ( + with_bucket => 'some-bucket', + with_acl_xml => acl_xml, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_request_content => acl_xml, + expect_request_headers => { + x_amz_acl => undef, + }, + expect_data => bool (1), +); + +expect_api_bucket_acl_set 'with error access denied' => ( + with_bucket => 'some-bucket', + with_acl_short => 'private', + fixture_error_access_denied, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_bucket_acl_set 'with error bucket not found' => ( + with_bucket => 'some-bucket', + with_acl_short => 'private', + fixture_error_no_such_bucket, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-bucket-create.t libnet-amazon-s3-perl-0.85/t/api-bucket-create.t --- libnet-amazon-s3-perl-0.84/t/api-bucket-create.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-bucket-create.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,85 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 6; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_bucket_create ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Create ( + qw[ create_bucket_in_ca_central_1_content_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_bucket_already_exists ], + qw[ fixture_error_invalid_bucket_name ], +); + +expect_api_bucket_create 'simple create bucket (default region us-east-1)' => ( + with_bucket => 'some-bucket', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'some-bucket'), + ), +); + +expect_api_bucket_create 'create bucket in different region' => ( + with_bucket => 'some-bucket', + with_region => 'ca-central-1', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => create_bucket_in_ca_central_1_content_xml, + expect_data => all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'some-bucket'), + ), +); + +expect_api_bucket_create 'create bucket with acl' => ( + with_bucket => 'some-bucket', + with_acl => 'private', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_request_headers => { x_amz_acl => 'private' }, + expect_data => all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'some-bucket'), + ), +); + +expect_api_bucket_create 'error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_bucket_create 'error bucket already exists' => ( + with_bucket => 'some-bucket', + fixture_error_bucket_already_exists, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => bool (0), + expect_s3_err => 'BucketAlreadyExists', + expect_s3_errstr => 'Bucket already exists error message', +); + +expect_api_bucket_create 'error invalid bucket name' => ( + with_bucket => 'some-bucket', + fixture_error_invalid_bucket_name, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => bool (0), + expect_s3_err => 'InvalidBucketName', + expect_s3_errstr => 'Invalid bucket name error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-bucket-delete.t libnet-amazon-s3-perl-0.85/t/api-bucket-delete.t --- libnet-amazon-s3-perl-0.84/t/api-bucket-delete.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-bucket-delete.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,54 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_bucket_delete ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_bucket_not_empty ], + qw[ fixture_error_no_such_bucket ], +); + +expect_api_bucket_delete 'delete bucket' => ( + with_bucket => 'some-bucket', + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_data => bool (1), +); + +expect_api_bucket_delete 'error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_bucket_delete 'error bucket not empty' => ( + with_bucket => 'some-bucket', + fixture_error_bucket_not_empty, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => bool (0), + expect_s3_err => 'BucketNotEmpty', + expect_s3_errstr => 'Bucket not empty error message', +); + +expect_api_bucket_delete 'error no such bucket' => ( + with_bucket => 'some-bucket', + fixture_error_no_such_bucket, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-bucket-objects-delete.t libnet-amazon-s3-perl-0.85/t/api-bucket-objects-delete.t --- libnet-amazon-s3-perl-0.84/t/api-bucket-objects-delete.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-bucket-objects-delete.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,56 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_bucket_objects_delete ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::Delete ( + qw[ fixture_response_quiet_without_errors ], +); + +expect_api_bucket_objects_delete 'delete multiple objects' => ( + with_bucket => 'some-bucket', + with_keys => [qw[ key-1 key-2 ]], + fixture_response_quiet_without_errors, + expect_request => { POST => 'https://some-bucket.s3.amazonaws.com/?delete' }, + expect_data => bool (1), + expect_request_content => <<'XML', + + true + key-1 + key-2 + +XML +); + +expect_api_bucket_objects_delete 'with error access denied' => ( + with_bucket => 'some-bucket', + with_keys => [qw[ key-1 key-2 ]], + fixture_error_access_denied, + expect_request => { POST => 'https://some-bucket.s3.amazonaws.com/?delete' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_bucket_objects_delete 'with error no such bucket' => ( + with_bucket => 'some-bucket', + with_keys => [qw[ key-1 key-2 ]], + fixture_error_no_such_bucket, + expect_request => { POST => 'https://some-bucket.s3.amazonaws.com/?delete' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-bucket-objects-list.t libnet-amazon-s3-perl-0.85/t/api-bucket-objects-list.t --- libnet-amazon-s3-perl-0.84/t/api-bucket-objects-list.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-bucket-objects-list.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,155 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 6; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_bucket_objects_list ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::List ( + qw[ list_bucket_objects_v1 ], + qw[ list_bucket_objects_v1_with_filter_truncated ], + qw[ list_bucket_objects_v1_with_delimiter ], + qw[ list_bucket_objects_v1_with_prefix_and_delimiter ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_api_bucket_objects_list 'list objects (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/' }, + expect_data => { + bucket => 'some-bucket', + prefix => '', + marker => '', + next_marker => '', + max_keys => 1000, + is_truncated => bool (0), + keys => [ { + key => 'my-image.jpg', + last_modified => '2009-10-12T17:50:30.000Z', + etag => 'fba9dede5f27731c9771645a39863328', + size => 434234, + storage_class => 'STANDARD', + owner_id => '75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a', + owner_displayname => 'mtd@amazon.com', + }, { + key => 'my-third-image.jpg', + last_modified => '2009-10-12T17:50:30.000Z', + etag => '1b2cf535f27731c974343645a3985328', + size => 64994, + storage_class => 'STANDARD_IA', + owner_id => '75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a', + owner_displayname => 'mtd@amazon.com', + } ], + }, +); + +expect_api_bucket_objects_list 'list objects with filters (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1_with_filter_truncated, + with_prefix => 'N', + with_marker => 'Ned', + with_max_keys => 40, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?marker=Ned&max-keys=40&prefix=N' }, + expect_data => { + bucket => 'some-bucket', + prefix => 'N', + marker => 'Ned', + next_marker => '', + max_keys => 40, + is_truncated => bool (1), + keys => [ { + key => 'Nelson', + last_modified => '2006-01-01T12:00:00.000Z', + etag => '828ef3fdfa96f00ad9f27c383fc9ac7f', + size => 5, + storage_class => 'STANDARD', + owner_id => 'bcaf161ca5fb16fd081034f', + owner_displayname => 'webfile', + }, { + key => 'Neo', + last_modified => '2006-01-01T12:00:00.000Z', + etag => '828ef3fdfa96f00ad9f27c383fc9ac7f', + size => 4, + storage_class => 'STANDARD', + owner_id => 'bcaf1ffd86a5fb16fd081034f', + owner_displayname => 'webfile', + } ], + }, +); + +expect_api_bucket_objects_list 'list objects with delimiter (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1_with_delimiter, + with_delimiter => '/', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?delimiter=%2F' }, + expect_data => { + bucket => 'some-bucket', + prefix => '', + marker => '', + next_marker => '', + max_keys => 1000, + is_truncated => bool (0), + keys => [ { + key => 'sample.jpg', + last_modified => '2011-02-26T01:56:20.000Z', + etag => 'bf1d737a4d46a19f3bced6905cc8b902', + size => 142863, + storage_class => 'STANDARD', + owner_id => 'canonical-user-id', + owner_displayname => 'display-name', + } ], + common_prefixes => [ + 'photos', + ], + }, +); + +expect_api_bucket_objects_list 'list objects with prefix and delimiter (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1_with_prefix_and_delimiter, + with_delimiter => '/', + with_prefix => 'photos/2006/', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?delimiter=%2F&prefix=photos%2F2006%2F' }, + expect_data => { + bucket => 'some-bucket', + prefix => 'photos/2006/', + marker => '', + next_marker => '', + max_keys => 1000, + is_truncated => bool (0), + keys => [], + common_prefixes => [ + 'photos/2006/February', + 'photos/2006/January', + ], + }, +); + +expect_api_bucket_objects_list 'error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_bucket_objects_list 'error no such bucket' => ( + with_bucket => 'some-bucket', + fixture_error_no_such_bucket, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-object-acl-get.t libnet-amazon-s3-perl-0.85/t/api-object-acl-get.t --- libnet-amazon-s3-perl-0.84/t/api-object-acl-get.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-object-acl-get.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,60 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_object_acl_get ], +); + +use Shared::Examples::Net::Amazon::S3::ACL ( + qw[ acl_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_api_object_acl_get 'get bucket acl' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_response_data => acl_xml, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_data => acl_xml, +); + +expect_api_object_acl_get 'with error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_access_denied, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + throws => qr/^Net::Amazon::S3: Amazon responded with 403 Forbidden/i, + expect_s3_err => 'network_error', + expect_s3_errstr => '403 Forbidden', +); + +expect_api_object_acl_get 'with error bucket not found' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_no_such_bucket, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_data => undef, + expect_s3_err => undef, + expect_s3_errstr => undef, +); + +expect_api_object_acl_get 'with error bucket not found' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_no_such_key, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_data => undef, + expect_s3_err => undef, + expect_s3_errstr => undef, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-object-acl-set.t libnet-amazon-s3-perl-0.85/t/api-object-acl-set.t --- libnet-amazon-s3-perl-0.84/t/api-object-acl-set.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-object-acl-set.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,80 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 5; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_object_acl_set ], +); + +use Shared::Examples::Net::Amazon::S3::ACL ( + qw[ acl_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_api_object_acl_set 'set bucket acl via canned acl header' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_acl_short => 'private', + with_response_data => acl_xml, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_request_content => '', + expect_request_headers => { + x_amz_acl => 'private', + }, + expect_data => bool (1), +); + +expect_api_object_acl_set 'set bucket acl via xml acl' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_acl_xml => acl_xml, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_request_content => acl_xml, + expect_request_headers => { + x_amz_acl => undef, + }, + expect_data => bool (1), +); + +expect_api_object_acl_set 'with error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_acl_short => 'private', + fixture_error_access_denied, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_object_acl_set 'with error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_acl_short => 'private', + fixture_error_no_such_bucket, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); + +expect_api_object_acl_set 'with error no such object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_acl_short => 'private', + fixture_error_no_such_key, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key?acl' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchKey', + expect_s3_errstr => 'No such key error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-object-create.t libnet-amazon-s3-perl-0.85/t/api-object-create.t --- libnet-amazon-s3-perl-0.84/t/api-object-create.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-object-create.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,80 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_object_create ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_api_object_create 'create object from scalar value' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + expect_data => bool (1), + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_request_content => 'some value', + expect_request_headers => { + content_length => 10, + content_md5 => undef, + expires => undef, + }, +); + +expect_api_object_create 'create object with headers recognized by Client::Bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + with_cache_control => 'private', + with_content_disposition => 'inline', + with_content_encoding => 'identity', + with_content_type => 'text/plain', + with_expires => 'Fri, 09 Sep 2011 23:36:00 GMT', + with_storage_class => 'reduced_redundancy', + with_user_metadata => { Foo => 1, Bar => 2 }, + expect_data => bool (1), + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_request_content => 'some value', + expect_request_headers => { + cache_control => 'private', + content_disposition => 'inline', + content_encoding => 'identity', + content_length => 10, + content_type => 'text/plain', + content_md5 => undef, + expires => 'Fri, 09 Sep 2011 23:36:00 GMT', + x_amz_meta_bar => 2, + x_amz_meta_foo => 1, + x_amz_storage_class => 'reduced_redundancy', + }, +); + +expect_api_object_create 'error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + fixture_error_access_denied, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_object_create 'error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + fixture_error_no_such_bucket, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); diff -Nru libnet-amazon-s3-perl-0.84/t/api-object-delete.t libnet-amazon-s3-perl-0.85/t/api-object-delete.t --- libnet-amazon-s3-perl-0.84/t/api-object-delete.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-object-delete.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,55 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; # Test::Warnings + our tests +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_object_delete ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_api_object_delete 'delete object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (1), +); + +expect_api_object_delete 'error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_access_denied, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + +expect_api_object_delete 'error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_no_such_bucket, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchBucket', + expect_s3_errstr => 'No such bucket error message', +); + +expect_api_object_delete 'error no such key' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_no_such_key, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (0), + expect_s3_err => 'NoSuchKey', + expect_s3_errstr => 'No such key error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-object-fetch.t libnet-amazon-s3-perl-0.85/t/api-object-fetch.t --- libnet-amazon-s3-perl-0.84/t/api-object-fetch.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-object-fetch.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,75 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use HTTP::Status; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_object_fetch ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_api_object_fetch 'fetch existing object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_response_code => HTTP::Status::HTTP_OK, + with_response_data => 'some-value', + with_response_headers => { + content_length => 10, + content_type => 'text/plain', + etag => 'some-key-etag', + x_amz_metadata_foo => 'foo-1', + date => 'Fri, 09 Sep 2011 23:36:00 GMT', + }, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => { + content_type => 'text/plain', + content_length => 10, + etag => 'some-key-etag', + value => 'some-value', + date => 'Fri, 09 Sep 2011 23:36:00 GMT', + 'x-amz-metadata-foo' => 'foo-1', + 'content-type' => 'text/plain', + 'content-length' => 10, + }, +); + +expect_api_object_fetch 'with error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_access_denied, + throws => qr/^Net::Amazon::S3: Amazon responded with 403 Forbidden/i, + expect_s3_err => 'network_error', + expect_s3_errstr => '403 Forbidden', +); + +expect_api_object_fetch 'with error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_no_such_bucket, + expect_data => bool (0), + expect_s3_err => undef,, + expect_s3_errstr => undef,, +); + +expect_api_object_fetch 'with error no such object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_no_such_key, + expect_data => bool (0), + expect_s3_err => undef,, + expect_s3_errstr => undef,, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-object-head.t libnet-amazon-s3-perl-0.85/t/api-object-head.t --- libnet-amazon-s3-perl-0.84/t/api-object-head.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-object-head.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,75 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use HTTP::Status; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_object_head ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_api_object_head 'head existing object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_response_code => HTTP::Status::HTTP_OK, + with_response_data => '', + with_response_headers => { + content_length => 10, + content_type => 'text/plain', + etag => 'some-key-etag', + x_amz_metadata_foo => 'foo-1', + date => 'Fri, 09 Sep 2011 23:36:00 GMT', + }, + expect_request => { HEAD => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => { + content_type => 'text/plain', + content_length => 10, + etag => 'some-key-etag', + value => '', + date => 'Fri, 09 Sep 2011 23:36:00 GMT', + 'x-amz-metadata-foo' => 'foo-1', + 'content-type' => 'text/plain', + 'content-length' => 10, + }, +); + +expect_api_object_head 'with error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { HEAD => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_access_denied, + throws => qr/^Net::Amazon::S3: Amazon responded with 403 Forbidden/i, + expect_s3_err => 'network_error', + expect_s3_errstr => '403 Forbidden', +); + +expect_api_object_head 'with error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { HEAD => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_no_such_bucket, + expect_data => bool (0), + expect_s3_err => undef,, + expect_s3_errstr => undef,, +); + +expect_api_object_head 'with error no such object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { HEAD => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_no_such_key, + expect_data => bool (0), + expect_s3_err => undef,, + expect_s3_errstr => undef,, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/api-service-buckets-list.t libnet-amazon-s3-perl-0.85/t/api-service-buckets-list.t --- libnet-amazon-s3-perl-0.84/t/api-service-buckets-list.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/api-service-buckets-list.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,67 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::API ( + qw[ expect_api_list_all_my_buckets ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Service::Buckets::List ( + qw[ buckets_list_with_displayname ], + qw[ buckets_list_without_displayname ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], +); + +expect_api_list_all_my_buckets 'list all my buckets with displayname' => ( + with_response_data => buckets_list_with_displayname, + expect_request => { GET => 'https://s3.amazonaws.com/' }, + expect_data => { + owner_id => 'bcaf1ffd86f461ca5fb16fd081034f', + owner_displayname => 'webfile', + buckets => [ + all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'quotes'), + ), + all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'samples'), + ), + ], + }, +); + +expect_api_list_all_my_buckets 'list all my buckets without displayname' => ( + with_response_data => buckets_list_without_displayname, + expect_request => { GET => 'https://s3.amazonaws.com/' }, + expect_data => { + owner_id => 'bcaf1ffd86f461ca5fb16fd081034f', + owner_displayname => '', + buckets => [ + all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'quotes'), + ), + all ( + obj_isa ('Net::Amazon::S3::Bucket'), + methods (bucket => 'samples'), + ), + ], + }, +); + +expect_api_list_all_my_buckets 'list all my buckets without displayname' => ( + fixture_error_access_denied, + expect_request => { GET => 'https://s3.amazonaws.com/' }, + expect_data => bool (0), + expect_s3_err => 'AccessDenied', + expect_s3_errstr => 'Access denied error message', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-bucket-acl-get.t libnet-amazon-s3-perl-0.85/t/client-bucket-acl-get.t --- libnet-amazon-s3-perl-0.84/t/client-bucket-acl-get.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-bucket-acl-get.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,42 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_bucket_acl_get ], +); + +use Shared::Examples::Net::Amazon::S3::ACL ( + qw[ acl_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_client_bucket_acl_get 'get bucket acl' => ( + with_bucket => 'some-bucket', + with_response_data => acl_xml, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?acl' }, + expect_data => acl_xml, +); + +expect_client_bucket_acl_get 'get bucket acl with access denied error' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?acl' }, + throws => qr/^AccessDenied: Access denied error message/, +); + +expect_client_bucket_acl_get 'get bucket acl with bucket not found error' => ( + with_bucket => 'some-bucket', + fixture_error_no_such_bucket, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?acl' }, + throws => qr/^NoSuchBucket: No such bucket error message/, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-bucket-create.t libnet-amazon-s3-perl-0.85/t/client-bucket-create.t --- libnet-amazon-s3-perl-0.84/t/client-bucket-create.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-bucket-create.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,78 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 6; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_bucket_create ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Create ( + qw[ create_bucket_in_ca_central_1_content_xml ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_bucket_already_exists ], + qw[ fixture_error_invalid_bucket_name ], +); + +expect_client_bucket_create 'create bucket' => ( + with_bucket => 'some-bucket', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_data => all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'some-bucket'), + ), +); + +expect_client_bucket_create 'create bucket in different region' => ( + with_bucket => 'some-bucket', + with_region => 'ca-central-1', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => create_bucket_in_ca_central_1_content_xml, + expect_data => all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'some-bucket'), + ), +); + +expect_client_bucket_create 'create bucket with acl' => ( + with_bucket => 'some-bucket', + with_acl => 'private', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + expect_request_headers => { x_amz_acl => 'private' }, + expect_data => all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'some-bucket'), + ), +); + +expect_client_bucket_create 'error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + throws => qr/^AccessDenied: Access denied error message/, +); + +expect_client_bucket_create 'error bucket already exists' => ( + with_bucket => 'some-bucket', + fixture_error_bucket_already_exists, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + throws => qr/^BucketAlreadyExists: Bucket already exists error message/, +); + +expect_client_bucket_create 'error invalid bucket name' => ( + with_bucket => 'some-bucket', + fixture_error_invalid_bucket_name, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/' }, + throws => qr/^InvalidBucketName: Invalid bucket name error message/, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-bucket-delete.t libnet-amazon-s3-perl-0.85/t/client-bucket-delete.t --- libnet-amazon-s3-perl-0.84/t/client-bucket-delete.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-bucket-delete.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,48 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_bucket_delete ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_bucket_not_empty ], + qw[ fixture_error_no_such_bucket ], +); + +expect_client_bucket_delete 'delete bucket' => ( + with_bucket => 'some-bucket', + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_data => bool (1), +); + +expect_client_bucket_delete 'error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + throws => qr/^AccessDenied: Access denied error message/, +); + +expect_client_bucket_delete 'error bucket not empty' => ( + with_bucket => 'some-bucket', + fixture_error_bucket_not_empty, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + throws => qr/^BucketNotEmpty: Bucket not empty error message/, +); + +expect_client_bucket_delete 'error no such bucket' => ( + with_bucket => 'some-bucket', + fixture_error_no_such_bucket, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/' }, + expect_request_content => '', + throws => qr/^NoSuchBucket: No such bucket error message/, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-bucket-objects-delete.t libnet-amazon-s3-perl-0.85/t/client-bucket-objects-delete.t --- libnet-amazon-s3-perl-0.84/t/client-bucket-objects-delete.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-bucket-objects-delete.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,55 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_bucket_objects_delete ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::Delete ( + qw[ fixture_response_quiet_without_errors ], +); + +expect_client_bucket_objects_delete 'delete multiple objects' => ( + with_bucket => 'some-bucket', + with_keys => [qw[ key-1 key-2 ]], + fixture_response_quiet_without_errors, + expect_request => { POST => 'https://some-bucket.s3.amazonaws.com/?delete' }, + expect_data => all ( + obj_isa ('HTTP::Response'), + methods (is_success => bool (1)), + ), + expect_request_content => <<'XML', + + true + key-1 + key-2 + +XML +); + +expect_client_bucket_objects_delete 'with error access denied' => ( + with_bucket => 'some-bucket', + with_keys => [qw[ key-1 key-2 ]], + fixture_error_access_denied, + expect_request => { POST => 'https://some-bucket.s3.amazonaws.com/?delete' }, + throws => qr/^AccessDenied: Access denied error message/, +); + +expect_client_bucket_objects_delete 'with error no such bucket' => ( + with_bucket => 'some-bucket', + with_keys => [qw[ key-1 key-2 ]], + fixture_error_no_such_bucket, + expect_request => { POST => 'https://some-bucket.s3.amazonaws.com/?delete' }, + throws => qr/^NoSuchBucket: No such bucket error message/, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-bucket-objects-list.t libnet-amazon-s3-perl-0.85/t/client-bucket-objects-list.t --- libnet-amazon-s3-perl-0.84/t/client-bucket-objects-list.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-bucket-objects-list.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,129 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 6; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_bucket_objects_list ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Objects::List ( + qw[ list_bucket_objects_v1 ], + qw[ list_bucket_objects_v1_with_filter ], + qw[ list_bucket_objects_v1_with_delimiter ], + qw[ list_bucket_objects_v1_with_prefix_and_delimiter ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_client_bucket_objects_list 'list objects (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?max-keys=1000' }, + expect_data => methods (get_more => [ + all ( + obj_isa ('Net::Amazon::S3::Client::Object'), + methods (bucket => methods(name => 'some-bucket')), + methods (key => 'my-image.jpg'), + methods (last_modified_raw => '2009-10-12T17:50:30.000Z'), + methods (etag => 'fba9dede5f27731c9771645a39863328'), + methods (size => 434234), + ), + all ( + obj_isa ('Net::Amazon::S3::Client::Object'), + methods (bucket => methods(name => 'some-bucket')), + methods (key => 'my-third-image.jpg'), + methods (last_modified_raw => '2009-10-12T17:50:30.000Z'), + methods (etag => '1b2cf535f27731c974343645a3985328'), + methods (size => 64994), + ), + ]), +); + +expect_client_bucket_objects_list 'list objects with filters (version 1)' => ( + with_bucket => 'some-bucket', + # truncated is not supported by shared examples yet (multiple requests => client reads while is truncated) + with_response_data => list_bucket_objects_v1_with_filter, + with_prefix => 'N', + with_marker => 'Ned', + with_max_keys => 40, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?max-keys=1000&prefix=N' }, + expect_data => methods (get_more => [ + all ( + obj_isa ('Net::Amazon::S3::Client::Object'), + methods (bucket => methods(name => 'some-bucket')), + methods (key => 'Nelson'), + methods (last_modified_raw => '2006-01-01T12:00:00.000Z'), + methods (etag => '828ef3fdfa96f00ad9f27c383fc9ac7f'), + methods (size => 5), + ), + all ( + obj_isa ('Net::Amazon::S3::Client::Object'), + methods (bucket => methods(name => 'some-bucket')), + methods (key => 'Neo'), + methods (last_modified_raw => '2006-01-01T12:00:00.000Z'), + methods (etag => '828ef3fdfa96f00ad9f27c383fc9ac7f'), + methods (size => 4), + ), + ]), +); + +# Client doesn't support common prefixes +expect_client_bucket_objects_list 'list objects with delimiter (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1_with_delimiter, + with_delimiter => '/', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?delimiter=%2F&max-keys=1000' }, + expect_data => methods (get_more => [ + all ( + obj_isa ('Net::Amazon::S3::Client::Object'), + methods (bucket => methods(name => 'some-bucket')), + methods (key => 'sample.jpg'), + methods (last_modified_raw => '2011-02-26T01:56:20.000Z'), + methods (etag => 'bf1d737a4d46a19f3bced6905cc8b902'), + methods (size => 142863), + ), + ]), +); + +# Client doesn't support common prefixes +expect_client_bucket_objects_list 'list objects with prefix and delimiter (version 1)' => ( + with_bucket => 'some-bucket', + with_response_data => list_bucket_objects_v1_with_prefix_and_delimiter, + with_delimiter => '/', + with_prefix => 'photos/2006/', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?delimiter=%2F&max-keys=1000&prefix=photos%2F2006%2F' }, + expect_data => methods (get_more => undef), +); + +expect_client_bucket_objects_list 'error access denied' => ( + with_bucket => 'some-bucket', + fixture_error_access_denied, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?max-keys=1000' }, + expect_data => code(sub { + return 0, "expect throw but lives" if eval { $_[0]->get_more; 1 }; + my $error = $@; + + Test::Deep::cmp_details $error, re(qr/^AccessDenied: Access denied error message/); + }), +); + +expect_client_bucket_objects_list 'error no such bucket' => ( + with_bucket => 'some-bucket', + fixture_error_no_such_bucket, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/?max-keys=1000' }, + expect_data => methods (get_more => undef), + expect_data => code(sub { + return 0, "expect throw but lives" if eval { $_[0]->get_more; 1 }; + my $error = $@; + + Test::Deep::cmp_details $error, re(qr/^NoSuchBucket: No such bucket error message/); + }), +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-object-create.t libnet-amazon-s3-perl-0.85/t/client-object-create.t --- libnet-amazon-s3-perl-0.84/t/client-object-create.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-object-create.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,86 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_object_create ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], +); + +expect_client_object_create 'create object from scalar value' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + with_response_headers => { etag => '5946210c9e93ae37891dfe96c3e39614' }, + expect_data => '', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_request_content => 'some value', + expect_request_headers => { + content_length => 10, + content_md5 => 'WUYhDJ6TrjeJHf6Ww+OWFA==', + expires => undef, + }, +); + +expect_client_object_create 'create object with headers recognized by Client::Bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + with_response_headers => { etag => '5946210c9e93ae37891dfe96c3e39614' }, + with_cache_control => 'private', + with_content_disposition => 'inline', + with_content_encoding => 'identity', + with_content_type => 'text/plain', + with_expires => DateTime->new( + year => 2011, + month => 9, + day => 9, + hour => 23, + minute => 36, + time_zone => 'UTC', + ), + with_storage_class => 'reduced_redundancy', + with_user_metadata => { Foo => 1, Bar => 2 }, + expect_data => '', + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_request_content => 'some value', + expect_request_headers => { + cache_control => 'private', + content_disposition => 'inline', + content_encoding => 'identity', + content_length => 10, + content_type => 'text/plain', + content_md5 => 'WUYhDJ6TrjeJHf6Ww+OWFA==', + expires => 'Fri, 09 Sep 2011 23:36:00 GMT', + x_amz_meta_bar => 2, + x_amz_meta_foo => 1, + x_amz_storage_class => 'REDUCED_REDUNDANCY', + }, +); + +expect_client_object_create 'error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + fixture_error_access_denied, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + throws => qr/^AccessDenied: Access denied error message/, +); + +expect_client_object_create 'error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_value => 'some value', + fixture_error_no_such_bucket, + expect_request => { PUT => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (0), + throws => qr/^NoSuchBucket: No such bucket error message/, +); diff -Nru libnet-amazon-s3-perl-0.84/t/client-object-delete.t libnet-amazon-s3-perl-0.85/t/client-object-delete.t --- libnet-amazon-s3-perl-0.84/t/client-object-delete.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-object-delete.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,49 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; # Test::Warnings + our tests +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_object_delete ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_client_object_delete 'delete object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => bool (1), +); + +expect_client_object_delete 'error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_access_denied, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + throws => qr/^AccessDenied: Access denied error message/, +); + +expect_client_object_delete 'error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_no_such_bucket, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + throws => qr/^NoSuchBucket: No such bucket error message/, +); + +expect_client_object_delete 'error no such key' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + fixture_error_no_such_key, + expect_request => { DELETE => 'https://some-bucket.s3.amazonaws.com/some-key' }, + throws => qr/^NoSuchKey: No such key error message/, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-object-fetch.t libnet-amazon-s3-perl-0.85/t/client-object-fetch.t --- libnet-amazon-s3-perl-0.84/t/client-object-fetch.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-object-fetch.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,60 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use HTTP::Status; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_object_fetch ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], + qw[ fixture_error_no_such_bucket ], + qw[ fixture_error_no_such_key ], +); + +expect_client_object_fetch 'fetch existing object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + with_response_code => HTTP::Status::HTTP_OK, + with_response_data => 'some-value', + with_response_headers => { + content_length => 10, + content_type => 'text/plain', + etag => '8c561147ab3ce19bb8e73db4a47cc6ac', + x_amz_metadata_foo => 'foo-1', + date => 'Fri, 09 Sep 2011 23:36:00 GMT', + }, + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + expect_data => 'some-value', +); + +expect_client_object_fetch 'with error access denied' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_access_denied, + throws => qr/^AccessDenied: Access denied error message/i, +); + +expect_client_object_fetch 'with error no such bucket' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_no_such_bucket, + throws => qr/^NoSuchBucket: No such bucket error message/i, +); + +expect_client_object_fetch 'with error no such object' => ( + with_bucket => 'some-bucket', + with_key => 'some-key', + expect_request => { GET => 'https://some-bucket.s3.amazonaws.com/some-key' }, + fixture_error_no_such_key, + throws => qr/^NoSuchKey: No such key error message/i, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/client-service-buckets-list.t libnet-amazon-s3-perl-0.85/t/client-service-buckets-list.t --- libnet-amazon-s3-perl-0.84/t/client-service-buckets-list.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/client-service-buckets-list.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,65 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Client ( + qw[ expect_client_list_all_my_buckets ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Service::Buckets::List ( + qw[ buckets_list_with_displayname ], + qw[ buckets_list_without_displayname ], +); + +use Shared::Examples::Net::Amazon::S3::Error ( + qw[ fixture_error_access_denied ], +); + +expect_client_list_all_my_buckets 'list all my buckets with displayname' => ( + with_response_data => buckets_list_with_displayname, + expect_request => { GET => 'https://s3.amazonaws.com/' }, + expect_data => [ + all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'quotes'), + methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'), + methods (owner_display_name => 'webfile'), + ), + all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'samples'), + methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'), + methods (owner_display_name => 'webfile'), + ), + ], +); + +expect_client_list_all_my_buckets 'list all my buckets without displayname' => ( + with_response_data => buckets_list_without_displayname, + expect_request => { GET => 'https://s3.amazonaws.com/' }, + expect_data => [ + all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'quotes'), + methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'), + methods (owner_display_name => ''), + ), + all ( + obj_isa ('Net::Amazon::S3::Client::Bucket'), + methods (name => 'samples'), + methods (owner_id => 'bcaf1ffd86f461ca5fb16fd081034f'), + methods (owner_display_name => ''), + ), + ], +); + +expect_client_list_all_my_buckets 'list all my buckets without displayname' => ( + fixture_error_access_denied, + expect_request => { GET => 'https://s3.amazonaws.com/' }, + throws => qr/^AccessDenied: Access denied error message/, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/query-string-authentication-uri.t libnet-amazon-s3-perl-0.85/t/query-string-authentication-uri.t --- libnet-amazon-s3-perl-0.84/t/query-string-authentication-uri.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/query-string-authentication-uri.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,43 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 2; +use Test::Warnings; +use Test::Deep; +use Test::MockTime ( + qw[ set_fixed_time ], +); + +use Hash::Util; + +use Shared::Examples::Net::Amazon::S3 ( + qw[ s3_api_with_signature_4 ], + qw[ s3_api_with_signature_2 ], + qw[ expect_net_amazon_s3_feature ], +); + +set_fixed_time '2011-09-09T23:36:00Z'; + +expect_net_amazon_s3_feature "Signature V4 query_string_authentication_uri" => ( + feature => 'signed_uri', + with_s3 => s3_api_with_signature_4, + with_bucket => 'some-bucket', + with_key => 'some/key', + with_expire_at => time + 123_000, + with_region => 'eu-west-1', + + expect_uri => 'https://some-bucket.s3-eu-west-1.amazonaws.com/some/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20110909%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20110909T233600Z&X-Amz-Expires=123000&X-Amz-SignedHeaders=host&X-Amz-Signature=93da6eea1ab776752fbde0d235f04e1513207a88a3cf1ff45fe4ad05505e45a1', +); + +expect_net_amazon_s3_feature "Signature V2 query_string_authentication_uri" => ( + feature => 'signed_uri', + with_s3 => s3_api_with_signature_2, + with_bucket => 'some-bucket', + with_key => 'some/key', + with_expire_at => time + 123_000, + with_region => 'eu-west-1', + + expect_uri => 'https://some-bucket.s3.amazonaws.com/some/key?AWSAccessKeyId=AKIDEXAMPLE&Expires=1315734360&Signature=YtOFhJwsOcNKz5xW7dF6TlrqZT0%3D', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-abort-multipart-upload.t libnet-amazon-s3-perl-0.85/t/request-abort-multipart-upload.t --- libnet-amazon-s3-perl-0.84/t/request-abort-multipart-upload.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-abort-multipart-upload.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,23 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'abort multipart upload' => ( + request_class => 'Net::Amazon::S3::Request::AbortMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_upload_id => '123&456', + + expect_request_method => 'DELETE', + expect_request_path => 'some-bucket/some/key?uploadId=123%26456', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-complete-multipart-upload.t libnet-amazon-s3-perl-0.85/t/request-complete-multipart-upload.t --- libnet-amazon-s3-perl-0.84/t/request-complete-multipart-upload.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-complete-multipart-upload.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,71 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'abort multipart upload with empty parts' => ( + request_class => 'Net::Amazon::S3::Request::CompleteMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_upload_id => '123&456', + with_etags => [ ], + with_part_numbers => [ ], + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/some/key?uploadId=123%26456', + expect_request_headers => { + 'Content-MD5' => ignore, + 'Content-Length' => ignore, + 'Content-Type' => 'application/xml', + }, + expect_request_content => <<'EOXML', + +EOXML +); + +behaves_like_net_amazon_s3_request 'abort multipart upload with some parts' => ( + request_class => 'Net::Amazon::S3::Request::CompleteMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_upload_id => '123&456', + with_etags => [ 'etag01', 'etag02' ], + with_part_numbers => [ 1, 2 ], + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/some/key?uploadId=123%26456', + expect_request_headers => { + 'Content-MD5' => ignore, + 'Content-Length' => ignore, + 'Content-Type' => 'application/xml', + }, + expect_request_content => <<'EOXML', + + + 1 + etag01 + + + 2 + etag02 + + +EOXML +); + +behaves_like_net_amazon_s3_request 'abort multipart upload with uneven argument arrays' => ( + request_class => 'Net::Amazon::S3::Request::CompleteMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/ %/key', + with_upload_id => '123&456', + with_etags => [ 'etag01', 'etag02' ], + with_part_numbers => [ 1, 2, 3 ], + + throws => re( qr/must have an equally sized list of etags and part numbers/ ), +); diff -Nru libnet-amazon-s3-perl-0.84/t/request-create-bucket.t libnet-amazon-s3-perl-0.85/t/request-create-bucket.t --- libnet-amazon-s3-perl-0.84/t/request-create-bucket.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-create-bucket.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,59 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +use Shared::Examples::Net::Amazon::S3::Operation::Bucket::Create ( + qw[ create_bucket_in_ca_central_1_content_xml ], +); + +behaves_like_net_amazon_s3_request 'create bucket' => ( + request_class => 'Net::Amazon::S3::Request::CreateBucket', + with_bucket => 'some-bucket', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/', + expect_request_headers => { }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'create bucket with acl' => ( + request_class => 'Net::Amazon::S3::Request::CreateBucket', + with_bucket => 'some-bucket', + with_acl_short => 'private', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/', + expect_request_headers => { 'x-amz-acl' => 'private' }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'create bucket in region' => ( + request_class => 'Net::Amazon::S3::Request::CreateBucket', + with_bucket => 'some-bucket', + with_location_constraint => 'ca-central-1', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/', + expect_request_headers => { }, + expect_request_content => create_bucket_in_ca_central_1_content_xml, +); + +behaves_like_net_amazon_s3_request 'create bucket in region with acl' => ( + request_class => 'Net::Amazon::S3::Request::CreateBucket', + with_bucket => 'some-bucket', + with_acl_short => 'private', + with_location_constraint => 'ca-central-1', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/', + expect_request_headers => { 'x-amz-acl' => 'private' }, + expect_request_content => create_bucket_in_ca_central_1_content_xml, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-delete-bucket.t libnet-amazon-s3-perl-0.85/t/request-delete-bucket.t --- libnet-amazon-s3-perl-0.84/t/request-delete-bucket.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-delete-bucket.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,21 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'delete bucket' => ( + request_class => 'Net::Amazon::S3::Request::DeleteBucket', + with_bucket => 'some-bucket', + + expect_request_method => 'DELETE', + expect_request_path => 'some-bucket/', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-delete-multi-object.t libnet-amazon-s3-perl-0.85/t/request-delete-multi-object.t --- libnet-amazon-s3-perl-0.84/t/request-delete-multi-object.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-delete-multi-object.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,59 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'delete multi object with empty keys' => ( + request_class => 'Net::Amazon::S3::Request::DeleteMultiObject', + with_bucket => 'some-bucket', + with_keys => [], + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/?delete', + expect_request_headers => { + 'Content-MD5' => 'hWgjGHog2fcu6stNeIAJsw==', + 'Content-Length' => 76, + 'Content-Type' => 'application/xml', + }, + expect_request_content => <<'EOXML', + + true + +EOXML +); + +behaves_like_net_amazon_s3_request 'delete multi object with some keys' => ( + request_class => 'Net::Amazon::S3::Request::DeleteMultiObject', + with_bucket => 'some-bucket', + with_keys => [ 'some/key', '' ], + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/?delete', + expect_request_headers => { + 'Content-MD5' => '+6onPaU8IPGxGhWh0ULBJg==', + 'Content-Length' => 159, + 'Content-Type' => 'application/xml', + }, + expect_request_content => <<'EOXML', + + true + some/key + <another/key> + +EOXML +); + +behaves_like_net_amazon_s3_request 'delete multi object with more than 1_000 keys' => ( + request_class => 'Net::Amazon::S3::Request::DeleteMultiObject', + with_bucket => 'some-bucket', + with_keys => [ 0 .. 1_000 ], + + throws => re( qr/The maximum number of keys is 1000/ ), +); diff -Nru libnet-amazon-s3-perl-0.84/t/request-delete-object.t libnet-amazon-s3-perl-0.85/t/request-delete-object.t --- libnet-amazon-s3-perl-0.84/t/request-delete-object.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-delete-object.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,22 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'delete object' => ( + request_class => 'Net::Amazon::S3::Request::DeleteObject', + with_bucket => 'some-bucket', + with_key => 'some/key', + + expect_request_method => 'DELETE', + expect_request_path => 'some-bucket/some/key', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-get-bucket-access-control.t libnet-amazon-s3-perl-0.85/t/request-get-bucket-access-control.t --- libnet-amazon-s3-perl-0.84/t/request-get-bucket-access-control.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-get-bucket-access-control.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,21 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'get bucket access control' => ( + request_class => 'Net::Amazon::S3::Request::GetBucketAccessControl', + with_bucket => 'some-bucket', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?acl', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-get-bucket-location-constraint.t libnet-amazon-s3-perl-0.85/t/request-get-bucket-location-constraint.t --- libnet-amazon-s3-perl-0.84/t/request-get-bucket-location-constraint.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-get-bucket-location-constraint.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,21 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'get bucket location constraint' => ( + request_class => 'Net::Amazon::S3::Request::GetBucketLocationConstraint', + with_bucket => 'some-bucket', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?location', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-get-object-access-control.t libnet-amazon-s3-perl-0.85/t/request-get-object-access-control.t --- libnet-amazon-s3-perl-0.84/t/request-get-object-access-control.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-get-object-access-control.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,22 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'get object access control' => ( + request_class => 'Net::Amazon::S3::Request::GetObjectAccessControl', + with_bucket => 'some-bucket', + with_key => 'some/key', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/some/key?acl', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-get-object.t libnet-amazon-s3-perl-0.85/t/request-get-object.t --- libnet-amazon-s3-perl-0.84/t/request-get-object.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-get-object.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,23 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'get object' => ( + request_class => 'Net::Amazon::S3::Request::GetObject', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_method => 'GET', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/some/key', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-initiate-multipart-upload.t libnet-amazon-s3-perl-0.85/t/request-initiate-multipart-upload.t --- libnet-amazon-s3-perl-0.84/t/request-initiate-multipart-upload.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-initiate-multipart-upload.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,46 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'initiate multipart upload' => ( + request_class => 'Net::Amazon::S3::Request::InitiateMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/key', + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/some/key?uploads', + expect_request_headers => { }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'initiate multipart upload with acl' => ( + request_class => 'Net::Amazon::S3::Request::InitiateMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_acl_short => 'private', + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/some/key?uploads', + expect_request_headers => { 'x-amz-acl' => 'private' }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'initiate multipart upload with service side encryption' => ( + request_class => 'Net::Amazon::S3::Request::InitiateMultipartUpload', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_encryption => 'AES256', + + expect_request_method => 'POST', + expect_request_path => 'some-bucket/some/key?uploads', + expect_request_headers => { 'x-amz-server-side-encryption' => 'AES256' }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-list-all-buckets.t libnet-amazon-s3-perl-0.85/t/request-list-all-buckets.t --- libnet-amazon-s3-perl-0.84/t/request-list-all-buckets.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-list-all-buckets.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,20 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 1; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'list all buckets' => ( + request_class => 'Net::Amazon::S3::Request::ListAllMyBuckets', + + expect_request_method => 'GET', + expect_request_path => '', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-list-bucket.t libnet-amazon-s3-perl-0.85/t/request-list-bucket.t --- libnet-amazon-s3-perl-0.84/t/request-list-bucket.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-list-bucket.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,64 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 5; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'list bucket' => ( + request_class => 'Net::Amazon::S3::Request::ListBucket', + with_bucket => 'some-bucket', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?max-keys=1000', + expect_request_headers => { }, +); + +behaves_like_net_amazon_s3_request 'list bucket with prefix' => ( + request_class => 'Net::Amazon::S3::Request::ListBucket', + with_bucket => 'some-bucket', + with_prefix => 'some-prefix', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?max-keys=1000&prefix=some-prefix', + expect_request_headers => { }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'list bucket with delimiter' => ( + request_class => 'Net::Amazon::S3::Request::ListBucket', + with_bucket => 'some-bucket', + with_delimiter => '&', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?delimiter=%26&max-keys=1000', + expect_request_headers => { }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'list bucket with max-keys' => ( + request_class => 'Net::Amazon::S3::Request::ListBucket', + with_bucket => 'some-bucket', + with_max_keys => '200', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?max-keys=200', + expect_request_headers => { }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'list bucket with marker' => ( + request_class => 'Net::Amazon::S3::Request::ListBucket', + with_bucket => 'some-bucket', + with_marker => 'x', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/?marker=x&max-keys=1000', + expect_request_headers => { }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-list-parts.t libnet-amazon-s3-perl-0.85/t/request-list-parts.t --- libnet-amazon-s3-perl-0.84/t/request-list-parts.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-list-parts.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,37 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 2; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'list parts' => ( + request_class => 'Net::Amazon::S3::Request::ListParts', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_upload_id => '123', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/some/key?uploadId=123', + expect_request_headers => { }, + expect_request_content => '', +); + +behaves_like_net_amazon_s3_request 'list parts with acl' => ( + request_class => 'Net::Amazon::S3::Request::ListParts', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_upload_id => '123', + with_acl_short => 'private', + + expect_request_method => 'GET', + expect_request_path => 'some-bucket/some/key?uploadId=123', + expect_request_headers => { 'x-amz-acl' => 'private' }, + expect_request_content => '', +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-put-object.t libnet-amazon-s3-perl-0.85/t/request-put-object.t --- libnet-amazon-s3-perl-0.84/t/request-put-object.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-put-object.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,46 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 3; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'put object' => ( + request_class => 'Net::Amazon::S3::Request::PutObject', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_value => 'foo', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key', + expect_request_headers => { }, +); + +behaves_like_net_amazon_s3_request 'put object with acl' => ( + request_class => 'Net::Amazon::S3::Request::PutObject', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_acl_short => 'private', + with_value => 'foo', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key', + expect_request_headers => { 'x-amz-acl' => 'private' }, +); + +behaves_like_net_amazon_s3_request 'put object with service side encryption' => ( + request_class => 'Net::Amazon::S3::Request::PutObject', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_encryption => 'AES256', + with_value => 'foo', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key', + expect_request_headers => { 'x-amz-server-side-encryption' => 'AES256' }, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-put-part.t libnet-amazon-s3-perl-0.85/t/request-put-part.t --- libnet-amazon-s3-perl-0.84/t/request-put-part.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-put-part.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,38 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 2; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'put object' => ( + request_class => 'Net::Amazon::S3::Request::PutPart', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_value => 'foo', + with_upload_id => '123', + with_part_number => '1', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key?partNumber=1&uploadId=123', + expect_request_headers => { }, +); + +behaves_like_net_amazon_s3_request 'put object with acl' => ( + request_class => 'Net::Amazon::S3::Request::PutPart', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_value => 'foo', + with_upload_id => '123', + with_part_number => '1', + with_acl_short => 'private', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key?partNumber=1&uploadId=123', + expect_request_headers => { 'x-amz-acl' => 'private' }, +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-set-bucket-access-control.t libnet-amazon-s3-perl-0.85/t/request-set-bucket-access-control.t --- libnet-amazon-s3-perl-0.84/t/request-set-bucket-access-control.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-set-bucket-access-control.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,48 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'set bucket access control with header acl' => ( + request_class => 'Net::Amazon::S3::Request::SetBucketAccessControl', + with_bucket => 'some-bucket', + with_acl_short => 'private', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/?acl', + expect_request_headers => { 'x-amz-acl' => 'private' }, +); + +behaves_like_net_amazon_s3_request 'set bucket access control with body acl' => ( + request_class => 'Net::Amazon::S3::Request::SetBucketAccessControl', + with_bucket => 'some-bucket', + with_acl_xml => 'private', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/?acl', + expect_request_headers => { }, +); + +behaves_like_net_amazon_s3_request 'set bucket access control without body or header acl' => ( + request_class => 'Net::Amazon::S3::Request::SetBucketAccessControl', + with_bucket => 'some-bucket', + + throws => re( qr/need either acl_xml or acl_short/ ), +); + +behaves_like_net_amazon_s3_request 'set bucket access control with both body and header acl specified' => ( + request_class => 'Net::Amazon::S3::Request::SetBucketAccessControl', + with_bucket => 'some-bucket', + with_acl_short => 'private', + with_acl_xml => 'private', + + throws => re( qr/can not provide both acl_xml and acl_short/ ), +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request-set-object-access-control.t libnet-amazon-s3-perl-0.85/t/request-set-object-access-control.t --- libnet-amazon-s3-perl-0.84/t/request-set-object-access-control.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request-set-object-access-control.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,52 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 4; +use Test::Deep; +use Test::Warnings; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ behaves_like_net_amazon_s3_request ], +); + +behaves_like_net_amazon_s3_request 'set object access control with header acl' => ( + request_class => 'Net::Amazon::S3::Request::SetObjectAccessControl', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_acl_short => 'private', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key?acl', + expect_request_headers => { 'x-amz-acl' => 'private' }, +); + +behaves_like_net_amazon_s3_request 'set object access control with body acl' => ( + request_class => 'Net::Amazon::S3::Request::SetObjectAccessControl', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_acl_xml => 'private', + + expect_request_method => 'PUT', + expect_request_path => 'some-bucket/some/key?acl', + expect_request_headers => { }, +); + +behaves_like_net_amazon_s3_request 'set object access control without body or header acl' => ( + request_class => 'Net::Amazon::S3::Request::SetObjectAccessControl', + with_bucket => 'some-bucket', + with_key => 'some/key', + + throws => re( qr/need either acl_xml or acl_short/ ), +); + +behaves_like_net_amazon_s3_request 'set object access control with both body and header acl specified' => ( + request_class => 'Net::Amazon::S3::Request::SetObjectAccessControl', + with_bucket => 'some-bucket', + with_key => 'some/key', + with_acl_short => 'private', + with_acl_xml => 'private', + + throws => re( qr/can not provide both acl_xml and acl_short/ ), +); + diff -Nru libnet-amazon-s3-perl-0.84/t/request.t libnet-amazon-s3-perl-0.85/t/request.t --- libnet-amazon-s3-perl-0.84/t/request.t 1970-01-01 00:00:00.000000000 +0000 +++ libnet-amazon-s3-perl-0.85/t/request.t 2018-08-28 19:40:55.000000000 +0000 @@ -0,0 +1,84 @@ + +use strict; +use warnings; + +use Test::More tests => 1 + 15; +use Test::Warnings; + +use Moose::Meta::Class; + +use Net::Amazon::S3; + +use Shared::Examples::Net::Amazon::S3::Request ( + qw[ expect_request_class ], + qw[ expect_request_instance ], +); + +my $request_class; + +sub request_class { + ($request_class) = @_; + + expect_request_class $request_class; +} + +sub request_path { + my ($title, %params) = @_; + + my $request = expect_request_instance + request_class => $request_class, + (with_bucket => $params{with_bucket}) x exists $params{with_bucket}, + (with_key => $params{with_key}) x exists $params{with_key}, + ; + + my $request_path = $request->_build_signed_request ( + method => 'GET', + path => $request->_request_path, + )->path; + + is + $request_path, + $params{expect}, + $title, + ; +} + +request_class 'Net::Amazon::S3::Request::Service'; + +request_path 'service request should return empty path', + expect => '', + ; + +request_class 'Net::Amazon::S3::Request::Bucket'; + +request_path 'bucket request', + with_bucket => 'some-bucket', + expect => 'some-bucket/', + ; + +request_class 'Net::Amazon::S3::Request::Object'; + +request_path 'object request with empty key', + with_bucket => 'some-bucket', + with_key => '', + expect => 'some-bucket/', + ; + +request_path 'object request should recognize leading slash', + with_bucket => 'some-bucket', + with_key => '/some/key', + expect => 'some-bucket/some/key', + ; + +request_path 'object request should sanitize key with slash sequences', + with_bucket => 'some-bucket', + with_key => '//some///key', + expect =>'some-bucket/some/key', + ; + +request_path 'object request should uri-escape key', + with_bucket => 'some-bucket', + with_key => 'some/ %/key', + expect => 'some-bucket/some/%20%25/key', + ; +