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 core/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ pub mod layers;
pub mod raw;
pub mod services;

/// Re-export of the [`reqsign_core`] crate that services sign requests with.
///
/// Service builders that accept credentials from the application take `reqsign`
/// types in their signatures, such as `ProvideCredentialChain` in
/// `opendal_service_s3::S3::credential_provider_chain`. Implement providers
/// against this re-export rather than depending on `reqsign-core` directly, so
/// that the types always match the ones the services are built with.
#[cfg(feature = "reqsign")]
pub use reqsign_core;

#[cfg(test)]
mod tests {
use super::*;
Expand Down
4 changes: 4 additions & 0 deletions core/services/azblob/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ impl AzblobBuilder {
}

/// Replace the credential providers with a custom chain.
///
/// Build the chain from [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_azure_storage`] so that its types match the ones this
/// service is built with.
pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain<Credential>) -> Self {
self.credential_providers = Some(chain);
self
Expand Down
10 changes: 10 additions & 0 deletions core/services/azblob/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ pub mod writer;

pub use backend::AzblobBuilder as Azblob;
pub use config::AzblobConfig;

/// Re-export of the [`reqsign_azure_storage`] crate that this service signs
/// requests with.
///
/// [`Azblob::credential_provider_chain`] takes a chain of providers for
/// [`reqsign_azure_storage::Credential`]. Implement providers against this
/// re-export and [`opendal_core::reqsign_core`] rather than depending on the
/// `reqsign` crates directly, so that the types always match the ones this
/// service is built with.
pub use reqsign_azure_storage;
4 changes: 4 additions & 0 deletions core/services/azdls/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ impl AzdlsBuilder {
}

/// Replace the credential providers with a custom chain.
///
/// Build the chain from [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_azure_storage`] so that its types match the ones this
/// service is built with.
pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain<Credential>) -> Self {
self.credential_providers = Some(chain);
self
Expand Down
10 changes: 10 additions & 0 deletions core/services/azdls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ mod writer;

pub use backend::AzdlsBuilder as Azdls;
pub use config::AzdlsConfig;

/// Re-export of the [`reqsign_azure_storage`] crate that this service signs
/// requests with.
///
/// [`Azdls::credential_provider_chain`] takes a chain of providers for
/// [`reqsign_azure_storage::Credential`]. Implement providers against this
/// re-export and [`opendal_core::reqsign_core`] rather than depending on the
/// `reqsign` crates directly, so that the types always match the ones this
/// service is built with.
pub use reqsign_azure_storage;
8 changes: 8 additions & 0 deletions core/services/gcs-grpc/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ impl GcsGrpcBuilder {
}

/// Set a custom Google credential provider.
///
/// Implement the provider against [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_google`] so that its types match the ones this service is
/// built with.
pub fn credential_provider(
mut self,
provider: impl ProvideCredential<Credential = Credential> + 'static,
Expand All @@ -118,6 +122,10 @@ impl GcsGrpcBuilder {
}

/// Set a custom Google credential provider chain.
///
/// Build the chain from [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_google`] so that its types match the ones this service is
/// built with.
pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain<Credential>) -> Self {
self.credential_provider_chain = Some(chain);
self
Expand Down
10 changes: 10 additions & 0 deletions core/services/gcs-grpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ mod writer;

pub use backend::GcsGrpcBuilder as GcsGrpc;
pub use config::GcsGrpcConfig;

/// Re-export of the [`reqsign_google`] crate that this service signs requests
/// with.
///
/// [`GcsGrpc::credential_provider`] and [`GcsGrpc::credential_provider_chain`]
/// take providers for [`reqsign_google::Credential`]. Implement providers against
/// this re-export and [`opendal_core::reqsign_core`] rather than depending on the
/// `reqsign` crates directly, so that the types always match the ones this
/// service is built with.
pub use reqsign_google;
8 changes: 8 additions & 0 deletions core/services/gcs/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ impl GcsBuilder {
/// Specify a customized credential provider used by this service.
///
/// This provider will be pushed to the front of credential chain.
///
/// Implement the provider against [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_google`] so that its types match the ones this service is
/// built with.
pub fn credential_provider(
mut self,
provider: impl ProvideCredential<Credential = Credential> + 'static,
Expand All @@ -168,6 +172,10 @@ impl GcsBuilder {
/// Specify a customized credential provider chain used by this service.
///
/// This chain will be pushed to the front of default chain.
///
/// Build the chain from [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_google`] so that its types match the ones this service is
/// built with.
pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain<Credential>) -> Self {
self.credential_provider_chain = Some(chain);
self
Expand Down
10 changes: 10 additions & 0 deletions core/services/gcs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ mod writer;
pub use backend::GcsBuilder as Gcs;
pub use config::GcsConfig;

/// Re-export of the [`reqsign_google`] crate that this service signs requests
/// with.
///
/// [`Gcs::credential_provider`] and [`Gcs::credential_provider_chain`] take
/// providers for [`reqsign_google::Credential`]. Implement providers against this
/// re-export and [`opendal_core::reqsign_core`] rather than depending on the
/// `reqsign` crates directly, so that the types always match the ones this
/// service is built with.
pub use reqsign_google;

/// URI scheme used for service registration and scheme-driven construction.
pub const GCS_SCHEME: &str = "gcs";

Expand Down
4 changes: 4 additions & 0 deletions core/services/s3/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ impl S3Builder {
}

/// Replace the credential providers with a custom chain.
///
/// Build the chain from [`opendal_core::reqsign_core`] and
/// [`crate::reqsign_aws_v4`] so that its types match the ones this service is
/// built with.
pub fn credential_provider_chain(mut self, chain: ProvideCredentialChain<Credential>) -> Self {
self.credential_providers = Some(chain);
self
Expand Down
9 changes: 9 additions & 0 deletions core/services/s3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ mod writer;
pub use backend::S3Builder as S3;
pub use config::S3Config;

/// Re-export of the [`reqsign_aws_v4`] crate that this service signs requests
/// with.
///
/// [`S3::credential_provider_chain`] takes a chain of providers for
/// [`reqsign_aws_v4::Credential`]. Implement providers against this re-export and
/// [`opendal_core::reqsign_core`] rather than depending on the `reqsign` crates
/// directly, so that the types always match the ones this service is built with.
pub use reqsign_aws_v4;

/// URI scheme used for service registration and scheme-driven construction.
pub const S3_SCHEME: &str = "s3";

Expand Down
Loading