Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions providers/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"strconv"
"strings"
"testing"
"time"

"github.com/efficientgo/core/logerrcapture"
"github.com/go-kit/log"
Expand Down Expand Up @@ -651,3 +652,16 @@ func NewTestBucketFromConfig(t testing.TB, location string, c Config, reuseBucke
func ContextWithSSEConfig(ctx context.Context, value encrypt.ServerSide) context.Context {
return context.WithValue(ctx, sseConfigKey, value)
}

// SignedPUT Returns a presigned URL to upload an object without credentials. URL can have a maximum expiry of upto 7days or a minimum of 1sec.
func (b *Bucket) SignedPUT(
ctx context.Context,
objectKey string,
expiry time.Time,
) (string, error) {
u, err := b.client.PresignedPutObject(ctx, b.name, objectKey, expiry.Sub(time.Now()))
if err != nil {
return "", err
}
return u.String(), nil
}