Documentation
¶
Index ¶
- Constants
- func NewGlobalHelper(opts ...Option) error
- type Helper
- func (h *Helper) CreateBucket(opts s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
- func (h *Helper) DeleteObject(bucket, key string) error
- func (h *Helper) GenPresignedUrl(bucket, key string, expires time.Duration) (string, error)
- func (h *Helper) PutByteObject(bucket, key string, body []byte) (*s3.PutObjectOutput, error)
- func (h *Helper) PutObject(bucket, key string, reader io.Reader) (*s3.PutObjectOutput, error)
- func (h *Helper) SetS3Client() error
- type Option
- type Options
- type S3Client
- type S3PresignedClient
Constants ¶
View Source
const ( RegionAuto = "auto" S3DefaultAccessKey = "" S3DefaultSecretKey = "" )
Variables ¶
This section is empty.
Functions ¶
func NewGlobalHelper ¶
Types ¶
type Helper ¶
type Helper struct { AwsS3Client *s3.Client S3Client S3PresignedClient Options }
func GetGlobalHelper ¶
func GetGlobalHelper() *Helper
func (*Helper) CreateBucket ¶
func (h *Helper) CreateBucket(opts s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
func (*Helper) DeleteObject ¶
func (*Helper) GenPresignedUrl ¶
func (*Helper) PutByteObject ¶
func (*Helper) SetS3Client ¶
type Option ¶
type Option func(*Options)
func EnableCustomURL ¶
func EnableStaticCreds ¶
func InsecureSkipVerify ¶
type Options ¶
type Options struct { Region string `json:"region" yaml:"region"` S3Url string `json:"s3Url" yaml:"s3Url"` AccessKey string `json:"accessKey" yaml:"accessKey"` SecretKey string `json:"secretKey" yaml:"secretKey"` EnableCustomURL bool `json:"enableCustomURL" yaml:"enableCustomURL"` EnableStaticCreds bool `json:"enableStaticCreds" yaml:"enableStaticCreds"` InsecureSkipVerify bool `json:"insecureSkipVerify" yaml:"insecureSkipVerify"` }
var (
Opts *Options
)
type S3Client ¶
type S3Client interface { CreateBucket(context.Context, *s3.CreateBucketInput, ...func(*s3.Options)) (*s3.CreateBucketOutput, error) PutObject(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) (*s3.PutObjectOutput, error) DeleteObject(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) (*s3.DeleteObjectOutput, error) }
type S3PresignedClient ¶
type S3PresignedClient interface {
PresignGetObject(context.Context, *s3.GetObjectInput, ...func(*s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)
}
Click to show internal directories.
Click to hide internal directories.