forked from smartystreets/s3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new.go
39 lines (30 loc) · 757 Bytes
/
new.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
package s3
import (
"errors"
"net/http"
)
func NewPresignedGet(options ...Option) (string, error) {
input := newInput(GET, options)
if err := input.validate(); err != nil {
return "", err
}
return newPresigner(input).GenerateURL()
}
func NewRequest(method string, options ...Option) (*http.Request, error) {
input := newInput(method, options)
if err := input.validate(); err != nil {
return nil, err
}
return input.buildAndSignRequest()
}
const (
HEAD = "HEAD"
GET = "GET"
PUT = "PUT"
)
var (
ErrInvalidRequestMethod = errors.New("invalid method")
ErrBucketMissing = errors.New("bucket is required")
ErrKeyMissing = errors.New("key is required")
ErrContentMissing = errors.New("content is required")
)