57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
package filemanager
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
type PutObjectInput struct {
|
|
ObjectKey string
|
|
ContentType string
|
|
SizeBytes int64
|
|
Body io.Reader
|
|
Metadata map[string]string
|
|
}
|
|
|
|
type PresignPutObjectInput struct {
|
|
ObjectKey string
|
|
ContentType string
|
|
SizeBytes int64
|
|
Metadata map[string]string
|
|
TTL time.Duration
|
|
}
|
|
|
|
type PresignedPutObject struct {
|
|
Bucket string
|
|
ObjectKey string
|
|
Method string
|
|
URL string
|
|
Headers map[string]string
|
|
ExpiresAt time.Time
|
|
}
|
|
|
|
type ObjectMetadata struct {
|
|
Bucket string
|
|
ObjectKey string
|
|
ETag string
|
|
VersionID string
|
|
SizeBytes int64
|
|
LastModified *time.Time
|
|
ContentType string
|
|
}
|
|
|
|
type ObjectStorage interface {
|
|
EnsureBucket(ctx context.Context) error
|
|
PutObject(ctx context.Context, input PutObjectInput) (ObjectMetadata, error)
|
|
DeleteObject(ctx context.Context, objectKey string) error
|
|
HeadObject(ctx context.Context, objectKey string) (ObjectMetadata, error)
|
|
PresignPutObject(ctx context.Context, input PresignPutObjectInput) (PresignedPutObject, error)
|
|
PresignGetObject(ctx context.Context, objectKey string, ttl time.Duration) (string, error)
|
|
}
|
|
|
|
type ObjectTaggingStorage interface {
|
|
PutObjectTagging(ctx context.Context, objectKey string, tags map[string]string) error
|
|
DeleteObjectTaggingKeys(ctx context.Context, objectKey string, keys []string) error
|
|
}
|