feat: add support for FilePut

This commit is contained in:
Rohan
2021-12-29 13:59:45 +05:30
parent b23aec1a12
commit a9d0bbf9a8
3 changed files with 163 additions and 25 deletions
+5 -5
View File
@@ -34,13 +34,13 @@ type UploadConfig struct {
MetaData map[string]string
}
// UploadPolicies Amazon s3 upload policies
// UploadPolicies Amazon s3 upload policies.
type UploadPolicies struct {
URL string
Form map[string]string
}
// PolicyJSON is policy rule
// PolicyJSON is policy rule.
type PolicyJSON struct {
Expiration string `json:"expiration"`
Conditions []interface{} `json:"conditions"`
@@ -57,12 +57,12 @@ const (
defaultExpirationHour = 1 * time.Hour
)
// nowTime mockable time.Now()
var nowTime = func() time.Time {
// nowTime is returns UTC time.
func nowTime() time.Time {
return time.Now().UTC()
}
var newLine = []byte{'\n'}
var newLine = []byte{'\n'} //nolint
// CreateUploadPolicies creates amazon s3 sigv4 compatible
// policy and signing keys with the signature returns the upload policy.