s3x

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package s3x contains S3 utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBucketIfNotExists

func CreateBucketIfNotExists(
	ctx context.Context,
	client *s3.Client,
	bucket string,
	onRequest func(any) []func(*s3.Options),
) error

CreateBucketIfNotExists creates an S3 bucket if it does not already exist.

func DeleteBucketIfExists

func DeleteBucketIfExists(
	ctx context.Context,
	client *s3.Client,
	bucket string,
	onRequest func(any) []func(*s3.Options),
) (err error)

DeleteBucketIfExists deletes an S3 bucket if it exists.

func IgnoreAlreadyExists

func IgnoreAlreadyExists(err error) error

IgnoreAlreadyExists returns nil if err is an error that indicates the requested object already exists; otherwise it returns err.

func IgnoreNotExists

func IgnoreNotExists(err error) error

IgnoreNotExists returns nil if err is an error that indicates the requested object was not found; otherwise it returns err.

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists returns true if err is an error that indicates the requested object already exists.

func IsConflict

func IsConflict(err error) bool

IsConflict returns true if err is an error that indicates an object conflict.

func IsNotExists

func IsNotExists(err error) bool

IsNotExists returns true if err is an error that indicates the requested object was not found.

func NewTestClient

func NewTestClient(t testing.TB) *s3.Client

NewTestClient returns a new S3 client for use in a test.

Types

type ReadSeeker

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

ReadSeeker is an io.ReadSeeker that reads from a byte slice.

See https://github.com/aws/aws-sdk-go-v2/issues/1108.

func NewReadSeeker

func NewReadSeeker(data []byte) *ReadSeeker

NewReadSeeker returns a new ReadSeeker that reads from the given byte slice.

func (*ReadSeeker) Read

func (s *ReadSeeker) Read(p []byte) (n int, err error)

Read implements io.Reader.

func (*ReadSeeker) Reset

func (s *ReadSeeker) Reset(data []byte)

Reset resets the reader to read from the given byte slice.

func (*ReadSeeker) Seek

func (s *ReadSeeker) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker.

Jump to

Keyboard shortcuts

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