Documentation ¶
Overview ¶
Package s3 implements S3 utilities.
Index ¶
- func CreateBucket(lg *zap.Logger, s3API s3iface.S3API, bucket string, region string, ...) (err error)
- func DeleteBucket(lg *zap.Logger, s3API s3iface.S3API, bucket string) error
- func Download(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, ...) (err error)
- func DownloadDir(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Dir string, ...) (targetDir string, err error)
- func DownloadToTempFile(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, ...) (localPath string, err error)
- func EmptyBucket(lg *zap.Logger, s3API s3iface.S3API, bucket string) error
- func Exist(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, ...) (exist bool, err error)
- func ListInDescendingLastModified(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3KeyPfx string, ...) (s3Objects []*s3.Object, err error)
- func PollUntilExist(ctx context.Context, stopc chan struct{}, lg *zap.Logger, s3API s3iface.S3API, ...) <-chan HeadObjectStatus
- func Upload(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, fpath string) error
- func UploadBody(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, ...) (err error)
- type HeadObjectStatus
- type Op
- type OpOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBucket ¶
func CreateBucket( lg *zap.Logger, s3API s3iface.S3API, bucket string, region string, lifecyclePrefix string, lifecycleExpirationDays int64) (err error)
CreateBucket creates a S3 bucket.
func DeleteBucket ¶
DeleteBucket deletes S3 bucket.
func Download ¶
func Download(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, localPath string, opts ...OpOption) (err error)
Download downloads the file from the S3 bucket.
func DownloadDir ¶
func DownloadDir(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Dir string, opts ...OpOption) (targetDir string, err error)
DownloadDir downloads all files from the directory in the S3 bucket.
func DownloadToTempFile ¶
func DownloadToTempFile(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, opts ...OpOption) (localPath string, err error)
DownloadToTempFile downloads the file from the S3 bucket to a temporary file.
func EmptyBucket ¶
EmptyBucket empties S3 bucket, by deleting all files in the bucket.
func Exist ¶
func Exist(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, opts ...OpOption) (exist bool, err error)
Exist returns true if the object exists.
func ListInDescendingLastModified ¶
func ListInDescendingLastModified(lg *zap.Logger, s3API s3iface.S3API, bucket string, s3KeyPfx string, opts ...OpOption) (s3Objects []*s3.Object, err error)
ListInDescendingLastModified returns s3 objects which are sorted in "descending" order of last modified timestamps. That is, the first element in the response is of the "most" recent and highest last modified timestamp value.
func PollUntilExist ¶
func PollUntilExist( ctx context.Context, stopc chan struct{}, lg *zap.Logger, s3API s3iface.S3API, bucket string, s3Key string, initialWait time.Duration, pollInterval time.Duration, ) <-chan HeadObjectStatus
PollUntilExist waits until the object exists.
Types ¶
type HeadObjectStatus ¶
type HeadObjectStatus struct { HeadObject *s3.HeadObjectOutput Error error }
HeadObjectStatus represents the S3 object head status.
type Op ¶
type Op struct {
// contains filtered or unexported fields
}
Op represents a SSH operation.
type OpOption ¶
type OpOption func(*Op)
OpOption configures archiver operations.
func WithTimeout ¶
WithTimeout configures request timeouts.
func WithVerbose ¶
WithVerbose configures verbose level in SSH operations.