Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ jobs:
run: cargo clippy --features azure -- -D warnings
- name: Run clippy with http feature
run: cargo clippy --features http -- -D warnings
- name: Run clippy with aws-base feature
run: cargo clippy --no-default-features --features aws-base -- -D warnings
- name: Run clippy with azure-base feature
run: cargo clippy --no-default-features --features azure-base -- -D warnings
- name: Run clippy with gcp-base feature
run: cargo clippy --no-default-features --features gcp-base -- -D warnings
- name: Run clippy with http-base feature
run: cargo clippy --no-default-features --features http-base -- -D warnings
- name: Run clippy with integration feature
run: cargo clippy --no-default-features --features integration -- -D warnings
- name: Run clippy with all features
Expand Down Expand Up @@ -196,6 +204,8 @@ jobs:
run: rustup target add wasm32-wasip1
- name: Build wasm32-wasip1
run: cargo build --all-features --target wasm32-wasip1
- name: Build wasm32-wasip1 without reqwest
run: cargo build --no-default-features --features aws-base --target wasm32-wasip1
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/setup-node@v6
Expand Down
16 changes: 11 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ futures-channel = {version = "0.3", features = ["sink"]}

[features]
default = ["fs"]
cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/stream", "chrono/serde", "base64", "rand", "ring", "http-body-util", "form_urlencoded", "serde_urlencoded", "tokio"]
azure = ["cloud", "httparse"]
cloud = ["cloud-base", "reqwest"]
cloud-base = ["serde", "serde_json", "quick-xml", "hyper", "chrono/serde", "base64", "rand", "ring", "http-body-util", "form_urlencoded", "serde_urlencoded", "tokio"]
azure = ["azure-base", "cloud"]
azure-base = ["cloud-base", "httparse"]
fs = ["walkdir", "tokio", "nix", "windows-sys"]
gcp = ["cloud", "rustls-pki-types"]
aws = ["cloud", "crc-fast", "md-5"]
http = ["cloud"]
gcp = ["gcp-base", "cloud"]
gcp-base = ["cloud-base", "rustls-pki-types"]
aws = ["aws-base", "cloud"]
aws-base = ["cloud-base", "crc-fast", "md-5"]
http = ["http-base", "cloud"]
http-base = ["cloud-base"]
reqwest = ["dep:reqwest", "reqwest/stream"]
tls-webpki-roots = ["reqwest?/rustls-tls-webpki-roots"]
integration = ["rand", "tokio"]
tokio = ["dep:tokio", "dep:tracing"]
Expand Down
10 changes: 9 additions & 1 deletion src/aws/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ use crate::config::ConfigValue;
use crate::{ClientConfigKey, ClientOptions, Result, RetryConfig, StaticCredentialProvider};
use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use http::header::{HeaderMap, HeaderValue};
use itertools::Itertools;
use md5::{Digest, Md5};
use reqwest::header::{HeaderMap, HeaderValue};
use serde::{Deserialize, Serialize};
use std::str::FromStr;
use std::sync::Arc;
Expand Down Expand Up @@ -1538,6 +1538,7 @@ mod tests {
assert!(builder.unsigned_payload.get().unwrap());
}

#[cfg(feature = "reqwest")]
#[test]
fn s3_test_endpoint_url_s3_config() {
// Verify aws_endpoint_url_s3 parses to S3Endpoint config key
Expand Down Expand Up @@ -1652,6 +1653,7 @@ mod tests {
);
}

#[cfg(feature = "reqwest")]
#[test]
fn s3_default_region() {
let builder = AmazonS3Builder::new()
Expand All @@ -1661,6 +1663,7 @@ mod tests {
assert_eq!(builder.client.config.region, "us-east-1");
}

#[cfg(feature = "reqwest")]
#[test]
fn s3_test_bucket_endpoint() {
let builder = AmazonS3Builder::new()
Expand Down Expand Up @@ -1760,6 +1763,7 @@ mod tests {
}
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn s3_test_proxy_url() {
let s3 = AmazonS3Builder::new()
Expand Down Expand Up @@ -1788,6 +1792,7 @@ mod tests {
assert_eq!("Generic HTTP client error: builder error", err);
}

#[cfg(feature = "reqwest")]
#[test]
fn test_invalid_config() {
let err = AmazonS3Builder::new()
Expand Down Expand Up @@ -1830,6 +1835,7 @@ mod tests {
);
}

#[cfg(feature = "reqwest")]
#[test]
fn test_request_payer_config() {
let s3 = AmazonS3Builder::new()
Expand Down Expand Up @@ -1903,6 +1909,7 @@ mod tests {
}
}

#[cfg(feature = "reqwest")]
#[test]
fn test_builder_eks_with_config() {
let builder = AmazonS3Builder::new()
Expand All @@ -1925,6 +1932,7 @@ mod tests {
);
}

#[cfg(feature = "reqwest")]
#[test]
fn test_builder_web_identity_with_config() {
let builder = AmazonS3Builder::new()
Expand Down
5 changes: 5 additions & 0 deletions src/aws/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ mod tests {
use hyper::Request;
use hyper::body::Incoming;

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_create_multipart_has_content_length() {
let mock = MockServer::new().await;
Expand Down Expand Up @@ -1110,6 +1111,7 @@ mod tests {
}
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_default_headers_signed_request() {
let mock = MockServer::new().await;
Expand All @@ -1134,6 +1136,7 @@ mod tests {
mock.shutdown().await;
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_default_headers_signed_bulk_delete() {
let mock = MockServer::new().await;
Expand All @@ -1153,6 +1156,7 @@ mod tests {
mock.shutdown().await;
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_default_headers_signed_get_request() {
let mock = MockServer::new().await;
Expand All @@ -1175,6 +1179,7 @@ mod tests {
mock.shutdown().await;
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_default_headers_signed_complete_multipart() {
let mock = MockServer::new().await;
Expand Down
12 changes: 10 additions & 2 deletions src/aws/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,13 @@ mod tests {
use crate::aws::{AmazonS3Builder, AmazonS3ConfigKey};
use crate::client::HttpClient;
use crate::client::mock_server::MockServer;
use http::Response;
use reqwest::{Client, Method};
use http::{Method, Response};
#[cfg(feature = "reqwest")]
use reqwest::Client;
use std::env;

// Test generated using https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
#[cfg(feature = "reqwest")]
#[test]
fn test_sign_with_signed_payload() {
let client = HttpClient::new(Client::new());
Expand Down Expand Up @@ -914,6 +916,7 @@ mod tests {
)
}

#[cfg(feature = "reqwest")]
#[test]
fn test_sign_with_signed_payload_request_payer() {
let client = HttpClient::new(Client::new());
Expand Down Expand Up @@ -958,6 +961,7 @@ mod tests {
)
}

#[cfg(feature = "reqwest")]
#[test]
fn test_sign_with_unsigned_payload() {
let client = HttpClient::new(Client::new());
Expand Down Expand Up @@ -1085,6 +1089,7 @@ mod tests {
);
}

#[cfg(feature = "reqwest")]
#[test]
fn test_sign_port() {
let client = HttpClient::new(Client::new());
Expand Down Expand Up @@ -1128,6 +1133,7 @@ mod tests {
)
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_instance_metadata() {
if env::var("TEST_INTEGRATION").is_err() {
Expand Down Expand Up @@ -1166,6 +1172,7 @@ mod tests {
assert!(!token.is_empty())
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_mock() {
let server = MockServer::new().await;
Expand Down Expand Up @@ -1259,6 +1266,7 @@ mod tests {
.unwrap_err();
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_eks_pod_credential_provider() {
use crate::client::mock_server::MockServer;
Expand Down
12 changes: 7 additions & 5 deletions src/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
use async_trait::async_trait;
use futures_util::stream::BoxStream;
use futures_util::{StreamExt, TryStreamExt};
use reqwest::header::{HeaderName, IF_MATCH, IF_NONE_MATCH};
use reqwest::{Method, StatusCode};
use http::header::{HeaderName, IF_MATCH, IF_NONE_MATCH};
use http::{Method, StatusCode};
use std::{sync::Arc, time::Duration};
use url::Url;

Expand All @@ -58,14 +58,14 @@ mod client;
mod credential;
mod precondition;

#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(feature = "reqwest", not(target_arch = "wasm32")))]
mod resolve;

pub use builder::{AmazonS3Builder, AmazonS3ConfigKey};
pub use checksum::Checksum;
pub use precondition::{S3ConditionalPut, S3CopyIfNotExists};

#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(feature = "reqwest", not(target_arch = "wasm32")))]
pub use resolve::resolve_bucket_region;

/// This struct is used to maintain the URI path encoding
Expand Down Expand Up @@ -118,7 +118,7 @@ impl Signer for AmazonS3 {
/// ```
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
/// # use object_store::{aws::AmazonS3Builder, path::Path, signer::Signer};
/// # use reqwest::Method;
/// # use http::Method;
/// # use std::time::Duration;
/// #
/// let region = "us-east-1";
Expand Down Expand Up @@ -515,6 +515,7 @@ mod tests {
use super::*;
use crate::ClientOptions;
use crate::ObjectStoreExt;
#[cfg(feature = "reqwest")]
use crate::client::SpawnedReqwestConnector;
use crate::client::get::GetClient;
use crate::client::retry::RetryContext;
Expand Down Expand Up @@ -923,6 +924,7 @@ mod tests {

/// Integration test that ensures I/O is done on an alternate threadpool
/// when using the `SpawnedReqwestConnector`.
#[cfg(feature = "reqwest")]
#[test]
fn s3_alternate_threadpool_spawned_request_connector() {
maybe_skip_integration!();
Expand Down
6 changes: 3 additions & 3 deletions src/aws/precondition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum S3CopyIfNotExists {
/// other than 412.
///
/// Encoded as `header-with-status:<HEADER_NAME>:<HEADER_VALUE>:<STATUS>` ignoring whitespace
HeaderWithStatus(String, String, reqwest::StatusCode),
HeaderWithStatus(String, String, http::StatusCode),
/// Native Amazon S3 supports copy if not exists through a multipart upload
/// where the upload copies an existing object and is completed only if the
/// new object does not already exist.
Expand Down Expand Up @@ -180,7 +180,7 @@ mod tests {
let expected = Some(S3CopyIfNotExists::HeaderWithStatus(
"key".to_owned(),
"value".to_owned(),
reqwest::StatusCode::FORBIDDEN,
http::StatusCode::FORBIDDEN,
));

assert_eq!(expected, S3CopyIfNotExists::from_str(input));
Expand Down Expand Up @@ -212,7 +212,7 @@ mod tests {
let expected = Some(S3CopyIfNotExists::HeaderWithStatus(
"key".to_owned(),
"value".to_owned(),
reqwest::StatusCode::FORBIDDEN,
http::StatusCode::FORBIDDEN,
));

const INPUTS: &[&str] = &[
Expand Down
2 changes: 1 addition & 1 deletion src/aws/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl From<Error> for crate::Error {
///
/// [HeadBucket API]: https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadBucket.html
pub async fn resolve_bucket_region(bucket: &str, client_options: &ClientOptions) -> Result<String> {
use reqwest::StatusCode;
use http::StatusCode;

let endpoint = format!("https://{bucket}.s3.amazonaws.com");

Expand Down
1 change: 1 addition & 0 deletions src/azure/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,7 @@ mod tests {
quick_xml::de::from_str(S).unwrap();
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_build_bulk_delete_body() {
let credential_provider = Arc::new(StaticCredentialProvider::new(
Expand Down
4 changes: 4 additions & 0 deletions src/azure/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ mod tests {
use crate::client::mock_server::MockServer;
use crate::{ObjectStoreExt, Path};

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_managed_identity() {
let server = MockServer::new().await;
Expand Down Expand Up @@ -1133,6 +1134,7 @@ mod tests {
);
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_workload_identity() {
let server = MockServer::new().await;
Expand Down Expand Up @@ -1185,6 +1187,7 @@ mod tests {
);
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_no_credentials() {
let server = MockServer::new().await;
Expand Down Expand Up @@ -1218,6 +1221,7 @@ mod tests {
}
}

#[cfg(feature = "reqwest")]
#[tokio::test]
async fn test_fabric_refresh_expired_token() {
let server = MockServer::new().await;
Expand Down
4 changes: 2 additions & 2 deletions src/azure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::{
};
use async_trait::async_trait;
use futures_util::stream::{BoxStream, StreamExt, TryStreamExt};
use reqwest::Method;
use http::Method;
use std::fmt::Debug;
use std::sync::Arc;
use std::time::Duration;
Expand Down Expand Up @@ -197,7 +197,7 @@ impl Signer for MicrosoftAzure {
/// ```
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
/// # use object_store::{azure::MicrosoftAzureBuilder, path::Path, signer::Signer};
/// # use reqwest::Method;
/// # use http::Method;
/// # use std::time::Duration;
/// #
/// let azure = MicrosoftAzureBuilder::new()
Expand Down
Loading