s3

package
v0.0.0-...-8f202a6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitS3

func InitS3(s3Cfg *config.S3Config) *s3.Client

InitS3 initializes and returns an S3 instance configured with the provided S3 configuration.

func NewAwsS3

func NewAwsS3(s3Cfg *config.S3Config, client *s3.Client) storage.IStorageProviderRepository

Types

type AwsS3Usecase

type AwsS3Usecase struct {
	Client *s3.Client
	Cfg    *config.S3Config
}

AwsS3Usecase AwsS3Use case Storage implements the laravel Filesystem like interface using Amazon S3.

func (*AwsS3Usecase) AllDirectories

func (s *AwsS3Usecase) AllDirectories(ctx context.Context, directory string) ([]string, error)

AllDirectories lists all directories under a directory in the S3 bucket, including those in subdirectories.

func (*AwsS3Usecase) AllFiles

func (s *AwsS3Usecase) AllFiles(ctx context.Context, directory string) ([]string, error)

AllFiles lists all files under a directory in the S3 bucket, including those in subdirectories.

func (*AwsS3Usecase) Append

func (s *AwsS3Usecase) Append(ctx context.Context, path, data string) error

Append appends data to the end of an object's content in the S3 bucket.

func (*AwsS3Usecase) Copy

func (s *AwsS3Usecase) Copy(ctx context.Context, from, to string) error

Copy copies an object from one location to another within the S3 bucket.

func (*AwsS3Usecase) Delete

func (s *AwsS3Usecase) Delete(ctx context.Context, paths ...string) error

Delete removes one or more objects from the S3 bucket.

func (*AwsS3Usecase) DeleteDirectory

func (s *AwsS3Usecase) DeleteDirectory(ctx context.Context, directory string) error

DeleteDirectory deletes a directory in the S3 bucket by removing all its contained objects.

func (*AwsS3Usecase) Directories

func (s *AwsS3Usecase) Directories(ctx context.Context, directory string, recursive bool) ([]string, error)

Directories lists the directories under a directory in the S3 bucket, optionally recursively.

func (*AwsS3Usecase) Exists

func (s *AwsS3Usecase) Exists(ctx context.Context, path string) bool

Exists checks if an object exists in the S3 bucket.

func (*AwsS3Usecase) Files

func (s *AwsS3Usecase) Files(ctx context.Context, directory string, recursive bool) ([]string, error)

Files lists the files under a directory in the S3 bucket, optionally recursively.

func (*AwsS3Usecase) GenerateURL

func (s *AwsS3Usecase) GenerateURL(ctx context.Context, path string, expires time.Duration) (*string, error)

func (*AwsS3Usecase) Get

func (s *AwsS3Usecase) Get(ctx context.Context, path string) (string, error)

Get retrieves the content of an object from the S3 bucket as a string.

func (*AwsS3Usecase) GetVisibility

func (s *AwsS3Usecase) GetVisibility(ctx context.Context, path string) (string, error)

GetVisibility retrieves the visibility setting of an object in the S3 bucket.

func (*AwsS3Usecase) LastModified

func (s *AwsS3Usecase) LastModified(ctx context.Context, path string) (int64, error)

LastModified retrieves the last modified timestamp of an object in the S3 bucket.

func (*AwsS3Usecase) MakeDirectory

func (s *AwsS3Usecase) MakeDirectory(ctx context.Context, path string) error

MakeDirectory creates a directory in the S3 bucket by storing an empty object with a trailing slash.

func (*AwsS3Usecase) Move

func (s *AwsS3Usecase) Move(ctx context.Context, from, to string) error

Move moves an object from one location to another within the S3 bucket.

func (*AwsS3Usecase) Prepend

func (s *AwsS3Usecase) Prepend(ctx context.Context, path, data string) error

Prepend prepends data to the beginning of an object's content in the S3 bucket.

func (*AwsS3Usecase) Put

func (s *AwsS3Usecase) Put(ctx context.Context, path string, contents interface{}, options ...interface{}) error

Put stores content in an object within the S3 bucket.

func (*AwsS3Usecase) ReadStream

func (s *AwsS3Usecase) ReadStream(ctx context.Context, path string) (io.ReadCloser, error)

ReadStream retrieves the content of an object from the S3 bucket as a ReadCloser.

func (*AwsS3Usecase) SetVisibility

func (s *AwsS3Usecase) SetVisibility(ctx context.Context, path, visibility string) error

SetVisibility sets the visibility of an object in the S3 bucket.

func (*AwsS3Usecase) Size

func (s *AwsS3Usecase) Size(ctx context.Context, path string) (int64, error)

Size retrieves the size of an object in the S3 bucket.

func (*AwsS3Usecase) WriteStream

func (s *AwsS3Usecase) WriteStream(ctx context.Context, path string, reader io.Reader, options ...interface{}) error

WriteStream writes the content of a Reader to an object within the S3 bucket.

Jump to

Keyboard shortcuts

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