Skip to content

Commit 91a0ed5

Browse files
committed
feat: #135 Generate presigned URL
Signed-off-by: Suraj Patil <[email protected]>
1 parent fd10502 commit 91a0ed5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

providers/s3/s3.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"strconv"
1515
"strings"
1616
"testing"
17+
"time"
1718

1819
"github.com/go-kit/log"
1920
"github.com/go-kit/log/level"
@@ -536,6 +537,15 @@ func (b *Bucket) Delete(ctx context.Context, name string) error {
536537
return b.client.RemoveObject(ctx, b.name, name, minio.RemoveObjectOptions{})
537538
}
538539

540+
// Get Presigned URL for uploading tsdb blocks.
541+
func (b *Bucket) GetPresignedUploadURL(ctx context.Context, name string, expiry time.Duration) (string, error) {
542+
presignedUrl, err := b.client.PresignedPutObject(ctx, b.name, name, expiry)
543+
if err != nil {
544+
return "", err
545+
}
546+
return presignedUrl.String(), nil
547+
}
548+
539549
// IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations.
540550
func (b *Bucket) IsObjNotFoundErr(err error) bool {
541551
return minio.ToErrorResponse(errors.Cause(err)).Code == "NoSuchKey"

0 commit comments

Comments
 (0)