s3

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package s3 handles interactions with aws-sdk-go/service/s3

Index

Constants

View Source
const (

	// ErrEmptyParameter is used when a required parameter is empty
	ErrEmptyParameter = "EmptyParameter"

	// ErrEmptyBody is used when an empty body has been found
	ErrEmptyBody = "EmptyBody"

	// ErrEmptyContentLength is used when no content length has been passed
	ErrEmptyContentLength = "EmptyContentLength"
)
View Source
const (

	// InputContentLength represents the parameter named inputContentLength
	InputContentLength = "inputContentLength"
	// Body represents the parameter named body
	Body = "body"
	// ContentType represents the parameter named contentType
	ContentType = "contentType"
	// FileName represents the parameter named fileName
	FileName = "fileName"
	// Image represents the parameter named image
	Image = "image"
	// Path represents the parameter named path
	Path = "path"
	// BucketName represents the parameter named bucketName
	BucketName = "bucketName"
	// Source represents the parameter named source
	Source = "source"
)

Variables

This section is empty.

Functions

func NewCreateBucketInput added in v1.0.1

func NewCreateBucketInput(bucketName string) (*s3.CreateBucketInput, error)

NewCreateBucketInput returns a new *s3.CreateBucketInput

func NewGetObjectInput

func NewGetObjectInput(bucketName, source string) (*s3.GetObjectInput, error)

NewGetObjectInput returns a new *s3.GetObjectInput given a bucket and a source image

func NewPutObjectInput added in v1.0.1

func NewPutObjectInput(bucketName, fileName, contentType string, image []byte, size int64) (*s3.PutObjectInput, error)

NewPutObjectInput returns a new *s3.PutObjectInput

func UnmarshalGetObjectOutput added in v1.0.1

func UnmarshalGetObjectOutput(input *s3.GetObjectOutput) ([]byte, error)

UnmarshalGetObjectOutput extracts bytes from *s3.GetObjectOutput

func UnmarshalIOReadCloser

func UnmarshalIOReadCloser(input io.ReadCloser) ([]byte, error)

UnmarshalIOReadCloser extracts []byte from input.Body

Types

type ReadImageOutput added in v1.0.1

type ReadImageOutput struct {
	// Body is the encoded body of the output
	Body []byte
	// ContentType is the content type of the output
	ContentType string
	// ContentSize is the body size
	ContentSize int64
}

ReadImageOutput embeds the result of opening an image and getting its metadata

func ReadImage added in v1.0.1

func ReadImage(path string) (*ReadImageOutput, error)

ReadImage reads an image given its path and returns a *ReadImageOutput containing its body and metadata

func (*ReadImageOutput) SetBody added in v1.0.1

func (img *ReadImageOutput) SetBody(body []byte) *ReadImageOutput

SetBody sets ReadImageOutput.Body to the passed body

func (*ReadImageOutput) SetContentSize added in v1.0.1

func (img *ReadImageOutput) SetContentSize(contentSize int64) *ReadImageOutput

SetContentSize sets ReadImageOutput.ContentSize to the passed contentSize

func (*ReadImageOutput) SetContentType added in v1.0.1

func (img *ReadImageOutput) SetContentType(contentType string) *ReadImageOutput

SetContentType sets ReadImageOutput.ContentType to the passed contentType

type S3

type S3 struct {
	*s3.S3
}

S3 embeds *s3.S3 to be used to call New

func New

func New(svc *pkgAws.Session, endpoint string) (*S3, error)

New returns a new *S3 embedding *s3.S3

func (*S3) S3CreateBucket added in v1.0.1

func (svc *S3) S3CreateBucket(bucketName string) error

S3CreateBucket creates a new bucket given a bucketName

func (*S3) S3GetObject

func (svc *S3) S3GetObject(bucketName, sourceImage string) ([]byte, error)

S3GetObject retrieves an object from S3 given a bucket name and a source image

func (*S3) S3PutObject added in v1.0.1

func (svc *S3) S3PutObject(bucketName, objectName, objectPath string) error

S3PutObject puts a given object on S3

Jump to

Keyboard shortcuts

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