Merge lp:~dave-cheney/goamz/s3-lower-case-bucket-names into lp:~gophers/goamz/trunk

Proposed by Dave Cheney
Status: Merged
Merged at revision: 10
Proposed branch: lp:~dave-cheney/goamz/s3-lower-case-bucket-names
Merge into: lp:~gophers/goamz/trunk
Prerequisite: lp:~dave-cheney/goamz/s3-location-constraint
Diff against target: 88 lines (+14/-7)
3 files modified
aws/aws.go (+8/-2)
s3/s3.go (+1/-2)
s3/s3i_test.go (+5/-3)
To merge this branch: bzr merge lp:~dave-cheney/goamz/s3-lower-case-bucket-names
Reviewer Review Type Date Requested Status
The Go Language Gophers Pending
Review via email: mp+113664@code.launchpad.net

Description of the change

s3: fix regions that require lowercase buckets.

US regions are lax on this restriction, but other later regions
enforce bucket names that are also valid dns names.

https://codereview.appspot.com/6343080/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

LGTM if the us-west situation is sorted out.

https://codereview.appspot.com/6343080/diff/7001/aws/aws.go
File aws/aws.go (right):

https://codereview.appspot.com/6343080/diff/7001/aws/aws.go#newcode50
aws/aws.go:50: false,
I believe both of these are wrong. us-west seems to have the same
software deployment as the other regions.

https://codereview.appspot.com/6343080/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'aws/aws.go'
2--- aws/aws.go 2012-07-06 03:23:10 +0000
3+++ aws/aws.go 2012-07-12 01:59:17 +0000
4@@ -22,7 +22,8 @@
5 EC2Endpoint string
6 S3Endpoint string
7 S3BucketEndpoint string // Not needed by AWS S3. Use ${bucket} for bucket name.
8- S3LocationConstraint bool // true if this region requires a LocationConstraint declaration
9+ S3LocationConstraint bool // true if this region requires a LocationConstraint declaration.
10+ S3LowercaseBucket bool // true if the region requires bucket names to be lower case.
11 SDBEndpoint string
12 SNSEndpoint string
13 SQSEndpoint string
14@@ -34,6 +35,7 @@
15 "https://s3.amazonaws.com",
16 "",
17 false,
18+ false,
19 "https://sdb.amazonaws.com",
20 "https://sns.us-east-1.amazonaws.com",
21 "https://sqs.us-east-1.amazonaws.com",
22@@ -44,7 +46,8 @@
23 "https://ec2.us-west-1.amazonaws.com",
24 "https://s3-us-west-1.amazonaws.com",
25 "",
26- false,
27+ true,
28+ true,
29 "https://sdb.us-west-1.amazonaws.com",
30 "https://sns.us-west-1.amazonaws.com",
31 "https://sqs.us-west-1.amazonaws.com",
32@@ -56,6 +59,7 @@
33 "https://s3-eu-west-1.amazonaws.com",
34 "",
35 true,
36+ true,
37 "https://sdb.eu-west-1.amazonaws.com",
38 "https://sns.eu-west-1.amazonaws.com",
39 "https://sqs.eu-west-1.amazonaws.com",
40@@ -67,6 +71,7 @@
41 "https://s3-ap-southeast-1.amazonaws.com",
42 "",
43 true,
44+ true,
45 "https://sdb.ap-southeast-1.amazonaws.com",
46 "https://sns.ap-southeast-1.amazonaws.com",
47 "https://sqs.ap-southeast-1.amazonaws.com",
48@@ -78,6 +83,7 @@
49 "https://s3-ap-northeast-1.amazonaws.com",
50 "",
51 true,
52+ true,
53 "https://sdb.ap-northeast-1.amazonaws.com",
54 "https://sns.ap-northeast-1.amazonaws.com",
55 "https://sqs.ap-northeast-1.amazonaws.com",
56
57=== modified file 's3/s3.go'
58--- s3/s3.go 2012-07-06 03:13:43 +0000
59+++ s3/s3.go 2012-07-12 01:59:17 +0000
60@@ -54,8 +54,7 @@
61
62 // Bucket returns a Bucket with the given name.
63 func (s3 *S3) Bucket(name string) *Bucket {
64- if s3.Region.S3BucketEndpoint != "" {
65- // If passing bucket name via hostname, it is necessarily lowercased.
66+ if s3.Region.S3BucketEndpoint != "" || s3.Region.S3LowercaseBucket {
67 name = strings.ToLower(name)
68 }
69 return &Bucket{s3, name}
70
71=== modified file 's3/s3i_test.go'
72--- s3/s3i_test.go 2012-07-05 23:45:54 +0000
73+++ s3/s3i_test.go 2012-07-12 01:59:17 +0000
74@@ -31,9 +31,11 @@
75 var _ = Suite(&AmazonClientSuite{Region: aws.USEast})
76 var _ = Suite(&AmazonDomainClientSuite{Region: aws.USEast})
77
78-// eu-west-1 tests (disabled)
79-// https://bugs.launchpad.net/goamz/+bug/1021515
80-// var _ = Suite(&AmazonClientSuite{Region: aws.EUWest})
81+// us-west-1 tests
82+var _ = Suite(&AmazonClientSuite{Region: aws.USWest})
83+
84+// eu-west-1 tests
85+var _ = Suite(&AmazonClientSuite{Region: aws.EUWest})
86
87 // AmazonClientSuite tests the client against a live S3 server.
88 type AmazonClientSuite struct {

Subscribers

People subscribed via source and target branches