From fb71af75c8f011b7808878b01240af3e3bb9ef6b Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Mon, 2 Feb 2015 11:03:20 -0800 Subject: [PATCH] Updates goamz dependency from crowdmob->AdRoll Also includes goamz PR #331 for s3 v4 auth + IAM role support --- Godeps/Godeps.json | 24 +++---- .../{crowdmob => AdRoll}/goamz/aws/attempt.go | 0 .../goamz/aws/attempt_test.go | 2 +- .../{crowdmob => AdRoll}/goamz/aws/aws.go | 0 .../goamz/aws/aws_test.go | 2 +- .../{crowdmob => AdRoll}/goamz/aws/client.go | 0 .../goamz/aws/export_test.go | 0 .../{crowdmob => AdRoll}/goamz/aws/regions.go | 2 +- .../{crowdmob => AdRoll}/goamz/aws/retry.go | 0 .../goamz/aws/retry_test.go | 0 .../{crowdmob => AdRoll}/goamz/aws/sign.go | 0 .../goamz/aws/sign_test.go | 2 +- .../goamz/cloudfront/cloudfront.go | 2 +- .../goamz/cloudfront/cloudfront_test.go | 0 .../goamz/cloudfront/testdata/key.pem | 0 .../goamz/cloudfront/testdata/key.pub | 0 .../goamz/s3/export_test.go | 2 +- .../goamz/s3/lifecycle.go | 0 .../goamz/s3/lifecycle_test.go | 2 +- .../{crowdmob => AdRoll}/goamz/s3/multi.go | 0 .../goamz/s3/multi_test.go | 6 +- .../goamz/s3/responses_test.go | 0 .../{crowdmob => AdRoll}/goamz/s3/s3.go | 21 +++++- .../{crowdmob => AdRoll}/goamz/s3/s3_test.go | 6 +- .../{crowdmob => AdRoll}/goamz/s3/s3i_test.go | 6 +- .../{crowdmob => AdRoll}/goamz/s3/s3t_test.go | 6 +- .../goamz/s3/s3test/server.go | 69 ++++++++++++++++++- .../{crowdmob => AdRoll}/goamz/s3/sign.go | 2 +- .../goamz/s3/sign_test.go | 4 +- storage/cloudfrontlayerhandler.go | 2 +- storagedriver/s3/s3.go | 6 +- storagedriver/s3/s3_test.go | 2 +- 32 files changed, 123 insertions(+), 45 deletions(-) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/attempt.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/attempt_test.go (97%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/aws.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/aws_test.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/client.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/export_test.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/regions.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/retry.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/retry_test.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/sign.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/aws/sign_test.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/cloudfront/cloudfront.go (98%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/cloudfront/cloudfront_test.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/cloudfront/testdata/key.pem (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/cloudfront/testdata/key.pub (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/export_test.go (92%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/lifecycle.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/lifecycle_test.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/multi.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/multi_test.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/responses_test.go (100%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/s3.go (97%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/s3_test.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/s3i_test.go (99%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/s3t_test.go (94%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/s3test/server.go (91%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/sign.go (98%) rename Godeps/_workspace/src/github.com/{crowdmob => AdRoll}/goamz/s3/sign_test.go (98%) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index c578c78ca..b4f422739 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -10,6 +10,18 @@ "Comment": "null-12", "Rev": "7dda39b2e7d5e265014674c5af696ba4186679e9" }, + { + "ImportPath": "github.com/AdRoll/goamz/aws", + "Rev": "d3664b76d90508cdda5a6c92042f26eab5db3103" + }, + { + "ImportPath": "github.com/AdRoll/goamz/cloudfront", + "Rev": "d3664b76d90508cdda5a6c92042f26eab5db3103" + }, + { + "ImportPath": "github.com/AdRoll/goamz/s3", + "Rev": "d3664b76d90508cdda5a6c92042f26eab5db3103" + }, { "ImportPath": "github.com/Sirupsen/logrus", "Comment": "v0.6.1-8-gcc09837", @@ -28,18 +40,6 @@ "ImportPath": "github.com/bugsnag/panicwrap", "Rev": "e5f9854865b9778a45169fc249e99e338d4d6f27" }, - { - "ImportPath": "github.com/crowdmob/goamz/aws", - "Rev": "962cedbbde5e1af59fb0b4ab681c848e61676941" - }, - { - "ImportPath": "github.com/crowdmob/goamz/cloudfront", - "Rev": "962cedbbde5e1af59fb0b4ab681c848e61676941" - }, - { - "ImportPath": "github.com/crowdmob/goamz/s3", - "Rev": "962cedbbde5e1af59fb0b4ab681c848e61676941" - }, { "ImportPath": "github.com/docker/docker/pkg/tarsum", "Comment": "v1.4.1-330-g3fbf723", diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/attempt.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/attempt.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/attempt_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt_test.go similarity index 97% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/attempt_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt_test.go index c83b185e5..a6a0afc99 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/attempt_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/attempt_test.go @@ -1,7 +1,7 @@ package aws_test import ( - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" "gopkg.in/check.v1" "time" ) diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/aws.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/aws.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/aws_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws_test.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/aws_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws_test.go index e1e686740..0577f5c8e 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/aws_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/aws_test.go @@ -1,7 +1,7 @@ package aws_test import ( - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" "gopkg.in/check.v1" "io/ioutil" "os" diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/client.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/client.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/client.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/client.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/export_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/export_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/export_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/export_test.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/regions.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/regions.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/regions.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/regions.go index 97e12e1dc..4e39069ef 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/regions.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/regions.go @@ -63,7 +63,7 @@ var USWest = Region{ ServiceInfo{"https://monitoring.us-west-1.amazonaws.com", V2Signature}, "https://autoscaling.us-west-1.amazonaws.com", ServiceInfo{"https://rds.us-west-1.amazonaws.com", V2Signature}, - "", + "https://kinesis.us-west-1.amazonaws.com", "https://sts.amazonaws.com", "https://cloudformation.us-west-1.amazonaws.com", "https://elasticache.us-west-1.amazonaws.com", diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/retry.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/retry.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/retry.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/retry.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/retry_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/retry_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/retry_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/retry_test.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/sign.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/sign.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/sign_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign_test.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/aws/sign_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign_test.go index d172bdb6c..0f01bce33 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/aws/sign_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/aws/sign_test.go @@ -2,7 +2,7 @@ package aws_test import ( "fmt" - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" "gopkg.in/check.v1" "net/http" "strings" diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/cloudfront.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront.go similarity index 98% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/cloudfront.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront.go index c13bbeeca..b845d3c5c 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/cloudfront.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront.go @@ -7,7 +7,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" "net/url" "strconv" "strings" diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/cloudfront_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/cloudfront_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/cloudfront_test.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/testdata/key.pem b/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/testdata/key.pem similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/testdata/key.pem rename to Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/testdata/key.pem diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/testdata/key.pub b/Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/testdata/key.pub similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/cloudfront/testdata/key.pub rename to Godeps/_workspace/src/github.com/AdRoll/goamz/cloudfront/testdata/key.pub diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/export_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/export_test.go similarity index 92% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/export_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/export_test.go index a4130791d..80f625587 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/export_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/export_test.go @@ -1,7 +1,7 @@ package s3 import ( - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" ) var originalStrategy = attempts diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/lifecycle.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/lifecycle.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/lifecycle_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle_test.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/lifecycle_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle_test.go index 04e143fc0..e43acb8ff 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/lifecycle_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/lifecycle_test.go @@ -2,7 +2,7 @@ package s3_test import ( "encoding/xml" - "github.com/crowdmob/goamz/s3" + "github.com/AdRoll/goamz/s3" "gopkg.in/check.v1" "io/ioutil" "net/http" diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/multi.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/multi.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/multi_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi_test.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/multi_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi_test.go index eadfadec3..875c0adda 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/multi_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/multi_test.go @@ -2,7 +2,7 @@ package s3_test import ( "encoding/xml" - "github.com/crowdmob/goamz/s3" + "github.com/AdRoll/goamz/s3" "gopkg.in/check.v1" "io" "io/ioutil" @@ -21,7 +21,7 @@ func (s *S) TestInitMulti(c *check.C) { Meta: metadata, ContentEncoding: "text/utf8", CacheControl: "no-cache", - RedirectLocation: "http://github.com/crowdmob/goamz", + RedirectLocation: "http://github.com/AdRoll/goamz", ContentMD5: "0000000000000000", } @@ -39,7 +39,7 @@ func (s *S) TestInitMulti(c *check.C) { c.Assert(req.Header["Content-Encoding"], check.DeepEquals, []string{"text/utf8"}) c.Assert(req.Header["Cache-Control"], check.DeepEquals, []string{"no-cache"}) c.Assert(req.Header["Content-Md5"], check.DeepEquals, []string{"0000000000000000"}) - c.Assert(req.Header["X-Amz-Website-Redirect-Location"], check.DeepEquals, []string{"http://github.com/crowdmob/goamz"}) + c.Assert(req.Header["X-Amz-Website-Redirect-Location"], check.DeepEquals, []string{"http://github.com/AdRoll/goamz"}) c.Assert(req.Header["X-Amz-Meta-Key1"], check.DeepEquals, []string{"value1"}) c.Assert(req.Header["X-Amz-Meta-Key2"], check.DeepEquals, []string{"value2"}) diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/responses_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/responses_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/responses_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/responses_test.go diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3.go similarity index 97% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3.go index d89be8b9e..18313c282 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3.go @@ -29,7 +29,7 @@ import ( "strings" "time" - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" ) const debug = false @@ -806,7 +806,7 @@ func (b *Bucket) SignedURLWithMethod(method, path string, expires time.Time, par if err != nil { panic(err) } - if b.S3.Auth.Token() != "" { + if b.S3.Auth.Token() != "" && b.S3.Signature == aws.V2Signature { return u.String() + "&x-amz-security-token=" + url.QueryEscape(req.headers["X-Amz-Security-Token"][0]) } else { return u.String() @@ -1041,8 +1041,10 @@ func (s3 *S3) prepare(req *request) error { } } - if s3.Auth.Token() != "" { + if s3.Signature == aws.V2Signature && s3.Auth.Token() != "" { req.headers["X-Amz-Security-Token"] = []string{s3.Auth.Token()} + } else if s3.Auth.Token() != "" { + req.params.Set("X-Amz-Security-Token", s3.Auth.Token()) } if s3.Signature == aws.V2Signature { @@ -1233,6 +1235,19 @@ func shouldRetry(err error) bool { case "read", "write": return true } + case *url.Error: + // url.Error can be returned either by net/url if a URL cannot be + // parsed, or by net/http if the response is closed before the headers + // are received or parsed correctly. In that later case, e.Op is set to + // the HTTP method name with the first letter uppercased. We don't want + // to retry on POST operations, since those are not idempotent, all the + // other ones should be safe to retry. + switch e.Op { + case "Get", "Put", "Delete", "Head": + return shouldRetry(e.Err) + default: + return false + } case *Error: switch e.Code { case "InternalError", "NoSuchUpload", "NoSuchBucket": diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3_test.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3_test.go index 4f474da44..87b23ad0c 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/crowdmob/goamz/aws" - "github.com/crowdmob/goamz/s3" - "github.com/crowdmob/goamz/testutil" + "github.com/AdRoll/goamz/aws" + "github.com/AdRoll/goamz/s3" + "github.com/AdRoll/goamz/testutil" "gopkg.in/check.v1" ) diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3i_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3i_test.go similarity index 99% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3i_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3i_test.go index a8979e02b..e3b707b45 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3i_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3i_test.go @@ -4,9 +4,9 @@ import ( "bytes" "crypto/md5" "fmt" - "github.com/crowdmob/goamz/aws" - "github.com/crowdmob/goamz/s3" - "github.com/crowdmob/goamz/testutil" + "github.com/AdRoll/goamz/aws" + "github.com/AdRoll/goamz/s3" + "github.com/AdRoll/goamz/testutil" "gopkg.in/check.v1" "io/ioutil" "net" diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3t_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3t_test.go similarity index 94% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3t_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3t_test.go index 171489261..29e2e753d 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3t_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3t_test.go @@ -1,9 +1,9 @@ package s3_test import ( - "github.com/crowdmob/goamz/aws" - "github.com/crowdmob/goamz/s3" - "github.com/crowdmob/goamz/s3/s3test" + "github.com/AdRoll/goamz/aws" + "github.com/AdRoll/goamz/s3" + "github.com/AdRoll/goamz/s3/s3test" "gopkg.in/check.v1" ) diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3test/server.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3test/server.go similarity index 91% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3test/server.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3test/server.go index 42bddcfc9..4dc95eae0 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/s3test/server.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/s3test/server.go @@ -7,7 +7,7 @@ import ( "encoding/hex" "encoding/xml" "fmt" - "github.com/crowdmob/goamz/s3" + "github.com/AdRoll/goamz/s3" "io" "io/ioutil" "log" @@ -432,11 +432,74 @@ func (r bucketResource) put(a *action) interface{} { return nil } -func (bucketResource) post(a *action) interface{} { - fatalf(400, "Method", "bucket POST method not available") +func (r bucketResource) post(a *action) interface{} { + if _, multiDel := a.req.URL.Query()["delete"]; multiDel { + return r.multiDel(a) + } + + fatalf(400, "Method", "bucket operation not supported") return nil } +func (b bucketResource) multiDel(a *action) interface{} { + type multiDelRequestObject struct { + Key string + VersionId string + } + + type multiDelRequest struct { + Quiet bool + Object []*multiDelRequestObject + } + + type multiDelDelete struct { + XMLName struct{} `xml:"Deleted"` + Key string + } + + type multiDelError struct { + XMLName struct{} `xml:"Error"` + Key string + Code string + Message string + } + + type multiDelResult struct { + XMLName struct{} `xml:"DeleteResult"` + Deleted []*multiDelDelete + Error []*multiDelError + } + + req := &multiDelRequest{} + + if err := xml.NewDecoder(a.req.Body).Decode(req); err != nil { + fatalf(400, "InvalidRequest", err.Error()) + } + + res := &multiDelResult{ + Deleted: []*multiDelDelete{}, + Error: []*multiDelError{}, + } + + for _, o := range req.Object { + if _, exists := b.bucket.objects[o.Key]; exists { + delete(b.bucket.objects, o.Key) + + res.Deleted = append(res.Deleted, &multiDelDelete{ + Key: o.Key, + }) + } else { + res.Error = append(res.Error, &multiDelError{ + Key: o.Key, + Code: "AccessDenied", + Message: "Access Denied", + }) + } + } + + return res +} + // validBucketName returns whether name is a valid bucket name. // Here are the rules, from: // http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/BucketRestrictions.html diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/sign.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign.go similarity index 98% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/sign.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign.go index 1c33f2746..19642094f 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/sign.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign.go @@ -4,7 +4,7 @@ import ( "crypto/hmac" "crypto/sha1" "encoding/base64" - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" "log" "sort" "strings" diff --git a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/sign_test.go b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign_test.go similarity index 98% rename from Godeps/_workspace/src/github.com/crowdmob/goamz/s3/sign_test.go rename to Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign_test.go index 0e35aef68..613dc7663 100644 --- a/Godeps/_workspace/src/github.com/crowdmob/goamz/s3/sign_test.go +++ b/Godeps/_workspace/src/github.com/AdRoll/goamz/s3/sign_test.go @@ -1,8 +1,8 @@ package s3_test import ( - "github.com/crowdmob/goamz/aws" - "github.com/crowdmob/goamz/s3" + "github.com/AdRoll/goamz/aws" + "github.com/AdRoll/goamz/s3" "gopkg.in/check.v1" ) diff --git a/storage/cloudfrontlayerhandler.go b/storage/cloudfrontlayerhandler.go index 2236f7be8..fa420cc7d 100644 --- a/storage/cloudfrontlayerhandler.go +++ b/storage/cloudfrontlayerhandler.go @@ -9,7 +9,7 @@ import ( "net/url" "time" - "github.com/crowdmob/goamz/cloudfront" + "github.com/AdRoll/goamz/cloudfront" "github.com/docker/distribution/storagedriver" ) diff --git a/storagedriver/s3/s3.go b/storagedriver/s3/s3.go index 2c3ec16b6..a13166807 100644 --- a/storagedriver/s3/s3.go +++ b/storagedriver/s3/s3.go @@ -1,7 +1,7 @@ // Package s3 provides a storagedriver.StorageDriver implementation to // store blobs in Amazon S3 cloud storage. // -// This package leverages the crowdmob/goamz client library for interfacing with +// This package leverages the AdRoll/goamz client library for interfacing with // s3. // // Because s3 is a key, value store the Stat call does not support last modification @@ -24,8 +24,8 @@ import ( "strings" "time" - "github.com/crowdmob/goamz/aws" - "github.com/crowdmob/goamz/s3" + "github.com/AdRoll/goamz/aws" + "github.com/AdRoll/goamz/s3" "github.com/docker/distribution/storagedriver" "github.com/docker/distribution/storagedriver/factory" ) diff --git a/storagedriver/s3/s3_test.go b/storagedriver/s3/s3_test.go index 830f99342..563b9d0ea 100644 --- a/storagedriver/s3/s3_test.go +++ b/storagedriver/s3/s3_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/crowdmob/goamz/aws" + "github.com/AdRoll/goamz/aws" "github.com/docker/distribution/storagedriver" "github.com/docker/distribution/storagedriver/testsuites"