Documentation
¶
Index ¶
- Variables
- type Client
- type Config
- type Instance
- func (c *Instance) GetObject(key string) (io.ReadCloser, error)
- func (c *Instance) GetObjects(key []string) ([]io.ReadCloser, error)
- func (c *Instance) PutObjectToTemporary(filename string, reader io.Reader) (string, error)
- func (c *Instance) SignAttachmentURLWithGet(key, filename string, expiredInSec int64) (string, error)
- func (c *Instance) SignURL(key string, method oss.HTTPMethod, expiredInSec int64, options ...oss.Option) (string, error)
- func (c *Instance) SignURLWithGet(key string, expiredInSec int64, options ...oss.Option) (string, error)
- func (c *Instance) Upload(key string, r io.Reader) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidKey = errors.New("invalid key")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // required AccessKeyId string `json:"accessKeyId" yaml:"accessKeyId" binding:"required"` // required AccessKeySecret string `json:"accessKeySecret" yaml:"accessKeySecret" binding:"required"` // 角色权限 // required RoleArn string `json:"roleArn" yaml:"roleArn" binding:"required"` // 区域: oss-cn-guangzhou // required Region string `yaml:"region" json:"region" binding:"required"` // 外网端点: 例如 https://oss-cn-shenzhen.aliyuncs.com // required Endpoint string `json:"endpoint" yaml:"endpoint" binding:"required"` // 内网端点: 例如 https://oss-cn-shenzhen-internal.aliyuncs.com // required InternalEndpoint string `json:"internalEndpoint" yaml:"internalEndpoint" binding:"required"` // 桶名称 // required BucketName string `json:"bucketName" yaml:"bucketName" binding:"required"` // cdn: cdn 域名地址 CdnDomain string `yaml:"cdnDomain" json:"cdnDomain"` // 根目录 Root string `json:"root" yaml:"root"` // 临时目录 Temporary string `json:"temporary" yaml:"temporary"` }
func (*Config) GenerateObjectKey ¶
GenerateObjectKey 生成对象的key 格式: {root}/{dir}/{uuid}[.{suffix}]
type Instance ¶
OSS 实例()
func (*Instance) GetObject ¶
func (c *Instance) GetObject(key string) (io.ReadCloser, error)
GetObject 获取对象
func (*Instance) GetObjects ¶
func (c *Instance) GetObjects(key []string) ([]io.ReadCloser, error)
GetObjects 获取对象列表
func (*Instance) PutObjectToTemporary ¶
PutObjectToTemporary 存储到临时文件夹, 返回 object key 并设置 tags: temporary:true oss服务器对 {Temporary} 目录下, 设有 tags为 temporary:true 一天后删除 Temporary 的文件夹名为 200601 格式
func (*Instance) SignAttachmentURLWithGet ¶
func (c *Instance) SignAttachmentURLWithGet(key, filename string, expiredInSec int64) (string, error)
获取资源 url, GET 方法 (临时url)
func (*Instance) SignURL ¶
func (c *Instance) SignURL(key string, method oss.HTTPMethod, expiredInSec int64, options ...oss.Option) (string, error)
获取资源 url(临时url)
Click to show internal directories.
Click to hide internal directories.