s3

package
v0.0.0-...-66cff79 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package s3 implements a generic Amazon S3 client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AccessKey       string
	SecretAccessKey string

	// Hostname is the S3 hostname to use.
	// If empty, the stanard US region of "s3.amazonaws.com" is
	// used.
	Hostname string
}

func (*Auth) SignRequest

func (a *Auth) SignRequest(req *http.Request)

type Bucket

type Bucket struct {
	Name         string
	CreationDate string // 2006-02-03T16:45:09.000Z
}

type Client

type Client struct {
	*Auth
	HTTPClient *http.Client // or nil for default client
	DefaultACL string
}

Client is an Amazon S3 client.

func (*Client) Buckets

func (c *Client) Buckets() ([]*Bucket, error)

func (*Client) Delete

func (c *Client) Delete(bucket, key string) error

func (*Client) Get

func (c *Client) Get(bucket, key string) (body io.ReadCloser, size int64, err error)

func (*Client) ListBucket

func (c *Client) ListBucket(bucket string, startAt string, maxKeys int) (items []*Item, err error)

ListBucket returns 0 to maxKeys (inclusive) items from the provided bucket. Keys before startAt will be skipped. (This is the S3 'marker' value). If the length of the returned items is equal to maxKeys, there is no indication whether or not the returned list is truncated.

func (*Client) PutObject

func (c *Client) PutObject(name, bucket string, md5 hash.Hash, size int64, body io.Reader) error

func (*Client) Stat

func (c *Client) Stat(name, bucket string) (size int64, reterr error)

Returns 0, os.ErrNotExist if not on S3, otherwise reterr is real.

type Item

type Item struct {
	Key  string
	Size int64
}

Jump to

Keyboard shortcuts

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