Documentation
¶
Overview ¶
Package driver defines the interface for storage service implementations.
Index ¶
- type Bucket
- type BucketInfo
- type BucketPolicy
- type CORSConfig
- type CORSRule
- type CopySource
- type EncryptionConfig
- type LifecycleConfig
- type LifecycleRule
- type ListOptions
- type ListResult
- type MultipartUpload
- type Object
- type ObjectInfo
- type PolicyStatement
- type PresignedURL
- type PresignedURLRequest
- type UploadPart
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface {
CreateBucket(ctx context.Context, name string) error
DeleteBucket(ctx context.Context, name string) error
ListBuckets(ctx context.Context) ([]BucketInfo, error)
PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, metadata map[string]string) error
GetObject(ctx context.Context, bucket, key string) (*Object, error)
DeleteObject(ctx context.Context, bucket, key string) error
HeadObject(ctx context.Context, bucket, key string) (*ObjectInfo, error)
ListObjects(ctx context.Context, bucket string, opts ListOptions) (*ListResult, error)
CopyObject(ctx context.Context, dstBucket, dstKey string, src CopySource) error
// Presigned URLs
GeneratePresignedURL(ctx context.Context, req PresignedURLRequest) (*PresignedURL, error)
// Lifecycle policies
PutLifecycleConfig(ctx context.Context, bucket string, config LifecycleConfig) error
GetLifecycleConfig(ctx context.Context, bucket string) (*LifecycleConfig, error)
EvaluateLifecycle(ctx context.Context, bucket string) ([]string, error)
// Multipart uploads
CreateMultipartUpload(ctx context.Context, bucket, key, contentType string) (*MultipartUpload, error)
UploadPart(ctx context.Context, bucket, key, uploadID string, partNumber int, data []byte) (*UploadPart, error)
CompleteMultipartUpload(ctx context.Context, bucket, key, uploadID string, parts []UploadPart) error
AbortMultipartUpload(ctx context.Context, bucket, key, uploadID string) error
ListMultipartUploads(ctx context.Context, bucket string) ([]MultipartUpload, error)
// Versioning
SetBucketVersioning(ctx context.Context, bucket string, enabled bool) error
GetBucketVersioning(ctx context.Context, bucket string) (bool, error)
// Bucket Policy
PutBucketPolicy(ctx context.Context, bucket string, policy BucketPolicy) error
GetBucketPolicy(ctx context.Context, bucket string) (*BucketPolicy, error)
DeleteBucketPolicy(ctx context.Context, bucket string) error
// CORS
PutCORSConfig(ctx context.Context, bucket string, config CORSConfig) error
GetCORSConfig(ctx context.Context, bucket string) (*CORSConfig, error)
DeleteCORSConfig(ctx context.Context, bucket string) error
// Encryption
PutEncryptionConfig(ctx context.Context, bucket string, config EncryptionConfig) error
GetEncryptionConfig(ctx context.Context, bucket string) (*EncryptionConfig, error)
}
Bucket is the interface that storage provider implementations must satisfy.
type BucketInfo ¶
BucketInfo describes a storage bucket.
type BucketPolicy ¶ added in v1.3.1
type BucketPolicy struct {
Version string
Statements []PolicyStatement
}
BucketPolicy represents a bucket access policy.
type CORSConfig ¶ added in v1.3.1
type CORSConfig struct {
Rules []CORSRule
}
CORSConfig is a set of CORS rules for a bucket.
type CORSRule ¶ added in v1.3.1
type CORSRule struct {
AllowedOrigins []string
AllowedMethods []string
AllowedHeaders []string
ExposeHeaders []string
MaxAgeSeconds int
}
CORSRule defines a CORS rule for a bucket.
type CopySource ¶
CopySource identifies the source for a copy operation.
type EncryptionConfig ¶ added in v1.3.1
type EncryptionConfig struct {
Enabled bool
Algorithm string // "AES256" or "aws:kms"
KeyID string // KMS key ID (optional)
}
EncryptionConfig describes the default encryption for a bucket.
type LifecycleConfig ¶ added in v1.2.0
type LifecycleConfig struct {
Rules []LifecycleRule
}
LifecycleConfig is a set of lifecycle rules for a bucket.
type LifecycleRule ¶ added in v1.2.0
type LifecycleRule struct {
ID string
Enabled bool
Prefix string
ExpirationDays int
TransitionDays int
TransitionStorageClass string
AbortMultipartDays int
NoncurrentExpirationDays int
}
LifecycleRule defines an object lifecycle policy rule.
type ListOptions ¶
ListOptions configures a list operation.
type ListResult ¶
type ListResult struct {
Objects []ObjectInfo
CommonPrefixes []string
NextPageToken string
IsTruncated bool
}
ListResult is the result of a list operation.
type MultipartUpload ¶ added in v1.2.0
MultipartUpload represents an in-progress multipart upload.
type ObjectInfo ¶
type ObjectInfo struct {
Key string
Size int64
ContentType string
ETag string
LastModified string
Metadata map[string]string
}
ObjectInfo describes a stored object.
type PolicyStatement ¶ added in v1.3.1
type PolicyStatement struct {
Effect string // "Allow" or "Deny"
Principal string // "*" or specific principal
Actions []string // e.g., "s3:GetObject"
Resources []string // e.g., "arn:aws:s3:::bucket/*"
}
PolicyStatement represents a single statement in a bucket policy.
type PresignedURL ¶ added in v1.2.0
PresignedURL is a generated presigned URL.
type PresignedURLRequest ¶ added in v1.2.0
type PresignedURLRequest struct {
Bucket string
Key string
Method string // "GET" or "PUT"
ExpiresIn time.Duration
}
PresignedURLRequest describes a presigned URL to generate.
type UploadPart ¶ added in v1.2.0
UploadPart represents a part of a multipart upload.