s3

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 68

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAWSCredentials

func GetAWSCredentials(opts S3ClientOpts) (*credentials.Credentials, error)

Get AWS credentials based on default order from aws SDK

func GetAssumeRoleCredentials

func GetAssumeRoleCredentials(opts S3ClientOpts) (*credentials.Credentials, error)

GetAssumeRoleCredentials gets Assumed role credentials

func GetCredentials

func GetCredentials(opts S3ClientOpts) (*credentials.Credentials, error)

func IsS3ErrCode

func IsS3ErrCode(err error, code string) bool

IsS3ErrCode returns if the supplied error is of a specific S3 error code

Types

type EncryptOpts added in v0.11.0

type EncryptOpts struct {
	KmsKeyId              string
	KmsEncryptionContext  string
	Enabled               bool
	ServerSideCustomerKey string
}

type S3Client

type S3Client interface {
	// PutFile puts a single file to a bucket at the specified key
	PutFile(bucket, key, path string) error

	// PutDirectory puts a complete directory into a bucket key prefix, with each file in the directory
	// a separate key in the bucket.
	PutDirectory(bucket, key, path string) error

	// GetFile downloads a file to a local file path
	GetFile(bucket, key, path string) error

	// OpenFile opens a file for much lower disk and memory usage that GetFile
	OpenFile(bucket, key string) (io.ReadCloser, error)

	Delete(bucket, key string) error

	// GetDirectory downloads a directory to a local file path
	GetDirectory(bucket, key, path string) error

	// ListDirectory list the contents of a directory/bucket
	ListDirectory(bucket, keyPrefix string) ([]string, error)

	// IsDirectory tests if the key is acting like a s3 directory
	IsDirectory(bucket, key string) (bool, error)

	// BucketExists returns whether a bucket exists
	BucketExists(bucket string) (bool, error)

	// MakeBucket creates a bucket with name bucketName and options opts
	MakeBucket(bucketName string, opts minio.MakeBucketOptions) error
}

func NewS3Client

func NewS3Client(ctx context.Context, opts S3ClientOpts) (S3Client, error)

NewS3Client instantiates a new S3 client object backed

type S3ClientOpts

type S3ClientOpts struct {
	Endpoint        string
	Region          string
	Secure          bool
	AccessKey       string
	SecretKey       string
	Trace           bool
	RoleARN         string
	RoleSessionName string
	UseSDKCreds     bool
	EncryptOpts     EncryptOpts
}

Jump to

Keyboard shortcuts

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