s3compatible

package
v0.0.0-...-9b96405 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false
View Source
var DebugWriter = os.Stdout

Functions

func IsHTTPError

func IsHTTPError(err error, statuscode int) bool

Types

type API

type API struct {
	S3 *s3.Client
}

func New

func New() *API

func (*API) Info

func (a *API) Info(ctx context.Context, bucket string, key string) (*Info, error)

func (*API) Load

func (a *API) Load(ctx context.Context, bucket string, key string, writer io.Writer) (int64, error)

func (*API) PresignGetObject

func (a *API) PresignGetObject(ctx context.Context, bucket string, key string, ttl time.Duration) (string, error)

func (*API) PresignPutObject

func (a *API) PresignPutObject(ctx context.Context, bucket string, key string, ttl time.Duration, opt *UploadOptions) (string, error)

func (*API) Remove

func (a *API) Remove(ctx context.Context, bucket string, key string) error

func (*API) Save

func (a *API) Save(ctx context.Context, bucket string, key string, reader io.Reader) error

type Info

type Info struct {
	LastModified *time.Time
	Size         int64
}

type S3Config

type S3Config struct {
	Region       string
	Endpoint     string
	SecretID     string
	Secret       string
	SessionToken string
	UsePathStyle bool
}

func (*S3Config) ApplyTo

func (c *S3Config) ApplyTo(api *API) error

type UploadOptions

type UploadOptions struct {
	ContentLength int64
}

func NewUploadOptions

func NewUploadOptions() *UploadOptions

Jump to

Keyboard shortcuts

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