gcs

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package gcs provides an in-memory mock implementation of Google Cloud Storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	// contains filtered or unexported fields
}

Mock is an in-memory mock implementation of Google Cloud Storage.

func New

func New(opts *config.Options) *Mock

New creates a new GCS mock.

func (*Mock) AbortMultipartUpload added in v1.2.0

func (m *Mock) AbortMultipartUpload(_ context.Context, bucket, _, uploadID string) error

func (*Mock) CompleteMultipartUpload added in v1.2.0

func (m *Mock) CompleteMultipartUpload(
	ctx context.Context, bucket, key, uploadID string, parts []driver.UploadPart,
) error

func (*Mock) CopyObject

func (m *Mock) CopyObject(ctx context.Context, dstBucket, dstKey string, src driver.CopySource) error

func (*Mock) CreateBucket

func (m *Mock) CreateBucket(_ context.Context, name string) error

func (*Mock) CreateMultipartUpload added in v1.2.0

func (m *Mock) CreateMultipartUpload(
	_ context.Context, bucket, key, contentType string,
) (*driver.MultipartUpload, error)

func (*Mock) DeleteBucket

func (m *Mock) DeleteBucket(_ context.Context, name string) error

func (*Mock) DeleteBucketPolicy added in v1.3.1

func (m *Mock) DeleteBucketPolicy(_ context.Context, bucket string) error

func (*Mock) DeleteBucketTagging added in v1.4.0

func (m *Mock) DeleteBucketTagging(_ context.Context, bucket string) error

DeleteBucketTagging removes all labels from a bucket.

func (*Mock) DeleteCORSConfig added in v1.3.1

func (m *Mock) DeleteCORSConfig(_ context.Context, bucket string) error

func (*Mock) DeleteObject

func (m *Mock) DeleteObject(ctx context.Context, bucket, key string) error

func (*Mock) DeleteObjectTagging added in v1.4.0

func (m *Mock) DeleteObjectTagging(_ context.Context, bucket, key string) error

DeleteObjectTagging removes all labels from an object.

func (*Mock) EvaluateLifecycle added in v1.2.0

func (m *Mock) EvaluateLifecycle(_ context.Context, bucket string) ([]string, error)

func (*Mock) GeneratePresignedURL added in v1.2.0

func (m *Mock) GeneratePresignedURL(_ context.Context, req driver.PresignedURLRequest) (*driver.PresignedURL, error)

GeneratePresignedURL generates a mock presigned URL. Note: expiry is tracked in the URL but not enforced on use — this is a mock limitation.

func (*Mock) GetBucketPolicy added in v1.3.1

func (m *Mock) GetBucketPolicy(_ context.Context, bucket string) (*driver.BucketPolicy, error)

func (*Mock) GetBucketTagging added in v1.4.0

func (m *Mock) GetBucketTagging(_ context.Context, bucket string) (map[string]string, error)

GetBucketTagging returns labels for a bucket.

func (*Mock) GetBucketVersioning added in v1.2.0

func (m *Mock) GetBucketVersioning(_ context.Context, bucket string) (bool, error)

func (*Mock) GetCORSConfig added in v1.3.1

func (m *Mock) GetCORSConfig(_ context.Context, bucket string) (*driver.CORSConfig, error)

func (*Mock) GetEncryptionConfig added in v1.3.1

func (m *Mock) GetEncryptionConfig(_ context.Context, bucket string) (*driver.EncryptionConfig, error)

func (*Mock) GetLifecycleConfig added in v1.2.0

func (m *Mock) GetLifecycleConfig(_ context.Context, bucket string) (*driver.LifecycleConfig, error)

func (*Mock) GetObject

func (m *Mock) GetObject(ctx context.Context, bucket, key string) (*driver.Object, error)

func (*Mock) GetObjectTagging added in v1.4.0

func (m *Mock) GetObjectTagging(_ context.Context, bucket, key string) (map[string]string, error)

GetObjectTagging returns labels for an object.

func (*Mock) HeadObject

func (m *Mock) HeadObject(_ context.Context, bucket, key string) (*driver.ObjectInfo, error)

func (*Mock) ListBuckets

func (m *Mock) ListBuckets(_ context.Context) ([]driver.BucketInfo, error)

func (*Mock) ListMultipartUploads added in v1.2.0

func (m *Mock) ListMultipartUploads(_ context.Context, bucket string) ([]driver.MultipartUpload, error)

func (*Mock) ListObjects

func (m *Mock) ListObjects(ctx context.Context, bucket string, opts driver.ListOptions) (*driver.ListResult, error)

func (*Mock) PutBucketPolicy added in v1.3.1

func (m *Mock) PutBucketPolicy(_ context.Context, bucket string, policy driver.BucketPolicy) error

func (*Mock) PutBucketTagging added in v1.4.0

func (m *Mock) PutBucketTagging(_ context.Context, bucket string, tags map[string]string) error

PutBucketTagging sets labels on a bucket.

func (*Mock) PutCORSConfig added in v1.3.1

func (m *Mock) PutCORSConfig(_ context.Context, bucket string, cfg driver.CORSConfig) error

func (*Mock) PutEncryptionConfig added in v1.3.1

func (m *Mock) PutEncryptionConfig(_ context.Context, bucket string, cfg driver.EncryptionConfig) error

func (*Mock) PutLifecycleConfig added in v1.2.0

func (m *Mock) PutLifecycleConfig(_ context.Context, bucket string, cfg driver.LifecycleConfig) error

func (*Mock) PutObject

func (m *Mock) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, metadata map[string]string) error

func (*Mock) PutObjectTagging added in v1.4.0

func (m *Mock) PutObjectTagging(_ context.Context, bucket, key string, tags map[string]string) error

PutObjectTagging sets labels on an object.

func (*Mock) SetBucketVersioning added in v1.2.0

func (m *Mock) SetBucketVersioning(_ context.Context, bucket string, enabled bool) error

SetBucketVersioning enables or disables versioning on a bucket. Note: this sets the flag but does not maintain object version history — mock limitation.

func (*Mock) SetMonitoring added in v1.2.0

func (m *Mock) SetMonitoring(mon mondriver.Monitoring)

SetMonitoring sets the monitoring backend for auto-metric generation.

func (*Mock) UploadPart added in v1.2.0

func (m *Mock) UploadPart(
	_ context.Context, bucket, _, uploadID string, partNumber int, data []byte,
) (*driver.UploadPart, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL