Documentation
¶
Index ¶
- Constants
- Variables
- func CheckObjectStorageSupport(osType string) bool
- func FormatBucketDomainByOsType(OsType string, name, region string, v ...any) (BucketInternetDomain, BucketInternalDomain, BucketAccelerateDomain string)
- func NewCustomS3Client(ctx context.Context, osType string, ...) (*s3.Client, error)
- type Actions
- type OSTool
- type Presigner
Constants ¶
View Source
const ( ObjectStorageTypeMinio = "minio" ObjectStorageTypeCos = "cos" ObjectStorageTypeOss = "oss" ObjectStorageTypeS3 = "s3" )
Variables ¶
View Source
var ObjectStorageTypeSupport = map[string]bool{ ObjectStorageTypeMinio: true, ObjectStorageTypeCos: true, ObjectStorageTypeOss: true, ObjectStorageTypeS3: true, }
Functions ¶
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 ¶
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 ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.