ucloud

package
v0.0.0-...-a2093d6 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: LGPL-2.1 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(options ...Option) *Client

func NewClientWithConfig

func NewClientWithConfig(config Config) *Client

func (*Client) Delete

func (client *Client) Delete(key string) error

func (*Client) Kernel

func (client *Client) Kernel() *ufsdk.Config

func (*Client) Upload

func (client *Client) Upload(file io.Reader, key string) (string, error)

type Config

type Config struct {
	// "说明1": "管理 bucket 创建和删除必须要公私钥(见 https://console.ucloud.cn/uapi/apikey),
	// 如果只做文件上传和下载用 TOEKN (见 https://console.ucloud.cn/ufile/token)就够了,为了安全,强烈建议只使用 TOKEN 做文件管理",
	PublicKey  string `mapstructure:"public_key" json:"public_key"`
	PrivateKey string `mapstructure:"private_key" json:"private_key"`
	// "说明2": "以下两个参数是用来管理文件用的。对应的是 file.go 里面的接口,file_host 是不带 bucket 名字的。
	// 比如:北京地域的host填cn-bj.ufileos.com,而不是填 bucketname.cn-bj.ufileos.com。若为自定义域名,请直接带上 http 开头的 URL。
	// 如:http://example.com",
	BucketName string `mapstructure:"bucket_name" json:"bucket_name"`
	BucketHost string `mapstructure:"bucket_host" json:"bucket_host"`
	FileHost   string `mapstructure:"file_host" json:"file_host"`
	// "说明3": "verifyUploadMD5 用于数据完整性校验,默认不开启,若要开启请置为true",
	VerifyUploadMD5 bool `mapstructure:"verify_upload_md_5" json:"verify_upload_md_5"`
}

type Option

type Option func(config *Config)

func WithBucketHost

func WithBucketHost(bucketHost string) Option

func WithBucketName

func WithBucketName(bucketName string) Option

func WithFileHost

func WithFileHost(fileHost string) Option

func WithPrivateKey

func WithPrivateKey(privateKey string) Option

func WithPublicKey

func WithPublicKey(publicKey string) Option

func WithVerifyUploadMD5

func WithVerifyUploadMD5(verifyUploadMD5 bool) Option

Jump to

Keyboard shortcuts

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