Documentation ¶
Index ¶
- Constants
- func Encode(v url.Values) string
- type ACL
- type Bucket
- func (b *Bucket) AddExt(Path string, kvs map[string]string, perm ACL) error
- func (b *Bucket) ChangeMd5(Path string, contentType string, md5 []byte) error
- func (b *Bucket) Copy(oldPath, newPath string, perm ACL) error
- func (b *Bucket) Del(path string) error
- func (b *Bucket) DelBucket() (err error)
- func (b *Bucket) Get(path string) (data []byte, err error)
- func (b *Bucket) GetACL(path string) (*Key, error)
- func (b *Bucket) GetBucketContents() (*map[string]Key, error)
- func (b *Bucket) GetKey(path string) (*Key, error)
- func (b *Bucket) GetReader(path string) (rc io.ReadCloser, err error)
- func (b *Bucket) GetResponse(path string) (*http.Response, error)
- func (b *Bucket) GetTorrent(path string) ([]byte, error)
- func (b *Bucket) GetTorrentReader(path string) (io.ReadCloser, error)
- func (b *Bucket) Head(path string) (*http.Response, error)
- func (b *Bucket) InitMulti(key string, contType string, perm ACL) (*Multi, error)
- func (b *Bucket) List(prefix, delim, marker string, max int) (result *ListResp, err error)
- func (b *Bucket) ListMulti(prefix, delim string) (multis []*Multi, prefixes []string, err error)
- func (b *Bucket) Multi(key, contType string, perm ACL) (*Multi, error)
- func (b *Bucket) MultiDel(paths []string) error
- func (b *Bucket) Put(path string, data []byte, contType string, perm ACL) error
- func (b *Bucket) PutBucket(perm ACL) error
- func (b *Bucket) PutHeader(path string, data []byte, customHeaders map[string][]string, perm ACL) error
- func (b *Bucket) PutReader(path string, r io.Reader, length int64, contType string, perm ACL) error
- func (b *Bucket) PutReaderHeader(path string, r io.Reader, length int64, customHeaders map[string][]string, ...) error
- func (b *Bucket) SignedURL(path string, expires time.Time) string
- func (b *Bucket) URL(path string) string
- type Error
- type Key
- type ListBucketsResp
- type ListResp
- type Multi
- type MultiObjectDeleteBody
- type Object
- type Owner
- type Part
- type ReaderAtSeeker
- type S3
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bucket ¶
The Bucket type encapsulates operations with an S3 bucket.
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 details.
func (*Bucket) Get ¶
Get retrieves an object from an S3 bucket.
See http://goo.gl/isCO7 for details.
func (*Bucket) GetBucketContents ¶
Returns a mapping of all key names in this bucket to Key objects
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) GetResponse ¶
GetResponse retrieves an object from an S3 bucket returning the http response It is the caller's responsibility to call Close on rc when finished reading.
func (*Bucket) GetTorrent ¶
GetTorrent retrieves an Torrent object from an S3, returning the torrent as a []byte.
func (*Bucket) GetTorrentReader ¶
func (b *Bucket) GetTorrentReader(path string) (io.ReadCloser, error)
GetTorrent retrieves an Torrent object from an S3 bucket an io.ReadCloser. It is the caller's responsibility to call Close on rc when finished reading.
func (*Bucket) InitMulti ¶
InitMulti initializes a new multipart upload at the provided key inside b and returns a value for manipulating it.
See http://goo.gl/XP8kL for details.
func (*Bucket) List ¶
List returns information about objects in an S3 bucket.
The prefix parameter limits the response to keys that begin with the specified prefix.
The delim parameter causes the response to group all of the keys that share a common prefix up to the next delimiter in a single entry within the CommonPrefixes field. You can use delimiters to separate a bucket into different groupings of keys, similar to how folders would work.
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 details.
func (*Bucket) ListMulti ¶
ListMulti returns the list of unfinished multipart uploads in b.
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 (to get the feeling of folders, for example).
The delim parameter causes the response to group all of the keys that share a common prefix up to the next delimiter in a single entry within the CommonPrefixes field. You can use delimiters to separate a bucket into different groupings of keys, similar to how folders would work.
See http://goo.gl/ePioY for details.
func (*Bucket) Multi ¶
Multi returns a multipart upload handler for the provided key inside b. If a multipart upload exists for key, it is returned, otherwise a new multipart upload is initiated with contType and perm.
func (*Bucket) MultiDel ¶
MultiDel removes multiple objects from the S3 bucket efficiently. A maximum of 1000 keys at once may be specified.
See http://goo.gl/WvA5sj for details.
func (*Bucket) PutHeader ¶
func (b *Bucket) PutHeader(path string, data []byte, customHeaders map[string][]string, perm ACL) error
PutHeader - like Put, inserts an object into the S3 bucket. Instead of Content-Type string, pass in custom headers to override defaults.
func (*Bucket) PutReader ¶
PutReader inserts an object into the S3 bucket by consuming data from r until EOF.
func (*Bucket) PutReaderHeader ¶
func (b *Bucket) PutReaderHeader(path string, r io.Reader, length int64, customHeaders map[string][]string, perm ACL) error
PutReaderHeader - like PutReader, inserts an object into S3 from a reader. Instead of Content-Type string, pass in custom headers to override defaults.
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 ListBucketsResp ¶
type ListBucketsResp struct {
Buckets []Bucket `xml:">Bucket"`
}
The ListBucketsResp type holds the results of a List buckets operation.
type ListResp ¶
type ListResp struct { Name string Prefix string Delimiter string Marker string NextMarker 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 Multi ¶
Multi represents an unfinished multipart upload.
Multipart uploads allow sending big objects in smaller chunks. After all parts have been sent, the upload must be explicitly completed by calling Complete with the list of parts.
See http://goo.gl/vJfTG for an overview of multipart uploads.
func (*Multi) Abort ¶
Abort deletes an unifinished multipart upload and any previously uploaded parts for it.
After a multipart upload is aborted, no additional parts can be uploaded using it. However, if any part uploads are currently in progress, those part uploads might or might not succeed. As a result, it might be necessary to abort a given multipart upload multiple times in order to completely free all storage consumed by all parts.
NOTE: If the described scenario happens to you, please report back to the goamz authors with details. In the future such retrying should be handled internally, but it's not clear what happens precisely (Is an error returned? Is the issue completely undetectable?).
See http://goo.gl/dnyJw for details.
func (*Multi) Complete ¶
Complete assembles the given previously uploaded parts into the final object. This operation may take several minutes.
See http://goo.gl/2Z7Tw for details.
func (*Multi) ListParts ¶
ListParts returns the list of previously uploaded parts in m, ordered by part number.
See http://goo.gl/ePioY for details.
func (*Multi) PutAll ¶
func (m *Multi) PutAll(r ReaderAtSeeker, partSize int64) ([]Part, error)
PutAll sends all of r via a multipart upload with parts no larger than partSize bytes, which must be set to at least 5MB. Parts previously uploaded are either reused if their checksum and size match the new part, or otherwise overwritten with the new content. PutAll returns all the parts of m (reused or not).
func (*Multi) PutPart ¶
PutPart sends part n of the multipart upload, reading all the content from r. Each part, except for the last one, must be at least 5MB in size.
See http://goo.gl/pqZer for details.
type MultiObjectDeleteBody ¶
type ReaderAtSeeker ¶
type ReaderAtSeeker interface { io.ReaderAt io.ReadSeeker }
type S3 ¶
type S3 struct { aws.Auth aws.Region HTTPClient func() *http.Client // contains filtered or unexported fields }
The S3 type encapsulates operations with an S3 region.
func (*S3) ListBuckets ¶
func (s3 *S3) ListBuckets() (result *ListBucketsResp, err error)
ListBuckets lists all buckets
See: http://goo.gl/NqlyMN