https://raw.githubusercontent.com/chineking/CloudBackup/master/CloudBackup/lib/s3.py
see:
http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html
http://docs.aws.amazon.com/zh_cn/AmazonS3/latest/dev/VirtualHosting.html
http://docs.aws.amazon.com/zh_cn/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-canned-policy.html
下面是例子, 上传图片,设置private的acl,gzip压缩!
type MyBucket struct {
*s3.Bucket
}
func initMyBucket(access_key, secret_key, bucket_name string) *MyBucket {
auth, err := aws.GetAuth(access_key, secret_key)
if err != nil {
Log4e("aws.GetAuth", err)
return nil
}
s := s3.New(auth, aws.USEast)
bucket := s.Bucket(bucket_name)
return &MyBucket{bucket}
}
func (b *MyBucket) Upload(path stri