Documentation ¶
Index ¶
- Constants
- type ACL
- type Bucket
- func (b *Bucket) Del(path string) error
- func (b *Bucket) DelBucket() error
- func (b *Bucket) Get(path string) (data []byte, err error)
- func (b *Bucket) GetReader(path string) (rc io.ReadCloser, err error)
- func (b *Bucket) List(prefix, delim, marker string, max int) (result *ListResp, err error)
- func (b *Bucket) Put(path string, data []byte, contType string, perm ACL) error
- func (b *Bucket) PutBucket(perm ACL) error
- func (b *Bucket) PutReader(path string, r io.Reader, length int64, contType string, perm ACL) error
- func (b *Bucket) SignedURL(path string, expires time.Time) string
- func (b *Bucket) URL(path string) string
- type Error
- type Key
- type ListResp
- type Owner
- type S3
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
The Bucket type encapsulates operations with an S3 bucket.
func (*Bucket) Del ¶
Del removes an object from the S3 bucket.
See http://goo.gl/APeTt for more details.
func (*Bucket) DelBucket ¶
DelBucket removes an existing S3 bucket. All objects in the bucket must be removed before the bucket itself can be removed.
See http://goo.gl/GoBrY for more details.
func (*Bucket) Get ¶
Get retrieves an object from an S3 bucket.
See http://goo.gl/isCO7 for more details.
func (*Bucket) GetReader ¶
func (b *Bucket) GetReader(path string) (rc io.ReadCloser, err error)
GetReader retrieves an object from an S3 bucket. It is the caller's responsibility to call Close on rc when finished reading.
func (*Bucket) List ¶
List returns a information about objects in an S3 bucket.
The prefix parameter limits the response to keys that begin with the specified prefix. You can use prefixes to separate a bucket into different groupings of keys (e.g. to get a feeling of folders).
The delimited parameter causes the response to group all of the keys that share a common prefix up to the next delimiter to be grouped in a single entry within the CommonPrefixes field.
The marker parameter specifies the key to start with when listing objects in a bucket. Amazon S3 lists objects in alphabetical order and will return keys alphabetically greater than the marker.
The max parameter specifies how many keys + common prefixes to return in the response. The default is 1000.
For example, given these keys in a bucket:
index.html index2.html photos/2006/January/sample.jpg photos/2006/February/sample2.jpg photos/2006/February/sample3.jpg photos/2006/February/sample4.jpg
Listing this bucket with delimiter set to "/" would yield the following result:
&ListResp{ Name: "sample-bucket", MaxKeys: 1000, Delimiter: "/", Contents: []Key{ {Key: "index.html", "index2.html"}, }, CommonPrefixes: []string{ "photos/", }, }
Listing the same bucket with delimiter set to "/" and prefix set to "photos/2006/" would yield the following result:
&ListResp{ Name: "sample-bucket", MaxKeys: 1000, Delimiter: "/", Prefix: "photos/2006/", CommonPrefixes: []string{ "photos/2006/February/", "photos/2006/January/", }, }
See http://goo.gl/YjQTc for more details.
func (*Bucket) Put ¶
Put inserts an object into the S3 bucket.
See http://goo.gl/FEBPD for more details.
func (*Bucket) PutBucket ¶
PutBucket creates a new bucket.
See http://goo.gl/ndjnR for more details.
func (*Bucket) PutReader ¶
PutReader inserts an object into the S3 bucket by consuming data from r until EOF.
func (*Bucket) SignedURL ¶
SignedURL returns a signed URL that allows anyone holding the URL to retrieve the object at path. The signature is valid until expires.
type Error ¶
type Error struct { StatusCode int // HTTP status code (200, 403, ...) Code string // EC2 error code ("UnsupportedOperation", ...) Message string // The human-oriented error message BucketName string RequestId string HostId string }
Error represents an error in an operation with S3.
type Key ¶
type Key struct { Key string LastModified string Size int64 // ETag gives the hex-encoded MD5 sum of the contents, // surrounded with double-quotes. ETag string StorageClass string Owner Owner }
The Key type represents an item stored in an S3 bucket.
type ListResp ¶
type ListResp struct { Name string Prefix string Delimiter string Marker string MaxKeys int // IsTruncated is true if the results have been truncated because // there are more keys and prefixes than can fit in MaxKeys. // N.B. this is the opposite sense to that documented (incorrectly) in // http://goo.gl/YjQTc IsTruncated bool Contents []Key CommonPrefixes []string `xml:">Prefix"` }
The ListResp type holds the results of a List bucket operation.
type Owner ¶
The Owner type represents the owner of the object in an S3 bucket.
type S3 ¶
The S3 type encapsulates operations with an S3 region.