s3

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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 NewClient

func NewClient(ctx context.Context, region, accessKey, secretKey, bucket string, opts ...ClientOption) (*Client, error)

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 (c *Client) DownloadBytes(ctx context.Context, input *s3.GetObjectInput) ([]byte, error)

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 (c *Client) FileExists(ctx context.Context, input *s3.HeadObjectInput) (bool, error)

func (*Client) GetPrivateURL

func (c *Client) GetPrivateURL(ctx context.Context, input *s3.GetObjectInput) (string, error)

func (*Client) ListBuckets

func (c *Client) ListBuckets(ctx context.Context) ([]types.Bucket, error)

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, input *s3.ListObjectsInput) (*s3.ListObjectsOutput, error)

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) 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).

type Config

type Config struct {
	URL         string
	Region      string
	AccessKeyID string
	Bucket      string
	FilePrefix  string
}

type PresignedPostForm added in v1.7.0

type PresignedPostForm struct {
	URL    string            `json:"url"`
	Fields map[string]string `json:"fields"`
}

type PresignedRequest added in v1.7.0

type PresignedRequest struct {
	URL     string      `json:"url"`
	Method  string      `json:"method"`
	Headers http.Header `json:"headers,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL