s3

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Service s3iface.S3API
	Bucket  string
}

Client struct contains the initialized S3 service and other S3-related parameters

func NewSession

func NewSession(key, secret, region, bucket string) Client

NewSession creates an AWS session for S3 and returns an S3Client

func (Client) GetObject

func (s Client) GetObject(key string) ([]byte, error)

GetObject returns an object from S3

func (Client) GetVersions

func (s Client) GetVersions(prefix string) ([]string, error)

GetVersions returns a list of all versions under a given prefix in S3 This assumes a specific format when organizing the objects in the S3 bucket, e.g.

s3://bucket/prefix/1.0/file.json

func (Client) ListObjects

func (s Client) ListObjects(prefix, delimiter string) (*s3.ListObjectsOutput, error)

ListObjects returns a list of objects from S3

func (Client) Load

func (s Client) Load(i interface{}, path string) error

Load loads the json object from S3 (path) into the given interface

func (Client) PutObject

func (s Client) PutObject(key, contentType string, object []byte) error

PutObject takes a byte array and saves it in S3 with the given key name

func (Client) Save

func (s Client) Save(i interface{}, path string) error

Save saves an object to S3 (path) as JSON

Jump to

Keyboard shortcuts

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