Skip to content

Instantly share code, notes, and snippets.

@korya
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korya/cff0c33464fde08f6b42 to your computer and use it in GitHub Desktop.
Save korya/cff0c33464fde08f6b42 to your computer and use it in GitHub Desktop.
goamz + fakes3 example
package main
import (
"fmt"
"github.com/crowdmob/goamz/aws"
"github.com/crowdmob/goamz/s3"
)
var (
fakes3host = "localhost"
fakes3port = "4567"
bucketname = "testbucket"
)
func main() {
auth := aws.Auth{
AccessKey: "abc",
SecretKey: "123",
}
fakeRegion := aws.Region{
Name: "fakes3",
S3Endpoint: fmt.Sprintf("http://%s:%s", fakes3host, fakes3port),
}
s := s3.New(auth, fakeRegion)
bucket := s.Bucket(bucketname)
err := bucket.PutBucket(s3.BucketOwnerFull)
if err != nil {
panic(err.Error())
}
_, err = bucket.List("", "/", "", 20)
if err != nil {
panic(err.Error())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment