pub trait UploadTokenProvider: DynClone + Debug + Sync + Send {
fn access_key(
&self,
opts: GetAccessKeyOptions
) -> Result<GotAccessKey, ParseError>;
fn policy(
&self,
opts: GetPolicyOptions
) -> Result<GotUploadPolicy<'_>, ParseError>;
fn to_token_string(
&self,
opts: ToStringOptions
) -> Result<Cow<'_, str>, ToStringError>;
fn async_access_key(
&self,
opts: GetAccessKeyOptions
) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>> { ... }
fn async_policy(
&self,
opts: GetPolicyOptions
) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>> { ... }
fn async_to_token_string(
&self,
opts: ToStringOptions
) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>> { ... }
}
Expand description
上传凭证获取接口
可以阅读 https://developer.qiniu.com/kodo/manual/1208/upload-token 了解七牛安全机制。
Required Methods§
sourcefn access_key(
&self,
opts: GetAccessKeyOptions
) -> Result<GotAccessKey, ParseError>
fn access_key(
&self,
opts: GetAccessKeyOptions
) -> Result<GotAccessKey, ParseError>
从上传凭证内获取 AccessKey
该方法的异步版本为 Self::async_access_key
。
sourcefn policy(
&self,
opts: GetPolicyOptions
) -> Result<GotUploadPolicy<'_>, ParseError>
fn policy(
&self,
opts: GetPolicyOptions
) -> Result<GotUploadPolicy<'_>, ParseError>
从上传凭证内获取上传策略
该方法的异步版本为 Self::async_policy
。
sourcefn to_token_string(
&self,
opts: ToStringOptions
) -> Result<Cow<'_, str>, ToStringError>
fn to_token_string(
&self,
opts: ToStringOptions
) -> Result<Cow<'_, str>, ToStringError>
生成字符串
该方法的异步版本为 Self::async_to_token_string
。
Provided Methods§
sourcefn async_access_key(
&self,
opts: GetAccessKeyOptions
) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>
fn async_access_key(
&self,
opts: GetAccessKeyOptions
) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>
异步从上传凭证内获取 AccessKey
sourcefn async_policy(
&self,
opts: GetPolicyOptions
) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>
fn async_policy(
&self,
opts: GetPolicyOptions
) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>
异步从上传凭证内获取上传策略
sourcefn async_to_token_string(
&self,
opts: ToStringOptions
) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>
fn async_to_token_string(
&self,
opts: ToStringOptions
) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>
异步生成字符串