Unverified Commit c8fe6e2a authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Fix several minimal version bugs and add it to CI (#1365)



* Fix several minimal version bugs and add it to CI

* Fix docker image

Co-authored-by: default avatarZelda Hessler <zhessler@amazon.com>
parent a0539e20
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -19,3 +19,6 @@ cargo test --all-features

echo "### Testing each feature in isolation"
cargo hack test --feature-powerset

echo "### Checking that compiling with the minimal versions succeeds"
cargo "+${RUST_NIGHTLY_VERSION:-nightly}" minimal-versions check --all-features
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ repository = "https://github.com/awslabs/smithy-rs"
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
aws-types = { path = "../aws-types" }
http = "0.2.3"
regex = { version = "1", default-features = false, features = ["std"] }
regex = { version = "1.5.5", default-features = false, features = ["std"] }
tracing = "0.1"

[package.metadata.docs.rs]
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" }
aws-types = { path = "../aws-types" }
http = "0.2.3"
lazy_static = "1"
lazy_static = "1.4.0"
tracing = "0.1"
percent-encoding = "2.1.0"

+0 −3
Original line number Diff line number Diff line
@@ -16,9 +16,6 @@ aws-smithy-eventstream = { path = "../../../rust-runtime/aws-smithy-eventstream"
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
aws-types = { path = "../aws-types" }
http = "0.2.2"
# Trying this out as an experiment. thiserror can be removed and replaced with hand written error
# implementations and it is not a breaking change.
thiserror = "1"
tracing = "0.1"

[dev-dependencies]
+43 −9
Original line number Diff line number Diff line
@@ -13,8 +13,9 @@ use aws_smithy_http::property_bag::PropertyBag;
use aws_types::region::SigningRegion;
use aws_types::Credentials;
use aws_types::SigningService;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::time::SystemTime;
use thiserror::Error;

/// Container for the request signature for use in the property bag.
#[non_exhaustive]
@@ -59,20 +60,53 @@ impl SigV4SigningStage {
    }
}

#[derive(Debug, Error)]
#[derive(Debug)]
pub enum SigningStageError {
    #[error("No credentials in the property bag")]
    MissingCredentials,
    #[error("No signing region in the property bag")]
    MissingSigningRegion,
    #[error("No signing service in the property bag")]
    MissingSigningService,
    #[error("No signing configuration in the property bag")]
    MissingSigningConfig,
    #[error("The request body could not be signed by this configuration")]
    InvalidBodyType,
    #[error("Signing failed")]
    SigningFailure(#[from] SigningError),
    SigningFailure(SigningError),
}

impl Display for SigningStageError {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self {
            SigningStageError::MissingCredentials => {
                write!(f, "No credentials in the property bag")
            }
            SigningStageError::MissingSigningRegion => {
                write!(f, "No signing region in the property bag")
            }
            SigningStageError::MissingSigningService => {
                write!(f, "No signing service in the property bag")
            }
            SigningStageError::MissingSigningConfig => {
                write!(f, "No signing configuration in the property bag")
            }
            SigningStageError::InvalidBodyType => write!(
                f,
                "The request body could not be signed by this configuration"
            ),
            SigningStageError::SigningFailure(_) => write!(f, "Signing failed"),
        }
    }
}

impl From<SigningError> for SigningStageError {
    fn from(error: SigningError) -> Self {
        Self::SigningFailure(error)
    }
}

impl Error for SigningStageError {
    fn source(&self) -> Option<&(dyn Error + 'static)> {
        match &self {
            SigningStageError::SigningFailure(err) => Some(err.as_ref()),
            _ => None,
        }
    }
}

/// Extract a signing config from a [`PropertyBag`](aws_smithy_http::property_bag::PropertyBag)
Loading