1
0
Fork 0
mirror of https://github.com/Luzifer/mondash.git synced 2024-11-13 01:42:41 +00:00
mondash/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go

38 lines
1.2 KiB
Go
Raw Normal View History

2016-01-23 12:07:07 +00:00
package s3
2016-03-27 18:46:08 +00:00
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/service"
)
2016-01-23 12:07:07 +00:00
func init() {
2016-03-27 18:46:08 +00:00
initService = func(s *service.Service) {
2016-01-23 12:07:07 +00:00
// Support building custom host-style bucket endpoints
s.Handlers.Build.PushFront(updateHostWithBucket)
// Require SSL when using SSE keys
s.Handlers.Validate.PushBack(validateSSERequiresSSL)
s.Handlers.Build.PushBack(computeSSEKeys)
// S3 uses custom error unmarshaling logic
s.Handlers.UnmarshalError.Clear()
s.Handlers.UnmarshalError.PushBack(unmarshalError)
}
2016-03-27 18:46:08 +00:00
initRequest = func(r *request.Request) {
2016-01-23 12:07:07 +00:00
switch r.Operation.Name {
2016-03-27 18:46:08 +00:00
case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, opPutBucketTagging, opDeleteObjects:
2016-01-23 12:07:07 +00:00
// These S3 operations require Content-MD5 to be set
r.Handlers.Build.PushBack(contentMD5)
case opGetBucketLocation:
// GetBucketLocation has custom parsing logic
r.Handlers.Unmarshal.PushFront(buildGetBucketLocation)
case opCreateBucket:
// Auto-populate LocationConstraint with current region
r.Handlers.Validate.PushFront(populateLocationConstraint)
2016-03-27 18:46:08 +00:00
case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload:
r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError)
2016-01-23 12:07:07 +00:00
}
}
}