Documentation ¶
Index ¶
- Variables
- type AccessKeyProvider
- type FieldError
- type Provider
- type PutPolicy
- func (putPolicy PutPolicy) Delete(key string) (value interface{}, ok bool)
- func (putPolicy PutPolicy) Get(key string) (value interface{}, ok bool)
- func (putPolicy PutPolicy) GetBucketName() (string, error)
- func (putPolicy PutPolicy) GetCallbackBody() (string, bool)
- func (putPolicy PutPolicy) GetCallbackBodyType() (string, bool)
- func (putPolicy PutPolicy) GetCallbackHost() (string, bool)
- func (putPolicy PutPolicy) GetCallbackUrl() (string, bool)
- func (putPolicy PutPolicy) GetDeadline() (int64, bool)
- func (putPolicy PutPolicy) GetDetectMime() (int64, bool)
- func (putPolicy PutPolicy) GetEndUser() (string, bool)
- func (putPolicy PutPolicy) GetFileType() (int64, bool)
- func (putPolicy PutPolicy) GetForceSaveKey() (bool, bool)
- func (putPolicy PutPolicy) GetFsizeLimit() (int64, bool)
- func (putPolicy PutPolicy) GetFsizeMin() (int64, bool)
- func (putPolicy PutPolicy) GetInsertOnly() (int64, bool)
- func (putPolicy PutPolicy) GetIsPrefixalScope() (int64, bool)
- func (putPolicy PutPolicy) GetMimeLimit() (string, bool)
- func (putPolicy PutPolicy) GetPersistentNotifyUrl() (string, bool)
- func (putPolicy PutPolicy) GetPersistentOps() (string, bool)
- func (putPolicy PutPolicy) GetPersistentPipeline() (string, bool)
- func (putPolicy PutPolicy) GetPersistentType() (int64, bool)
- func (putPolicy PutPolicy) GetPersistentWorkflowTemplateID() (string, bool)
- func (putPolicy PutPolicy) GetReturnBody() (string, bool)
- func (putPolicy PutPolicy) GetReturnUrl() (string, bool)
- func (putPolicy PutPolicy) GetSaveKey() (string, bool)
- func (putPolicy PutPolicy) GetScope() (string, bool)
- func (putPolicy PutPolicy) Set(key string, value interface{}) error
- func (putPolicy PutPolicy) SetCallbackBody(value string) PutPolicy
- func (putPolicy PutPolicy) SetCallbackBodyType(value string) PutPolicy
- func (putPolicy PutPolicy) SetCallbackHost(value string) PutPolicy
- func (putPolicy PutPolicy) SetCallbackUrl(value string) PutPolicy
- func (putPolicy PutPolicy) SetDeadline(value int64) PutPolicy
- func (putPolicy PutPolicy) SetDetectMime(value int64) PutPolicy
- func (putPolicy PutPolicy) SetEndUser(value string) PutPolicy
- func (putPolicy PutPolicy) SetFileType(value int64) PutPolicy
- func (putPolicy PutPolicy) SetForceSaveKey(value bool) PutPolicy
- func (putPolicy PutPolicy) SetFsizeLimit(value int64) PutPolicy
- func (putPolicy PutPolicy) SetFsizeMin(value int64) PutPolicy
- func (putPolicy PutPolicy) SetInsertOnly(value int64) PutPolicy
- func (putPolicy PutPolicy) SetIsPrefixalScope(value int64) PutPolicy
- func (putPolicy PutPolicy) SetMimeLimit(value string) PutPolicy
- func (putPolicy PutPolicy) SetPersistentNotifyUrl(value string) PutPolicy
- func (putPolicy PutPolicy) SetPersistentOps(value string) PutPolicy
- func (putPolicy PutPolicy) SetPersistentPipeline(value string) PutPolicy
- func (putPolicy PutPolicy) SetPersistentType(value int64) PutPolicy
- func (putPolicy PutPolicy) SetPersistentWorkflowTemplateID(value string) PutPolicy
- func (putPolicy PutPolicy) SetReturnBody(value string) PutPolicy
- func (putPolicy PutPolicy) SetReturnUrl(value string) PutPolicy
- func (putPolicy PutPolicy) SetSaveKey(value string) PutPolicy
- func (putPolicy PutPolicy) SetScope(value string) PutPolicy
- type PutPolicyProvider
- type UpTokenProvider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyBucketName 空的 Bucket 名称 ErrEmptyBucketName = errors.New("empty bucket name") // ErrInvalidPolicyValue 非法凭证值 ErrInvalidPolicyValue = errors.New("invalid put policy value") )
var ErrInvalidUpToken = errors.New("invalid upToken")
ErrInvalidUpToken 非法的上传凭证
Functions ¶
This section is empty.
Types ¶
type AccessKeyProvider ¶
AccessKeyProvider 获取 AccessKey 接口
type FieldError ¶
type FieldError struct {
Err error
}
FieldError indicates an error condition occurred while setting put policy
func (*FieldError) Error ¶
func (e *FieldError) Error() string
func (*FieldError) Unwrap ¶
func (e *FieldError) Unwrap() error
Unwrap returns the underlying error cause
type Provider ¶
type Provider interface { PutPolicyProvider AccessKeyProvider UpTokenProvider }
Provider 获取上传凭证,AccessKey 和上传策略接口
func NewSigner ¶
func NewSigner(putPolicy PutPolicy, credentialsProvider credentials.CredentialsProvider) Provider
NewSigner 创建上传凭证签发器
需要注意的是 NewSigner 仅仅只会通过 credentials.CredentialsProvider 获取一次鉴权参数,之后就会缓存该鉴权参数,不会反复获取
type PutPolicy ¶
type PutPolicy map[string]interface{}
PutPolicy 存储上传策略
func NewPutPolicy ¶
NewPutPolicy 为指定的空间生成上传策略
func NewPutPolicyWithKey ¶
NewPutPolicyWithKey 为指定的空间和对象名称生成上传策略
func NewPutPolicyWithKeyPrefix ¶
NewPutPolicyWithKeyPrefix 为指定的空间和对象前缀生成上传策略
func (PutPolicy) GetBucketName ¶
GetBucketName 获取上传策略内的空间名称
该方法会从上传策略中解析出空间名称,如果上传策略中没有 scope 字段,则返回 ErrEmptyBucketName 错误,如果上传策略的 scope 字段格式有误,则返回 ErrInvalidPolicyValue 错误。
func (PutPolicy) GetCallbackBody ¶
GetCallbackBody 获取上传成功后,七牛云向业务服务器发送 Content-Type: application/x-www-form-urlencoded 的 POST 请求
func (PutPolicy) GetCallbackBodyType ¶
GetCallbackBodyType 获取上传成功后,七牛云向业务服务器发送回调通知 callbackBody 的 Content-Type
func (PutPolicy) GetCallbackHost ¶
GetCallbackHost 获取上传成功后,七牛云向业务服务器发送回调通知时的 Host 值
func (PutPolicy) GetCallbackUrl ¶
GetCallbackUrl 获取上传成功后,七牛云向业务服务器发送 POST 请求的 URL
func (PutPolicy) GetDeadline ¶
GetDeadline 获取上传策略有效截止时间
func (PutPolicy) GetDetectMime ¶
GetDetectMime 获取开启 MimeType 侦测功能
func (PutPolicy) GetEndUser ¶
GetEndUser 获取唯一属主标识
func (PutPolicy) GetFileType ¶
GetFileType 获取文件存储类型
func (PutPolicy) GetForceSaveKey ¶
GetForceSaveKey 获取 saveKey 的优先级设置
func (PutPolicy) GetFsizeLimit ¶
GetFsizeLimit 获取限定上传文件大小最大值
func (PutPolicy) GetFsizeMin ¶
GetFsizeMin 获取限定上传文件大小最小值
func (PutPolicy) GetInsertOnly ¶
GetInsertOnly 获取是否限定为新增语意
func (PutPolicy) GetIsPrefixalScope ¶
GetIsPrefixalScope 获取是否允许用户上传以 scope 的 keyPrefix 为前缀的文件
func (PutPolicy) GetMimeLimit ¶
GetMimeLimit 获取限定用户上传的文件类型
func (PutPolicy) GetPersistentNotifyUrl ¶
GetPersistentNotifyUrl 获取接收持久化处理结果通知的 URL
func (PutPolicy) GetPersistentOps ¶
GetPersistentOps 获取资源上传成功后触发执行的预转持久化处理指令列表
func (PutPolicy) GetPersistentPipeline ¶
GetPersistentPipeline 获取转码队列名
func (PutPolicy) GetPersistentType ¶ added in v7.23.0
GetPersistentType 获取任务类型
func (PutPolicy) GetPersistentWorkflowTemplateID ¶ added in v7.24.0
GetPersistentWorkflowTemplateID 获取工作流模版 ID
func (PutPolicy) GetReturnBody ¶
GetReturnBody 获取上传成功后,自定义七牛云最终返回给上传端的数据
func (PutPolicy) GetReturnUrl ¶
GetReturnUrl 获取 Web 端文件上传成功后,浏览器执行 303 跳转的 URL
func (PutPolicy) GetSaveKey ¶
GetSaveKey 获取自定义资源名
func (PutPolicy) SetCallbackBody ¶
SetCallbackBody 指定上传成功后,七牛云向业务服务器发送 Content-Type: application/x-www-form-urlencoded 的 POST 请求
func (PutPolicy) SetCallbackBodyType ¶
SetCallbackBodyType 指定上传成功后,七牛云向业务服务器发送回调通知 callbackBody 的 Content-Type
func (PutPolicy) SetCallbackHost ¶
SetCallbackHost 指定上传成功后,七牛云向业务服务器发送回调通知时的 Host 值
func (PutPolicy) SetCallbackUrl ¶
SetCallbackUrl 指定上传成功后,七牛云向业务服务器发送 POST 请求的 URL
func (PutPolicy) SetDeadline ¶
SetDeadline 指定上传策略有效截止时间
func (PutPolicy) SetDetectMime ¶
SetDetectMime 指定开启 MimeType 侦测功能
func (PutPolicy) SetEndUser ¶
SetEndUser 指定唯一属主标识
func (PutPolicy) SetFileType ¶
SetFileType 指定文件存储类型
func (PutPolicy) SetForceSaveKey ¶
SetForceSaveKey 指定 saveKey 的优先级设置
func (PutPolicy) SetFsizeLimit ¶
SetFsizeLimit 指定限定上传文件大小最大值
func (PutPolicy) SetFsizeMin ¶
SetFsizeMin 指定限定上传文件大小最小值
func (PutPolicy) SetInsertOnly ¶
SetInsertOnly 指定是否限定为新增语意
func (PutPolicy) SetIsPrefixalScope ¶
SetIsPrefixalScope 指定是否允许用户上传以 scope 的 keyPrefix 为前缀的文件
func (PutPolicy) SetMimeLimit ¶
SetMimeLimit 指定限定用户上传的文件类型
func (PutPolicy) SetPersistentNotifyUrl ¶
SetPersistentNotifyUrl 指定接收持久化处理结果通知的 URL
func (PutPolicy) SetPersistentOps ¶
SetPersistentOps 指定资源上传成功后触发执行的预转持久化处理指令列表
func (PutPolicy) SetPersistentPipeline ¶
SetPersistentPipeline 指定转码队列名
func (PutPolicy) SetPersistentType ¶ added in v7.23.0
SetPersistentType 指定任务类型
func (PutPolicy) SetPersistentWorkflowTemplateID ¶ added in v7.24.0
SetPersistentWorkflowTemplateID 指定工作流模版 ID
func (PutPolicy) SetReturnBody ¶
SetReturnBody 指定上传成功后,自定义七牛云最终返回给上传端的数据
func (PutPolicy) SetReturnUrl ¶
SetReturnUrl 指定 Web 端文件上传成功后,浏览器执行 303 跳转的 URL
func (PutPolicy) SetSaveKey ¶
SetSaveKey 指定自定义资源名
type PutPolicyProvider ¶
PutPolicyProvider 获取上传策略接口