s3

package
v0.0.0-...-fdd2a27 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AudioHeader = "audio/"
	MP3Header   = AudioHeader + "mpeg" // audio/mpeg
	MP4Header   = AudioHeader + "mp4"  // audio/mp4
	WAVHeader   = AudioHeader + "wav"  // audio/wav
	OGGHeader   = AudioHeader + "ogg"  // audio/ogg
	FLACHeader  = AudioHeader + "flac" // audio/flac
)

Constants for the content-type headers for audio files

Variables

This section is empty.

Functions

func GetContentType

func GetContentType(ext string) string

GetContentType returns the content-type header for a given audio file extension

Types

type DownloadError

type DownloadError struct {
	Err error
}

func (*DownloadError) Error

func (de *DownloadError) Error() string

type DownloadUploader

type DownloadUploader interface {
	Uploader
	Downloader
}

type Downloader

type Downloader interface {
	DownloadObject(ctx context.Context, objectName, bucket string) ([]byte, error)
}

Downloader defines the API for downloading objects to S3 storage

type MinioClient

type MinioClient struct {
	// S3Client is the service client for MinIO
	S3Client *minio.Client
}

MinioClient is a struct that implements the DownloadUploader interface using MinIO's S3 SDK for Go

func NewMinioClient

func NewMinioClient(client *minio.Client) *MinioClient

func (*MinioClient) DownloadObject

func (m *MinioClient) DownloadObject(ctx context.Context, objectName, bucket string) ([]byte, error)

DownloadObject downloads an object from a MinIO bucket with the given object name TODO this needs to return the file/data received

func (*MinioClient) UploadObject

func (uploader *MinioClient) UploadObject(ctx context.Context, filename, bucket string) error

UploadObject uploads to an MinIO bucket with the given file

type S3Client

type S3Client struct {
	// S3Client is the service client for Amazon S3
	S3Client *s3.Client
}

S3Client is a struct that implements the DownloadUploader interface using AWS's S3 SDK for Go

func New

func New(client *s3.Client) *S3Client

func (*S3Client) DownloadObject

func (a *S3Client) DownloadObject(ctx context.Context, objectName, bucket string) error

DownloadObject downloads from the given file an AWS bucket

func (*S3Client) UploadObject

func (a *S3Client) UploadObject(ctx context.Context, filename, bucket string) error

UploadObject uploads to an AWS bucket with the given file

type UploadError

type UploadError struct {
	Err error
}

func (*UploadError) Error

func (ue *UploadError) Error() string

type Uploader

type Uploader interface {
	UploadObject(ctx context.Context, filename, bucket string) error
}

Uploader defines the API for uploading objects to S3 storage

Jump to

Keyboard shortcuts

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