s3

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegion = "ap-shanghai"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*s3.S3
}

func NewClient

func NewClient(endpoint, ak, sk string, insecure, forcedPathStyle bool) (*Client, error)

func (*Client) CopyObject added in v1.4.0

func (c *Client) CopyObject(bucketName, oldKey, newKey string) error

CopyObject copies an object to a new place in the same bucket.

func (*Client) DeleteObjects added in v1.4.0

func (c *Client) DeleteObjects(bucketName string, keys []string) error

DeleteObjects deletes all the objects listed in keys.

func (*Client) Download

func (c *Client) Download(bucketName, objectKey, dest string) error

Download the file to object storage

func (*Client) DownloadWithOption added in v1.7.0

func (c *Client) DownloadWithOption(bucketName, objectKey, dest string, option *DownloadOption) error

func (*Client) GetFile added in v1.9.9

func (c *Client) GetFile(bucketName, objectKey string, option *DownloadOption) (*s3.GetObjectOutput, error)

func (*Client) ListFiles

func (c *Client) ListFiles(bucketName, prefix string, recursive bool) ([]string, error)

ListFiles with given prefix

func (*Client) RemoveFiles

func (c *Client) RemoveFiles(bucketName string, prefixList []string)

RemoveFiles removes the files with a specific list of prefixes and delete ALL of them for NOW, if an error is encountered, nothing will happen except for a line of error log.

func (*Client) Upload

func (c *Client) Upload(bucketName, src string, objectKey string) error

Upload uploads a file from src to the bucket with the specified objectKey

func (*Client) UploadDir added in v1.9.9

func (c *Client) UploadDir(bucketName, srcdir string, s3dir string) error

Upload upload all files in a directory to a S3 path recursively

func (*Client) ValidateBucket

func (c *Client) ValidateBucket(bucketName string) error

Validate the existence of bucket

type DownloadOption added in v1.7.0

type DownloadOption struct {
	IgnoreNotExistError bool
	RetryNum            int
}

Jump to

Keyboard shortcuts

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