object_storage

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AliCloudEnvRoleArn         = "ALIBABA_CLOUD_ROLE_ARN"
	AliCloudEnvOidcProviderArn = "ALIBABA_CLOUD_OIDC_PROVIDER_ARN"
	AliCloudEnvOidcTokenFile   = "ALIBABA_CLOUD_OIDC_TOKEN_FILE"
)

Variables

View Source
var (
	ErrAliCloudStorageServiceCredentialTypeEmpty = errors.New("credential_type for alicloud storage service is empty")
	ErrAliCloudStorageServiceEndPointEmpty       = errors.New("endpoint for alicloud storage service is empty")
	ErrAliCloudStorageServiceSessionNameEmpty    = errors.New("session_name for alicloud storage service is empty")
)
View Source
var (
	ErrObjectKeyEmpty  = errors.New("object key is empty")
	ErrBucketNameEmpty = errors.New("bucket name is empty")
	ErrObjectNotFound  = errors.New("object is not found")
)

Functions

func HTTPHeaderLastModifiedToTime added in v1.3.0

func HTTPHeaderLastModifiedToTime(timeStr string) (time.Time, error)

Types

type AWSObjectStorageService

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

func (*AWSObjectStorageService) DeleteObject

func (service *AWSObjectStorageService) DeleteObject(ctx context.Context, key string) error

func (*AWSObjectStorageService) DeleteObjects

func (service *AWSObjectStorageService) DeleteObjects(ctx context.Context, keys ...string) error

func (*AWSObjectStorageService) GetObject

func (service *AWSObjectStorageService) GetObject(ctx context.Context, key string) (Object, error)

func (*AWSObjectStorageService) GetSignedURL

func (service *AWSObjectStorageService) GetSignedURL(key string, duration time.Duration) (string, error)

func (*AWSObjectStorageService) GetSignedURLForExistedKey added in v1.1.1

func (service *AWSObjectStorageService) GetSignedURLForExistedKey(ctx context.Context, key string, duration time.Duration) (string, error)

func (*AWSObjectStorageService) HeadObject added in v1.1.1

func (service *AWSObjectStorageService) HeadObject(ctx context.Context, key string) (Object, error)

func (*AWSObjectStorageService) ListObjects

func (service *AWSObjectStorageService) ListObjects(ctx context.Context, prefix string, continueToken *string, maxObjects int) ([]Object, *string, error)

func (*AWSObjectStorageService) PutObject

func (service *AWSObjectStorageService) PutObject(ctx context.Context, key string, input *PutObjectInput) error

type AliCloudObjectStorageService added in v1.3.0

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

func (*AliCloudObjectStorageService) DeleteObject added in v1.3.0

func (service *AliCloudObjectStorageService) DeleteObject(ctx context.Context, key string) error

func (*AliCloudObjectStorageService) DeleteObjects added in v1.3.0

func (service *AliCloudObjectStorageService) DeleteObjects(ctx context.Context, keys ...string) error

func (*AliCloudObjectStorageService) GetObject added in v1.3.0

func (service *AliCloudObjectStorageService) GetObject(ctx context.Context, key string) (Object, error)

func (*AliCloudObjectStorageService) GetSignedURL added in v1.3.0

func (service *AliCloudObjectStorageService) GetSignedURL(key string, duration time.Duration) (string, error)

func (*AliCloudObjectStorageService) GetSignedURLForExistedKey added in v1.3.0

func (service *AliCloudObjectStorageService) GetSignedURLForExistedKey(ctx context.Context, key string, duration time.Duration) (string, error)

func (*AliCloudObjectStorageService) HeadObject added in v1.3.0

func (service *AliCloudObjectStorageService) HeadObject(ctx context.Context, key string) (Object, error)

func (*AliCloudObjectStorageService) ListObjects added in v1.3.0

func (service *AliCloudObjectStorageService) ListObjects(ctx context.Context, prefix string, continueToken *string, maxObjects int) ([]Object, *string, error)

func (*AliCloudObjectStorageService) PutObject added in v1.3.0

func (service *AliCloudObjectStorageService) PutObject(ctx context.Context, key string, input *PutObjectInput) error

type AliCloudStorageOption added in v1.3.0

type AliCloudStorageOption struct {
	CredentialType string // eg: "oidc_role_arn"
	EndPoint       string // eg: "oss-cn-zhangjiakou.aliyuncs.com"
	SessionName    string // eg: "test-rrsa-oidc-token"
}

func (AliCloudStorageOption) CheckAWS added in v1.3.0

func (option AliCloudStorageOption) CheckAWS() error

func (AliCloudStorageOption) CheckAliCloudStorage added in v1.3.0

func (option AliCloudStorageOption) CheckAliCloudStorage() error

func (AliCloudStorageOption) CheckClusterRedis added in v1.3.0

func (option AliCloudStorageOption) CheckClusterRedis() error

func (AliCloudStorageOption) CheckStandaloneRedis added in v1.3.0

func (option AliCloudStorageOption) CheckStandaloneRedis() error

func (AliCloudStorageOption) CheckTencentCloud added in v1.3.0

func (option AliCloudStorageOption) CheckTencentCloud() error

func (AliCloudStorageOption) GetAssumeRegion added in v1.3.0

func (option AliCloudStorageOption) GetAssumeRegion() string

func (AliCloudStorageOption) GetAssumeRoleArn added in v1.3.0

func (option AliCloudStorageOption) GetAssumeRoleArn() string

func (AliCloudStorageOption) GetProvider added in v1.3.0

func (option AliCloudStorageOption) GetProvider() cloud.Provider

func (AliCloudStorageOption) GetRegion added in v1.3.0

func (option AliCloudStorageOption) GetRegion() string

func (AliCloudStorageOption) GetSecretID added in v1.3.0

func (option AliCloudStorageOption) GetSecretID() string

func (AliCloudStorageOption) GetSecretKey added in v1.3.0

func (option AliCloudStorageOption) GetSecretKey() string

type Object

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

func (Object) GetContent

func (object Object) GetContent() ([]byte, error)

func (Object) GetContentType added in v1.1.2

func (object Object) GetContentType() string

func (Object) GetKey

func (object Object) GetKey() string

func (Object) GetModifiedTime

func (object Object) GetModifiedTime() time.Time

func (Object) GetObjectSize added in v1.1.1

func (object Object) GetObjectSize() int64

type ObjectStorageService

type ObjectStorageService interface {
	ListObjects(ctx context.Context, prefix string, continueToken *string, maxObjects int) ([]Object, *string, error)
	HeadObject(ctx context.Context, key string) (Object, error)
	GetObject(ctx context.Context, key string) (Object, error)
	PutObject(ctx context.Context, key string, input *PutObjectInput) error
	DeleteObject(ctx context.Context, key string) error
	DeleteObjects(ctx context.Context, keys ...string) error
	GetSignedURL(key string, duration time.Duration) (string, error)
	// GetSignedURLForExistedKey generates signed url if key exists. If key does not exist, return error
	GetSignedURLForExistedKey(ctx context.Context, key string, duration time.Duration) (string, error)
}

func GetAWSObjectService

func GetAWSObjectService(bucketName string, option cloud.Option) (ObjectStorageService, error)

func GetAliCloudObjectService added in v1.3.0

func GetAliCloudObjectService(bucketName string, option cloud.Option) (ObjectStorageService, error)

GetAliCloudObjectService option.credentialType Only Support "oidc_role_arn"

func GetObjectStorageService

func GetObjectStorageService(bucketName string, option cloud.Option) (ObjectStorageService, error)

func GetTencentCloudObjectService

func GetTencentCloudObjectService(bucketName string, option cloud.Option) (ObjectStorageService, error)

type PutObjectInput added in v1.1.2

type PutObjectInput struct {
	Body        []byte
	ContentType string
	Tagging     string
}

type TencentCloudObjectStorageService

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

func (*TencentCloudObjectStorageService) DeleteObject

func (service *TencentCloudObjectStorageService) DeleteObject(ctx context.Context, key string) error

func (*TencentCloudObjectStorageService) DeleteObjects

func (service *TencentCloudObjectStorageService) DeleteObjects(ctx context.Context, keys ...string) error

func (*TencentCloudObjectStorageService) GetObject

func (service *TencentCloudObjectStorageService) GetObject(ctx context.Context, key string) (Object, error)

func (*TencentCloudObjectStorageService) GetSignedURL

func (service *TencentCloudObjectStorageService) GetSignedURL(key string, duration time.Duration) (string, error)

func (*TencentCloudObjectStorageService) GetSignedURLForExistedKey added in v1.1.1

func (service *TencentCloudObjectStorageService) GetSignedURLForExistedKey(ctx context.Context, key string, duration time.Duration) (string, error)

func (*TencentCloudObjectStorageService) HeadObject added in v1.1.1

func (service *TencentCloudObjectStorageService) HeadObject(ctx context.Context, key string) (Object, error)

func (*TencentCloudObjectStorageService) ListObjects

func (service *TencentCloudObjectStorageService) ListObjects(ctx context.Context, prefix string, continueToken *string, maxObjects int) ([]Object, *string, error)

func (*TencentCloudObjectStorageService) PutObject

func (service *TencentCloudObjectStorageService) PutObject(ctx context.Context, key string, input *PutObjectInput) error

Jump to

Keyboard shortcuts

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