aws

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Err

func Err(err error) error

Transform the error into an httpresponse error

Types

type Client

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

func New

func New(ctx context.Context, opt ...Opt) (*Client, error)

func (*Client) CreateBucket

func (aws *Client) CreateBucket(ctx context.Context, name string, opt ...Opt) (*s3types.Bucket, error)

CreateBucket creates a new S3 bucket

func (*Client) DeleteBucket

func (aws *Client) DeleteBucket(ctx context.Context, name string) error

DeleteBucket deletes an S3 bucket

func (*Client) DeleteObject

func (aws *Client) DeleteObject(ctx context.Context, bucket, key string) error

DeleteObject deletes the object with the specified key in the specified bucket.

func (*Client) GetBucket

func (aws *Client) GetBucket(ctx context.Context, name string) (*s3types.Bucket, error)

GetBucket returns an S3 bucket

func (*Client) GetObject

func (aws *Client) GetObject(ctx context.Context, w io.Writer, meta func(url.Values) error, bucket, key string) (*s3types.Object, error)

GetObject returns the metadata and writes the object data with the specified key. If w is nil, no data is written. If meta is nil, the metadata function is not called. The object is returned after the data is written.

func (*Client) GetObjectMeta

func (aws *Client) GetObjectMeta(ctx context.Context, bucket, key string) (*s3types.Object, url.Values, error)

GetObjectMeta returns the object metadata with the specified key in the specified bucket. The object is not downloaded.

func (*Client) ListBuckets

func (aws *Client) ListBuckets(ctx context.Context) ([]s3types.Bucket, error)

ListBuckets lists all S3 buckets in the account TODO: up to the specified limit.

func (*Client) ListObjects

func (aws *Client) ListObjects(ctx context.Context, bucket string, opts ...Opt) ([]s3types.Object, error)

ListObjects lists all objects in an S3 bucket. Adding WithPrefix() to the options will limit the objects to those with a key that starts with the specified prefix. TODO: up to the specified limit.

func (*Client) PutObject

func (aws *Client) PutObject(ctx context.Context, bucket, key string, r io.Reader, opts ...Opt) (*s3types.Object, error)

PutObject creates or updates an object in the specified bucket with the specified key. The object is created from the specified reader. Content Type and additional metadata can be specified in the options.

func (*Client) Region

func (aws *Client) Region() string

func (*Client) S3

func (aws *Client) S3() *s3.Client

type Opt

type Opt func(*opt) error

Opt represents a function that modifies the options

func WithContentLength

func WithContentLength(v int64) Opt

func WithContentType

func WithContentType(v string) Opt

func WithMeta

func WithMeta(v url.Values) Opt

func WithPrefix

func WithPrefix(v string) Opt

func WithRegion

func WithRegion(region string) Opt

func WithS3Endpoint

func WithS3Endpoint(endpoint string) Opt

Jump to

Keyboard shortcuts

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