pub trait UploadTokenProvider: DynClone + Debug + Sync + Send {
    // Required methods
    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>;

    // Provided methods
    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§

fn access_key( &self, opts: GetAccessKeyOptions ) -> Result<GotAccessKey, ParseError>

从上传凭证内获取 AccessKey

该方法的异步版本为 Self::async_access_key

fn policy( &self, opts: GetPolicyOptions ) -> Result<GotUploadPolicy<'_>, ParseError>

从上传凭证内获取上传策略

该方法的异步版本为 Self::async_policy

fn to_token_string( &self, opts: ToStringOptions ) -> Result<Cow<'_, str>, ToStringError>

生成字符串

该方法的异步版本为 Self::async_to_token_string

Provided Methods§

fn async_access_key( &self, opts: GetAccessKeyOptions ) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>

异步从上传凭证内获取 AccessKey

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>>

异步生成字符串

Implementations on Foreign Types§

§

impl<T> UploadTokenProvider for Arc<T>where T: UploadTokenProvider + ?Sized, Arc<T>: DynClone + Debug + Sync + Send,

§

fn access_key( &self, opts: GetAccessKeyOptions ) -> Result<GotAccessKey, ParseError>

§

fn async_access_key( &self, opts: GetAccessKeyOptions ) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>

§

fn policy( &self, opts: GetPolicyOptions ) -> Result<GotUploadPolicy<'_>, ParseError>

§

fn async_policy( &self, opts: GetPolicyOptions ) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>

§

fn to_token_string( &self, opts: ToStringOptions ) -> Result<Cow<'_, str>, ToStringError>

§

fn async_to_token_string( &self, opts: ToStringOptions ) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>

§

impl<T> UploadTokenProvider for Rc<T>where T: UploadTokenProvider + ?Sized, Rc<T>: DynClone + Debug + Sync + Send,

§

fn access_key( &self, opts: GetAccessKeyOptions ) -> Result<GotAccessKey, ParseError>

§

fn async_access_key( &self, opts: GetAccessKeyOptions ) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>

§

fn policy( &self, opts: GetPolicyOptions ) -> Result<GotUploadPolicy<'_>, ParseError>

§

fn async_policy( &self, opts: GetPolicyOptions ) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>

§

fn to_token_string( &self, opts: ToStringOptions ) -> Result<Cow<'_, str>, ToStringError>

§

fn async_to_token_string( &self, opts: ToStringOptions ) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>

§

impl<'a, T> UploadTokenProvider for &'a Twhere T: 'a + UploadTokenProvider + ?Sized, &'a T: DynClone + Debug + Sync + Send,

§

fn access_key( &self, opts: GetAccessKeyOptions ) -> Result<GotAccessKey, ParseError>

§

fn async_access_key( &self, opts: GetAccessKeyOptions ) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>

§

fn policy( &self, opts: GetPolicyOptions ) -> Result<GotUploadPolicy<'_>, ParseError>

§

fn async_policy( &self, opts: GetPolicyOptions ) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>

§

fn to_token_string( &self, opts: ToStringOptions ) -> Result<Cow<'_, str>, ToStringError>

§

fn async_to_token_string( &self, opts: ToStringOptions ) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>

§

impl<'a, T> UploadTokenProvider for &'a mut Twhere T: 'a + UploadTokenProvider + ?Sized, &'a mut T: DynClone + Debug + Sync + Send,

§

fn access_key( &self, opts: GetAccessKeyOptions ) -> Result<GotAccessKey, ParseError>

§

fn async_access_key( &self, opts: GetAccessKeyOptions ) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>

§

fn policy( &self, opts: GetPolicyOptions ) -> Result<GotUploadPolicy<'_>, ParseError>

§

fn async_policy( &self, opts: GetPolicyOptions ) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>

§

fn to_token_string( &self, opts: ToStringOptions ) -> Result<Cow<'_, str>, ToStringError>

§

fn async_to_token_string( &self, opts: ToStringOptions ) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>

§

impl<T> UploadTokenProvider for Box<T, Global>where T: UploadTokenProvider + ?Sized, Box<T, Global>: DynClone + Debug + Sync + Send,

§

fn access_key( &self, opts: GetAccessKeyOptions ) -> Result<GotAccessKey, ParseError>

§

fn async_access_key( &self, opts: GetAccessKeyOptions ) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>>

§

fn policy( &self, opts: GetPolicyOptions ) -> Result<GotUploadPolicy<'_>, ParseError>

§

fn async_policy( &self, opts: GetPolicyOptions ) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>>

§

fn to_token_string( &self, opts: ToStringOptions ) -> Result<Cow<'_, str>, ToStringError>

§

fn async_to_token_string( &self, opts: ToStringOptions ) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, ToStringError>> + Send, Global>>

Implementors§

§

impl UploadTokenProvider for StaticUploadTokenProvider

§

impl<C> UploadTokenProvider for BucketUploadTokenProvider<C>where C: CredentialProvider + Clone,

§

impl<C> UploadTokenProvider for FromUploadPolicy<C>where C: CredentialProvider + Clone,

§

impl<C> UploadTokenProvider for ObjectUploadTokenProvider<C>where C: CredentialProvider + Clone,

§

impl<P> UploadTokenProvider for CachedUploadTokenProvider<P>where P: UploadTokenProvider + Clone,