Ejemplo n.º 1
0
func TestS3(t *testing.T) {
	if emptyVars() {
		t.Skip("need AWS credentials in order to test")
	}

	k, v := "greetings.json", "Hello World"

	s, err := s3.New(access, secret, bucket, region, content, prefix)

	if err != nil {
		t.Fatal(err.Error())
	}

	err = s.Put(k, []byte(v))

	if err != nil {
		t.Fatal(err.Error())
	}

	b := s.Get(k)

	if v != string(b) {
		t.Errorf("expected %s; got %s", v, b)
	}

	s.Delete(k)

	c := s.Get(k)

	if len(c) > 1 {
		t.Errorf("expected empty return; got %s", c)
	}

	s.Flush()
}
Ejemplo n.º 2
0
// S3 uses Amazon AWS S3 for storage.
//
// Every key combined with the prefix (to support Flush) and a possible extension determined by content.
// The field content is the content type to use with all keys. For example: "application/json; charset=utf-8".
func S3(access, secret, bucket, region, content, prefix string) (Storage, error) {
	return s3.New(access, secret, bucket, region, content, prefix)
}