s3

package
v0.0.0-...-62f8b51 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

s3 handles storing documents in AWS S3 buckets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type S3

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

S3 represents the data needed to communicate with AWS S3 service.

func New

func New(access, secret, bucket, region, content, prefix string) (S3, error)

New creates a connection to an AWS S3 service bucket.

The parameters access, secret, bucket, and region are issued from AWS.

The parameter content should be a recognized Content-Type to help download applications correctly associate the file contents. AWS allows this to be blank.

The parameter prefix is required so that Flush is a simpler process. Deleting and recreating the bucket is not supported.

func (S3) Delete

func (store S3) Delete(key string)

Delete removes a file by key.

func (S3) Flush

func (store S3) Flush()

Flush removes the prefix folder from S3, effectively removing all files/keys.

func (S3) Get

func (store S3) Get(key string) []byte

Get attempts to access the contents of a file by key.

func (S3) Put

func (store S3) Put(key string, data []byte) error

Put overwrites or creates as needed a new file based on the key.

Jump to

Keyboard shortcuts

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