s3

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACLAuthenticatedRead = "authenticated-read"
	ACLPrivate           = "private"
	ACLPublicRead        = "public-read"
	ACLPublicReadWrite   = "public-read-write"
)

ACL settings

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	// contains filtered or unexported fields
}

Bucket is S3 Bucket wrapper struct.

func NewBucket added in v1.0.0

func NewBucket(svc *S3, name string) *Bucket

NewBucket returns initialized *Bucket.

func (*Bucket) AddObject

func (b *Bucket) AddObject(obj *PutObject, path string)

AddObject adds object to write spool (w/ public read access).

func (*Bucket) AddSecretObject

func (b *Bucket) AddSecretObject(obj *PutObject, path string)

AddSecretObject adds object to write spool (w/ ACL permission).

func (*Bucket) DeleteObject

func (b *Bucket) DeleteObject(path string) error

DeleteObject deletes the object of target path.

func (*Bucket) GetObjectByte

func (b *Bucket) GetObjectByte(path string) ([]byte, error)

GetObjectByte returns bytes of object from given S3 path.

func (*Bucket) GetSecretURL

func (b *Bucket) GetSecretURL(path string) (string, error)

GetSecretURL fetches a url of target S3 object w/ ACL permission.

func (*Bucket) GetSecretURLWithExpire

func (b *Bucket) GetSecretURLWithExpire(path string, expire int) (string, error)

GetSecretURLWithExpire fetches a url of target S3 object w/ ACL permission (url expires in `expire` value seconds) ** this isn't work **

func (*Bucket) GetURL

func (b *Bucket) GetURL(path string) string

GetURL fetches url of target S3 object.

func (*Bucket) HeadObject added in v1.4.2

func (b *Bucket) HeadObject(path string) (*SDK.HeadObjectOutput, error)

HeadObject executes HeadObject operation.

func (*Bucket) IsExists added in v1.4.2

func (b *Bucket) IsExists(path string) bool

IsExists checks if an object exists on the given path.

func (*Bucket) PutAll added in v1.0.0

func (b *Bucket) PutAll() error

PutAll executes PutObject operation in the put spool.

func (*Bucket) PutOne added in v1.0.0

func (b *Bucket) PutOne(obj *PutObject, path, acl string) error

PutOne executes PutObject operation in the put spool.

func (*Bucket) SetExpire added in v1.0.0

func (b *Bucket) SetExpire(sec int)

SetExpire sets default expire sec for ACL access.

type PutObject added in v1.0.0

type PutObject struct {
	// contains filtered or unexported fields
}

PutObject is wrapper struct for the object to upload S3.

func NewPutObject added in v1.0.0

func NewPutObject(file *os.File) *PutObject

NewPutObject returns initialized *PutObject from File.

func NewPutObjectCopy added in v1.0.0

func NewPutObjectCopy(file *os.File) *PutObject

NewPutObjectCopy returns initialized *PutObject from File and copy byte data.

func NewPutObjectString added in v1.0.0

func NewPutObjectString(s string) *PutObject

NewPutObjectString returns initialized *PutObject from string.

func (*PutObject) Content added in v1.0.0

func (o *PutObject) Content() io.ReadSeeker

Content returns the content of the Object.

func (*PutObject) FileType added in v1.0.0

func (o *PutObject) FileType() string

FileType returns file type of the content.

func (*PutObject) SetTypeAsText added in v1.0.0

func (o *PutObject) SetTypeAsText()

SetTypeAsText sets MIME type as text file.

func (*PutObject) Size added in v1.0.0

func (o *PutObject) Size() int64

Size returns size of the content.

func (*PutObject) String added in v1.0.0

func (o *PutObject) String() string

type S3 added in v1.0.0

type S3 struct {
	// contains filtered or unexported fields
}

S3 has S3 client and bucket list.

func New added in v1.0.0

func New(conf config.Config) (*S3, error)

New returns initialized *S4.

func (*S3) CreateBucket added in v1.0.0

func (svc *S3) CreateBucket(in *SDK.CreateBucketInput) error

CreateBucket creates new S3 bucket.

func (*S3) CreateBucketWithName added in v1.0.0

func (svc *S3) CreateBucketWithName(name string) error

CreateBucketWithName creates new S3 bucket by given name.

func (*S3) Errorf added in v1.0.0

func (svc *S3) Errorf(format string, v ...interface{})

Errorf logging error information.

func (*S3) ForceDeleteBucket added in v1.0.0

func (svc *S3) ForceDeleteBucket(name string) error

ForceDeleteBucket deletes S3 bucket by given name.

func (*S3) GetBucket added in v1.0.0

func (svc *S3) GetBucket(bucket string) (*Bucket, error)

GetBucket gets S3 bucket.

func (*S3) Infof added in v1.0.0

func (svc *S3) Infof(format string, v ...interface{})

Infof logging information.

func (*S3) IsExistBucket added in v1.0.0

func (svc *S3) IsExistBucket(name string) (bool, error)

IsExistBucket checks if the Bucket already exists or not.

func (*S3) SetLogger added in v1.0.0

func (svc *S3) SetLogger(logger log.Logger)

SetLogger sets logger.

Jump to

Keyboard shortcuts

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