s3

package
v0.0.0-...-8357697 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewS3Store

func NewS3Store(opt Opt) (media.Store, error)

NewS3Store initialises store for S3 provider. It takes in the AWS configuration and sets up the `simples3` client to interact with AWS APIs for all bucket operations.

Types

type Client

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

Client implements `media.Store` for S3 provider

func (*Client) Delete

func (c *Client) Delete(name string) error

Delete accepts the filename of the object and deletes from S3.

func (*Client) GetBlob

func (c *Client) GetBlob(uurl string) ([]byte, error)

GetBlob reads a file from S3 and returns the raw bytes.

func (*Client) GetURL

func (c *Client) GetURL(name string) string

Get accepts the filename of the object stored and retrieves from S3.

func (*Client) Put

func (c *Client) Put(name string, cType string, file io.ReadSeeker) (string, error)

Put takes in the filename, the content type and file object itself and uploads to S3.

type Opt

type Opt struct {
	URL        string        `koanf:"url"`
	PublicURL  string        `koanf:"public_url"`
	AccessKey  string        `koanf:"aws_access_key_id"`
	SecretKey  string        `koanf:"aws_secret_access_key"`
	Region     string        `koanf:"aws_default_region"`
	Bucket     string        `koanf:"bucket"`
	BucketPath string        `koanf:"bucket_path"`
	BucketType string        `koanf:"bucket_type"`
	Expiry     time.Duration `koanf:"expiry"`
}

Opt represents AWS S3 specific params

Jump to

Keyboard shortcuts

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