Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Added support for v4 signing to S3. #27

Merged
merged 3 commits into from
Mar 1, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package aws
import (
"errors"
"os"
"strings"
)

// Region defines the URLs where AWS services may be accessed.
Expand All @@ -30,6 +31,13 @@ type Region struct {
Sign Signer // Method which will be used to sign requests.
}

func (r Region) ResolveS3BucketEndpoint(bucketName string) string {
if r.S3BucketEndpoint != "" {
return strings.Replace(r.S3BucketEndpoint, "${bucket}", bucketName, -1)
}
return r.S3Endpoint + "/" + bucketName + "/"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.Join here instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.Join scrubs the content and will remove one of the slashes in "http://" in the r.S3Endpoint.

}

var USEast = Region{
"us-east-1",
"https://ec2.us-east-1.amazonaws.com",
Expand Down
4 changes: 0 additions & 4 deletions s3/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ func AttemptStrategy() aws.AttemptStrategy {
return attempts
}

func Sign(auth aws.Auth, method, path string, params, headers map[string][]string) {
sign(auth, method, path, params, headers)
}

func SetListPartsMax(n int) {
listPartsMax = n
}
Expand Down