diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-06-06 14:44:38 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-06-06 14:44:38 +0100 |
commit | 067ad51b6a6ee8829612f51a6e6b2ade3eaa61b3 (patch) | |
tree | 301d2a7303e2b5db0c3fa1911d799e16f921d9dc /vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go | |
parent | 5ca59399fe0880368f88d17c0c9d781d836969c6 (diff) | |
parent | a18a13fb09eac00cdacf1f74080524182b7243de (diff) |
Merge pull request #17 from nsheridan/vendor
update dependencies
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go new file mode 100644 index 0000000..c3a2702 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go @@ -0,0 +1,43 @@ +package s3 + +import ( + "io/ioutil" + "regexp" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" +) + +var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) + +func buildGetBucketLocation(r *request.Request) { + if r.DataFilled() { + out := r.Data.(*GetBucketLocationOutput) + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed reading response body", err) + return + } + + match := reBucketLocation.FindSubmatch(b) + if len(match) > 1 { + loc := string(match[1]) + out.LocationConstraint = &loc + } + } +} + +func populateLocationConstraint(r *request.Request) { + if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" { + in := r.Params.(*CreateBucketInput) + if in.CreateBucketConfiguration == nil { + r.Params = awsutil.CopyOf(r.Params) + in = r.Params.(*CreateBucketInput) + in.CreateBucketConfiguration = &CreateBucketConfiguration{ + LocationConstraint: r.Config.Region, + } + } + } +} |