Documentation
¶
Index ¶
- Constants
- type StorageClient
- func (c *StorageClient) BucketExists(ctx context.Context, bucket string) (bool, error)
- func (c *StorageClient) BucketPrefix() string
- func (c *StorageClient) Config() types.WorkspaceStorageConfig
- func (c *StorageClient) CopyObject(ctx context.Context, srcBucket, srcKey, dstBucket, dstKey string) error
- func (c *StorageClient) CreateBucket(ctx context.Context, bucket string) error
- func (c *StorageClient) CreateWorkspaceBucket(ctx context.Context, workspaceExternalId string) (string, error)
- func (c *StorageClient) Delete(ctx context.Context, bucket, key string) error
- func (c *StorageClient) Download(ctx context.Context, bucket, key string) ([]byte, error)
- func (c *StorageClient) Exists(ctx context.Context, bucket, key string) (bool, error)
- func (c *StorageClient) Head(ctx context.Context, bucket, key string) (*s3.HeadObjectOutput, error)
- func (c *StorageClient) ListObjects(ctx context.Context, bucket, prefix string, maxKeys int32) (*s3.ListObjectsV2Output, error)
- func (c *StorageClient) PresignClient() *s3.PresignClient
- func (c *StorageClient) PresignDownload(ctx context.Context, bucket, key string, expires time.Duration) (string, error)
- func (c *StorageClient) PresignUpload(ctx context.Context, bucket, key, contentType string, expires time.Duration) (string, error)
- func (c *StorageClient) S3Client() *s3.Client
- func (c *StorageClient) Upload(ctx context.Context, bucket, key string, data []byte) error
- func (c *StorageClient) WorkspaceBucketName(workspaceExternalId string) string
Constants ¶
View Source
const ( // Presigned URL expiry times PresignUploadExpiry = 15 * time.Minute // Upload URLs valid for 15 minutes PresignDownloadExpiry = 1 * time.Hour // Download URLs valid for 1 hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StorageClient ¶
type StorageClient struct {
// contains filtered or unexported fields
}
StorageClient manages S3 operations for workspace storage
func NewStorageClient ¶
func NewStorageClient(ctx context.Context, cfg types.WorkspaceStorageConfig) (*StorageClient, error)
func (*StorageClient) BucketExists ¶
func (*StorageClient) BucketPrefix ¶ added in v0.1.32
func (c *StorageClient) BucketPrefix() string
BucketPrefix returns the configured bucket name prefix.
func (*StorageClient) Config ¶
func (c *StorageClient) Config() types.WorkspaceStorageConfig
func (*StorageClient) CopyObject ¶
func (c *StorageClient) CopyObject(ctx context.Context, srcBucket, srcKey, dstBucket, dstKey string) error
func (*StorageClient) CreateBucket ¶
func (c *StorageClient) CreateBucket(ctx context.Context, bucket string) error
func (*StorageClient) CreateWorkspaceBucket ¶
func (*StorageClient) Delete ¶
func (c *StorageClient) Delete(ctx context.Context, bucket, key string) error
func (*StorageClient) Head ¶
func (c *StorageClient) Head(ctx context.Context, bucket, key string) (*s3.HeadObjectOutput, error)
func (*StorageClient) ListObjects ¶
func (c *StorageClient) ListObjects(ctx context.Context, bucket, prefix string, maxKeys int32) (*s3.ListObjectsV2Output, error)
func (*StorageClient) PresignClient ¶
func (c *StorageClient) PresignClient() *s3.PresignClient
func (*StorageClient) PresignDownload ¶
func (c *StorageClient) PresignDownload(ctx context.Context, bucket, key string, expires time.Duration) (string, error)
PresignDownload generates a presigned GET URL for downloading a file
func (*StorageClient) PresignUpload ¶
func (c *StorageClient) PresignUpload(ctx context.Context, bucket, key, contentType string, expires time.Duration) (string, error)
PresignUpload generates a presigned PUT URL for uploading a file
func (*StorageClient) S3Client ¶
func (c *StorageClient) S3Client() *s3.Client
func (*StorageClient) WorkspaceBucketName ¶
func (c *StorageClient) WorkspaceBucketName(workspaceExternalId string) string
Click to show internal directories.
Click to hide internal directories.