s3

package
v1.81.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package s3 provides a client for AWS S3 bucket.

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 wrapper for the S3 client in the AWS SDK.

func New

func New(ctx context.Context, bucketName string, opts ...Option) (*Client, error)

New creates a new instance of the S3 client wrapper.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key string) error

Delete removes an object from S3 Bucket by key.

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) (*Object, error)

Get returns *Object.

func (*Client) ListKeys

func (c *Client) ListKeys(ctx context.Context, prefix string) ([]string, error)

ListKeys searches for keys by a provided prefix; returns all keys if prefix is empty string.

func (*Client) Put

func (c *Client) Put(ctx context.Context, key string, reader io.Reader) error

Put uploads data from reader to S3 Bucket.

type Object

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

Object represents object retrieved from S3.

type Option

type Option func(*cfg)

Option is a type to allow setting custom client options.

func WithAWSOptions

func WithAWSOptions(opt awsopt.Options) Option

WithAWSOptions allows to add an arbitrary AWS options.

type S3

type S3 interface {
	DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
	PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
}

S3 represents the mockable functions in the AWS SDK S3 client.

Jump to

Keyboard shortcuts

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