Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Simple Storage Service (aka S3) client to perform bucket and object operations.

If credential provider is passed, all S3 operation requests are signed using AWS Signature Version 4; else they are performed anonymously.

Implementations§

Source§

impl Client

Source

pub fn append_object<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, data: SegmentedBytes, offset_bytes: u64, ) -> AppendObject

Creates a AppendObject request builder to append data to the end of an (existing) object. This is a lower-level API that performs a non-multipart object upload.

To execute the request, call AppendObject::send(), which returns a Result containing a AppendObjectResponse.

🛈 This operation is not supported for regular non-express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::{AppendObjectResponse, PutObjectResponse};
use minio::s3::segmented_bytes::SegmentedBytes;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let data1: SegmentedBytes = SegmentedBytes::from("aaaa".to_string());
    let data2: SegmentedBytes = SegmentedBytes::from("bbbb".to_string());
    let resp: PutObjectResponse = client
        .put_object("bucket-name", "object-name", data1)
        .send().await.unwrap();
    let offset_bytes = 4; // the offset at which to append the data
    let resp: AppendObjectResponse = client
        .append_object("bucket-name", "object-name", data2, offset_bytes)
        .send().await.unwrap();
    println!("size of the final object is {} bytes", resp.object_size);
}
Source

pub fn append_object_content<S1: Into<String>, S2: Into<String>, C: Into<ObjectContent>>( &self, bucket: S1, object: S2, content: C, ) -> AppendObjectContent

Creates an AppendObjectContent request builder to append data to the end of an (existing) object. The content is streamed and appended to MinIO/S3. This is a higher-level API that handles multipart appends transparently.

To execute the request, call AppendObjectContent::send(), which returns a Result containing a AppendObjectResponse.

🛈 This operation is not supported for regular non-express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::{AppendObjectResponse, PutObjectResponse};
use minio::s3::builders::ObjectContent;
use minio::s3::segmented_bytes::SegmentedBytes;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
let client: Client = Default::default(); // configure your client here
    let data1: SegmentedBytes = SegmentedBytes::from("aaaa".to_string());
    let content2: String = "bbbb".to_string();
    let resp: PutObjectResponse = client
        .put_object("bucket-name", "object-name", data1)
        .send().await.unwrap();
    let resp: AppendObjectResponse = client
        .append_object_content("bucket-name", "object-name", content2)
        .send().await.unwrap();
    println!("size of the final object is {} bytes", resp.object_size);
}
Source§

impl Client

Source

pub fn bucket_exists<S: Into<String>>(&self, bucket: S) -> BucketExists

Creates a BucketExists request builder to check if a bucket exists in S3.

To execute the request, call BucketExists::send(), which returns a Result containing a BucketExistsResponse.

§Example
use minio::s3::Client;
use minio::s3::response::BucketExistsResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: BucketExistsResponse = client
        .bucket_exists("bucket-name")
        .send().await.unwrap();
    println!("bucket '{}' exists: {}", resp.bucket, resp.exists);
}
Source§

impl Client

Source

pub fn upload_part_copy<S1: Into<String>, S2: Into<String>, S3: Into<String>>( &self, bucket: S1, object: S2, upload_id: S3, ) -> UploadPartCopy

Creates a UploadPartCopy request builder. See UploadPartCopy S3 API

To execute the request, call UploadPartCopy::send(), which returns a Result containing a UploadPartCopyResponse.

§Example
use minio::s3::Client;
use minio::s3::response::{UploadPartCopyResponse};
use minio::s3::segmented_bytes::SegmentedBytes;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let data1: SegmentedBytes = SegmentedBytes::from("aaaa".to_string());
    todo!();
    let resp: UploadPartCopyResponse = client
        .upload_part_copy("bucket-name", "object-name", "TODO")
        .send().await.unwrap();
    println!("uploaded {}", resp.object);
}
Source

pub fn copy_object<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> CopyObject

copy object is a higher-level API that calls stat_object and based on the results calls compose_object to copy the object.

Source

pub fn compose_object<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, sources: Vec<ComposeSource>, ) -> ComposeObject

compose object is higher-level API that calls an internal compose object, and if that call fails, it calls ’abort_multipart_upload`.

Source§

impl Client

Source

pub fn create_bucket<S: Into<String>>(&self, bucket: S) -> CreateBucket

Creates a CreateBucket request builder.

To execute the request, call CreateBucket::send(), which returns a Result containing a CreateBucketResponse.

§Example
use minio::s3::Client;
use minio::s3::response::CreateBucketResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: CreateBucketResponse = client
        .create_bucket("bucket-name")
        .send().await.unwrap();
    println!("Made bucket '{}' in region '{}'", resp.bucket, resp.region);
}
Source§

impl Client

Source

pub fn delete_bucket<S: Into<String>>(&self, bucket: S) -> DeleteBucket

Creates a DeleteBucket request builder.

To execute the request, call DeleteBucket::send(), which returns a Result containing a DeleteBucketResponse.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketResponse =
        client.delete_bucket("bucket-name").send().await.unwrap();
    println!("bucket '{}' in region '{}' is removed", resp.bucket, resp.region);
}
Source

pub async fn delete_and_purge_bucket<S: Into<String>>( &self, bucket: S, ) -> Result<DeleteBucketResponse, Error>

Deletes a bucket and also deletes non-empty buckets by first removing all objects before deleting the bucket. Bypasses governance mode and legal hold.

Source§

impl Client

Source

pub fn delete_bucket_encryption<S: Into<String>>( &self, bucket: S, ) -> DeleteBucketEncryption

Creates a DeleteBucketEncryption request builder.

To execute the request, call DeleteBucketEncryption::send(), which returns a Result containing a BucketExistsResponse.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketEncryptionResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketEncryptionResponse = client
        .delete_bucket_encryption("bucket-name")
        .send().await.unwrap();
    println!("bucket '{}' is deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_bucket_lifecycle<S: Into<String>>( &self, bucket: S, ) -> DeleteBucketLifecycle

Creates a DeleteBucketLifecycle request builder.

To execute the request, call DeleteBucketLifecycle::send(), which returns a Result containing a DeleteBucketLifecycleResponse.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketLifecycleResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketLifecycleResponse = client
        .delete_bucket_lifecycle("bucket-name")
        .send().await.unwrap();
    println!("lifecycle of bucket '{}' is deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_bucket_notification<S: Into<String>>( &self, bucket: S, ) -> DeleteBucketNotification

Creates a DeleteBucketNotification request builder.

To execute the request, call DeleteBucketNotification::send(), which returns a Result containing a DeleteBucketNotificationResponse.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketNotificationResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketNotificationResponse = client
        .delete_bucket_notification("bucket-name")
        .send().await.unwrap();
    println!("notification of bucket '{}' is deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_bucket_policy<S: Into<String>>( &self, bucket: S, ) -> DeleteBucketPolicy

Creates a DeleteBucketPolicy request builder.

To execute the request, call DeleteBucketPolicy::send(), which returns a Result containing a DeleteBucketPolicyResponse.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketPolicyResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketPolicyResponse = client
        .delete_bucket_policy("bucket-name")
        .send().await.unwrap();
    println!("policy of bucket '{}' is deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_bucket_replication<S: Into<String>>( &self, bucket: S, ) -> DeleteBucketReplication

Creates a DeleteBucketReplication request builder.

To execute the request, call DeleteBucketReplication::send(), which returns a Result containing a DeleteBucketReplicationResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketReplicationResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketReplicationResponse = client
        .delete_bucket_replication("bucket-name")
        .send().await.unwrap();
    println!("replication of bucket '{}' is deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_bucket_tagging<S: Into<String>>( &self, bucket: S, ) -> DeleteBucketTagging

Creates a DeleteBucketTagging request builder.

To execute the request, call DeleteBucketTagging::send(), which returns a Result containing a DeleteBucketTagsResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteBucketTaggingResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteBucketTaggingResponse = client
        .delete_bucket_tagging("bucket-name")
        .send().await.unwrap();
    println!("tags of bucket '{}' are deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_object_lock_config<S: Into<String>>( &self, bucket: S, ) -> DeleteObjectLockConfig

Creates a DeleteObjectLockConfig request builder.

To execute the request, call DeleteObjectLockConfig::send(), which returns a Result containing a DeleteObjectLockConfigResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::{DeleteObjectLockConfigResponse, CreateBucketResponse, PutObjectLockConfigResponse};
use minio::s3::types::{S3Api, ObjectLockConfig, RetentionMode};

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let bucket_name = "bucket-name";

    let resp: CreateBucketResponse =
        client.create_bucket(bucket_name).object_lock(true).send().await.unwrap();
    println!("created bucket '{}' with object locking enabled", resp.bucket);

    const DURATION_DAYS: i32 = 7;
    let config = ObjectLockConfig::new(RetentionMode::GOVERNANCE, Some(DURATION_DAYS), None).unwrap();

    let resp: PutObjectLockConfigResponse =     
        client.put_object_lock_config(bucket_name).config(config).send().await.unwrap();
    println!("configured object locking for bucket '{}'", resp.bucket);

    let resp: DeleteObjectLockConfigResponse =
        client.delete_object_lock_config(bucket_name).send().await.unwrap();
    println!("object locking of bucket '{}' is deleted", resp.bucket);
}
Source§

impl Client

Source

pub fn delete_object_tagging<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> DeleteObjectTagging

Creates a DeleteObjectTagging request builder.

To execute the request, call DeleteObjectTagging::send(), which returns a Result containing a DeleteObjectTagsResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteObjectTaggingResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: DeleteObjectTaggingResponse = client
        .delete_object_tagging("bucket-name", "object_name")
        .send().await.unwrap();
    println!("legal hold of object '{}' in bucket '{}' is deleted", resp.object, resp.bucket);
}
Source§

impl Client

Source

pub fn delete_object<S: Into<String>, D: Into<ObjectToDelete>>( &self, bucket: S, object: D, ) -> DeleteObject

Creates a DeleteObject request builder to delete a single object from an S3 bucket.

To execute the request, call DeleteObject::send(), which returns a Result containing a DeleteObjectResponse.

§Example
use minio::s3::Client;
use minio::s3::response::DeleteObjectResponse;
use minio::s3::builders::ObjectToDelete;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
let client: Client = Default::default(); // configure your client here
    let resp: DeleteObjectResponse = client
        .delete_object("bucket-name", ObjectToDelete::from("object-name"))
        .send().await.unwrap();
    println!("the object is deleted. The delete marker has version '{:?}'", resp.version_id);
}
Source

pub fn delete_objects<S: Into<String>, D: Into<ObjectToDelete>>( &self, bucket: S, object: Vec<ObjectToDelete>, ) -> DeleteObjects

Creates a DeleteObjects request builder to delete multiple objects from an S3 bucket.

To execute the request, call DeleteObjects::send(), which returns a Result containing a DeleteObjectsResponse.

Source

pub fn delete_objects_streaming<S: Into<String>, D: Into<ObjectsStream>>( &self, bucket: S, objects: D, ) -> DeleteObjectsStreaming

Creates a DeleteObjectsStreaming request builder to delete a stream of objects from an S3 bucket.

to execute the request, call DeleteObjectsStreaming::to_stream(), which returns a Result containing a DeleteObjectsResponse.

Source§

impl Client

Source

pub fn get_bucket_encryption<S: Into<String>>( &self, bucket: S, ) -> GetBucketEncryption

Creates a GetBucketEncryption request builder.

To execute the request, call GetBucketEncryption::send(), which returns a Result containing a GetBucketEncryptionResponse.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketEncryptionResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketEncryptionResponse = client
        .get_bucket_encryption("bucket-name")
        .send().await.unwrap();
    println!("retrieved SseConfig '{:?}' from bucket '{}'", resp.config, resp.bucket);
}
Source§

impl Client

Source

pub fn get_bucket_lifecycle<S: Into<String>>( &self, bucket: S, ) -> GetBucketLifecycle

Creates a GetBucketLifecycle request builder.

To execute the request, call GetBucketLifecycle::send(), which returns a Result containing a GetBucketLifecycleResponse.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketLifecycleResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketLifecycleResponse = client
        .get_bucket_lifecycle("bucket-name")
        .send().await.unwrap();
    println!("retrieved bucket lifecycle config '{:?}' from bucket '{}'", resp.config, resp.bucket);
}
Source§

impl Client

Source

pub fn get_bucket_notification<S: Into<String>>( &self, bucket: S, ) -> GetBucketNotification

Creates a GetBucketNotification request builder.

To execute the request, call GetBucketNotification::send(), which returns a Result containing a GetBucketNotificationResponse.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketNotificationResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketNotificationResponse = client
        .get_bucket_notification("bucket-name")
        .send().await.unwrap();
    println!("retrieved bucket notification config '{:?}' from bucket '{}'", resp.config, resp.bucket);
}
Source§

impl Client

Source

pub fn get_bucket_policy<S: Into<String>>(&self, bucket: S) -> GetBucketPolicy

Creates a GetBucketPolicy request builder.

To execute the request, call GetBucketPolicy::send(), which returns a Result containing a GetBucketPolicyResponse.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketPolicyResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketPolicyResponse = client
        .get_bucket_policy("bucket-name")
        .send().await.unwrap();
    println!("retrieved bucket policy config '{:?}' from bucket '{}'", resp.config, resp.bucket);
}
Source§

impl Client

Source

pub fn get_bucket_replication<S: Into<String>>( &self, bucket: S, ) -> GetBucketReplication

Creates a GetBucketReplication request builder.

To execute the request, call GetBucketReplication::send(), which returns a Result containing a GetBucketReplicationResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketReplicationResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketReplicationResponse = client
        .get_bucket_replication("bucket-name")
        .send().await.unwrap();
    println!("retrieved bucket replication config '{:?}' from bucket '{}'", resp.config, resp.bucket);
}
Source§

impl Client

Source

pub fn get_bucket_tagging<S: Into<String>>(&self, bucket: S) -> GetBucketTagging

Creates a GetBucketTagging request builder.

To execute the request, call GetBucketTags::send(), which returns a Result containing a GetBucketTagsResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketTaggingResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketTaggingResponse = client
        .get_bucket_tagging("bucket-name")
        .send().await.unwrap();
    println!("retrieved bucket tags '{:?}' from bucket '{}'", resp.tags, resp.bucket);
}
Source§

impl Client

Source

pub fn get_bucket_versioning<S: Into<String>>( &self, bucket: S, ) -> GetBucketVersioning

Creates a GetBucketVersioning request builder.

To execute the request, call GetBucketVersioning::send(), which returns a Result containing a GetBucketVersioningResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetBucketVersioningResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetBucketVersioningResponse = client
        .get_bucket_versioning("bucket-name")
        .send().await.unwrap();
    println!("retrieved versioning status '{:?}' from bucket '{}'", resp.status, resp.bucket);
}
Source§

impl Client

Source

pub fn get_object<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> GetObject

Creates a GetObject request builder to download an object from a specified S3 bucket. This allows retrieval of the full content and metadata for the object.

To execute the request, call GetObject::send(), which returns a Result containing a GetObjectResponse.

For more information, refer to the AWS S3 GetObject API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::GetObjectResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetObjectResponse = client
        .get_object("bucket-name", "object-name")
        .send().await.unwrap();
    let content_bytes = resp.content.to_segmented_bytes().await.unwrap().to_bytes();
    let content_str = String::from_utf8(content_bytes.to_vec()).unwrap();
    println!("retrieved content '{content_str}'");
}
Source§

impl Client

Creates a GetObjectLegalHold request builder.

To execute the request, call GetObjectLegalHold::send(), which returns a Result containing a GetObjectLegalHoldResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetObjectLegalHoldResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetObjectLegalHoldResponse = client
        .get_object_legal_hold("bucket-name", "object-name")
        .send().await.unwrap();
    println!("legal hold of object '{}' in bucket '{}' is enabled: {}", resp.object, resp.bucket, resp.enabled);
}
Source§

impl Client

Source

pub fn get_object_lock_config<S: Into<String>>( &self, bucket: S, ) -> GetObjectLockConfig

Creates a GetObjectLockConfig request builder.

To execute the request, call GetObjectLockConfig::send(), which returns a Result containing a GetObjectLockConfigResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetObjectLockConfigResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetObjectLockConfigResponse = client
        .get_object_lock_config("bucket-name")
        .send().await.unwrap();
    println!("retrieved object lock config '{:?}' from bucket '{}' is enabled", resp.config, resp.bucket);
}
Source§

impl Client

Source

pub fn get_object_prompt<S1: Into<String>, S2: Into<String>, S3: Into<String>>( &self, bucket: S1, object: S2, prompt: S3, ) -> GetObjectPrompt

Creates a GetObjectPrompt request builder. Prompt an object using natural language.

To execute the request, call GetObjectPrompt::send(), which returns a Result containing a GetObjectPromptResponse.

§Example
use minio::s3::Client;
use minio::s3::response::GetObjectPromptResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetObjectPromptResponse = client
        .get_object_prompt("bucket-name", "object-name", "What is it about?")
        .send().await.unwrap();
    println!("the prompt response is: '{}'", resp.prompt_response);
}
Source§

impl Client

Source

pub fn get_object_retention<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> GetObjectRetention

Creates a GetObjectRetention request builder.

To execute the request, call GetObjectRetention::send(), which returns a Result containing a GetObjectRetentionResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetObjectRetentionResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetObjectRetentionResponse = client
        .get_object_retention("bucket-name", "object-name")
        .send().await.unwrap();
    println!("retrieved retention mode '{:?}' until '{:?}' from bucket '{}' is enabled", resp.retention_mode, resp.retain_until_date, resp.bucket);
}
Source§

impl Client

Source

pub fn get_object_tagging<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> GetObjectTagging

Creates a GetObjectTagging request builder.

To execute the request, call GetObjectTagging::send(), which returns a Result containing a GetObjectTaggingResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::GetObjectTaggingResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetObjectTaggingResponse = client
        .get_object_tagging("bucket-name", "object-name")
        .send().await.unwrap();
    println!("retrieved object tags '{:?}' from object '{}' in bucket '{}' is enabled", resp.tags, resp.object, resp.bucket);
}
Source§

impl Client

Source

pub fn get_presigned_object_url<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, method: Method, ) -> GetPresignedObjectUrl

Creates a GetPresignedObjectUrl request builder.

To execute the request, call GetPresignedObjectUrl::send(), which returns a Result containing a GetPresignedObjectUrlResponse.

§Example
use http::Method;
use minio::s3::Client;
use minio::s3::response::GetPresignedObjectUrlResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetPresignedObjectUrlResponse = client
        .get_presigned_object_url("bucket-name", "object-name", Method::GET)
        .send().await.unwrap();
    println!("the presigned url: '{:?}'", resp.url);
}
Source§

impl Client

Source

pub fn get_presigned_post_form_data( &self, policy: PostPolicy, ) -> GetPresignedPolicyFormData

Creates a GetPresignedPolicyFormData request builder.

To execute the request, call GetPresignedPolicyFormData::send(), which returns a HashMap<String, String> with the presigned policy.

§Example
use http::Method;
use std::collections::HashMap;
use chrono::{DateTime, Utc};
use minio::s3::Client;
use minio::s3::types::S3Api;
use minio::s3::builders::PostPolicy;
use minio::s3::utils::utc_now;

pub fn create_post_policy_example(bucket_name: &str, object_name: &str) -> PostPolicy {
    let expiration: DateTime<Utc> = utc_now() + chrono::Duration::days(5);
    let mut policy = PostPolicy::new(&bucket_name, expiration).unwrap();
    policy.add_equals_condition("key", &object_name).unwrap();
    policy
        .add_content_length_range_condition(1024 * 1024, 4 * 1024 * 1024)
        .unwrap();
    policy
}

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let policy: PostPolicy = create_post_policy_example("bucket-name", "object-name");
    let resp: HashMap<String, String> = client
        .get_presigned_post_form_data(policy)
        .send().await.unwrap();
    println!("presigned post form data: '{:?}'", resp);
}
Source§

impl Client

Source

pub fn get_region<S: Into<String>>(&self, bucket: S) -> GetRegion

Creates a GetRegion request builder.

To execute the request, call GetRegion::send(), which returns a Result containing a GetRegionResponse.

§Example
use minio::s3::Client;
use minio::s3::response::GetRegionResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: GetRegionResponse = client
        .get_region("bucket-name")
        .send().await.unwrap();
    println!("retrieved region '{:?}' for bucket '{}'", resp.region_response, resp.bucket);
}
Source

pub async fn get_region_cached_async<S: Into<String>>( &self, bucket: S, region: &Option<String>, ) -> Result<String, Error>

Retrieves the region for the specified bucket name from the cache. If the region is not found in the cache, it is fetched via a call to S3 or MinIO and then stored in the cache for future lookups.

Source

pub fn get_region_cached( &self, bucket: &str, region: &Option<String>, ) -> Result<String, Error>

Retrieves the region for the specified bucket name from the cache. If the region is not found in the cache, it is fetched via a call to S3 or MinIO and then stored in the cache for future lookups.

Source§

impl Client

Source

pub fn list_buckets(&self) -> ListBuckets

Creates a ListBuckets request builder to retrieve the list of all buckets owned by the authenticated sender of the request.

To execute the request, call ListBuckets::send(), which returns a Result containing a ListBucketsResponse.

For more information, refer to the AWS S3 ListBuckets API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::ListBucketsResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: ListBucketsResponse = client
        .list_buckets()
        .send().await.unwrap();
    println!("retrieved buckets '{:?}'", resp.buckets);
}
Source§

impl Client

Source

pub fn list_objects<S: Into<String>>(&self, bucket: S) -> ListObjects

Creates a ListObjects request builder.

List objects with version information optionally. This function handles pagination and returns a stream of results. Each result corresponds to the response of a single listing API call.

To execute the request, call ListObjects::send(), which returns a Result containing a ListObjectsResponse.

§Example
use minio::s3::Client;
use minio::s3::types::{ToStream, S3Api};

use futures_util::StreamExt;

#[tokio::main]
async fn main() {
   let client: Client = Default::default(); // configure your client here

   let mut resp = client
       .list_objects("bucket-name")
       .recursive(true)
       .use_api_v1(false) // use v2
       .include_versions(true)
       .to_stream().await;

   while let Some(result) = resp.next().await {
       match result {
           Ok(resp) => {
               for item in resp.contents {
                   println!("{:?}", item);
               }
           }
           Err(e) => println!("Error: {:?}", e),
       }
   }
}
Source§

impl Client

Source

pub fn listen_bucket_notification<S: Into<String>>( &self, bucket: S, ) -> ListenBucketNotification

Creates a ListenBucketNotification request builder.

To execute the request, call ListenBucketNotification::send(), which returns a tuple of ListenBucketNotificationResponse and a stream of NotificationRecords. The former contains the HTTP headers returned by the server and the latter is a stream of notification records. In normal operation (when there are no errors), the stream never ends.

§MinIO Extensions

This function is only available in MinIO and not part of the AWS S3 API.

§Example
use minio::s3::Client;
use minio::s3::types::{NotificationRecord, NotificationRecords, S3Api};
use futures_util::StreamExt;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let (_resp, mut event_stream) = client
        .listen_bucket_notification("bucket-name")
        .send().await .unwrap();

    while let Some(event) = event_stream.next().await {
        let event: NotificationRecords = event.unwrap();
        let record: Option<&NotificationRecord> = event.records.first();    
        println!("received a notification record {:#?}", record);
    }
}
Source§

impl Client

Source

pub fn put_bucket_encryption<S: Into<String>>( &self, bucket: S, ) -> PutBucketEncryption

Creates a PutBucketEncryption request builder.

To execute the request, call SetBucketEncryption::send(), which returns a Result containing a SetBucketEncryptionResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::types::SseConfig;
use minio::s3::Client;
use minio::s3::response::PutBucketEncryptionResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let config = SseConfig::default();
    let resp: PutBucketEncryptionResponse = client
        .put_bucket_encryption("bucket-name")
        .sse_config(config)
        .send().await.unwrap();
    println!("set encryption on bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_bucket_lifecycle<S: Into<String>>( &self, bucket: S, ) -> PutBucketLifecycle

Creates a PutBucketLifecycle request builder.

To execute the request, call SetBucketLifecycle::send(), which returns a Result containing a SetBucketLifecycleResponse.

§Example
use std::collections::HashMap;
use minio::s3::Client;
use minio::s3::builders::VersioningStatus;
use minio::s3::response::PutBucketLifecycleResponse;
use minio::s3::types::{Filter, S3Api};
use minio::s3::lifecycle_config::{LifecycleRule, LifecycleConfig};

#[tokio::main]
async fn main() {
let client: Client = Default::default(); // configure your client here

    let rules: Vec<LifecycleRule> = vec![LifecycleRule {
        id: String::from("rule1"),
        filter: Filter {and_operator: None, prefix: Some(String::from("logs/")), tag: None},
        expiration_days: Some(365),
        status: true,
        ..Default::default()
    }];

    let resp: PutBucketLifecycleResponse = client
        .put_bucket_lifecycle("bucket-name")
        .life_cycle_config(LifecycleConfig { rules })
        .send().await.unwrap();
    println!("set bucket replication policy on bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_bucket_notification<S: Into<String>>( &self, bucket: S, ) -> PutBucketNotification

Creates a PutBucketNotification request builder.

To execute the request, call SetBucketNotification::send(), which returns a Result containing a SetBucketNotificationResponse.

§Example
use minio::s3::Client;
use minio::s3::types::{NotificationConfig, PrefixFilterRule, QueueConfig, S3Api, SuffixFilterRule};
use minio::s3::response::PutBucketNotificationResponse;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here

    let config = NotificationConfig {
        cloud_func_config_list: None,
        queue_config_list: Some(vec![QueueConfig {
            events: vec![
                String::from("s3:ObjectCreated:Put"),
                String::from("s3:ObjectCreated:Copy"),
            ],
            id: None,
            prefix_filter_rule: Some(PrefixFilterRule {
                value: String::from("images"),
            }),
            suffix_filter_rule: Some(SuffixFilterRule {
                value: String::from("pg"),
            }),
            queue: String::from("arn:minio:sqs::miniojavatest:webhook"),
        }]),
        topic_config_list: None,
    };

    let resp: PutBucketNotificationResponse = client
        .put_bucket_notification("bucket-name")
        .notification_config(config)
        .send().await.unwrap();
    println!("set bucket notification for bucket '{:?}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_bucket_policy<S: Into<String>>(&self, bucket: S) -> PutBucketPolicy

Creates a PutBucketPolicy request builder.

To execute the request, call SetBucketPolicy::send(), which returns a Result containing a SetBucketPolicyResponse.

§Example
use std::collections::HashMap;
use minio::s3::Client;
use minio::s3::builders::VersioningStatus;
use minio::s3::response::PutBucketPolicyResponse;
use minio::s3::types::{S3Api, AndOperator, Destination, Filter, ReplicationConfig, ReplicationRule};

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
     
    let config = r#"{
        "Version": "2012-10-17",
        "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket"
            ],
            "Resource": "arn:aws:s3:::bucket-name"
        },
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::bucket-name/*"
        }]
    }"#;

    let resp: PutBucketPolicyResponse = client
        .put_bucket_policy("bucket-name")
        .config(config.to_owned())
        .send().await.unwrap();
    println!("set bucket replication policy on bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_bucket_replication<S: Into<String>>( &self, bucket: S, ) -> PutBucketReplication

Creates a PutBucketReplication request builder.

To execute the request, call SetBucketReplication::send(), which returns a Result containing a SetBucketReplicationResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::builders::VersioningStatus;
use minio::s3::response::PutBucketReplicationResponse;
use minio::s3::types::{S3Api, AndOperator, Destination, Filter, ReplicationConfig, ReplicationRule};

use std::collections::HashMap;

#[tokio::main]
async fn main() {
let client: Client = Default::default(); // configure your client here
     
    let mut tags: HashMap<String, String> = HashMap::new();  
    tags.insert(String::from("key1"), String::from("value1"));
    tags.insert(String::from("key2"), String::from("value2"));

    let mut rules: Vec<ReplicationRule> = Vec::new();
    rules.push(ReplicationRule {
        destination: Destination {
            bucket_arn: String::from("REPLACE-WITH-ACTUAL-DESTINATION-BUCKET-ARN"),
            access_control_translation: None,
            account: None,
            encryption_config: None,
            metrics: None,
            replication_time: None,
            storage_class: None,
        },
        delete_marker_replication_status: None,
        existing_object_replication_status: None,
        filter: Some(Filter {
            and_operator: Some(AndOperator {
                prefix: Some(String::from("TaxDocs")),
                tags: Some(tags),
            }),
            prefix: None,
            tag: None,
        }),
        id: Some(String::from("rule1")),
        prefix: None,
        priority: Some(1),
        source_selection_criteria: None,
        delete_replication_status: Some(false),
        status: true,
    });

    let resp: PutBucketReplicationResponse = client
        .put_bucket_replication("bucket-name")
        .replication_config(ReplicationConfig {role: None, rules})
        .send().await.unwrap();
    println!("enabled versioning on bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_bucket_tagging<S: Into<String>>(&self, bucket: S) -> PutBucketTagging

Creates a PutBucketTagging request builder.

To execute the request, call PutBucketTagging::send(), which returns a Result containing a PutBucketTaggingResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::builders::VersioningStatus;
use minio::s3::response::PutBucketTaggingResponse;
use minio::s3::types::S3Api;

use std::collections::HashMap;

#[tokio::main]
async fn main() {
let client: Client = Default::default(); // configure your client here

    let mut tags: HashMap<String, String> = HashMap::new();
    tags.insert(String::from("Project"), String::from("Project One"));
    tags.insert(String::from("User"), String::from("jsmith"));

    let resp: PutBucketTaggingResponse = client
        .put_bucket_tagging("bucket-name")
        .tags(tags)
        .send().await.unwrap();
    println!("set tags on bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_bucket_versioning<S: Into<String>>( &self, bucket: S, ) -> PutBucketVersioning

Creates a PutBucketVersioning request builder.

To execute the request, call SetBucketVersioning::send(), which returns a Result containing a SetBucketVersioningResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::builders::VersioningStatus;
use minio::s3::response::PutBucketVersioningResponse;
use minio::s3::types::{S3Api, ObjectLockConfig, RetentionMode};

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
     
    let resp: PutBucketVersioningResponse = client
        .put_bucket_versioning("bucket-name")
        .versioning_status(VersioningStatus::Enabled)
        .send().await.unwrap();
    println!("enabled versioning on bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_object<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, data: SegmentedBytes, ) -> PutObject

Creates a PutObject request builder to upload an object to a specified bucket in S3-compatible storage. This method performs a simple, non-multipart upload of the provided content as an object.

For handling large files requiring multipart upload, see create_multipart_upload.

To execute the request, call PutObject::send(), which returns a Result containing a PutObjectResponse.

For more information, refer to the AWS S3 PutObject API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::PutObjectResponse;
use minio::s3::types::S3Api;
use minio::s3::segmented_bytes::SegmentedBytes;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let data = SegmentedBytes::from("Hello world".to_string());
    let resp: PutObjectResponse =
        client.put_object("bucket-name", "object-name", data).send().await.unwrap();
    println!("successfully put object '{}'", resp.object);
}
Source

pub fn create_multipart_upload<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> CreateMultipartUpload

Creates a CreateMultipartUpload request builder to initiate a new multipart upload for a specified object in a bucket. This allows uploading large objects as a series of parts, which can be uploaded independently and in parallel.

To execute the request, call CreateMultipartUpload::send(), which returns a Result containing a CreateMultipartUploadResponse.

For more information, refer to the AWS S3 CreateMultipartUpload API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::CreateMultipartUploadResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default();
    let resp: CreateMultipartUploadResponse = client
        .create_multipart_upload("bucket-name", "large-object")
        .send().await.unwrap();
    println!("Initiated multipart upload with UploadId '{}'", resp.upload_id);
}
Source

pub fn abort_multipart_upload<S1: Into<String>, S2: Into<String>, S3: Into<String>>( &self, bucket: S1, object: S2, upload_id: S3, ) -> AbortMultipartUpload

Creates an AbortMultipartUpload request builder to abort an ongoing multipart upload for an object. This operation stops the multipart upload and discards all uploaded parts, freeing storage.

To execute the request, call AbortMultipartUpload::send(), which returns a Result containing a AbortMultipartUploadResponse.

For more information, refer to the AWS S3 AbortMultipartUpload API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::AbortMultipartUploadResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default();
    let resp: AbortMultipartUploadResponse = client
        .abort_multipart_upload("bucket-name", "object-name", "upload-id-123")
        .send().await.unwrap();
    println!("Aborted multipart upload for '{}', upload id '{}'", "object-name", "upload-id-123");
}
Source

pub fn complete_multipart_upload<S1: Into<String>, S2: Into<String>, S3: Into<String>>( &self, bucket: S1, object: S2, upload_id: S3, parts: Vec<PartInfo>, ) -> CompleteMultipartUpload

Creates a CompleteMultipartUpload request builder to complete a multipart upload by assembling previously uploaded parts into a single object. This finalizes the upload and makes the object available in the bucket.

To execute the request, call CompleteMultipartUpload::send(), which returns a Result containing a CompleteMultipartUploadResponse.

For more information, refer to the AWS S3 CompleteMultipartUpload API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::CompleteMultipartUploadResponse;
use minio::s3::types::S3Api;
use minio::s3::types::PartInfo;

#[tokio::main]
async fn main() {
    let client: Client = Default::default();
    let parts: Vec<PartInfo> = vec![]; // fill with your uploaded part info
    let resp: CompleteMultipartUploadResponse = client
        .complete_multipart_upload("bucket-name", "object-name", "upload-id-123", parts)
        .send().await.unwrap();
    println!("Completed multipart upload for '{}'", resp.object);
}
Source

pub fn upload_part<S1: Into<String>, S2: Into<String>, S3: Into<String>>( &self, bucket: S1, object: S2, upload_id: S3, part_number: u16, data: SegmentedBytes, ) -> UploadPart

Creates an UploadPart request builder to upload a single part as part of a multipart upload. Each part is uploaded independently, enabling parallel uploads for large objects.

To execute the request, call UploadPart::send(), which returns a Result containing a UploadPartResponse.

For more information, refer to the AWS S3 UploadPart API documentation.

§Example
use minio::s3::Client;
use minio::s3::response::UploadPartResponse;
use minio::s3::types::S3Api;
use minio::s3::segmented_bytes::SegmentedBytes;

#[tokio::main]
async fn main() {
    let client: Client = Default::default();
    let data = SegmentedBytes::from("Some part data".to_string());
    let resp: UploadPartResponse = client
        .upload_part("bucket-name", "object-name", "upload-id", 1, data)
        .send().await.unwrap();
    println!("Uploaded object: {}", resp.object);
}
Source

pub fn put_object_content<S1: Into<String>, S2: Into<String>, C: Into<ObjectContent>>( &self, bucket: S1, object: S2, content: C, ) -> PutObjectContent

Creates a PutObjectContent request builder to upload data to MinIO/S3, automatically handling multipart uploads for large content. This higher-level API efficiently streams and uploads content, splitting it into parts as needed.

To execute the request, call PutObjectContent::send(), which returns a Result containing a PutObjectContentResponse.

For more information, see the AWS S3 Multipart Upload Overview.

§Example
use minio::s3::Client;
use minio::s3::response::PutObjectContentResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default();
    let content = "Hello, world!".to_string();
    let resp: PutObjectContentResponse = client
        .put_object_content("bucket", "object", content)
        .send().await.unwrap();
    println!("Uploaded object '{}' with ETag '{}'", resp.object, resp.etag);
}
Source§

impl Client

Creates a PutObjectLegalHold request builder.

To execute the request, call DisableObjectLegalHold::send(), which returns a Result containing a DisableObjectLegalHoldResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::PutObjectLegalHoldResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let resp: PutObjectLegalHoldResponse = client
        .put_object_legal_hold("bucket-name", "object-name", true)
        .send().await.unwrap();
    println!("legal hold of bucket '{}' is enabled", resp.bucket);
}
Source§

impl Client

Source

pub fn put_object_lock_config<S: Into<String>>( &self, bucket: S, ) -> PutObjectLockConfig

Creates a PutObjectLockConfig request builder.

To execute the request, call SetObjectLockConfig::send(), which returns a Result containing a SetObjectLockConfigResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::{CreateBucketResponse, PutObjectLockConfigResponse};
use minio::s3::types::{S3Api, ObjectLockConfig, RetentionMode};

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let bucket_name = "bucket-name";

    let resp: CreateBucketResponse =
        client.create_bucket(bucket_name).object_lock(true).send().await.unwrap();
    println!("created bucket '{}' with object locking enabled", resp.bucket);

    const DURATION_DAYS: i32 = 7;
    let config = ObjectLockConfig::new(RetentionMode::GOVERNANCE, Some(DURATION_DAYS), None).unwrap();

    let resp: PutObjectLockConfigResponse =
        client.put_object_lock_config(bucket_name).config(config).send().await.unwrap();
    println!("configured object locking for bucket '{}'", resp.bucket);
}
Source§

impl Client

Source

pub fn put_object_retention<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> PutObjectRetention

Creates a PutObjectRetention request builder.

To execute the request, call SetObjectRetention::send(), which returns a Result containing a SetObjectRetentionResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::PutObjectRetentionResponse;
use minio::s3::builders::ObjectToDelete;
use minio::s3::types::{S3Api, RetentionMode};
use minio::s3::utils::utc_now;

#[tokio::main]
async fn main() {
let client: Client = Default::default(); // configure your client here
    let retain_until_date = utc_now() + chrono::Duration::days(1);
    let resp: PutObjectRetentionResponse = client
        .put_object_retention("bucket-name", "object-name")
        .retention_mode(Some(RetentionMode::GOVERNANCE))
        .retain_until_date(Some(retain_until_date))
        .send().await.unwrap();
    println!("set the object retention for object '{}'", resp.object);
}
Source§

impl Client

Source

pub fn put_object_tagging<S: Into<String>>( &self, bucket: S, object: S, ) -> PutObjectTagging

Creates a PutObjectTagging request builder.

To execute the request, call SetObjectTags::send(), which returns a Result containing a SetObjectTagsResponse.

🛈 This operation is not supported for express buckets.

§Example
use std::collections::HashMap;
use minio::s3::Client;
use minio::s3::response::PutObjectTaggingResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {
let client: Client = Default::default(); // configure your client here
    let tags = HashMap::from([
        (String::from("Project"), String::from("Project One")),
        (String::from("User"), String::from("jsmith")),
    ]);
    let resp: PutObjectTaggingResponse = client
        .put_object_tagging("bucket-name", "object-name")
        .tags(tags)
        .send().await.unwrap();
    println!("set the object tags for object '{}'", resp.object);
}
Source§

impl Client

Source

pub fn select_object_content<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, request: SelectRequest, ) -> SelectObjectContent

Creates a SelectObjectContent request builder.

To execute the request, call SelectObjectContent::send(), which returns a Result containing a SelectObjectContentResponse.

🛈 This operation is not supported for express buckets.

§Example
use minio::s3::Client;
use minio::s3::response::SelectObjectContentResponse;
use minio::s3::types::S3Api;

use minio::s3::types::{SelectRequest, CsvInputSerialization, CsvOutputSerialization, FileHeaderInfo, QuoteFields};

#[tokio::main]
async fn main() {
    let client: Client = Default::default(); // configure your client here
    let request = SelectRequest::new_csv_input_output(
        "select * from S3Object",
        CsvInputSerialization {
            compression_type: None,
            allow_quoted_record_delimiter: false,
            comments: None,
            field_delimiter: None,
            file_header_info: Some(FileHeaderInfo::USE),
            quote_character: None,
            quote_escape_character: None,
            record_delimiter: None,
        },
        CsvOutputSerialization {
            field_delimiter: None,
            quote_character: None,
            quote_escape_character: None,
            quote_fields: Some(QuoteFields::ASNEEDED),
            record_delimiter: None,
        },
    ).unwrap();

    let resp: SelectObjectContentResponse = client
        .select_object_content("bucket-name", "object-name", request)
        .send().await.unwrap();
    println!("the progress: '{:?}'", resp.progress);
}
Source§

impl Client

Source

pub fn stat_object<S1: Into<String>, S2: Into<String>>( &self, bucket: S1, object: S2, ) -> StatObject

Creates a StatObject request builder. Given a bucket and object name, return some statistics.

To execute the request, call StatObject::send(), which returns a Result containing a StatObjectResponse.

§Example
use minio::s3::Client;
use minio::s3::response::StatObjectResponse;
use minio::s3::types::S3Api;

#[tokio::main]
async fn main() {    
    let client: Client = Default::default(); // configure your client here
    let resp: StatObjectResponse =
        client.stat_object("bucket-name", "object-name").send().await.unwrap();
    println!("stat of object '{}' are {:#?}", resp.object, resp);
}
Source§

impl Client

Source

pub fn new( base_url: BaseUrl, provider: Option<Box<dyn Provider + Send + Sync + 'static>>, ssl_cert_file: Option<&Path>, ignore_cert_check: Option<bool>, ) -> Result<Self, Error>

Returns a S3 client with given base URL.

§Examples
use minio::s3::client::Client;
use minio::s3::creds::StaticProvider;
use minio::s3::http::BaseUrl;

let base_url: BaseUrl = "play.min.io".parse().unwrap();
let static_provider = StaticProvider::new(
    "Q3AM3UQ867SPQQA43P2F",
    "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
    None,
);
let client = Client::new(base_url, Some(Box::new(static_provider)), None, None).unwrap();
Source

pub fn is_aws_host(&self) -> bool

Returns whether is client uses an AWS host.

Source

pub fn is_secure(&self) -> bool

Returns whether this client is configured to use HTTPS.

Source

pub fn is_minio_express(&self) -> bool

Returns whether this client is configured to use the express endpoint and is minio enterprise.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Client

Source§

fn default() -> Client

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,