hms_s3

package module
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCreateBucketInputWithACL

func GetCreateBucketInputWithACL(bucketName string, acl string) *s3.CreateBucketInput

Types

type ConnectionInfo

type ConnectionInfo struct {
	AccessKey string
	SecretKey string
	Endpoint  string
	Bucket    string
	Region    string
}

func LoadConnectionInfoFromEnvVars

func LoadConnectionInfoFromEnvVars() (info ConnectionInfo, err error)

func NewConnectionInfo

func NewConnectionInfo(AccessKey string, SecretKey string, Endpoint string, Bucket string,
	Region string) (c ConnectionInfo)

func (*ConnectionInfo) Equals

func (obj *ConnectionInfo) Equals(other ConnectionInfo) (equals bool)

func (*ConnectionInfo) Validate

func (obj *ConnectionInfo) Validate() error

type S3Client

type S3Client struct {
	Session  *session.Session
	Uploader *s3manager.Uploader
	S3       *s3.S3
	//Service service
	ConnInfo ConnectionInfo
}

func NewS3Client

func NewS3Client(info ConnectionInfo, httpClient *http.Client) (*S3Client, error)

NewS3Client only sets up the connection to S3, it *does not* test that connection. For that, call PingBucket().

func (*S3Client) CreateBucketWithACL

func (client *S3Client) CreateBucketWithACL(bucketName string, acl string) (*s3.CreateBucketOutput, error)

CreateBucketWithACL creates a new bucket in S3 with the provided ACL.

func (*S3Client) DeleteObject

func (client *S3Client) DeleteObject(key string) (*s3.DeleteObjectOutput, error)

func (*S3Client) DeleteObjectInput

func (client *S3Client) DeleteObjectInput(key string) *s3.DeleteObjectInput

Delete

func (*S3Client) GetObject

func (client *S3Client) GetObject(key string) (*s3.GetObjectOutput, error)

func (*S3Client) GetObjectInput

func (client *S3Client) GetObjectInput(key string) *s3.GetObjectInput

func (*S3Client) GetURL

func (client *S3Client) GetURL(key string, expire time.Duration) (string, error)

func (*S3Client) PingBucket

func (client *S3Client) PingBucket() error

PingBucket will test the connection to S3 a single time. If you're using this as a measure for whether S3 is responsive, call it in a loop looking for nil err returned.

func (*S3Client) PutFile

func (client *S3Client) PutFile(key string, file *os.File) (*s3.PutObjectOutput, error)

func (*S3Client) PutFileWithACL

func (client *S3Client) PutFileWithACL(key string, file *os.File, acl string) (*s3.PutObjectOutput, error)

func (*S3Client) PutObject

func (client *S3Client) PutObject(key string, payloadBytes []byte) (*s3.PutObjectOutput, error)

func (*S3Client) PutObjectInputBytes

func (client *S3Client) PutObjectInputBytes(key string, payloadBytes []byte) *s3.PutObjectInput

func (*S3Client) PutObjectInputFile

func (client *S3Client) PutObjectInputFile(key string, file *os.File) *s3.PutObjectInput

func (*S3Client) PutObjectInputFileACL

func (client *S3Client) PutObjectInputFileACL(key string, file *os.File, acl string) *s3.PutObjectInput

func (*S3Client) SetBucket

func (client *S3Client) SetBucket(newBucket string)

SetBucket updates the connection info to use the newly passed in bucket name.

func (*S3Client) UploadFileWithACL added in v1.10.0

func (client *S3Client) UploadFileWithACL(key string, file *os.File, acl string) (*s3manager.UploadOutput, error)

func (*S3Client) UploadInputACL added in v1.10.0

func (client *S3Client) UploadInputACL(key string, file *os.File, acl string) *s3manager.UploadInput

Jump to

Keyboard shortcuts

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