s3util

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const CannotReadError = "cannot read remote object"

CannotReadError is used in the tests.

Variables

This section is empty.

Functions

func CopyObject

func CopyObject(client s3iface.S3API, inputBucket, inputKey, outputBucket, outputKey string) error

CopyObject copies the `inputKey` in the inputBucket to `outputKey` in the outputBucket.

func DeleteObject

func DeleteObject(client s3iface.S3API, bucket, file string) error

DeleteObject delete the key in the specified bucket.

func DeleteObjects added in v1.23.5

func DeleteObjects(client s3iface.S3API, bucket string, files []string) error

DeleteObjects delete the keys in the specified bucket.

func DownloadObject

func DownloadObject(client s3iface.S3API, bucket, src string) ([]byte, error)

DownloadObject downloads a file from an S3 bucket given the bucket and key. The response is in slice of byte format.

func ListBucket

func ListBucket(client s3iface.S3API, bucket, prefix, lastKey string, maxKeys int64) ([]string, error)

ListBucket returns a slice of the files at an S3 bucket at a given prefix. It lists the objects using maxKeys in each iteration, but returns all of the objects, which may be higher than maxKeys.

func ListFolders

func ListFolders(client s3iface.S3API, bucket, prefix, lastKey string, maxKeys int64) ([]string, error)

ListFolders returns the folders stored at `prefix` in the bucket `bucket`.

func ListNObjectsInBucket

func ListNObjectsInBucket(client s3iface.S3API, bucket, prefix, lastKey, delimiter string, maxKeys int64) (objects []string, isTruncated bool, err error)

ListNObjectsInBucket returns a slice of the files at an S3 bucket at a given prefix. It starts listing the files from `lastKey` and returns up to `maxKeys`.

func ObjectExists

func ObjectExists(client s3iface.S3API, bucket, file string) (bool, error)

ObjectExists returns a boolean of whether the key exists in the bucket.

func RenameObject

func RenameObject(client s3iface.S3API, bucket, inputKey, outputKey string) error

RenameObject renames the `inputKey` in the bucket to `outputKey`.

func UploadObject

func UploadObject(client s3iface.S3API, bucket, dst string, src []byte) error

UploadObject uploads a slice of bytes to a specific path and S3 bucket.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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