-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3_options.go
52 lines (43 loc) · 1.67 KB
/
s3_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package gfs3
import "github.com/aws/aws-sdk-go/aws"
type (
UploadOption func(options *uploadOptions)
uploadOptions struct {
// The canned ACL to apply to the object. For more information, see Canned ACL
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL).
//
// This action is not supported by Amazon S3 on Outposts.
ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"`
// Specifies presentational information for the object. For more information,
// see http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1).
ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"`
}
DownloadOption func(options *downloadOptions)
downloadOptions struct {
// The account ID of the expected bucket owner. If the bucket is owned by a
// different account, the request will fail with an HTTP 403 (Access Denied)
// error.
ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"`
}
)
func WithACL(acl string) UploadOption {
return func(options *uploadOptions) {
if acl != "" {
options.ACL = aws.String(acl)
}
}
}
func WithContentDisposition(contentDisposition string) UploadOption {
return func(options *uploadOptions) {
if contentDisposition != "" {
options.ContentDisposition = aws.String(contentDisposition)
}
}
}
func WithExpectedBucketOwner(expectedBucketOwner string) DownloadOption {
return func(options *downloadOptions) {
if expectedBucketOwner != "" {
options.ExpectedBucketOwner = aws.String(expectedBucketOwner)
}
}
}