s3

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for S3.

func NewClient

func NewClient(ctx context.Context, c config.S3Config) (*Client, error)

NewClient returns a new S3 client.

func (*Client) GeneratePresignedURL

func (c *Client) GeneratePresignedURL(ctx context.Context, key string, expire time.Duration, requestType RequestType) (string, error)

GeneratePresignedURL generates a pre-signed URL.

func (*Client) GeneratePresignedURLForPost added in v0.219.0

func (c *Client) GeneratePresignedURLForPost(ctx context.Context, keyPrefix string, expire time.Duration) (*s3.PresignedPostRequest, error)

GeneratePresignedURLForPost generates a pre-signed URL for a POST request. It allows uploading files with given key prefix. For example, when a file 'myfile' is uploaded, the key will be keyPrefix/myfile.

func (*Client) ListObjectsPages

func (c *Client) ListObjectsPages(
	ctx context.Context,
	prefix string,
) (*s3.ListObjectsV2Output, error)

ListObjectsPages returns S3 objects with pagination.

type RequestType

type RequestType string

RequestType is the type of the request.

const (
	// RequestTypeGetObject is the type for getting an object.
	RequestTypeGetObject RequestType = "GetObject"
	// RequestTypePutObject is the type for putting an object.
	RequestTypePutObject RequestType = "PutObject"
)

Jump to

Keyboard shortcuts

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