AWS-S3
view release on metacpan or search on metacpan
0.15 2018-04-20
- More fixes for ->add_bucket. Fix an error when no location is provided or
us-east-1 is explicitly asked for. Patch by Dave Rolsky. (GH #9)
0.14 2018-04-13
- Fix sending of undefined location param in ->add_bucket (GH #9)
0.13 2017-02-06
- Add documentation for parameter 'prefix' for AWS::S3::FileIterator
- Add test coverage (GH #8, thanks to simbabque for these changes)
- Fix over encoding of characters in path (GH #6)
0.12 2016-03-07
- Fix DNS bucket name checking for non-valid DNS bucket nams (GH #4)
- Fix URI escaping for filenames to avoid infinite loop on spaces (GH #5)
0.11 2015-08-31
- Fix signed_url to URI escape the Signature param value (GH #3)
0.10 2015-06-23
- dist changes related to kwalitee (no functional changes)
lib/AWS/S3/Request/DeleteMulti.pm view on Meta::CPAN
has '+_expect_nothing' => ( default => 0 );
sub request {
my $s = shift;
my $objects = join "\n", map { "<Object><Key>@{[ $_ ]}</Key></Object>" } @{ $s->keys };
my $xml = <<"XML";
<?xml version="1.0" encoding="UTF-8"?>
<Delete>
$objects
</Delete>
XML
my $signer = AWS::S3::Signer->new(
s3 => $s->s3,
method => 'POST',
uri => $s->_uri,
content => \$xml,
lib/AWS/S3/Roles/Request.pm view on Meta::CPAN
my $m = $self->meta;
my $uri = URI->new(
$self->protocol . '://'
. ( $m->has_attribute('bucket') ? $self->bucket . '.' : '' )
. $self->endpoint
. '/'
);
# note we add some extra exceptions to uri_escape to prevent
# encoding of things like "/", ":", "="
if ( $m->has_attribute('key') ) {
my $escaped_path = uri_escape( $self->key,"^A-Za-z0-9\-\._~\/:=" );
# if we have a leading slash in the key name we need to add *another*
# slash in the call to ->path to ensure it is retained
if ( $escaped_path =~ m!^/! && $self->s3->honor_leading_slashes ) {
$uri->path( '/'.$escaped_path )
} else {
$uri->path( $escaped_path )
}
local *LWP::UserAgent::Determined::request = sub {
return Mocked::HTTP::Response->new( 400,$xml );
};
throws_ok { $s3->add_bucket( name => 'too many buckets', location => 'us-west-1' ) }
qr/TooManyBuckets/, 'add_bucket throws an error';
}
__DATA__
@@ ListAllMyBucketsResult.xml
<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>bcaf1ffd86f41161ca5fb16fd081034f</ID>
<DisplayName>webfile</DisplayName>
</Owner>
<Buckets>
<Bucket>
<Name>foo</Name>
<CreationDate>2006-02-03T16:45:09.000Z</CreationDate>
</Bucket>
<Bucket>
<Name>bar</Name>
<CreationDate>2006-02-03T16:41:58.000Z</CreationDate>
</Bucket>
</Buckets>
</ListAllMyBucketsResult>
@@ error.xml
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>TooManyBuckets</Code>
<Message>You have attempted to create more buckets than allowed.</Message>
<Resource>/mybucket</Resource>
<RequestId>4442587FB7D0A2F9</RequestId>
</Error>
t/aws/s3/file_iterator.t view on Meta::CPAN
is( $iterator->next_page->[0]->key,8,'... file 8' );
is( $iterator->next_page->[0]->key,9,'... file 9' );
is( $iterator->next_page->[0]->key,0,'do a new request and get file 0' );
is( $number_of_request,2,'did two requests' );
};
done_testing();
__DATA__
@@ ListBucketResult.xml
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>bucket</Name>
<Prefix>img</Prefix>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>img/my image.jpg</Key>
<LastModified>2009-10-12T17:50:30.000Z</LastModified>
<ETag>"fba9dede5f27731c9771645a39863328"</ETag>
t/aws/s3/file_iterator.t view on Meta::CPAN
</ListBucketResult>
@@ EmptyResult
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>bucket</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
</ListBucketResult>
@@ LongResult
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>bucket</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>true</IsTruncated>
<Contents>
<Key>0</Key>
<LastModified>2009-10-12T17:50:30.000Z</LastModified>
<ETag>"fba9dede5f27731c9771645a39863328"</ETag>
( run in 0.277 second using v1.01-cache-2.11-cpan-4d50c553e7e )