s3

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, region string, insecure, forcedPathStyle bool) (*Client, error)

func (*Client) CopyObject

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

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

func (*Client) DeleteObjects

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

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

func (*Client) GetFile

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

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

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