Documentation ¶
Overview ¶
Package s3 implements a generic Amazon S3 client, not specific to Camlistore.
Index ¶
- func IsValidBucket(bucket string) bool
- type Auth
- type Bucket
- type Client
- func (c *Client) BucketLocation(bucket string) (location string, err error)
- func (c *Client) Buckets() ([]*Bucket, error)
- func (c *Client) Delete(bucket, key string) error
- func (c *Client) Get(bucket, key string) (body io.ReadCloser, size int64, err error)
- func (c *Client) GetPartial(bucket, key string, offset, length int64) (rc io.ReadCloser, err error)
- func (c *Client) ListBucket(bucket string, startAt string, maxKeys int) (items []*Item, err error)
- func (c *Client) PutObject(key, bucket string, md5 hash.Hash, size int64, body io.Reader) error
- func (c *Client) Stat(key, bucket string) (size int64, reterr error)
- type Error
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidBucket ¶
IsValid reports whether bucket is a valid bucket name, per Amazon's naming restrictions.
See http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
Types ¶
type Auth ¶
type Auth struct { AccessKey string SecretAccessKey string // Hostname is the S3 hostname to use. // If empty, the standard US region of "s3.amazonaws.com" is // used. Hostname string }
func (*Auth) SignRequest ¶
type Client ¶
type Client struct { *Auth Transport http.RoundTripper // or nil for the default }
Client is an Amazon S3 client.
func (*Client) BucketLocation ¶
BucketLocation returns the S3 hostname to be used with the given bucket.
func (*Client) GetPartial ¶
GetPartial fetches part of the s3 key object in bucket. If length is negative, the rest of the object is returned. The caller must close rc.
func (*Client) ListBucket ¶
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.
type Error ¶
type Error struct { Op string Code int // HTTP status code Body []byte // response body Header http.Header // response headers // UsedEndpoint and AmazonCode are the XML response's Endpoint and // Code fields, respectively. UseEndpoint string // if a temporary redirect (wrong hostname) AmazonCode string }
Error is the type returned by some API operations.
TODO: it should be more/all of them.