Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions service/s3/s3manager/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (m multiUploadError) UploadID() string {
// UploadInput contains all input for upload requests to Amazon S3.
type UploadInput struct {
// The canned ACL to apply to the object.
ACL *string `location:"header" locationName:"x-amz-acl" type:"string"`
ACL s3.ObjectCannedACL `location:"header" locationName:"x-amz-acl" type:"string"`

Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`

Expand Down Expand Up @@ -140,13 +140,13 @@ type UploadInput struct {
Key *string `location:"uri" locationName:"Key" type:"string" required:"true"`

// A map of metadata to store with the object in S3.
Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"`
Metadata map[string]string `location:"headers" locationName:"x-amz-meta-" type:"map"`

// Confirms that the requester knows that she or he will be charged for the
// request. Bucket owners need not specify this parameter in their requests.
// Documentation on downloading objects from requester pays buckets can be found
// at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"`
RequestPayer s3.RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string"`

// Specifies the algorithm to use to when encrypting the object (e.g., AES256,
// aws:kms).
Expand Down Expand Up @@ -175,7 +175,7 @@ type UploadInput struct {
ServerSideEncryption s3.ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string"`

// The type of storage to use for the object. Defaults to 'STANDARD'.
StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string"`
StorageClass s3.StorageClass `location:"header" locationName:"x-amz-storage-class" type:"string"`

// The tag-set for the object. The tag-set must be encoded as URL Query parameters
Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"`
Expand Down
20 changes: 14 additions & 6 deletions service/s3/s3manager/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
var emptyList = []string{}

func val(i interface{}, s string) interface{} {
fmt.Println("INNER", i)
v, err := awsutil.ValuesAtPath(i, s)
if err != nil || len(v) == 0 {
return nil
Expand Down Expand Up @@ -772,7 +771,10 @@ func TestUploadInputS3PutObjectInputPairity(t *testing.T) {
bOnly := []string{}

for k, c := range matchings {
if c == 1 && k != "ContentLength" {
if strings.HasPrefix(k, "Body-") || strings.HasPrefix(k, "ContentLength-") {
continue
}
if c == 1 {
aOnly = append(aOnly, k)
} else if c == 2 {
bOnly = append(bOnly, k)
Expand Down Expand Up @@ -850,18 +852,24 @@ func compareStructType(a, b reflect.Type) map[string]int {

for i := 0; i < len(aFields) || i < len(bFields); i++ {
if i < len(aFields) {
c := matchings[aFields[i].Name]
matchings[aFields[i].Name] = c + 1
name := matchName(aFields[i])
c := matchings[name]
matchings[name] = c + 1
}
if i < len(bFields) {
c := matchings[bFields[i].Name]
matchings[bFields[i].Name] = c + 2
name := matchName(bFields[i])
c := matchings[name]
matchings[name] = c + 2
}
}

return matchings
}

func matchName(field reflect.StructField) string {
return field.Name + "-" + field.Type.String()
}

func enumFields(v reflect.Type) []reflect.StructField {
fields := []reflect.StructField{}

Expand Down