You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1Panel/backend/utils/cloud_storage/cloud_storage_client.go

38 lines
1006 B

package cloud_storage
import (
"github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/utils/cloud_storage/client"
)
type CloudStorageClient interface {
ListBuckets() ([]interface{}, error)
ListObjects(prefix string) ([]interface{}, error)
Exist(path string) (bool, error)
Delete(path string) (bool, error)
Upload(src, target string) (bool, error)
Download(src, target string) (bool, error)
}
func NewCloudStorageClient(vars map[string]interface{}) (CloudStorageClient, error) {
if vars["type"] == constant.S3 {
return client.NewS3Client(vars)
}
if vars["type"] == constant.OSS {
return client.NewOssClient(vars)
}
if vars["type"] == constant.Sftp {
return client.NewSftpClient(vars)
}
if vars["type"] == constant.MinIo {
return client.NewMinIoClient(vars)
}
if vars["type"] == constant.Cos {
return client.NewCosClient(vars)
}
if vars["type"] == constant.Kodo {
return client.NewKodoClient(vars)
}
return nil, constant.ErrNotSupportType
}