Documentation
¶
Overview ¶
Package bs3test provides an in-memory fake of the S3 client subset provided by the bs3 package, for use in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeS3 ¶
type FakeS3 struct {
Objects map[string]StoredObject
// contains filtered or unexported fields
}
FakeS3 implements the PutObject/GetObject/Bucket subset of the S3 API with an in-memory map.
func (*FakeS3) GetObject ¶
func (f *FakeS3) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
GetObject returns the object stored under params.Key, failing with 404 Not Found when there is none.
func (*FakeS3) PutObject ¶
func (f *FakeS3) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
PutObject stores params.Body under params.Key. It fails with 412 Precondition Failed when params.IfNoneMatch is set and the key exists, or when params.IfMatch is set and does not match the stored ETag, and with 404 Not Found when params.IfMatch is set and the key does not exist.
type StoredObject ¶
type StoredObject struct {
Data []byte
ContentEncoding *string
// ETag is set by PutObject. An object placed in Objects directly without
// one has no ETag, so GetObject returns none and IfMatch never matches it.
ETag string
}
StoredObject is an object held by a FakeS3.