Updates goamz dependency from crowdmob->AdRoll
Also includes goamz PR #331 for s3 v4 auth + IAM role support
This commit is contained in:
parent
c41141fbd3
commit
fb71af75c8
24
Godeps/Godeps.json
generated
24
Godeps/Godeps.json
generated
@ -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",
|
||||
|
@ -1,7 +1,7 @@
|
||||
package aws_test
|
||||
|
||||
import (
|
||||
"github.com/crowdmob/goamz/aws"
|
||||
"github.com/AdRoll/goamz/aws"
|
||||
"gopkg.in/check.v1"
|
||||
"time"
|
||||
)
|
@ -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"
|
@ -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",
|
@ -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"
|
@ -7,7 +7,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/crowdmob/goamz/aws"
|
||||
"github.com/AdRoll/goamz/aws"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
@ -1,7 +1,7 @@
|
||||
package s3
|
||||
|
||||
import (
|
||||
"github.com/crowdmob/goamz/aws"
|
||||
"github.com/AdRoll/goamz/aws"
|
||||
)
|
||||
|
||||
var originalStrategy = attempts
|
@ -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"
|
@ -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"})
|
||||
|
@ -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":
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
@ -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"
|
||||
)
|
||||
|
@ -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
|
@ -4,7 +4,7 @@ import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha1"
|
||||
"encoding/base64"
|
||||
"github.com/crowdmob/goamz/aws"
|
||||
"github.com/AdRoll/goamz/aws"
|
||||
"log"
|
||||
"sort"
|
||||
"strings"
|
@ -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"
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/crowdmob/goamz/cloudfront"
|
||||
"github.com/AdRoll/goamz/cloudfront"
|
||||
"github.com/docker/distribution/storagedriver"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user