-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3_options.go
48 lines (39 loc) · 872 Bytes
/
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
package awsx
type S3Option func(bd *S3RequestConfig)
func applyS3Options(options []S3Option) *S3RequestConfig {
req := &S3RequestConfig{}
for _, option := range options {
option(req)
}
return req
}
func AccessKeyID(id string) S3Option {
return func(req *S3RequestConfig) {
req.accessKeyID = id
}
}
func AccessKeySecret(secret string) S3Option {
return func(req *S3RequestConfig) {
req.accessKeySecret = secret
}
}
func Region(region string) S3Option {
return func(req *S3RequestConfig) {
req.region = region
}
}
func BucketName(name string) S3Option {
return func(req *S3RequestConfig) {
req.bucketName = name
}
}
func UploadTimeout(timeout int) S3Option {
return func(req *S3RequestConfig) {
req.uploadTimeout = timeout
}
}
func DefaultBaseURL(url string) S3Option {
return func(req *S3RequestConfig) {
req.defaultBaseURL = url
}
}