Loading aws/rust-runtime/aws-hyper/src/lib.rs +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ where pub async fn call<O, T, E, Retry>(&self, input: Operation<O, Retry>) -> Result<T, SdkError<E>> where O: ParseHttpResponse<hyper::Body, Output = Result<T, E>> + Send + 'static, E: Error, { self.call_raw(input).await.map(|res| res.parsed) } Loading @@ -87,6 +88,7 @@ where ) -> Result<SdkSuccess<R>, SdkError<E>> where O: ParseHttpResponse<hyper::Body, Output = Result<R, E>> + Send + 'static, E: Error, { let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new())); let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage); Loading aws/rust-runtime/aws-hyper/tests/e2e_test.rs +14 −1 Original line number Diff line number Diff line Loading @@ -20,15 +20,28 @@ use smithy_http::response::ParseHttpResponse; use std::convert::Infallible; use std::sync::Arc; use std::time::{Duration, UNIX_EPOCH}; use std::error::Error; use std::fmt::{Display, Formatter}; use std::fmt; #[derive(Clone)] struct TestOperationParser; #[derive(Debug)] struct OperationError; impl Display for OperationError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } } impl Error for OperationError {} impl<B> ParseHttpResponse<B> for TestOperationParser where B: http_body::Body, { type Output = Result<String, String>; type Output = Result<String, OperationError>; fn parse_unloaded(&self, _response: &mut Response<B>) -> Option<Self::Output> { Some(Ok("Hello!".to_string())) Loading aws/sdk/build.gradle.kts +2 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ task("relocateServices") { } } } outputs.upToDateWhen { false } } task("relocateExamples") { Loading Loading @@ -151,6 +152,7 @@ tasks.register<Copy>("relocateRuntime") { exclude("**/Cargo.lock") } into(sdkOutputDir) outputs.upToDateWhen { false } } fun generateCargoWorkspace(services: List<AwsService>): String { Loading aws/sdk/examples/kms-helloworld/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,4 @@ aws-hyper = { path = "../../build/aws-sdk/aws-hyper" } tokio = { version = "1", features = ["full"]} # optional env_logger = "0.8.2" tracing-subscriber = { version = "0.2.16", features = ["fmt"] } aws/sdk/examples/kms-helloworld/src/main.rs +3 −2 Original line number Diff line number Diff line use kms::operation::GenerateRandom; use kms::Region; use env_logger::Env; use tracing_subscriber::fmt::SubscriberBuilder; use tracing_subscriber::fmt::format::FmtSpan; #[tokio::main] async fn main() { env_logger::init_from_env(Env::default().default_filter_or("info")); SubscriberBuilder::default().with_env_filter("info").with_span_events(FmtSpan::CLOSE).init(); let config = kms::Config::builder() // region can also be loaded from AWS_DEFAULT_REGION, just remove this line. .region(Region::from("us-east-1")) Loading Loading
aws/rust-runtime/aws-hyper/src/lib.rs +2 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ where pub async fn call<O, T, E, Retry>(&self, input: Operation<O, Retry>) -> Result<T, SdkError<E>> where O: ParseHttpResponse<hyper::Body, Output = Result<T, E>> + Send + 'static, E: Error, { self.call_raw(input).await.map(|res| res.parsed) } Loading @@ -87,6 +88,7 @@ where ) -> Result<SdkSuccess<R>, SdkError<E>> where O: ParseHttpResponse<hyper::Body, Output = Result<R, E>> + Send + 'static, E: Error, { let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new())); let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage); Loading
aws/rust-runtime/aws-hyper/tests/e2e_test.rs +14 −1 Original line number Diff line number Diff line Loading @@ -20,15 +20,28 @@ use smithy_http::response::ParseHttpResponse; use std::convert::Infallible; use std::sync::Arc; use std::time::{Duration, UNIX_EPOCH}; use std::error::Error; use std::fmt::{Display, Formatter}; use std::fmt; #[derive(Clone)] struct TestOperationParser; #[derive(Debug)] struct OperationError; impl Display for OperationError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } } impl Error for OperationError {} impl<B> ParseHttpResponse<B> for TestOperationParser where B: http_body::Body, { type Output = Result<String, String>; type Output = Result<String, OperationError>; fn parse_unloaded(&self, _response: &mut Response<B>) -> Option<Self::Output> { Some(Ok("Hello!".to_string())) Loading
aws/sdk/build.gradle.kts +2 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ task("relocateServices") { } } } outputs.upToDateWhen { false } } task("relocateExamples") { Loading Loading @@ -151,6 +152,7 @@ tasks.register<Copy>("relocateRuntime") { exclude("**/Cargo.lock") } into(sdkOutputDir) outputs.upToDateWhen { false } } fun generateCargoWorkspace(services: List<AwsService>): String { Loading
aws/sdk/examples/kms-helloworld/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,4 @@ aws-hyper = { path = "../../build/aws-sdk/aws-hyper" } tokio = { version = "1", features = ["full"]} # optional env_logger = "0.8.2" tracing-subscriber = { version = "0.2.16", features = ["fmt"] }
aws/sdk/examples/kms-helloworld/src/main.rs +3 −2 Original line number Diff line number Diff line use kms::operation::GenerateRandom; use kms::Region; use env_logger::Env; use tracing_subscriber::fmt::SubscriberBuilder; use tracing_subscriber::fmt::format::FmtSpan; #[tokio::main] async fn main() { env_logger::init_from_env(Env::default().default_filter_or("info")); SubscriberBuilder::default().with_env_filter("info").with_span_events(FmtSpan::CLOSE).init(); let config = kms::Config::builder() // region can also be loaded from AWS_DEFAULT_REGION, just remove this line. .region(Region::from("us-east-1")) Loading