Documentation ¶
Index ¶
- Constants
- func VhostName(b string, ep *http.URL) string
- type Bucket
- func (self *Bucket) Close() (err os.Error)
- func (self *Bucket) Delete(id *aws.Signer, key string) (err os.Error)
- func (self *Bucket) Exists(id *aws.Signer, key string) (err os.Error)
- func (self *Bucket) GetKey(id *aws.Signer, key string, w io.Writer) (hdr http.Header, err os.Error)
- func (self *Bucket) HeadKey(id *aws.Signer, key string) (resp *http.Response, err os.Error)
- func (self *Bucket) ListKeys(id *aws.Signer, prefix, delim, marker string, out chan<- string) (err os.Error)
- func (self *Bucket) PutFile(id *aws.Signer, key string, fp *os.File) (err os.Error)
- func (self *Bucket) PutKeyBytes(id *aws.Signer, key string, buff []byte, hdr http.Header) (err os.Error)
- func (self *Bucket) PutKeyReader(id *aws.Signer, key string, r io.Reader, l int64, hdr http.Header) (err os.Error)
- func (self *Bucket) PutLocalFile(id *aws.Signer, key, file string) (err os.Error)
- type Service
- func (self *Service) Bucket(name string) *Bucket
- func (self *Service) Close() (err os.Error)
- func (self *Service) CreateBucket(id *aws.Signer, name string) (err os.Error)
- func (self *Service) DeleteBucket(id *aws.Signer, name string) (err os.Error)
- func (self *Service) ListBuckets(id *aws.Signer) (out []string, err os.Error)
Constants ¶
const ( USWEST_HOST = "us-west-1.s3.amazonaws.com" USEAST_HOST = "s3.amazonaws.com" APSOUTHEAST_HOST = "ap-southeast-1.s3.amazonaws.com" EUWEST_HOST = "eu-west-1.s3.amazonaws.com" )
Do S3 endpoints actually play any role?
const (
DEFAULT_HASH = crypto.SHA1
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bucket ¶
Represents a URL and connection to an S3 bucket.
func NewBucket ¶
NewBucket creates a new *Bucket object from an endpoint URL.
URL is the _endpoint_ url (nil will default to https://s3.amazonaws.com/) Name should be the bucket name; If you pass this as an empty string, you will regret it. conn is OPTIONAL, but allows you to re-use another aws.Conn if you'd like.
If you omit conn, the dialer used will be based off the VHost of your bucket (if possible), to ensure best performance (e.g., endpoint associated w/ your bucket, and any regional lb's)
func (*Bucket) Delete ¶
Deletes the named key from the bucket. To delete a bucket, see *Service.DeleteBucket()
func (*Bucket) Exists ¶
Performs a HEAD request on the bucket and returns nil of the key appears valid (returns 200).
func (*Bucket) GetKey ¶
Opens the named key and copys it to the named io.Writer IFF the response.Status is 200. Also returns the http headers for convenience (regardless of status code, as long as a resp is generated).
func (*Bucket) HeadKey ¶
Performs a HEAD request on the bucket and returns the response object. The body is CLOSED, and it is an error to try and read from it.
func (*Bucket) ListKeys ¶
func (self *Bucket) ListKeys(id *aws.Signer, prefix, delim, marker string, out chan<- string) (err os.Error)
Walks a bucket and writes the resulting strings to the channel. * There is currently NO (correct) way to abort a running walk.
func (*Bucket) PutFile ¶
Will put an open file descriptor to the named key. Size is determined by statting the fd (so a partially read file will not work). TODO: ACL's & content-type/headers support
func (*Bucket) PutKeyBytes ¶
type Service ¶
func NewService ¶
Initilalize a new Service object with a specific S3 endpoint. If URL is omitted, it defaults to the us-east endpoint over HTTPS (https://s3.amazonaws.com/)
func (*Service) Bucket ¶
Returns a new *Bucket with the same URL data as the Service connection. You MUST have already created the bucket in order to make use of the Bucket object.
See CreateBucket to create a new bucket.
func (*Service) CreateBucket ¶
Creates a new bucket TODO: Will (probably) create the bucket in US-east no matter what underlying endpoint you've chosen.
func (*Service) DeleteBucket ¶
Deletes the named bucket from the S3 service.