Ejemplo n.º 1
0
func doUpload() error {
	path := feeds.NewUUID().String()
	err := bucket.Put(path, bytes, filetype, s3.BucketOwnerRead)

	// NOTE : If you get this error message
	// Get : 301 response missing Location header

	// this is because you are using the wrong region for the bucket
	// and if you want to figure out the bucket location automatically
	// see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html
	// I've try it out with http.Get() and just getting the authenticating
	// requests part right is already too much
	// work for this tutorial.
	// See http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html

	// UPDATE 15th Jan 2015: See http://camlistore.org/pkg/misc/amazon/s3/#Client.BucketLocation
	if err != nil {
		fmt.Println(err)
	}
	return err
}
Ejemplo n.º 2
0
func GenerateKey() string {
	u := feeds.NewUUID()
	return fmt.Sprintf("%x%x%x%x%x", u[:4], u[4:6], u[6:8], u[8:10], u[10:])
}