Documentation
¶
Overview ¶
Package storage provides a portable storage bucket API with cross-cutting concerns.
Index ¶
- type Bucket
- func (b *Bucket) AbortMultipartUpload(ctx context.Context, bucket, key, uploadID string) error
- func (b *Bucket) CompleteMultipartUpload(ctx context.Context, bucket, key, uploadID string, parts []driver.UploadPart) error
- func (b *Bucket) CopyObject(ctx context.Context, dstBucket, dstKey string, src driver.CopySource) error
- func (b *Bucket) CreateBucket(ctx context.Context, name string) error
- func (b *Bucket) CreateMultipartUpload(ctx context.Context, bucket, key, contentType string) (*driver.MultipartUpload, error)
- func (b *Bucket) DeleteBucket(ctx context.Context, name string) error
- func (b *Bucket) DeleteBucketPolicy(ctx context.Context, bucket string) error
- func (b *Bucket) DeleteBucketTagging(ctx context.Context, bucket string) error
- func (b *Bucket) DeleteCORSConfig(ctx context.Context, bucket string) error
- func (b *Bucket) DeleteObject(ctx context.Context, bucket, key string) error
- func (b *Bucket) DeleteObjectTagging(ctx context.Context, bucket, key string) error
- func (b *Bucket) EvaluateLifecycle(ctx context.Context, bucket string) ([]string, error)
- func (b *Bucket) GeneratePresignedURL(ctx context.Context, req driver.PresignedURLRequest) (*driver.PresignedURL, error)
- func (b *Bucket) GetBucketPolicy(ctx context.Context, bucket string) (*driver.BucketPolicy, error)
- func (b *Bucket) GetBucketTagging(ctx context.Context, bucket string) (map[string]string, error)
- func (b *Bucket) GetBucketVersioning(ctx context.Context, bucket string) (bool, error)
- func (b *Bucket) GetCORSConfig(ctx context.Context, bucket string) (*driver.CORSConfig, error)
- func (b *Bucket) GetEncryptionConfig(ctx context.Context, bucket string) (*driver.EncryptionConfig, error)
- func (b *Bucket) GetLifecycleConfig(ctx context.Context, bucket string) (*driver.LifecycleConfig, error)
- func (b *Bucket) GetObject(ctx context.Context, bucket, key string) (*driver.Object, error)
- func (b *Bucket) GetObjectTagging(ctx context.Context, bucket, key string) (map[string]string, error)
- func (b *Bucket) HeadObject(ctx context.Context, bucket, key string) (*driver.ObjectInfo, error)
- func (b *Bucket) ListBuckets(ctx context.Context) ([]driver.BucketInfo, error)
- func (b *Bucket) ListMultipartUploads(ctx context.Context, bucket string) ([]driver.MultipartUpload, error)
- func (b *Bucket) ListObjects(ctx context.Context, bucket string, opts driver.ListOptions) (*driver.ListResult, error)
- func (b *Bucket) PutBucketPolicy(ctx context.Context, bucket string, policy driver.BucketPolicy) error
- func (b *Bucket) PutBucketTagging(ctx context.Context, bucket string, tags map[string]string) error
- func (b *Bucket) PutCORSConfig(ctx context.Context, bucket string, cfg driver.CORSConfig) error
- func (b *Bucket) PutEncryptionConfig(ctx context.Context, bucket string, cfg driver.EncryptionConfig) error
- func (b *Bucket) PutLifecycleConfig(ctx context.Context, bucket string, config driver.LifecycleConfig) error
- func (b *Bucket) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, ...) error
- func (b *Bucket) PutObjectTagging(ctx context.Context, bucket, key string, tags map[string]string) error
- func (b *Bucket) SetBucketVersioning(ctx context.Context, bucket string, enabled bool) error
- func (b *Bucket) UploadPart(ctx context.Context, bucket, key, uploadID string, partNumber int, data []byte) (*driver.UploadPart, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is the portable storage type wrapping a driver with cross-cutting concerns.
func (*Bucket) AbortMultipartUpload ¶ added in v1.2.0
AbortMultipartUpload aborts a multipart upload and removes all uploaded parts.
func (*Bucket) CompleteMultipartUpload ¶ added in v1.2.0
func (b *Bucket) CompleteMultipartUpload( ctx context.Context, bucket, key, uploadID string, parts []driver.UploadPart, ) error
CompleteMultipartUpload completes a multipart upload by assembling all parts.
func (*Bucket) CopyObject ¶
func (b *Bucket) CopyObject(ctx context.Context, dstBucket, dstKey string, src driver.CopySource) error
CopyObject copies an object between buckets.
func (*Bucket) CreateBucket ¶
CreateBucket creates a new storage bucket.
func (*Bucket) CreateMultipartUpload ¶ added in v1.2.0
func (b *Bucket) CreateMultipartUpload( ctx context.Context, bucket, key, contentType string, ) (*driver.MultipartUpload, error)
CreateMultipartUpload initiates a multipart upload.
func (*Bucket) DeleteBucket ¶
DeleteBucket deletes a storage bucket.
func (*Bucket) DeleteBucketPolicy ¶ added in v1.3.1
DeleteBucketPolicy removes the bucket policy.
func (*Bucket) DeleteBucketTagging ¶ added in v1.4.0
DeleteBucketTagging removes all tags from a bucket.
func (*Bucket) DeleteCORSConfig ¶ added in v1.3.1
DeleteCORSConfig removes the CORS configuration for a bucket.
func (*Bucket) DeleteObject ¶
DeleteObject deletes an object from a bucket.
func (*Bucket) DeleteObjectTagging ¶ added in v1.4.0
DeleteObjectTagging removes all tags from an object.
func (*Bucket) EvaluateLifecycle ¶ added in v1.2.0
EvaluateLifecycle evaluates lifecycle rules and returns keys eligible for expiration.
func (*Bucket) GeneratePresignedURL ¶ added in v1.2.0
func (b *Bucket) GeneratePresignedURL(ctx context.Context, req driver.PresignedURLRequest) (*driver.PresignedURL, error)
GeneratePresignedURL generates a presigned URL for an object.
func (*Bucket) GetBucketPolicy ¶ added in v1.3.1
GetBucketPolicy returns the bucket policy.
func (*Bucket) GetBucketTagging ¶ added in v1.4.0
GetBucketTagging returns tags for a bucket.
func (*Bucket) GetBucketVersioning ¶ added in v1.2.0
GetBucketVersioning returns whether versioning is enabled on a bucket.
func (*Bucket) GetCORSConfig ¶ added in v1.3.1
GetCORSConfig returns the CORS configuration for a bucket.
func (*Bucket) GetEncryptionConfig ¶ added in v1.3.1
func (b *Bucket) GetEncryptionConfig(ctx context.Context, bucket string) (*driver.EncryptionConfig, error)
GetEncryptionConfig returns the default encryption for a bucket.
func (*Bucket) GetLifecycleConfig ¶ added in v1.2.0
func (b *Bucket) GetLifecycleConfig(ctx context.Context, bucket string) (*driver.LifecycleConfig, error)
GetLifecycleConfig retrieves the lifecycle configuration for a bucket.
func (*Bucket) GetObjectTagging ¶ added in v1.4.0
func (b *Bucket) GetObjectTagging(ctx context.Context, bucket, key string) (map[string]string, error)
GetObjectTagging returns tags for an object.
func (*Bucket) HeadObject ¶
HeadObject retrieves object metadata without the body.
func (*Bucket) ListBuckets ¶
ListBuckets lists all buckets.
func (*Bucket) ListMultipartUploads ¶ added in v1.2.0
func (b *Bucket) ListMultipartUploads(ctx context.Context, bucket string) ([]driver.MultipartUpload, error)
ListMultipartUploads lists active multipart uploads for a bucket.
func (*Bucket) ListObjects ¶
func (b *Bucket) ListObjects(ctx context.Context, bucket string, opts driver.ListOptions) (*driver.ListResult, error)
ListObjects lists objects in a bucket.
func (*Bucket) PutBucketPolicy ¶ added in v1.3.1
func (b *Bucket) PutBucketPolicy(ctx context.Context, bucket string, policy driver.BucketPolicy) error
PutBucketPolicy sets the bucket policy.
func (*Bucket) PutBucketTagging ¶ added in v1.4.0
PutBucketTagging sets tags on a bucket.
func (*Bucket) PutCORSConfig ¶ added in v1.3.1
PutCORSConfig sets the CORS configuration for a bucket.
func (*Bucket) PutEncryptionConfig ¶ added in v1.3.1
func (b *Bucket) PutEncryptionConfig(ctx context.Context, bucket string, cfg driver.EncryptionConfig) error
PutEncryptionConfig sets the default encryption for a bucket.
func (*Bucket) PutLifecycleConfig ¶ added in v1.2.0
func (b *Bucket) PutLifecycleConfig(ctx context.Context, bucket string, config driver.LifecycleConfig) error
PutLifecycleConfig sets a lifecycle configuration on a bucket.
func (*Bucket) PutObject ¶
func (b *Bucket) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, metadata map[string]string) error
PutObject stores an object in a bucket.
func (*Bucket) PutObjectTagging ¶ added in v1.4.0
func (b *Bucket) PutObjectTagging(ctx context.Context, bucket, key string, tags map[string]string) error
PutObjectTagging sets tags on an object.
func (*Bucket) SetBucketVersioning ¶ added in v1.2.0
SetBucketVersioning enables or disables versioning on a bucket.
type Option ¶
type Option func(*Bucket)
Option configures a portable Bucket.
func WithErrorInjection ¶
WithErrorInjection sets the error injector.
func WithMetrics ¶
WithMetrics sets the metrics collector.
func WithRateLimiter ¶
WithRateLimiter sets the rate limiter.