Subject: | Patch: support for new regions ap-southeast-1 and us-west-1 |
Previous versions of Net::Amazon::S3 only recognized the US and EU
location constraints. This patch adds support for new regions
ap-southeast-1 and us-west-1.
love,
freeside
Subject: | net-amazon-s3.locationconstraints.patch |
Only in /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/: .exists
Only in ./: EC2
Only in ./: EC2.pm
diff -ur /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3/HTTPRequest.pm ./S3/HTTPRequest.pm
--- /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3/HTTPRequest.pm 2010-03-30 17:16:37.000000000 +0800
+++ ./S3/HTTPRequest.pm 2010-05-18 13:25:03.000000000 +0800
@@ -37,6 +37,7 @@
$self->_add_auth_header( $http_headers, $method, $path )
unless exists $headers->{Authorization};
my $protocol = $self->s3->secure ? 'https' : 'http';
+ # TODO: add support for regional endpoints -- http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?LocationSelection.html
my $uri = "$protocol://s3.amazonaws.com/$path";
if ( $path =~ m{^([^/?]+)(.*)} && _is_dns_bucket($1) ) {
$uri = "$protocol://$1.s3.amazonaws.com$2";
Only in ./S3: HTTPRequest.pm~
diff -ur /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3/Request/CreateBucket.pm ./S3/Request/CreateBucket.pm
--- /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3/Request/CreateBucket.pm 2009-01-20 22:50:30.000000000 +0800
+++ ./S3/Request/CreateBucket.pm 2010-05-18 13:21:34.000000000 +0800
@@ -18,8 +18,7 @@
: {};
my $content = '';
- if ( defined $self->location_constraint
- && $self->location_constraint eq 'EU' )
+ if ( defined $self->location_constraint )
{
$content
= "<CreateBucketConfiguration><LocationConstraint>"
Only in ./S3/Request: CreateBucket.pm~
diff -ur /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3/Request.pm ./S3/Request.pm
--- /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3/Request.pm 2009-01-20 22:51:21.000000000 +0800
+++ ./S3/Request.pm 2010-05-18 13:23:00.000000000 +0800
@@ -6,7 +6,7 @@
enum 'AclShort' =>
qw(private public-read public-read-write authenticated-read);
-enum 'LocationConstraint' => ( 'US', 'EU' );
+enum 'LocationConstraint' => ( 'US', 'EU', 'us-west-1', 'ap-southeast-1' );
# To comply with Amazon S3 requirements, bucket names must:
# Contain lowercase letters, numbers, periods (.), underscores (_), and dashes (-)
Only in ./S3: Request.pm~
diff -ur /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3.pm ./S3.pm
--- /Users/mengwong/.cpan/build/Net-Amazon-S3-0.53-xJ9VSW/blib/lib/Net/Amazon/S3.pm 2010-03-30 22:24:14.000000000 +0800
+++ ./S3.pm 2010-05-18 13:29:51.000000000 +0800
@@ -273,8 +273,13 @@
=item location_constraint (option)
Sets the location constraint of the new bucket. If left unspecified, the
-default S3 datacenter location will be used. Otherwise, you can set it
-to 'EU' for a European data center - note that costs are different.
+default us-east-1 region will be used. Otherwise, you can set it
+to one of the following (note that costs may differ):
+ 'EU' for the European region in Ireland
+ 'ap-southeast-1' for the Singapore region
+ 'us-west-1' for the Northern California region
+
+See U<http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?LocationSelection.html> for details.
=back