Documentation
¶
Overview ¶
Package s3 provides a client for Amazon S3 (and S3-compatible) object storage.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) DeleteFileByKey(ctx context.Context, private bool, key string) error
- func (c *Client) GetFileByKey(ctx context.Context, private bool, key string) (io.ReadCloser, error)
- func (c *Client) GetGetFileLink(ctx context.Context, private bool, key string) (string, error)
- func (c *Client) GetNewFileUploadLink(ctx context.Context, private, withPrefix bool, ...) (string, string, error)
- func (c *Client) GetUpdateFileUploadLink(ctx context.Context, private bool, key string) (string, error)
- func (c *Client) Init(ctx context.Context) error
- type Config
Constants ¶
View Source
const ( ErrCodeS3PresignPutObject = "S3-001" ErrCodeS3DeleteObject = "S3-002" ErrCodeS3GetObject = "S3-003" ErrCodeS3UrlBuildFailed = "S3-004" )
Variables ¶
View Source
var ( ErrS3PresignPutObject = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeS3PresignPutObject, "presign put object").C(ctx).Wrap(cause).Err() } ErrS3DeleteObject = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeS3DeleteObject, "delete object").C(ctx).Wrap(cause).Err() } ErrS3GetObject = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeS3GetObject, "get object").C(ctx).Wrap(cause).Err() } ErrS3UrlBuildFailed = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeS3UrlBuildFailed, "url build failed").C(ctx).Wrap(cause).Err() } )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DeleteFileByKey ¶
func (*Client) GetFileByKey ¶
func (*Client) GetGetFileLink ¶
func (*Client) GetNewFileUploadLink ¶
func (*Client) GetUpdateFileUploadLink ¶
type Config ¶
type Config struct {
PublicBucketName string `mapstructure:"public_bucket_name"`
PublicBucketUploadQueueName string `mapstructure:"public_bucket_upload_queue_name"`
PrivateBucketName string `mapstructure:"private_bucket_name"`
PrivateBucketUploadQueue string `mapstructure:"private_bucket_upload_queue_name"`
PresignedLinkTTL int64 `mapstructure:"presigned_link_ttl"`
}
Click to show internal directories.
Click to hide internal directories.