Skip to content

Commit

Permalink
service/s3: Fix PutObject and UploadPart API to include ContentMD5 fi…
Browse files Browse the repository at this point in the history
…eld (#1559)

Fixes the SDK's S3 PutObject and UploadPart API code generation to
correctly render the ContentMD5 field into the associated input types
for these two API operations.

Fix #1553
  • Loading branch information
jasdel authored Sep 29, 2017
1 parent 56009cc commit 7fd9f01
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
14 changes: 11 additions & 3 deletions private/model/api/customization_passes.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ func (a *API) customizationPasses() {
func s3Customizations(a *API) {
var strExpires *Shape

var keepContentMD5Ref = map[string]struct{}{
"PutObjectInput": struct{}{},
"UploadPartInput": struct{}{},
}

for name, s := range a.Shapes {
// Remove ContentMD5 members
if _, ok := s.MemberRefs["ContentMD5"]; ok {
delete(s.MemberRefs, "ContentMD5")
// Remove ContentMD5 members unless specified otherwise.
if _, keep := keepContentMD5Ref[name]; !keep {
if _, have := s.MemberRefs["ContentMD5"]; have {
delete(s.MemberRefs, "ContentMD5")
}
}

// Generate getter methods for API operation fields used by customizations.
for _, refName := range []string{"Bucket", "SSECustomerKey", "CopySourceSSECustomerKey"} {
if ref, ok := s.MemberRefs[refName]; ok {
ref.GenerateGetter = true
Expand Down
18 changes: 18 additions & 0 deletions service/s3/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions service/s3/s3manager/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ type UploadInput struct {
// The language the content is in.
ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"`

// The base64-encoded 128-bit MD5 digest of the part data.
ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"`

// A standard MIME type describing the format of the object data.
ContentType *string `location:"header" locationName:"Content-Type" type:"string"`

Expand Down

0 comments on commit 7fd9f01

Please sign in to comment.