s3

package
v0.0.0-...-8462f15 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2014 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package s3 implements a generic Amazon S3 client, not specific to Camlistore.

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
}

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, after string, maxKeys int) (items []*Item, err error)

ListBucket returns 0 to maxKeys (inclusive) items from the provided bucket. The items will have keys greater than the provided after, which may be empty. (Note: this is not greater than or equal to, like the S3 API's 'marker' parameter). 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