s3

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Bifrost interface for Simple Storage Service (S3)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleStorageService

type SimpleStorageService struct {
	// Provider is the name of the cloud storage service to use.
	Provider types.Provider
	// DefaultBucket is the S3 bucket to use for storage
	DefaultBucket string
	// CredentialsFile is the path to the S3 credentials file
	CredentialsFile string
	// Region is the S3 region to use for storage
	Region string
	// Zone is the S3 zone to use for storage
	Zone string
	// DefaultTimeout is the time-to-live for time-dependent S3 operations
	DefaultTimeout int64
	// UseAsync enables asynchronous operations with go routines.
	UseAsync bool
	// s3 client
	Client *s3.Client
	// PublicRead enables public read access to uploaded files.
	PublicRead bool
	// SecretKey is the secret key for IAM authentication.
	SecretKey string
	// AccessKey is the access key for IAM authentication.
	AccessKey string
	// EnableDebug enables debug logging.
	EnableDebug bool
}

SimpleStorageService is the S3 struct

func (*SimpleStorageService) Config

Config returns the s3 configuration.

func (*SimpleStorageService) Disconnect

func (s *SimpleStorageService) Disconnect() error

Disconnect closes the S3 connection and returns an error if one occurs.

Disconnect should only be called when the connection is no longer needed.

func (*SimpleStorageService) IsConnected

func (s *SimpleStorageService) IsConnected() bool

IsConnected returns true if the S3 connection is open.

func (*SimpleStorageService) UploadFile

func (s *SimpleStorageService) UploadFile(fileFace interface{}) (*types.UploadedFile, error)

UploadFile uploads a file to S3 and returns an error if one occurs.

Note: UploadFile requires that a default bucket be set in bifrost.BridgeConfig.

func (*SimpleStorageService) UploadFolder

func (s *SimpleStorageService) UploadFolder(foldFace interface{}) ([]*types.UploadedFile, error)

UploadFolder uploads a folder to the provider storage and returns an error if one occurs.

Note: for some providers, UploadFolder requires that a default bucket be set in bifrost.BridgeConfig.

func (*SimpleStorageService) UploadMultiFile

func (s *SimpleStorageService) UploadMultiFile(multiFace interface{}) ([]*types.UploadedFile, error)

UploadMultiFile

Jump to

Keyboard shortcuts

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