s3

package
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const LinkLifetime = 24 * time.Hour

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client *awss3.Client
	Config *Config
}

func NewClient

func NewClient(ctx context.Context, config *Config) (*Client, error)
func (client *Client) PreSignLink(ctx context.Context, sourceLink string) (string, error)

PreSignLink generates a pre-signed URL for the given sourceLink. If the link does not belong to the configured storage endpoint, it is returned as-is. If the link belongs to the storage, the function generates a pre-signed URL using the AWS S3 client.

func (*Client) UploadFile

func (client *Client) UploadFile(ctx context.Context, filename string, fileType string, src io.Reader) (string, error)

type Config

type Config struct {
	AccessKey string
	SecretKey string
	Bucket    string
	EndPoint  string
	Region    string
	URLPrefix string
	URLSuffix string
	PreSign   bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL