Documentation
¶
Index ¶
- Variables
- type GoogleCSBackend
- func (b GoogleCSBackend) CopyObject(ctx context.Context, srcPath, dstPath string) *ae.AppError
- func (b GoogleCSBackend) DeleteObject(ctx context.Context, path string) *ae.AppError
- func (b GoogleCSBackend) GetObject(ctx context.Context, path string) (Object, *ae.AppError)
- func (b GoogleCSBackend) GetObjects(ctx context.Context, prefix string) ([]Object, *ae.AppError)
- func (b GoogleCSBackend) PutObject(ctx context.Context, path string, content []byte) *ae.AppError
- type IGCSClient
- type IS3Client
- type IS3Uploader
- type IStorageBackend
- type Metadata
- type Object
- type S3Backend
- func NewS3Backend(bucket string, prefix string, region string, disableSSL bool) (*S3Backend, *ae.AppError)
- func NewS3BackendWithCredentials(bucket string, prefix string, region string, disableSSL bool, ...) (*S3Backend, *ae.AppError)
- func NewS3BackendWithEndpoint(bucket string, prefix string, region string, endpoint string, disableSSL bool, ...) (*S3Backend, *ae.AppError)
- func (b *S3Backend) CopyObject(ctx context.Context, srcPath, dstPath string) *ae.AppError
- func (b *S3Backend) DeleteObject(ctx context.Context, path string) *ae.AppError
- func (b *S3Backend) GetObject(ctx context.Context, path string) (Object, *ae.AppError)
- func (b *S3Backend) GetObjects(ctx context.Context, prefix string) ([]Object, *ae.AppError)
- func (b *S3Backend) PutObject(ctx context.Context, path string, content []byte) *ae.AppError
Constants ¶
This section is empty.
Variables ¶
var ( GoogleCSBackendClient = ae.GetCustomErr("ERR_OS_GCS_1000", "failed to initialise the gcs client", false) GCSGetObjects = ae.GetCustomErr("ERR_OS_GCS_1001", "error while getting objects from gcs bucket", false) GCSGetObject = ae.GetCustomErr("ERR_OS_GCS_1002", "error while getting object from gcs bucket", false) GCSPutObject = ae.GetCustomErr("ERR_OS_GCS_1003", "error while putting object to gcs bucket", false) GCSDeleteObject = ae.GetCustomErr("ERR_OS_GCS_1004", "error while deleting object from gcs bucket", false) GCSCopyObject = ae.GetCustomErr("ERR_OS_GCS_1005", "error while copying object in gcs bucket", false) )
GCS (Google Cloud Storage) error definitions
var ( S3BackendClient = ae.GetCustomErr("ERR_OS_S3_2000", "failed to initialise the s3 client", false) S3GetObjects = ae.GetCustomErr("ERR_OS_S3_2001", "error while getting objects from s3 bucket", false) S3GetObject = ae.GetCustomErr("ERR_OS_S3_2002", "error while getting object from s3 bucket", false) S3PutObject = ae.GetCustomErr("ERR_OS_S3_2003", "error while putting object to s3 bucket", false) S3DeleteObject = ae.GetCustomErr("ERR_OS_S3_2004", "error while deleting object from s3 bucket", false) S3CopyObject = ae.GetCustomErr("ERR_OS_S3_2005", "error while copying object in s3 bucket", false) )
S3 (Amazon S3) error definitions
Functions ¶
This section is empty.
Types ¶
type GoogleCSBackend ¶
type GoogleCSBackend struct {
Prefix string
Client IGCSClient
}
GoogleCSBackend is a storage backend for Google Cloud Storage
func NewGoogleCSBackend ¶
func NewGoogleCSBackend(ctx context.Context, bucket string, prefix string) (*GoogleCSBackend, *ae.AppError)
NewGoogleCSBackend creates a new instance of GoogleCSBackend
func (GoogleCSBackend) CopyObject ¶
CopyObject copy an object from Google Cloud Storage bucket one path to another
func (GoogleCSBackend) DeleteObject ¶
DeleteObject removes an object from Google Cloud Storage bucket, at prefix
func (GoogleCSBackend) GetObject ¶
GetObject retrieves an object from Google Cloud Storage bucket, at prefix
func (GoogleCSBackend) GetObjects ¶
GetObjects lists all objects in Google Cloud Storage bucket, at prefix
type IGCSClient ¶
type IGCSClient interface {
Objects(ctx context.Context, q *storage.Query) *storage.ObjectIterator
Object(name string) *storage.ObjectHandle
}
IGCSClient this interface is added to make Client ins GCS BucketHandle mock compatible for tests
type IS3Client ¶
type IS3Client interface {
ListObjectsWithContext(ctx aws.Context, input *s3.ListObjectsInput, opts ...request.Option) (*s3.ListObjectsOutput, error)
GetObjectWithContext(ctx aws.Context, input *s3.GetObjectInput, opts ...request.Option) (*s3.GetObjectOutput, error)
DeleteObjectWithContext(ctx aws.Context, input *s3.DeleteObjectInput, opts ...request.Option) (*s3.DeleteObjectOutput, error)
CopyObjectWithContext(ctx aws.Context, input *s3.CopyObjectInput, opts ...request.Option) (*s3.CopyObjectOutput, error)
}
IS3Client interface for S3 client operations - allows mocking in tests
type IS3Uploader ¶
type IS3Uploader interface {
UploadWithContext(ctx aws.Context, input *s3manager.UploadInput, opts ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
}
IS3Uploader interface for S3 upload operations - allows mocking in tests
type IStorageBackend ¶
type IStorageBackend interface {
// GetObject retrieves a single object from the storage bucket
GetObject(ctx context.Context, path string) (Object, *ae.AppError)
// GetObjects lists all objects at the given prefix
GetObjects(ctx context.Context, prefix string) ([]Object, *ae.AppError)
// PutObject uploads an object to the storage bucket
PutObject(ctx context.Context, path string, content []byte) *ae.AppError
// DeleteObject removes an object from the storage bucket
DeleteObject(ctx context.Context, path string) *ae.AppError
// CopyObject copies an object from source path to destination path
CopyObject(ctx context.Context, srcPath, dstPath string) *ae.AppError
}
IStorageBackend defines the interface for storage backend implementations Both S3Backend and GoogleCSBackend implement this interface
type S3Backend ¶
type S3Backend struct {
Bucket string
Client IS3Client
Downloader *s3manager.Downloader
Prefix string
Uploader IS3Uploader
}
S3Backend implements IStorageBackend for Amazon S3
func NewS3Backend ¶
func NewS3Backend(bucket string, prefix string, region string, disableSSL bool) (*S3Backend, *ae.AppError)
NewS3Backend creates a new instance of S3Backend using default credentials
func NewS3BackendWithCredentials ¶
func NewS3BackendWithCredentials(bucket string, prefix string, region string, disableSSL bool, creds *credentials.Credentials) (*S3Backend, *ae.AppError)
NewS3BackendWithCredentials creates a new instance of S3Backend with explicit credentials
func NewS3BackendWithEndpoint ¶
func NewS3BackendWithEndpoint(bucket string, prefix string, region string, endpoint string, disableSSL bool, creds *credentials.Credentials) (*S3Backend, *ae.AppError)
NewS3BackendWithEndpoint creates a new instance of S3Backend with custom endpoint (for S3-compatible services like MinIO)
func (*S3Backend) CopyObject ¶
CopyObject copies an object within Amazon S3 bucket
func (*S3Backend) DeleteObject ¶
DeleteObject removes an object from Amazon S3 bucket
func (*S3Backend) GetObjects ¶
GetObjects lists all objects in Amazon S3 bucket at the given prefix