mirror of
https://github.com/minio/minio-rs.git
synced 2025-12-06 15:26:51 +08:00
Bumped rust edition from 2021 to 2024. Only change is some include sorting (#128)
This commit is contained in:
parent
48da7630a9
commit
8134acdd09
@ -1 +1,9 @@
|
|||||||
edition = "2021"
|
# rustfmt doc - https://rust-lang.github.io/rustfmt/
|
||||||
|
|
||||||
|
hard_tabs = false
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
max_width = 100
|
||||||
|
array_width = 60 # default is 60
|
||||||
|
attr_fn_like_width = 70 # default is 70
|
||||||
|
chain_width = 60 # default is 60
|
||||||
|
|||||||
24
Cargo.toml
24
Cargo.toml
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "minio"
|
name = "minio"
|
||||||
version = "0.2.0-alpha"
|
version = "0.2.0-alpha"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
authors = ["MinIO Dev Team <dev@min.io>"]
|
authors = ["MinIO Dev Team <dev@min.io>"]
|
||||||
description = "MinIO SDK for Amazon S3 compatible object storage access"
|
description = "MinIO SDK for Amazon S3 compatible object storage access"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
@ -23,33 +23,33 @@ rustls-tls = ["reqwest/rustls-tls"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-recursion = "1.1.1"
|
async-recursion = "1.1.1"
|
||||||
async-trait = "0.1.86"
|
async-trait = "0.1.87"
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
byteorder = "1.5.0"
|
byteorder = "1.5.0"
|
||||||
bytes = "1.9.0"
|
bytes = "1.10.1"
|
||||||
chrono = "0.4.39"
|
chrono = "0.4.40"
|
||||||
crc = "3.2.1"
|
crc = "3.2.1"
|
||||||
dashmap = "6.1.0"
|
dashmap = "6.1.0"
|
||||||
derivative = "2.2.0"
|
derivative = "2.2.0"
|
||||||
env_logger = "0.11.6"
|
env_logger = "0.11.7"
|
||||||
futures-util = "0.3.31"
|
futures-util = "0.3.31"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
hmac = "0.12.1"
|
hmac = "0.12.1"
|
||||||
home = "0.5.9"
|
#home = "0.5.9"
|
||||||
http = "1.2.0"
|
http = "1.2.0"
|
||||||
hyper = { version = "1.6.0", features = ["full"] }
|
hyper = { version = "1.6.0", features = ["full"] }
|
||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
log = "0.4.25"
|
log = "0.4.26"
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
multimap = "0.10.0"
|
multimap = "0.10.0"
|
||||||
os_info = "3.9.2"
|
os_info = "3.10.0"
|
||||||
percent-encoding = "2.3.1"
|
percent-encoding = "2.3.1"
|
||||||
rand = { version = "0.8.5", features = ["small_rng"] }
|
rand = { version = "0.8.5", features = ["small_rng"] }
|
||||||
regex = "1.11.1"
|
regex = "1.11.1"
|
||||||
serde = { version = "1.0.217", features = ["derive"] }
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
serde_json = "1.0.138"
|
serde_json = "1.0.140"
|
||||||
sha2 = "0.10.8"
|
sha2 = "0.10.8"
|
||||||
tokio = { version = "1.43.0", features = ["full"] }
|
tokio = { version = "1.44.0", features = ["full"] }
|
||||||
tokio-stream = "0.1.17"
|
tokio-stream = "0.1.17"
|
||||||
tokio-util = { version = "0.7.13", features = ["io"] }
|
tokio-util = { version = "0.7.13", features = ["io"] }
|
||||||
urlencoding = "2.1.3"
|
urlencoding = "2.1.3"
|
||||||
@ -57,7 +57,7 @@ xmltree = "0.11.0"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
async-std = { version = "1.13.0", features = ["attributes", "tokio1"] }
|
async-std = { version = "1.13.0", features = ["attributes", "tokio1"] }
|
||||||
clap = { version = "4.5.27", features = ["derive"] }
|
clap = { version = "4.5.31", features = ["derive"] }
|
||||||
quickcheck = "1.0.3"
|
quickcheck = "1.0.3"
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
|
|||||||
@ -16,9 +16,9 @@
|
|||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
||||||
|
use minio::s3::Client;
|
||||||
use minio::s3::response::{GetBucketEncryptionResponse, SetBucketEncryptionResponse};
|
use minio::s3::response::{GetBucketEncryptionResponse, SetBucketEncryptionResponse};
|
||||||
use minio::s3::types::{S3Api, SseConfig};
|
use minio::s3::types::{S3Api, SseConfig};
|
||||||
use minio::s3::Client;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
|||||||
@ -16,11 +16,11 @@
|
|||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
||||||
|
use minio::s3::Client;
|
||||||
use minio::s3::response::{
|
use minio::s3::response::{
|
||||||
DeleteBucketLifecycleResponse, GetBucketLifecycleResponse, SetBucketLifecycleResponse,
|
DeleteBucketLifecycleResponse, GetBucketLifecycleResponse, SetBucketLifecycleResponse,
|
||||||
};
|
};
|
||||||
use minio::s3::types::{Filter, LifecycleConfig, LifecycleRule, S3Api};
|
use minio::s3::types::{Filter, LifecycleConfig, LifecycleRule, S3Api};
|
||||||
use minio::s3::Client;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
|||||||
@ -16,10 +16,10 @@
|
|||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
||||||
|
use minio::s3::Client;
|
||||||
use minio::s3::builders::VersioningStatus;
|
use minio::s3::builders::VersioningStatus;
|
||||||
use minio::s3::response::{GetBucketVersioningResponse, SetBucketVersioningResponse};
|
use minio::s3::response::{GetBucketVersioningResponse, SetBucketVersioningResponse};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
use minio::s3::Client;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
|||||||
@ -16,9 +16,9 @@
|
|||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
||||||
|
use minio::s3::Client;
|
||||||
use minio::s3::builders::ObjectContent;
|
use minio::s3::builders::ObjectContent;
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
use minio::s3::Client;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
@ -15,8 +15,8 @@
|
|||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
use crate::common::{create_bucket_if_not_exists, create_client_on_play};
|
||||||
use minio::s3::builders::ObjectContent;
|
|
||||||
use minio::s3::Client;
|
use minio::s3::Client;
|
||||||
|
use minio::s3::builders::ObjectContent;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
@ -23,13 +23,13 @@ use crate::s3::types::{
|
|||||||
RetentionMode, SelectRequest,
|
RetentionMode, SelectRequest,
|
||||||
};
|
};
|
||||||
use crate::s3::utils::{
|
use crate::s3::utils::{
|
||||||
b64encode, check_bucket_name, merge, to_amz_date, to_http_header_value, to_iso8601utc,
|
Multimap, UtcTime, b64encode, check_bucket_name, merge, to_amz_date, to_http_header_value,
|
||||||
to_signer_date, urlencode, utc_now, Multimap, UtcTime,
|
to_iso8601utc, to_signer_date, urlencode, utc_now,
|
||||||
};
|
};
|
||||||
|
|
||||||
use hyper::http::Method;
|
use hyper::http::Method;
|
||||||
use serde_json::json;
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
use serde_json::json;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub const MIN_PART_SIZE: usize = 5_242_880; // 5 MiB
|
pub const MIN_PART_SIZE: usize = 5_242_880; // 5 MiB
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::BucketCommon;
|
use crate::s3::builders::BucketCommon;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::DeleteBucketEncryptionResponse;
|
use crate::s3::response::DeleteBucketEncryptionResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::check_bucket_name;
|
use crate::s3::utils::check_bucket_name;
|
||||||
use crate::s3::Client;
|
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [delete_bucket_encryption()](Client::delete_bucket_encryption) API
|
/// Argument builder for [delete_bucket_encryption()](Client::delete_bucket_encryption) API
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::BucketCommon;
|
use crate::s3::builders::BucketCommon;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::DeleteBucketLifecycleResponse;
|
use crate::s3::response::DeleteBucketLifecycleResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::check_bucket_name;
|
use crate::s3::utils::check_bucket_name;
|
||||||
use crate::s3::Client;
|
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [delete_bucket_lifecycle()](Client::delete_bucket_lifecycle) API
|
/// Argument builder for [delete_bucket_lifecycle()](Client::delete_bucket_lifecycle) API
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::BucketCommon;
|
use crate::s3::builders::BucketCommon;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::DeleteBucketPolicyResponse;
|
use crate::s3::response::DeleteBucketPolicyResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::check_bucket_name;
|
use crate::s3::utils::check_bucket_name;
|
||||||
use crate::s3::Client;
|
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [delete_bucket_policy()](Client::delete_bucket_policy) API
|
/// Argument builder for [delete_bucket_policy()](Client::delete_bucket_policy) API
|
||||||
|
|||||||
@ -17,7 +17,7 @@ use crate::s3::builders::BucketCommon;
|
|||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::GetBucketEncryptionResponse;
|
use crate::s3::response::GetBucketEncryptionResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::{check_bucket_name, merge, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name, merge};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [get_bucket_encryption()](crate::s3::client::Client::get_bucket_encryption) API
|
/// Argument builder for [get_bucket_encryption()](crate::s3::client::Client::get_bucket_encryption) API
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::BucketCommon;
|
use crate::s3::builders::BucketCommon;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::GetBucketLifecycleResponse;
|
use crate::s3::response::GetBucketLifecycleResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::check_bucket_name;
|
use crate::s3::utils::check_bucket_name;
|
||||||
use crate::s3::Client;
|
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [get_bucket_lifecycle()](Client::get_bucket_lifecycle) API
|
/// Argument builder for [get_bucket_lifecycle()](Client::get_bucket_lifecycle) API
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::BucketCommon;
|
use crate::s3::builders::BucketCommon;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::GetBucketPolicyResponse;
|
use crate::s3::response::GetBucketPolicyResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::check_bucket_name;
|
use crate::s3::utils::check_bucket_name;
|
||||||
use crate::s3::Client;
|
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [get_bucket_policy()](Client::get_bucket_policy) API
|
/// Argument builder for [get_bucket_policy()](Client::get_bucket_policy) API
|
||||||
|
|||||||
@ -17,7 +17,7 @@ use crate::s3::builders::BucketCommon;
|
|||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::GetBucketVersioningResponse;
|
use crate::s3::response::GetBucketVersioningResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::{check_bucket_name, merge, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name, merge};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
/// Argument builder for [get_bucket_versioning()](crate::s3::client::Client::get_bucket_versioning) API
|
/// Argument builder for [get_bucket_versioning()](crate::s3::client::Client::get_bucket_versioning) API
|
||||||
|
|||||||
@ -21,7 +21,7 @@ use crate::s3::{
|
|||||||
response::GetObjectResponse,
|
response::GetObjectResponse,
|
||||||
sse::{Sse, SseCustomerKey},
|
sse::{Sse, SseCustomerKey},
|
||||||
types::{S3Api, S3Request, ToS3Request},
|
types::{S3Api, S3Request, ToS3Request},
|
||||||
utils::{check_bucket_name, merge, to_http_header_value, Multimap, UtcTime},
|
utils::{Multimap, UtcTime, check_bucket_name, merge, to_http_header_value},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Argument builder for [list_objects()](Client::get_object) API.
|
/// Argument builder for [list_objects()](Client::get_object) API.
|
||||||
|
|||||||
@ -17,10 +17,10 @@ use http::Method;
|
|||||||
|
|
||||||
use crate::s3::response::ListBucketsResponse;
|
use crate::s3::response::ListBucketsResponse;
|
||||||
use crate::s3::{
|
use crate::s3::{
|
||||||
|
Client,
|
||||||
error::Error,
|
error::Error,
|
||||||
types::{S3Api, S3Request, ToS3Request},
|
types::{S3Api, S3Request, ToS3Request},
|
||||||
utils::Multimap,
|
utils::Multimap,
|
||||||
Client,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Argument builder for [list_buckets()](Client::list_buckets) API.
|
/// Argument builder for [list_buckets()](Client::list_buckets) API.
|
||||||
|
|||||||
@ -13,18 +13,18 @@
|
|||||||
//! Argument builders for ListObject APIs.
|
//! Argument builders for ListObject APIs.
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use futures_util::{stream as futures_stream, Stream, StreamExt};
|
use futures_util::{Stream, StreamExt, stream as futures_stream};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
use crate::s3::{
|
use crate::s3::{
|
||||||
client::Client,
|
client::Client,
|
||||||
error::Error,
|
error::Error,
|
||||||
|
response::ListObjectsResponse,
|
||||||
response::list_objects::{
|
response::list_objects::{
|
||||||
ListObjectVersionsResponse, ListObjectsV1Response, ListObjectsV2Response,
|
ListObjectVersionsResponse, ListObjectsV1Response, ListObjectsV2Response,
|
||||||
},
|
},
|
||||||
response::ListObjectsResponse,
|
|
||||||
types::{S3Api, S3Request, ToS3Request, ToStream},
|
types::{S3Api, S3Request, ToS3Request, ToStream},
|
||||||
utils::{check_bucket_name, merge, Multimap},
|
utils::{Multimap, check_bucket_name, merge},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn add_common_list_objects_query_params(
|
fn add_common_list_objects_query_params(
|
||||||
|
|||||||
@ -22,7 +22,7 @@ use crate::s3::{
|
|||||||
error::Error,
|
error::Error,
|
||||||
response::ListenBucketNotificationResponse,
|
response::ListenBucketNotificationResponse,
|
||||||
types::{NotificationRecords, S3Api, S3Request, ToS3Request},
|
types::{NotificationRecords, S3Api, S3Request, ToS3Request},
|
||||||
utils::{check_bucket_name, merge, Multimap},
|
utils::{Multimap, check_bucket_name, merge},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Argument builder for
|
/// Argument builder for
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
use crate::s3::builders::SegmentedBytes;
|
use crate::s3::builders::SegmentedBytes;
|
||||||
use crate::s3::sse::{Sse, SseCustomerKey};
|
use crate::s3::sse::{Sse, SseCustomerKey};
|
||||||
use crate::s3::utils::{check_bucket_name, merge, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name, merge};
|
||||||
use crate::s3::{
|
use crate::s3::{
|
||||||
client::Client,
|
client::Client,
|
||||||
error::Error,
|
error::Error,
|
||||||
|
|||||||
@ -29,7 +29,7 @@ use crate::s3::{
|
|||||||
},
|
},
|
||||||
sse::Sse,
|
sse::Sse,
|
||||||
types::{PartInfo, Retention, S3Api, S3Request, ToS3Request},
|
types::{PartInfo, Retention, S3Api, S3Request, ToS3Request},
|
||||||
utils::{check_bucket_name, md5sum_hash, merge, to_iso8601utc, urlencode, Multimap},
|
utils::{Multimap, check_bucket_name, md5sum_hash, merge, to_iso8601utc, urlencode},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{ObjectContent, SegmentedBytes};
|
use super::{ObjectContent, SegmentedBytes};
|
||||||
|
|||||||
@ -19,17 +19,17 @@ use std::pin::Pin;
|
|||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use futures_util::{stream as futures_stream, Stream, StreamExt};
|
use futures_util::{Stream, StreamExt, stream as futures_stream};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
use tokio_stream::iter as stream_iter;
|
use tokio_stream::iter as stream_iter;
|
||||||
|
|
||||||
use crate::s3::{
|
use crate::s3::{
|
||||||
|
Client,
|
||||||
client_core::ClientCore,
|
client_core::ClientCore,
|
||||||
error::Error,
|
error::Error,
|
||||||
response::{RemoveObjectResponse, RemoveObjectsResponse},
|
response::{RemoveObjectResponse, RemoveObjectsResponse},
|
||||||
types::{S3Api, S3Request, ToS3Request, ToStream},
|
types::{S3Api, S3Request, ToS3Request, ToStream},
|
||||||
utils::{check_bucket_name, md5sum_hash, merge, Multimap},
|
utils::{Multimap, check_bucket_name, md5sum_hash, merge},
|
||||||
Client,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Specify an object to be deleted. The object can be specified by key or by
|
/// Specify an object to be deleted. The object can be specified by key or by
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::SegmentedBytes;
|
use crate::s3::builders::SegmentedBytes;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::SetBucketEncryptionResponse;
|
use crate::s3::response::SetBucketEncryptionResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, SseConfig, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, SseConfig, ToS3Request};
|
||||||
use crate::s3::utils::{check_bucket_name, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name};
|
||||||
use crate::s3::Client;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::SegmentedBytes;
|
use crate::s3::builders::SegmentedBytes;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::SetBucketLifecycleResponse;
|
use crate::s3::response::SetBucketLifecycleResponse;
|
||||||
use crate::s3::types::{LifecycleConfig, S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{LifecycleConfig, S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::{check_bucket_name, md5sum_hash, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name, md5sum_hash};
|
||||||
use crate::s3::Client;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::SegmentedBytes;
|
use crate::s3::builders::SegmentedBytes;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::SetBucketLifecycleResponse;
|
use crate::s3::response::SetBucketLifecycleResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::{check_bucket_name, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name};
|
||||||
use crate::s3::Client;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use crate::s3::Client;
|
||||||
use crate::s3::builders::SegmentedBytes;
|
use crate::s3::builders::SegmentedBytes;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::response::SetBucketVersioningResponse;
|
use crate::s3::response::SetBucketVersioningResponse;
|
||||||
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
use crate::s3::types::{S3Api, S3Request, ToS3Request};
|
||||||
use crate::s3::utils::{check_bucket_name, Multimap};
|
use crate::s3::utils::{Multimap, check_bucket_name};
|
||||||
use crate::s3::Client;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use http::Method;
|
use http::Method;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
@ -130,7 +130,7 @@ impl ToS3Request for SetBucketVersioning {
|
|||||||
None => {
|
None => {
|
||||||
return Err(Error::InvalidVersioningStatus(
|
return Err(Error::InvalidVersioningStatus(
|
||||||
"Missing VersioningStatus".into(),
|
"Missing VersioningStatus".into(),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -32,16 +32,16 @@ use crate::s3::types::{
|
|||||||
Directive, NotificationConfig, ObjectLockConfig, Part, ReplicationConfig, RetentionMode,
|
Directive, NotificationConfig, ObjectLockConfig, Part, ReplicationConfig, RetentionMode,
|
||||||
};
|
};
|
||||||
use crate::s3::utils::{
|
use crate::s3::utils::{
|
||||||
from_iso8601utc, get_default_text, get_option_text, get_text, md5sum_hash, md5sum_hash_sb,
|
Multimap, from_iso8601utc, get_default_text, get_option_text, get_text, md5sum_hash,
|
||||||
merge, sha256_hash_sb, to_amz_date, to_iso8601utc, utc_now, Multimap,
|
md5sum_hash_sb, merge, sha256_hash_sb, to_amz_date, to_iso8601utc, utc_now,
|
||||||
};
|
};
|
||||||
|
|
||||||
use async_recursion::async_recursion;
|
use async_recursion::async_recursion;
|
||||||
use bytes::{Buf, Bytes};
|
use bytes::{Buf, Bytes};
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use hyper::http::Method;
|
use hyper::http::Method;
|
||||||
use reqwest::header::HeaderMap;
|
|
||||||
use reqwest::Body;
|
use reqwest::Body;
|
||||||
|
use reqwest::header::HeaderMap;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
use xmltree::Element;
|
use xmltree::Element;
|
||||||
@ -1044,14 +1044,22 @@ impl Client {
|
|||||||
{
|
{
|
||||||
if let Some(v) = &args.metadata_directive {
|
if let Some(v) = &args.metadata_directive {
|
||||||
match v {
|
match v {
|
||||||
Directive::Copy => return Err(Error::InvalidCopyDirective(String::from("COPY metadata directive is not applicable to source object size greater than 5 GiB"))),
|
Directive::Copy => {
|
||||||
|
return Err(Error::InvalidCopyDirective(String::from(
|
||||||
|
"COPY metadata directive is not applicable to source object size greater than 5 GiB",
|
||||||
|
)));
|
||||||
|
}
|
||||||
_ => todo!(), // Nothing to do.
|
_ => todo!(), // Nothing to do.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(v) = &args.tagging_directive {
|
if let Some(v) = &args.tagging_directive {
|
||||||
match v {
|
match v {
|
||||||
Directive::Copy => return Err(Error::InvalidCopyDirective(String::from("COPY tagging directive is not applicable to source object size greater than 5 GiB"))),
|
Directive::Copy => {
|
||||||
|
return Err(Error::InvalidCopyDirective(String::from(
|
||||||
|
"COPY tagging directive is not applicable to source object size greater than 5 GiB",
|
||||||
|
)));
|
||||||
|
}
|
||||||
_ => todo!(), // Nothing to do.
|
_ => todo!(), // Nothing to do.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1995,7 +2003,10 @@ impl Client {
|
|||||||
|
|
||||||
let data = match region {
|
let data = match region {
|
||||||
"us-east-1" => String::new(),
|
"us-east-1" => String::new(),
|
||||||
_ => format!("<CreateBucketConfiguration><LocationConstraint>{}</LocationConstraint></CreateBucketConfiguration>", region),
|
_ => format!(
|
||||||
|
"<CreateBucketConfiguration><LocationConstraint>{}</LocationConstraint></CreateBucketConfiguration>",
|
||||||
|
region
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
let body = match data.is_empty() {
|
let body = match data.is_empty() {
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
//! Module containing lower level APIs.
|
//! Module containing lower level APIs.
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
builders::{ObjectToDelete, RemoveObjectsApi},
|
|
||||||
Client,
|
Client,
|
||||||
|
builders::{ObjectToDelete, RemoveObjectsApi},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ClientCore exposes lower-level APIs not exposed by the high-level client.
|
/// ClientCore exposes lower-level APIs not exposed by the high-level client.
|
||||||
|
|||||||
@ -186,7 +186,13 @@ impl fmt::Display for Error {
|
|||||||
Error::S3Error(er) => write!(
|
Error::S3Error(er) => write!(
|
||||||
f,
|
f,
|
||||||
"s3 operation failed; code: {}, message: {}, resource: {}, request_id: {}, host_id: {}, bucket_name: {}, object_name: {}",
|
"s3 operation failed; code: {}, message: {}, resource: {}, request_id: {}, host_id: {}, bucket_name: {}, object_name: {}",
|
||||||
er.code, er.message, er.resource, er.request_id, er.host_id, er.bucket_name, er.object_name,
|
er.code,
|
||||||
|
er.message,
|
||||||
|
er.resource,
|
||||||
|
er.request_id,
|
||||||
|
er.host_id,
|
||||||
|
er.bucket_name,
|
||||||
|
er.object_name,
|
||||||
),
|
),
|
||||||
Error::InvalidResponse(sc, ct) => write!(
|
Error::InvalidResponse(sc, ct) => write!(
|
||||||
f,
|
f,
|
||||||
@ -203,19 +209,68 @@ impl fmt::Display for Error {
|
|||||||
Error::SelectError(ec, em) => write!(f, "error code: {}, error message: {}", ec, em),
|
Error::SelectError(ec, em) => write!(f, "error code: {}, error message: {}", ec, em),
|
||||||
Error::UnsupportedApi(a) => write!(f, "{} API is not supported in Amazon AWS S3", a),
|
Error::UnsupportedApi(a) => write!(f, "{} API is not supported in Amazon AWS S3", a),
|
||||||
Error::InvalidComposeSource(m) => write!(f, "{}", m),
|
Error::InvalidComposeSource(m) => write!(f, "{}", m),
|
||||||
Error::InvalidComposeSourceOffset(b, o, v, of, os) => write!(f, "source {}/{}{}: offset {} is beyond object size {}", b, o, v.as_ref().map_or(String::new(), |v| String::from("?versionId=") + v), of, os),
|
Error::InvalidComposeSourceOffset(b, o, v, of, os) => write!(
|
||||||
Error::InvalidComposeSourceLength(b, o, v, l, os) => write!(f, "source {}/{}{}: length {} is beyond object size {}", b, o, v.as_ref().map_or(String::new(), |v| String::from("?versionId=") + v), l, os),
|
f,
|
||||||
Error::InvalidComposeSourceSize(b, o, v, cs, os) => write!(f, "source {}/{}{}: compose size {} is beyond object size {}", b, o, v.as_ref().map_or(String::new(), |v| String::from("?versionId=") + v), cs, os),
|
"source {}/{}{}: offset {} is beyond object size {}",
|
||||||
|
b,
|
||||||
|
o,
|
||||||
|
v.as_ref()
|
||||||
|
.map_or(String::new(), |v| String::from("?versionId=") + v),
|
||||||
|
of,
|
||||||
|
os
|
||||||
|
),
|
||||||
|
Error::InvalidComposeSourceLength(b, o, v, l, os) => write!(
|
||||||
|
f,
|
||||||
|
"source {}/{}{}: length {} is beyond object size {}",
|
||||||
|
b,
|
||||||
|
o,
|
||||||
|
v.as_ref()
|
||||||
|
.map_or(String::new(), |v| String::from("?versionId=") + v),
|
||||||
|
l,
|
||||||
|
os
|
||||||
|
),
|
||||||
|
Error::InvalidComposeSourceSize(b, o, v, cs, os) => write!(
|
||||||
|
f,
|
||||||
|
"source {}/{}{}: compose size {} is beyond object size {}",
|
||||||
|
b,
|
||||||
|
o,
|
||||||
|
v.as_ref()
|
||||||
|
.map_or(String::new(), |v| String::from("?versionId=") + v),
|
||||||
|
cs,
|
||||||
|
os
|
||||||
|
),
|
||||||
Error::InvalidDirective(m) => write!(f, "{}", m),
|
Error::InvalidDirective(m) => write!(f, "{}", m),
|
||||||
Error::InvalidCopyDirective(m) => write!(f, "{}", m),
|
Error::InvalidCopyDirective(m) => write!(f, "{}", m),
|
||||||
Error::InvalidComposeSourcePartSize(b, o, v, s, es) => write!(f, "source {}/{}{}: size {} must be greater than {}", b, o, v.as_ref().map_or(String::new(), |v| String::from("?versionId=") + v), s, es),
|
Error::InvalidComposeSourcePartSize(b, o, v, s, es) => write!(
|
||||||
Error::InvalidComposeSourceMultipart(b, o, v, s, es) => write!(f, "source {}/{}{}: size {} for multipart split upload of {}, last part size is less than {}", b, o, v.as_ref().map_or(String::new(), |v| String::from("?versionId=") + v), s, s, es),
|
f,
|
||||||
|
"source {}/{}{}: size {} must be greater than {}",
|
||||||
|
b,
|
||||||
|
o,
|
||||||
|
v.as_ref()
|
||||||
|
.map_or(String::new(), |v| String::from("?versionId=") + v),
|
||||||
|
s,
|
||||||
|
es
|
||||||
|
),
|
||||||
|
Error::InvalidComposeSourceMultipart(b, o, v, s, es) => write!(
|
||||||
|
f,
|
||||||
|
"source {}/{}{}: size {} for multipart split upload of {}, last part size is less than {}",
|
||||||
|
b,
|
||||||
|
o,
|
||||||
|
v.as_ref()
|
||||||
|
.map_or(String::new(), |v| String::from("?versionId=") + v),
|
||||||
|
s,
|
||||||
|
s,
|
||||||
|
es
|
||||||
|
),
|
||||||
Error::InvalidMultipartCount(c) => write!(
|
Error::InvalidMultipartCount(c) => write!(
|
||||||
f,
|
f,
|
||||||
"Compose sources create more than allowed multipart count {}",
|
"Compose sources create more than allowed multipart count {}",
|
||||||
c
|
c
|
||||||
),
|
),
|
||||||
Error::MissingLifecycleAction => write!(f, "at least one of action (AbortIncompleteMultipartUpload, Expiration, NoncurrentVersionExpiration, NoncurrentVersionTransition or Transition) must be specified in a rule"),
|
Error::MissingLifecycleAction => write!(
|
||||||
|
f,
|
||||||
|
"at least one of action (AbortIncompleteMultipartUpload, Expiration, NoncurrentVersionExpiration, NoncurrentVersionTransition or Transition) must be specified in a rule"
|
||||||
|
),
|
||||||
Error::InvalidExpiredObjectDeleteMarker => write!(
|
Error::InvalidExpiredObjectDeleteMarker => write!(
|
||||||
f,
|
f,
|
||||||
"ExpiredObjectDeleteMarker must not be provided along with Date and Days"
|
"ExpiredObjectDeleteMarker must not be provided along with Date and Days"
|
||||||
@ -229,10 +284,16 @@ impl fmt::Display for Error {
|
|||||||
Error::PostPolicyError(m) => write!(f, "{}", m),
|
Error::PostPolicyError(m) => write!(f, "{}", m),
|
||||||
Error::InvalidObjectLockConfig(m) => write!(f, "{}", m),
|
Error::InvalidObjectLockConfig(m) => write!(f, "{}", m),
|
||||||
Error::NoClientProvided => write!(f, "no client provided"),
|
Error::NoClientProvided => write!(f, "no client provided"),
|
||||||
Error::TagDecodingError(input, error_message) => write!(f, "tag decoding failed: {} on input '{}'", error_message, input),
|
Error::TagDecodingError(input, error_message) => write!(
|
||||||
|
f,
|
||||||
|
"tag decoding failed: {} on input '{}'",
|
||||||
|
error_message, input
|
||||||
|
),
|
||||||
Error::ContentLengthUnknown => write!(f, "content length is unknown"),
|
Error::ContentLengthUnknown => write!(f, "content length is unknown"),
|
||||||
Error::NoSuchTagSet => write!(f, "no such tag set"),
|
Error::NoSuchTagSet => write!(f, "no such tag set"),
|
||||||
Error::ReplicationConfigurationNotFoundError => write!(f, "Replication configuration not found"),
|
Error::ReplicationConfigurationNotFoundError => {
|
||||||
|
write!(f, "Replication configuration not found")
|
||||||
|
}
|
||||||
Error::NoSuchObjectLockConfiguration => write!(f, "no such object lock"),
|
Error::NoSuchObjectLockConfiguration => write!(f, "no such object lock"),
|
||||||
Error::NoSuchBucketPolicy => write!(f, "no such bucket policy"),
|
Error::NoSuchBucketPolicy => write!(f, "no such bucket policy"),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::utils::match_hostname;
|
use crate::s3::utils::match_hostname;
|
||||||
use crate::s3::utils::{to_query_string, Multimap};
|
use crate::s3::utils::{Multimap, to_query_string};
|
||||||
use derivative::Derivative;
|
use derivative::Derivative;
|
||||||
use hyper::http::Method;
|
|
||||||
use hyper::Uri;
|
use hyper::Uri;
|
||||||
|
use hyper::http::Method;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
@ -254,7 +254,7 @@ impl FromStr for BaseUrl {
|
|||||||
_ => {
|
_ => {
|
||||||
return Err(Error::InvalidBaseUrl(String::from(
|
return Err(Error::InvalidBaseUrl(String::from(
|
||||||
"scheme must be http or https",
|
"scheme must be http or https",
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -264,7 +264,7 @@ impl FromStr for BaseUrl {
|
|||||||
_ => {
|
_ => {
|
||||||
return Err(Error::InvalidBaseUrl(String::from(
|
return Err(Error::InvalidBaseUrl(String::from(
|
||||||
"valid host must be provided",
|
"valid host must be provided",
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -24,11 +24,11 @@ use xmltree::Element;
|
|||||||
|
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::types::{
|
use crate::s3::types::{
|
||||||
parse_legal_hold, NotificationConfig, ObjectLockConfig, ReplicationConfig, RetentionMode,
|
NotificationConfig, ObjectLockConfig, ReplicationConfig, RetentionMode, SelectProgress,
|
||||||
SelectProgress,
|
parse_legal_hold,
|
||||||
};
|
};
|
||||||
use crate::s3::utils::{
|
use crate::s3::utils::{
|
||||||
copy_slice, crc32, from_http_header_value, from_iso8601utc, get_text, uint32, UtcTime,
|
UtcTime, copy_slice, crc32, from_http_header_value, from_iso8601utc, get_text, uint32,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod delete_bucket_encryption;
|
mod delete_bucket_encryption;
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use futures_util::{stream, Stream, StreamExt};
|
use futures_util::{Stream, StreamExt, stream};
|
||||||
use http::HeaderMap;
|
use http::HeaderMap;
|
||||||
use tokio::io::AsyncBufReadExt;
|
use tokio::io::AsyncBufReadExt;
|
||||||
use tokio_util::io::StreamReader;
|
use tokio_util::io::StreamReader;
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
//! Signature V4 for S3 API
|
//! Signature V4 for S3 API
|
||||||
|
|
||||||
use crate::s3::utils::{
|
use crate::s3::utils::{
|
||||||
get_canonical_headers, get_canonical_query_string, sha256_hash, to_amz_date, to_signer_date,
|
Multimap, UtcTime, get_canonical_headers, get_canonical_query_string, sha256_hash, to_amz_date,
|
||||||
Multimap, UtcTime,
|
to_signer_date,
|
||||||
};
|
};
|
||||||
use hex::encode as hexencode;
|
use hex::encode as hexencode;
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
|
|||||||
@ -19,7 +19,7 @@ use super::builders::SegmentedBytes;
|
|||||||
use super::client::Client;
|
use super::client::Client;
|
||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
use crate::s3::utils::{
|
use crate::s3::utils::{
|
||||||
from_iso8601utc, get_default_text, get_option_text, get_text, to_iso8601utc, Multimap, UtcTime,
|
Multimap, UtcTime, from_iso8601utc, get_default_text, get_option_text, get_text, to_iso8601utc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|||||||
@ -17,15 +17,15 @@
|
|||||||
|
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
use base64::engine::general_purpose::STANDARD as BASE64;
|
|
||||||
use base64::engine::Engine as _;
|
use base64::engine::Engine as _;
|
||||||
|
use base64::engine::general_purpose::STANDARD as BASE64;
|
||||||
use byteorder::{BigEndian, ReadBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt};
|
||||||
use chrono::{DateTime, Datelike, NaiveDateTime, ParseError, Utc};
|
use chrono::{DateTime, Datelike, NaiveDateTime, ParseError, Utc};
|
||||||
use crc::{Crc, CRC_32_ISO_HDLC};
|
use crc::{CRC_32_ISO_HDLC, Crc};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use md5::compute as md5compute;
|
use md5::compute as md5compute;
|
||||||
use multimap::MultiMap;
|
use multimap::MultiMap;
|
||||||
use percent_encoding::{percent_decode_str, utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
|
use percent_encoding::{AsciiSet, NON_ALPHANUMERIC, percent_decode_str, utf8_percent_encode};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
pub use urlencoding::decode as urldecode;
|
pub use urlencoding::decode as urldecode;
|
||||||
@ -162,7 +162,7 @@ pub fn urlencode_object_key(key: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod aws_date_format {
|
pub mod aws_date_format {
|
||||||
use super::{from_iso8601utc, to_iso8601utc, UtcTime};
|
use super::{UtcTime, from_iso8601utc, to_iso8601utc};
|
||||||
use serde::{Deserialize, Deserializer, Serializer};
|
use serde::{Deserialize, Deserializer, Serializer};
|
||||||
|
|
||||||
pub fn serialize<S>(date: &UtcTime, serializer: S) -> Result<S::Ok, S::Error>
|
pub fn serialize<S>(date: &UtcTime, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
@ -485,7 +485,7 @@ pub fn parse_tags(s: &str) -> Result<HashMap<String, String>, Error> {
|
|||||||
return Err(Error::TagDecodingError(
|
return Err(Error::TagDecodingError(
|
||||||
s.to_string(),
|
s.to_string(),
|
||||||
"tag key was empty".to_string(),
|
"tag key was empty".to_string(),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let v = match kv.next() {
|
let v = match kv.next() {
|
||||||
|
|||||||
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
use async_std::task;
|
use async_std::task;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use rand::SeedableRng;
|
||||||
use rand::distributions::{Alphanumeric, DistString};
|
use rand::distributions::{Alphanumeric, DistString};
|
||||||
use rand::prelude::SmallRng;
|
use rand::prelude::SmallRng;
|
||||||
use rand::SeedableRng;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::{io, thread};
|
use std::{io, thread};
|
||||||
use tokio::io::AsyncRead;
|
use tokio::io::AsyncRead;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::response::{DeleteBucketEncryptionResponse, GetBucketEncryptionResponse};
|
use minio::s3::response::{DeleteBucketEncryptionResponse, GetBucketEncryptionResponse};
|
||||||
use minio::s3::types::{S3Api, SseConfig};
|
use minio::s3::types::{S3Api, SseConfig};
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::args::BucketExistsArgs;
|
use minio::s3::args::BucketExistsArgs;
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 10)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 10)]
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::response::{
|
use minio::s3::response::{
|
||||||
DeleteBucketLifecycleResponse, GetBucketLifecycleResponse, SetBucketLifecycleResponse,
|
DeleteBucketLifecycleResponse, GetBucketLifecycleResponse, SetBucketLifecycleResponse,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::args::{
|
use minio::s3::args::{
|
||||||
DeleteBucketNotificationArgs, GetBucketNotificationArgs, SetBucketNotificationArgs,
|
DeleteBucketNotificationArgs, GetBucketNotificationArgs, SetBucketNotificationArgs,
|
||||||
};
|
};
|
||||||
@ -47,12 +47,16 @@ async fn set_get_delete_bucket_notification() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(resp.config.queue_config_list.as_ref().unwrap().len(), 1);
|
assert_eq!(resp.config.queue_config_list.as_ref().unwrap().len(), 1);
|
||||||
assert!(resp.config.queue_config_list.as_ref().unwrap()[0]
|
assert!(
|
||||||
|
resp.config.queue_config_list.as_ref().unwrap()[0]
|
||||||
.events
|
.events
|
||||||
.contains(&String::from("s3:ObjectCreated:Put")));
|
.contains(&String::from("s3:ObjectCreated:Put"))
|
||||||
assert!(resp.config.queue_config_list.as_ref().unwrap()[0]
|
);
|
||||||
|
assert!(
|
||||||
|
resp.config.queue_config_list.as_ref().unwrap()[0]
|
||||||
.events
|
.events
|
||||||
.contains(&String::from("s3:ObjectCreated:Copy")));
|
.contains(&String::from("s3:ObjectCreated:Copy"))
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resp.config.queue_config_list.as_ref().unwrap()[0]
|
resp.config.queue_config_list.as_ref().unwrap()[0]
|
||||||
.prefix_filter_rule
|
.prefix_filter_rule
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::args::{DeleteBucketTagsArgs, GetBucketTagsArgs, SetBucketTagsArgs};
|
use minio::s3::args::{DeleteBucketTagsArgs, GetBucketTagsArgs, SetBucketTagsArgs};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, TestContext};
|
use crate::common::{TestContext, create_bucket_helper};
|
||||||
use minio::s3::builders::VersioningStatus;
|
use minio::s3::builders::VersioningStatus;
|
||||||
use minio::s3::response::GetBucketVersioningResponse;
|
use minio::s3::response::GetBucketVersioningResponse;
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::{ComposeObjectArgs, ComposeSource, PutObjectArgs, StatObjectArgs};
|
use minio::s3::args::{ComposeObjectArgs, ComposeSource, PutObjectArgs, StatObjectArgs};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::{CopyObjectArgs, CopySource, PutObjectArgs, StatObjectArgs};
|
use minio::s3::args::{CopyObjectArgs, CopySource, PutObjectArgs, StatObjectArgs};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{rand_bucket_name, TestContext};
|
use crate::common::{TestContext, rand_bucket_name};
|
||||||
use minio::s3::args::{BucketExistsArgs, MakeBucketArgs, RemoveBucketArgs};
|
use minio::s3::args::{BucketExistsArgs, MakeBucketArgs, RemoveBucketArgs};
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 10)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 10)]
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, TestContext};
|
use crate::common::{TestContext, create_bucket_helper, rand_object_name};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use minio::s3::args::{GetObjectArgs, PutObjectArgs};
|
use minio::s3::args::{GetObjectArgs, PutObjectArgs};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, TestContext};
|
use crate::common::{TestContext, create_bucket_helper, rand_object_name};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
use minio::s3::args::GetPresignedObjectUrlArgs;
|
use minio::s3::args::GetPresignedObjectUrlArgs;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, TestContext};
|
use crate::common::{TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::PostPolicy;
|
use minio::s3::args::PostPolicy;
|
||||||
use minio::s3::utils::utc_now;
|
use minio::s3::utils::utc_now;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use crate::common::{create_bucket_helper, CleanupGuard, TestContext};
|
use crate::common::{CleanupGuard, TestContext, create_bucket_helper};
|
||||||
// MinIO Rust Library for Amazon S3 Compatible Cloud Storage
|
// MinIO Rust Library for Amazon S3 Compatible Cloud Storage
|
||||||
// Copyright 2025 MinIO, Inc.
|
// Copyright 2025 MinIO, Inc.
|
||||||
//
|
//
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::PutObjectArgs;
|
use minio::s3::args::PutObjectArgs;
|
||||||
use minio::s3::builders::ObjectToDelete;
|
use minio::s3::builders::ObjectToDelete;
|
||||||
use minio::s3::types::ToStream;
|
use minio::s3::types::ToStream;
|
||||||
|
|||||||
@ -15,12 +15,12 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use async_std::task;
|
use async_std::task;
|
||||||
|
use minio::s3::Client;
|
||||||
use minio::s3::args::PutObjectArgs;
|
use minio::s3::args::PutObjectArgs;
|
||||||
use minio::s3::creds::StaticProvider;
|
use minio::s3::creds::StaticProvider;
|
||||||
use minio::s3::types::{NotificationRecords, S3Api};
|
use minio::s3::types::{NotificationRecords, S3Api};
|
||||||
use minio::s3::Client;
|
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tokio_stream::StreamExt;
|
use tokio_stream::StreamExt;
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{rand_bucket_name, CleanupGuard, TestContext};
|
use crate::common::{CleanupGuard, TestContext, rand_bucket_name};
|
||||||
use minio::s3::args::{
|
use minio::s3::args::{
|
||||||
DeleteObjectLockConfigArgs, GetObjectLockConfigArgs, MakeBucketArgs, SetObjectLockConfigArgs,
|
DeleteObjectLockConfigArgs, GetObjectLockConfigArgs, MakeBucketArgs, SetObjectLockConfigArgs,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{rand_bucket_name, rand_object_name, CleanupGuard, RandReader, TestContext};
|
use crate::common::{CleanupGuard, RandReader, TestContext, rand_bucket_name, rand_object_name};
|
||||||
use minio::s3::args::{
|
use minio::s3::args::{
|
||||||
GetObjectRetentionArgs, MakeBucketArgs, PutObjectArgs, SetObjectRetentionArgs,
|
GetObjectRetentionArgs, MakeBucketArgs, PutObjectArgs, SetObjectRetentionArgs,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::{DeleteObjectTagsArgs, GetObjectTagsArgs, PutObjectArgs, SetObjectTagsArgs};
|
use minio::s3::args::{DeleteObjectTagsArgs, GetObjectTagsArgs, PutObjectArgs, SetObjectTagsArgs};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, RandSrc, TestContext};
|
use crate::common::{RandReader, RandSrc, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use http::header;
|
use http::header;
|
||||||
use minio::s3::args::{PutObjectArgs, StatObjectArgs};
|
use minio::s3::args::{PutObjectArgs, StatObjectArgs};
|
||||||
use minio::s3::builders::ObjectContent;
|
use minio::s3::builders::ObjectContent;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::PutObjectArgs;
|
use minio::s3::args::PutObjectArgs;
|
||||||
use minio::s3::builders::ObjectToDelete;
|
use minio::s3::builders::ObjectToDelete;
|
||||||
use minio::s3::types::ToStream;
|
use minio::s3::types::ToStream;
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, TestContext};
|
use crate::common::{TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::{PutObjectArgs, SelectObjectContentArgs};
|
use minio::s3::args::{PutObjectArgs, SelectObjectContentArgs};
|
||||||
use minio::s3::types::{
|
use minio::s3::types::{
|
||||||
CsvInputSerialization, CsvOutputSerialization, FileHeaderInfo, QuoteFields, S3Api,
|
CsvInputSerialization, CsvOutputSerialization, FileHeaderInfo, QuoteFields, S3Api,
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{create_bucket_helper, rand_object_name, RandReader, TestContext};
|
use crate::common::{RandReader, TestContext, create_bucket_helper, rand_object_name};
|
||||||
use minio::s3::args::{DownloadObjectArgs, UploadObjectArgs};
|
use minio::s3::args::{DownloadObjectArgs, UploadObjectArgs};
|
||||||
use minio::s3::types::S3Api;
|
use minio::s3::types::S3Api;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user