initial import

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-01-26 02:11:14 +03:00
parent a83cc13bf4
commit d5e7969521
12 changed files with 796 additions and 0 deletions

73
options.go Normal file
View File

@@ -0,0 +1,73 @@
package s3
import (
"github.com/unistack-org/micro/v3/store"
)
type endpointKey struct{}
// Endpoint sets the endpoint option
func Endpoint(ep string) store.Option {
return store.SetOption(endpointKey{}, ep)
}
type regionKey struct{}
// Region sets the region option
func Region(reg string) store.Option {
return store.SetOption(regionKey{}, reg)
}
type accessKey struct{}
// AccessKey sets the AccessKey option
func AccessKey(akey string) store.Option {
return store.SetOption(accessKey{}, akey)
}
type secretKey struct{}
// SecretKey sets the SecretKey option
func SecretKey(skey string) store.Option {
return store.SetOption(secretKey{}, skey)
}
type bucketKey struct{}
// ReadBucket sets the bucket name option
func ReadBucket(bucket string) store.ReadOption {
return store.SetReadOption(bucketKey{}, bucket)
}
// WriteBucket sets the bucket name option
func WriteBucket(bucket string) store.WriteOption {
return store.SetWriteOption(bucketKey{}, bucket)
}
// DeleteBucket sets the bucket name option
func DeleteBucket(bucket string) store.DeleteOption {
return store.SetDeleteOption(bucketKey{}, bucket)
}
type contentTypeKey struct{}
func ContentType(ct string) store.WriteOption {
return store.SetWriteOption(contentTypeKey{}, ct)
}
// ListBucket sets the bucket name option
func ListBucket(bucket string) store.ListOption {
return store.SetListOption(bucketKey{}, bucket)
}
type listRecursiveKey struct{}
// ListRecursive sets the bucket name option
func ListRecursive(b bool) store.ListOption {
return store.SetListOption(listRecursiveKey{}, b)
}
// ExistsBucket sets the bucket name option
func ExistsBucket(bucket string) store.ExistsOption {
return store.SetExistsOption(bucketKey{}, bucket)
}