]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / service / s3 / customizations.go
1 package s3
2
3 import (
4 "github.com/aws/aws-sdk-go/aws/client"
5 "github.com/aws/aws-sdk-go/aws/request"
6 "github.com/aws/aws-sdk-go/internal/s3err"
7 )
8
9 func init() {
10 initClient = defaultInitClientFn
11 initRequest = defaultInitRequestFn
12 }
13
14 func defaultInitClientFn(c *client.Client) {
15 // Support building custom endpoints based on config
16 c.Handlers.Build.PushFront(updateEndpointForS3Config)
17
18 // Require SSL when using SSE keys
19 c.Handlers.Validate.PushBack(validateSSERequiresSSL)
20 c.Handlers.Build.PushBack(computeSSEKeys)
21
22 // S3 uses custom error unmarshaling logic
23 c.Handlers.UnmarshalError.Clear()
24 c.Handlers.UnmarshalError.PushBack(unmarshalError)
25 c.Handlers.UnmarshalError.PushBackNamed(s3err.RequestFailureWrapperHandler())
26 }
27
28 func defaultInitRequestFn(r *request.Request) {
29 // Add reuest handlers for specific platforms.
30 // e.g. 100-continue support for PUT requests using Go 1.6
31 platformRequestHandlers(r)
32
33 switch r.Operation.Name {
34 case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy,
35 opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration,
36 opPutObjectLegalHold, opPutObjectRetention, opPutObjectLockConfiguration,
37 opPutBucketReplication:
38 // These S3 operations require Content-MD5 to be set
39 r.Handlers.Build.PushBack(contentMD5)
40 case opGetBucketLocation:
41 // GetBucketLocation has custom parsing logic
42 r.Handlers.Unmarshal.PushFront(buildGetBucketLocation)
43 case opCreateBucket:
44 // Auto-populate LocationConstraint with current region
45 r.Handlers.Validate.PushFront(populateLocationConstraint)
46 case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload:
47 r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError)
48 r.Handlers.Unmarshal.PushBackNamed(s3err.RequestFailureWrapperHandler())
49 case opPutObject, opUploadPart:
50 r.Handlers.Build.PushBack(computeBodyHashes)
51 // Disabled until #1837 root issue is resolved.
52 // case opGetObject:
53 // r.Handlers.Build.PushBack(askForTxEncodingAppendMD5)
54 // r.Handlers.Unmarshal.PushBack(useMD5ValidationReader)
55 }
56 }
57
58 // bucketGetter is an accessor interface to grab the "Bucket" field from
59 // an S3 type.
60 type bucketGetter interface {
61 getBucket() string
62 }
63
64 // sseCustomerKeyGetter is an accessor interface to grab the "SSECustomerKey"
65 // field from an S3 type.
66 type sseCustomerKeyGetter interface {
67 getSSECustomerKey() string
68 }
69
70 // copySourceSSECustomerKeyGetter is an accessor interface to grab the
71 // "CopySourceSSECustomerKey" field from an S3 type.
72 type copySourceSSECustomerKeyGetter interface {
73 getCopySourceSSECustomerKey() string
74 }