pub struct OSSClient { /* private fields */ }
Expand description
OSSClient - Alibaba Cloud OSS Client
Reference URL: https://help.aliyun.com/document_detail/31952.html
Implementations§
Source§impl OSSClient
OSS Client implemention
impl OSSClient
OSS Client implemention
Sourcepub fn new(
endpoint: &str,
access_key_id: &str,
access_key_secret: &str,
) -> OSSClient
pub fn new( endpoint: &str, access_key_id: &str, access_key_secret: &str, ) -> OSSClient
New OSSClient
Use access_key_id and access_key_secret to create a OSSClient Consider support STS!
Sourcepub fn new_sts(
endpoint: &str,
access_key_id: &str,
access_key_secret: &str,
security_token: &str,
) -> OSSClient
pub fn new_sts( endpoint: &str, access_key_id: &str, access_key_secret: &str, security_token: &str, ) -> OSSClient
New OSSClient
Use access_key_id and access_key_secret to create a OSSClient Consider support STS!
Sourcepub fn from_json(json: &str) -> XResult<Self>
pub fn from_json(json: &str) -> XResult<Self>
New OSSClient from JSON
JSON sample:
{
"endpoint": "",
"accessKeyId": "",
"accessKeySecret": ""
}
Sourcepub async fn put_file(
&self,
bucket_name: &str,
key: &str,
expire_in_seconds: u64,
file: File,
) -> XResult<Response>
pub async fn put_file( &self, bucket_name: &str, key: &str, expire_in_seconds: u64, file: File, ) -> XResult<Response>
Put file will read full file content to memory and send with HTTP protocol
Sourcepub async fn put_body(
&self,
bucket_name: &str,
key: &str,
expire_in_seconds: u64,
body: Body,
) -> XResult<Response>
pub async fn put_body( &self, bucket_name: &str, key: &str, expire_in_seconds: u64, body: Body, ) -> XResult<Response>
Put body to OSS
pub async fn delete_file( &self, bucket_name: &str, key: &str, ) -> XResult<Response>
pub async fn get_file_content( &self, bucket_name: &str, key: &str, ) -> XResult<Option<String>>
pub async fn get_file_content_bytes( &self, bucket_name: &str, key: &str, ) -> XResult<Option<Vec<u8>>>
pub async fn put_file_content( &self, bucket_name: &str, key: &str, content: &str, ) -> XResult<Response>
pub async fn put_file_content_bytes( &self, bucket_name: &str, key: &str, content_bytes: Vec<u8>, ) -> XResult<Response>
pub fn generate_signed_put_url( &self, bucket_name: &str, key: &str, expire_in_seconds: u64, ) -> String
pub fn generate_signed_get_url( &self, bucket_name: &str, key: &str, expire_in_seconds: u64, ) -> String
pub fn generate_signed_delete_url( &self, bucket_name: &str, key: &str, expire_in_seconds: u64, ) -> String
pub fn generate_signed_url( &self, verb: &str, bucket_name: &str, key: &str, expire_in_seconds: u64, is_https: bool, ) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OSSClient
impl RefUnwindSafe for OSSClient
impl Send for OSSClient
impl Sync for OSSClient
impl Unpin for OSSClient
impl UnwindSafe for OSSClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more