Documentation
¶
Overview ¶
Package object object/copy.go
Package object object/delete.go
Package object object/errors.go
Package object object/fputget.go
Package object object/get.go
Package object object/list.go
Package object object/multipart.go
Package object object/object.go
Package object object/options.go
Package object object/presign.go
Package object object/put.go
Package object object/service.go
Package object object/stat.go
Package object object/tagging.go
Package object object/utils.go
Index ¶
- Variables
- func WithVersionID(versionID string) interface{}
- type CommonPrefix
- type CopyOption
- type CopyOptions
- type DeleteOption
- type DeleteOptions
- type GetOption
- type GetOptions
- type ListBucketV2Result
- type ListOption
- type ListOptions
- type PresignOption
- type PresignOptions
- type PutOption
- func WithContentDisposition(disposition string) PutOption
- func WithContentEncoding(encoding string) PutOption
- func WithContentType(contentType string) PutOption
- func WithPartSize(size uint64) PutOption
- func WithSSECustomer(keyB64, keyMD5 string) PutOption
- func WithSSES3() PutOption
- func WithStorageClass(class string) PutOption
- func WithUserMetadata(metadata map[string]string) PutOption
- func WithUserTags(tags map[string]string) PutOption
- type PutOptions
- type Service
- type StatOption
- type StatOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBucketName invalid bucket name ErrInvalidBucketName = errors.New("invalid bucket name") // ErrInvalidObjectName invalid object name ErrInvalidObjectName = errors.New("invalid object name") // ErrObjectNotFound object not found ErrObjectNotFound = errors.New("object not found") // ErrListStopped list operation stopped via stop channel ErrListStopped = errors.New("list stopped by stop channel") // ErrNotImplemented feature not implemented ErrNotImplemented = errors.New("not implemented yet") )
Functions ¶
func WithVersionID ¶
func WithVersionID(versionID string) interface{}
WithVersionID selects a specific object version (Get/Stat/Delete)
Types ¶
type CommonPrefix ¶
type CommonPrefix struct {
Prefix string `xml:"Prefix"`
}
CommonPrefix represents common prefix entry
type CopyOption ¶
type CopyOption func(*CopyOptions)
CopyOption applies copy option
func WithCopyMetadata ¶
func WithCopyMetadata(metadata map[string]string, replace bool) CopyOption
WithCopyMetadata sets destination metadata for copy
func WithCopySourceVersionID ¶
func WithCopySourceVersionID(versionID string) CopyOption
WithCopySourceVersionID sets the source version ID for a copy
type CopyOptions ¶
type CopyOptions struct {
// Source version ID
SourceVersionID string
// Destination metadata and tags
UserMetadata map[string]string
UserTags map[string]string
// Replace metadata and/or tagging instead of copying existing
ReplaceMetadata bool
ReplaceTagging bool
// Object header overrides
ContentType string
ContentEncoding string
ContentDisposition string
CacheControl string
Expires time.Time
// Storage class
StorageClass string
// Conditional copy headers
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
// Custom headers
CustomHeaders http.Header
}
CopyOptions controls server-side copy behavior
type DeleteOptions ¶
type DeleteOptions struct {
// Version ID
VersionID string
// Force delete when possible
ForceDelete bool
// Custom headers
CustomHeaders http.Header
}
DeleteOptions controls object deletion
type GetOption ¶
type GetOption func(*GetOptions)
GetOption applies download option
func WithGetRange ¶
WithGetRange sets byte range for downloads
func WithGetSSECustomer ¶ added in v1.0.3
WithGetSSECustomer sets SSE-C parameters for downloads (key must be base64 encoded)
type GetOptions ¶
type GetOptions struct {
// Range header
RangeStart int64
RangeEnd int64
SetRange bool
// Version ID
VersionID string
// Conditional headers
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
// Custom headers
CustomHeaders http.Header
// SSE-C headers for encrypted objects
SSECustomerAlgorithm string
SSECustomerKey string
SSECustomerKeyMD5 string
}
GetOptions controls object download behavior
type ListBucketV2Result ¶
type ListBucketV2Result struct {
XMLName xml.Name `xml:"ListBucketResult"`
Name string `xml:"Name"`
Prefix string `xml:"Prefix"`
KeyCount int `xml:"KeyCount"`
MaxKeys int `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter"`
IsTruncated bool `xml:"IsTruncated"`
Contents []types.ObjectInfo `xml:"Contents"`
CommonPrefixes []CommonPrefix `xml:"CommonPrefixes"`
ContinuationToken string `xml:"ContinuationToken"`
NextContinuationToken string `xml:"NextContinuationToken"`
StartAfter string `xml:"StartAfter"`
}
ListBucketV2Result represents bucket listing V2 response
type ListOption ¶
type ListOption func(*ListOptions)
ListOption applies list option
func WithListMaxKeys ¶
func WithListMaxKeys(maxKeys int) ListOption
WithListMaxKeys sets the maximum keys to return
func WithListMetadata ¶ added in v1.0.4
func WithListMetadata(include bool) ListOption
WithListMetadata includes object metadata in list results when supported
func WithListPrefix ¶
func WithListPrefix(prefix string) ListOption
WithListPrefix sets listing prefix
func WithListRecursive ¶
func WithListRecursive(recursive bool) ListOption
WithListRecursive toggles recursive listing
func WithListStopChan ¶ added in v1.0.4
func WithListStopChan(ch <-chan struct{}) ListOption
WithListStopChan sets a channel to stop listing early
func WithListVersions ¶ added in v1.0.4
func WithListVersions() ListOption
WithListVersions lists object versions instead of current objects
type ListOptions ¶
type ListOptions struct {
// Prefix filter
Prefix string
// Recursive listing
Recursive bool
// StopChan is an optional signal channel to stop listing early
StopChan <-chan struct{}
// Max keys
MaxKeys int
// Start token
StartAfter string
// Use ListObjectsV2
UseV2 bool
// Include object versions
WithVersions bool
// Include object metadata
WithMetadata bool
// Custom headers
CustomHeaders http.Header
}
ListOptions controls object listing
type PresignOption ¶ added in v1.0.3
type PresignOption func(*PresignOptions)
PresignOption applies presign options
func WithPresignHeaders ¶ added in v1.0.3
func WithPresignHeaders(headers http.Header) PresignOption
WithPresignHeaders adds headers that must be signed for the presigned URL
func WithPresignQuery ¶ added in v1.0.3
func WithPresignQuery(values url.Values) PresignOption
WithPresignQuery adds additional query parameters (e.g., response-content-type)
func WithPresignSSECustomer ¶ added in v1.0.3
func WithPresignSSECustomer(keyB64, keyMD5 string) PresignOption
WithPresignSSECustomer signs SSE-C headers for presigned requests (key must be base64 encoded)
func WithPresignSSES3 ¶ added in v1.0.3
func WithPresignSSES3() PresignOption
WithPresignSSES3 signs SSE-S3 header for presigned requests
type PresignOptions ¶ added in v1.0.3
PresignOptions controls presigned URL generation
type PutOption ¶
type PutOption func(*PutOptions)
PutOption applies upload option
func WithContentDisposition ¶
WithContentDisposition sets Content-Disposition
func WithContentEncoding ¶
WithContentEncoding sets Content-Encoding
func WithContentType ¶
WithContentType sets Content-Type
func WithSSECustomer ¶ added in v1.0.3
WithSSECustomer provides SSE-C parameters for uploads (key must be base64 encoded)
func WithSSES3 ¶ added in v1.0.3
func WithSSES3() PutOption
WithSSES3 enables SSE-S3 server-side encryption for uploads
func WithStorageClass ¶
WithStorageClass sets storage class
func WithUserMetadata ¶
WithUserMetadata sets user metadata
func WithUserTags ¶
WithUserTags sets object tags
type PutOptions ¶
type PutOptions struct {
// Content-Type
ContentType string
// Content-Encoding
ContentEncoding string
// Content-Disposition
ContentDisposition string
// Content-Language
ContentLanguage string
// Cache-Control
CacheControl string
// Expiration time
Expires time.Time
// User metadata
UserMetadata map[string]string
// User tags
UserTags map[string]string
// Storage class
StorageClass string
// Custom headers
CustomHeaders http.Header
// Whether to send Content-MD5
SendContentMD5 bool
// Disable Content-SHA256
DisableContentSHA256 bool
// SSE-S3 / SSE-C options
SSECustomerAlgorithm string
SSECustomerKey string
SSECustomerKeyMD5 string
// Multipart part size
PartSize uint64
// Number of concurrent uploads
NumThreads uint
// contains filtered or unexported fields
}
PutOptions controls object upload behavior
type Service ¶
type Service interface {
// Put uploads an object
Put(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts ...PutOption) (types.UploadInfo, error)
// Get downloads an object
Get(ctx context.Context, bucketName, objectName string, opts ...GetOption) (io.ReadCloser, types.ObjectInfo, error)
// FPut uploads a file from a local path
FPut(ctx context.Context, bucketName, objectName, filePath string, opts ...PutOption) (types.UploadInfo, error)
// FGet downloads an object to a local file path
FGet(ctx context.Context, bucketName, objectName, filePath string, opts ...GetOption) (types.ObjectInfo, error)
// Stat retrieves object info
Stat(ctx context.Context, bucketName, objectName string, opts ...StatOption) (types.ObjectInfo, error)
// Delete removes an object
Delete(ctx context.Context, bucketName, objectName string, opts ...DeleteOption) error
// List lists objects
List(ctx context.Context, bucketName string, opts ...ListOption) <-chan types.ObjectInfo
// ListVersions lists object versions and delete markers
ListVersions(ctx context.Context, bucketName string, opts ...ListOption) <-chan types.ObjectInfo
// Copy copies an object
Copy(ctx context.Context, destBucket, destObject, srcBucket, srcObject string, opts ...CopyOption) (types.CopyInfo, error)
// PresignGet creates a presigned GET URL with optional signed headers
PresignGet(ctx context.Context, bucketName, objectName string, expires time.Duration, reqParams url.Values, opts ...PresignOption) (*url.URL, http.Header, error)
// PresignPut creates a presigned PUT URL with optional signed headers
PresignPut(ctx context.Context, bucketName, objectName string, expires time.Duration, reqParams url.Values, opts ...PresignOption) (*url.URL, http.Header, error)
// SetTagging sets object tags
SetTagging(ctx context.Context, bucketName, objectName string, tags map[string]string) error
// GetTagging retrieves object tags
GetTagging(ctx context.Context, bucketName, objectName string) (map[string]string, error)
// DeleteTagging deletes object tags
DeleteTagging(ctx context.Context, bucketName, objectName string) error
}
Service Object service interface
func NewService ¶
func NewService(executor *core.Executor, locationCache *cache.LocationCache) Service
NewService creates a new Object service
type StatOptions ¶
type StatOptions struct {
// Version ID
VersionID string
// Custom headers
CustomHeaders http.Header
}
StatOptions controls stat/metadata retrieval