Documentation
¶
Index ¶
- type Client
- func (c *Client) CopyFile(ctx context.Context, input *s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
- func (c *Client) DeleteFile(ctx context.Context, input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
- func (c *Client) DownloadBytes(ctx context.Context, input *s3.GetObjectInput) ([]byte, error)
- func (c *Client) DownloadFile(ctx context.Context, input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
- func (c *Client) FileExists(ctx context.Context, input *s3.HeadObjectInput) (bool, error)
- func (c *Client) GetObjectACL(ctx context.Context, input *s3.GetObjectAclInput) (*s3.GetObjectAclOutput, error)
- func (c *Client) GetPrivateURL(ctx context.Context, input *s3.GetObjectInput) (string, error)
- func (c *Client) ListBuckets(ctx context.Context) ([]types.Bucket, error)
- func (c *Client) ListFiles(ctx context.Context, input *s3.ListObjectsInput) (*s3.ListObjectsOutput, error)
- func (c *Client) PresignGetObject(ctx context.Context, input *s3.GetObjectInput, signingTime time.Time, ...) (*PresignedRequest, error)
- func (c *Client) PresignPostObject(ctx context.Context, input *s3.PutObjectInput, expires time.Duration, ...) (*PresignedPostForm, error)
- func (c *Client) PresignPutObject(ctx context.Context, input *s3.PutObjectInput, expires time.Duration) (*PresignedRequest, error)
- func (c *Client) SetObjectACL(ctx context.Context, input *s3.PutObjectAclInput) (*s3.PutObjectAclOutput, error)
- func (c *Client) UploadFile(ctx context.Context, input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
- type ClientOption
- type Config
- type PresignedPostForm
- type PresignedRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Region string
Bucket string
PublicURL string
// contains filtered or unexported fields
}
Client contains the DO configuration and methods
func NewMemoryClient ¶ added in v1.30.0
func NewMemoryClient(bucket string, opts ...ClientOption) *Client
NewMemoryClient returns a Client whose bucket lives in memory, for tests that must run with no AWS credentials and no network. It has the same type and methods as a Client from NewClient, and it reads no AWS environment or shared config. opts fill PublicURL as in NewClient; an endpoint option is ignored. Presigned URLs are well formed and signed with dummy credentials, but they point at a host on the reserved .invalid domain, so nothing answers them.
No input field is silently ignored: a field the store does not model on an operation fails with ez.ENOTIMPLEMENTED naming the field, and so does a value it does not model, such as a canned ACL other than private and public-read or a bucket other than its own. A cancelled context fails with the context's error. The rejections it does model, such as a missing key, fail with the error types and wrapping the SDK returns.
func (*Client) CopyFile ¶ added in v1.6.7
func (c *Client) CopyFile(ctx context.Context, input *s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
func (*Client) DeleteFile ¶
func (c *Client) DeleteFile(ctx context.Context, input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
func (*Client) DownloadBytes ¶ added in v1.7.1
func (*Client) DownloadFile ¶ added in v1.7.1
func (c *Client) DownloadFile(ctx context.Context, input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
func (*Client) FileExists ¶
func (*Client) GetObjectACL ¶ added in v1.30.0
func (c *Client) GetObjectACL(ctx context.Context, input *s3.GetObjectAclInput) (*s3.GetObjectAclOutput, error)
GetObjectACL returns the owner and the grants of one object, for instance to check what SetObjectACL or an upload's canned ACL left on it.
func (*Client) GetPrivateURL ¶
func (*Client) ListBuckets ¶
func (*Client) ListFiles ¶
func (c *Client) ListFiles(ctx context.Context, input *s3.ListObjectsInput) (*s3.ListObjectsOutput, error)
func (*Client) PresignGetObject ¶ added in v1.13.0
func (c *Client) PresignGetObject(ctx context.Context, input *s3.GetObjectInput, signingTime time.Time, expires time.Duration) (*PresignedRequest, error)
PresignGetObject presigns a GET for input.Key, signed as of signingTime and valid for expires from that instant. Two calls with the same input and signingTime return the same URL. With a non-zero signingTime, expires is required and signingTime plus expires must be in the future. A zero signingTime signs as of now. Headers holds the signed headers (e.g. Range) the caller must send with the request. The URL points at the bucket's origin host; a CDN in front of the bucket that forwards the query string serves it too.
func (*Client) PresignPostObject ¶ added in v1.7.0
func (c *Client) PresignPostObject(ctx context.Context, input *s3.PutObjectInput, expires time.Duration, conditions ...interface{}) (*PresignedPostForm, error)
func (*Client) PresignPutObject ¶ added in v1.7.0
func (c *Client) PresignPutObject(ctx context.Context, input *s3.PutObjectInput, expires time.Duration) (*PresignedRequest, error)
func (*Client) SetObjectACL ¶ added in v1.13.0
func (c *Client) SetObjectACL(ctx context.Context, input *s3.PutObjectAclInput) (*s3.PutObjectAclOutput, error)
SetObjectACL replaces the access control list of one object, for instance to make a public object private. The object's content and metadata are untouched.
func (*Client) UploadFile ¶
func (c *Client) UploadFile(ctx context.Context, input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
type ClientOption ¶ added in v1.7.2
type ClientOption func(*clientOptions)
ClientOption defines function type for client options.
func WithDigitalOceanCDN ¶ added in v1.7.2
func WithDigitalOceanCDN(bucket, region, url string) ClientOption
WithDigitalOceanCDN sets the S3 base endpoint for DigitalOcean Spaces
func WithDigitalOceanEndpoint ¶ added in v1.7.2
func WithDigitalOceanEndpoint(region, hostSuffix string) ClientOption
WithDigitalOceanEndpoint sets the S3 base endpoint for DigitalOcean Spaces
func WithPublicBaseURL ¶ added in v1.7.2
func WithPublicBaseURL(publicBaseURL string) ClientOption
WithPublicBaseURL overrides the public base URL stored in Client.URL. This is typically a CDN or custom domain (e.g. DO Spaces CDN, CloudFront).