Documentation
¶
Index ¶
- type Bucket
- type Client
- func (c *Client) DownloadObject(ctx context.Context, bucket, key, destPath string) error
- func (c *Client) DownloadObjectWithProgress(ctx context.Context, bucket, key, destPath string, progress ProgressFunc) error
- func (c *Client) GetBucketRegion(ctx context.Context, bucket string) (string, error)
- func (c *Client) GetObjectDetails(ctx context.Context, bucket, key string) (*ObjectDetails, error)
- func (c *Client) GetObjectPreview(ctx context.Context, bucket, key string, maxBytes int64) ([]byte, string, error)
- func (c *Client) ListAllObjects(ctx context.Context, bucket, prefix string) ([]Object, error)
- func (c *Client) ListBuckets(ctx context.Context) ([]Bucket, error)
- func (c *Client) ListObjects(ctx context.Context, bucket, prefix string, token *string) ([]Object, *string, error)
- type Object
- type ObjectDetails
- type ProgressFunc
- type S3API
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the S3 API for bucket and object operations.
func (*Client) DownloadObject ¶
DownloadObject downloads an object to the specified destination path.
func (*Client) DownloadObjectWithProgress ¶ added in v0.1.3
func (c *Client) DownloadObjectWithProgress(ctx context.Context, bucket, key, destPath string, progress ProgressFunc) error
DownloadObjectWithProgress downloads an object with progress reporting.
func (*Client) GetBucketRegion ¶
GetBucketRegion returns the region for a bucket.
func (*Client) GetObjectDetails ¶
GetObjectDetails retrieves extended metadata for an object.
func (*Client) GetObjectPreview ¶
func (c *Client) GetObjectPreview(ctx context.Context, bucket, key string, maxBytes int64) ([]byte, string, error)
GetObjectPreview downloads up to maxBytes of an object and returns the content with its content type.
func (*Client) ListAllObjects ¶ added in v0.1.3
ListAllObjects lists all objects under a prefix recursively (no delimiter). This is used for downloading entire folders.
func (*Client) ListBuckets ¶
ListBuckets returns all S3 buckets.
type Object ¶
type Object struct {
Key string
Name string // display name (last path segment)
Size int64
LastModified time.Time
StorageClass string
IsPrefix bool // true for "folders"
}
Object represents an S3 object or prefix (folder).
type ObjectDetails ¶
ObjectDetails contains extended metadata for an S3 object.
type ProgressFunc ¶ added in v0.1.3
type ProgressFunc func(bytesWritten, totalBytes int64)
ProgressFunc is called during download with bytes written and total size.
type S3API ¶
type S3API interface {
ListBuckets(ctx context.Context, params *s3.ListBucketsInput, optFns ...func(*s3.Options)) (*s3.ListBucketsOutput, error)
ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
HeadObject(ctx context.Context, params *s3.HeadObjectInput, optFns ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
GetBucketLocation(ctx context.Context, params *s3.GetBucketLocationInput, optFns ...func(*s3.Options)) (*s3.GetBucketLocationOutput, error)
}
S3API captures the AWS SDK methods we use.