pub struct OssClient { /* private fields */ }Expand description
OSS API client
Implementations§
Source§impl OssClient
impl OssClient
Sourcepub async fn copy_object(
&self,
src_bucket: &str,
object_key: &str,
dest_bucket: &str,
dest_key: Option<&str>,
) -> Result<ObjectDetails>
pub async fn copy_object( &self, src_bucket: &str, object_key: &str, dest_bucket: &str, dest_key: Option<&str>, ) -> Result<ObjectDetails>
Server-side copy of an object using x-ads-copy-from header.
Much more efficient than download+re-upload for same-region copies.
Sourcepub async fn batch_copy_objects(
&self,
src_bucket: &str,
dest_bucket: &str,
object_keys: &[String],
) -> Result<BatchResult<ObjectDetails>>
pub async fn batch_copy_objects( &self, src_bucket: &str, dest_bucket: &str, object_keys: &[String], ) -> Result<BatchResult<ObjectDetails>>
Batch copy objects from one bucket to another with concurrent execution. Uses a semaphore to limit concurrency to 10 concurrent requests.
Sourcepub async fn batch_rename_objects(
&self,
bucket: &str,
renames: &[(String, String)],
) -> Result<BatchResult<ObjectDetails>>
pub async fn batch_rename_objects( &self, bucket: &str, renames: &[(String, String)], ) -> Result<BatchResult<ObjectDetails>>
Batch rename objects within a bucket (copy to new key, then delete old key). Uses a semaphore to limit concurrency to 10 concurrent requests.
Source§impl OssClient
impl OssClient
Sourcepub async fn create_bucket(
&self,
bucket_key: &str,
policy: RetentionPolicy,
region: Region,
) -> Result<Bucket>
pub async fn create_bucket( &self, bucket_key: &str, policy: RetentionPolicy, region: Region, ) -> Result<Bucket>
Create a new bucket
Sourcepub async fn list_buckets(&self) -> Result<Vec<BucketItem>>
pub async fn list_buckets(&self) -> Result<Vec<BucketItem>>
List all buckets from all regions
Queries US and EMEA regions concurrently with a per-region timeout to avoid hanging when one region is slow or unreachable.
Sourcepub async fn list_buckets_streaming(&self) -> Vec<RegionResult>
pub async fn list_buckets_streaming(&self) -> Vec<RegionResult>
List buckets from all regions, returning results per-region as they complete.
Uses tokio::select! so whichever region finishes first yields its
RegionResult immediately. The caller can display partial results
while waiting for slower regions.
Sourcepub async fn get_bucket_details(&self, bucket_key: &str) -> Result<Bucket>
pub async fn get_bucket_details(&self, bucket_key: &str) -> Result<Bucket>
Get bucket details
Sourcepub async fn delete_bucket(&self, bucket_key: &str) -> Result<()>
pub async fn delete_bucket(&self, bucket_key: &str) -> Result<()>
Delete a bucket
Source§impl OssClient
impl OssClient
Sourcepub async fn upload_multipart(
&self,
bucket_key: &str,
object_key: &str,
file_path: &Path,
resume: bool,
) -> Result<ObjectInfo>
pub async fn upload_multipart( &self, bucket_key: &str, object_key: &str, file_path: &Path, resume: bool, ) -> Result<ObjectInfo>
Upload a large file using multipart upload with resume capability
Source§impl OssClient
impl OssClient
Sourcepub async fn upload_object(
&self,
bucket_key: &str,
object_key: &str,
file_path: &Path,
) -> Result<ObjectInfo>
pub async fn upload_object( &self, bucket_key: &str, object_key: &str, file_path: &Path, ) -> Result<ObjectInfo>
Upload a file to a bucket using S3 signed URLs Automatically uses multipart upload for files larger than 5MB
Sourcepub async fn upload_object_with_options(
&self,
bucket_key: &str,
object_key: &str,
file_path: &Path,
resume: bool,
) -> Result<ObjectInfo>
pub async fn upload_object_with_options( &self, bucket_key: &str, object_key: &str, file_path: &Path, resume: bool, ) -> Result<ObjectInfo>
Upload a file with resume option If resume is true, will attempt to resume an interrupted upload
Sourcepub async fn download_object(
&self,
bucket_key: &str,
object_key: &str,
output_path: &Path,
) -> Result<()>
pub async fn download_object( &self, bucket_key: &str, object_key: &str, output_path: &Path, ) -> Result<()>
Download an object from a bucket using S3 signed URLs (new API)
Sourcepub async fn download_object_to_writer(
&self,
bucket_key: &str,
object_key: &str,
writer: &mut (impl AsyncWrite + Unpin),
) -> Result<()>
pub async fn download_object_to_writer( &self, bucket_key: &str, object_key: &str, writer: &mut (impl AsyncWrite + Unpin), ) -> Result<()>
Download an object and stream it to any async writer (stdout, file, etc.)
Sourcepub async fn list_objects(&self, bucket_key: &str) -> Result<Vec<ObjectItem>>
pub async fn list_objects(&self, bucket_key: &str) -> Result<Vec<ObjectItem>>
List objects in a bucket
Sourcepub async fn delete_object(
&self,
bucket_key: &str,
object_key: &str,
) -> Result<()>
pub async fn delete_object( &self, bucket_key: &str, object_key: &str, ) -> Result<()>
Delete an object from a bucket
Sourcepub async fn get_object_details(
&self,
bucket_key: &str,
object_key: &str,
) -> Result<ObjectDetails>
pub async fn get_object_details( &self, bucket_key: &str, object_key: &str, ) -> Result<ObjectDetails>
Get detailed metadata for an object without downloading it
Returns extended information including size, SHA1 hash, content type, and timestamps.
Sourcepub async fn get_signed_download_url(
&self,
bucket_key: &str,
object_key: &str,
minutes_expiration: Option<u32>,
) -> Result<SignedS3DownloadResponse>
pub async fn get_signed_download_url( &self, bucket_key: &str, object_key: &str, minutes_expiration: Option<u32>, ) -> Result<SignedS3DownloadResponse>
Get a signed S3 URL for direct download (bypasses OSS servers)
The signed URL expires in 2 minutes by default.
Sourcepub async fn get_signed_upload_url(
&self,
bucket_key: &str,
object_key: &str,
parts: Option<u32>,
minutes_expiration: Option<u32>,
) -> Result<SignedS3UploadResponse>
pub async fn get_signed_upload_url( &self, bucket_key: &str, object_key: &str, parts: Option<u32>, minutes_expiration: Option<u32>, ) -> Result<SignedS3UploadResponse>
Get a signed S3 URL for direct upload (bypasses OSS servers)
The signed URL expires in 2 minutes by default. Returns an upload key that must be used to complete the upload.
Sourcepub async fn complete_signed_upload(
&self,
bucket_key: &str,
object_key: &str,
upload_key: &str,
) -> Result<ObjectInfo>
pub async fn complete_signed_upload( &self, bucket_key: &str, object_key: &str, upload_key: &str, ) -> Result<ObjectInfo>
Complete an S3 signed upload
Source§impl OssClient
impl OssClient
Sourcepub fn new(config: Config, auth: AuthClient) -> Self
pub fn new(config: Config, auth: AuthClient) -> Self
Create a new OSS client
Sourcepub fn new_with_http_config(
config: Config,
auth: AuthClient,
http_config: HttpClientConfig,
) -> Self
pub fn new_with_http_config( config: Config, auth: AuthClient, http_config: HttpClientConfig, ) -> Self
Create a new OSS client with custom HTTP config