rexObjectStorage

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObjectStorageTypeMinio = "minio"
	ObjectStorageTypeCos   = "cos"
	ObjectStorageTypeOss   = "oss"
	ObjectStorageTypeS3    = "s3"
)

Variables

Functions

func CheckObjectStorageSupport

func CheckObjectStorageSupport(osType string) bool

func FormatBucketDomainByOsType

func FormatBucketDomainByOsType(OsType string, name, region string, v ...any) (BucketInternetDomain, BucketInternalDomain, BucketAccelerateDomain string)

func NewCustomS3Client

func NewCustomS3Client(ctx context.Context, osType string, AccessKey, AccessSecret, Region, AccessEndpoint string) (*s3.Client, error)

Types

type Actions

type Actions interface {
	CreateBucketWithLock(ctx context.Context, bucket string, region string, enableObjectLock bool) (string, error)
	DeleteObject(ctx context.Context, bucket string, key string, versionId string, bypassGovernance bool) (bool, error)
	DeleteObjects(ctx context.Context, bucket string, objects []types.ObjectIdentifier, bypassGovernance bool) error
	GetObjectLegalHold(ctx context.Context, bucket string, key string, versionId string) (*types.ObjectLockLegalHoldStatus, error)
	GetObjectLockConfiguration(ctx context.Context, bucket string) (*types.ObjectLockConfiguration, error)
	GetObjectRetention(ctx context.Context, bucket string, key string) (*types.ObjectLockRetention, error)
	ListObjectVersions(ctx context.Context, bucket string) ([]types.ObjectVersion, error)
	UploadObject(ctx context.Context, bucket string, key string, contents string) (string, error)
	PutObjectLegalHold(ctx context.Context, bucket string, key string, versionId string, legalHoldStatus types.ObjectLockLegalHoldStatus) error
	EnableObjectLockOnBucket(ctx context.Context, bucket string) error
	ModifyDefaultBucketRetention(ctx context.Context, bucket string, lockMode types.ObjectLockEnabled, retentionPeriod int32, retentionMode types.ObjectLockRetentionMode) error
	PutObjectRetention(ctx context.Context, bucket string, key string, retentionMode types.ObjectLockRetentionMode, retentionPeriodDays int32) error
}

func NewActions

func NewActions(client *s3.Client) Actions

type OSTool

type OSTool interface {
	GetPresigner() Presigner
	GetClient() *s3.Client
	GetActions() Actions
	CopyToBucket(ctx context.Context, sourceBucket string, destinationBucket string, objectKey string) error
	CreateBucket(ctx context.Context, name string, region string) error
	DeleteBucket(ctx context.Context, bucketName string) error
	DownloadFile(ctx context.Context, bucketName string, objectKey string, fileName string) error
	BucketExists(ctx context.Context, bucketName string) (bool, error)
	ListBuckets(ctx context.Context) ([]types.Bucket, error)
	ListObjects(ctx context.Context, bucketName string) ([]types.Object, error)
	UploadFile(ctx context.Context, bucketName string, objectKey string, fileName string) error
	UploadLargeObject(ctx context.Context, bucketName string, objectKey string, largeObject []byte) error
	DownloadLargeObject(ctx context.Context, bucketName string, objectKey string) ([]byte, error)
}

func NewObjectStorageUtils

func NewObjectStorageUtils(client *s3.Client) OSTool

type Presigner

type Presigner interface {
	GetPresignClient() *s3.PresignClient
	GetObject(ctx context.Context, bucketName string, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)
	PutObject(ctx context.Context, bucketName string, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)
	DeleteObject(ctx context.Context, bucketName string, objectKey string) (*v4.PresignedHTTPRequest, error)
	PresignPostObject(ctx context.Context, bucketName string, objectKey string, lifetimeSecs int64) (*s3.PresignedPostRequest, error)
	PresignPutObject(ctx context.Context, bucketName string, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)
	PresignHeadObject(ctx context.Context, bucketName string, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)
}

func NewPresigner

func NewPresigner(s3Client *s3.Client) Presigner

Jump to

Keyboard shortcuts

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