diff --git a/aws/rust-runtime/.gitignore b/aws/rust-runtime/.gitignore index 2c96eb1b65..1e7caa9ea8 100644 --- a/aws/rust-runtime/.gitignore +++ b/aws/rust-runtime/.gitignore @@ -1,2 +1,2 @@ -target/ Cargo.lock +target/ diff --git a/aws/rust-runtime/aws-auth/Cargo.toml b/aws/rust-runtime/aws-auth/Cargo.toml index aee28a6714..99a68eb13e 100644 --- a/aws/rust-runtime/aws-auth/Cargo.toml +++ b/aws/rust-runtime/aws-auth/Cargo.toml @@ -3,6 +3,7 @@ name = "aws-auth" version = "0.1.0" authors = ["Russell Cohen "] edition = "2018" +description = "Authentication related functionality for the AWS Rust SDK. All interfaces considered unstable." # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/aws/rust-runtime/aws-endpoint/src/lib.rs b/aws/rust-runtime/aws-endpoint/src/lib.rs index d49ef0c3bf..20f4efccf3 100644 --- a/aws/rust-runtime/aws-endpoint/src/lib.rs +++ b/aws/rust-runtime/aws-endpoint/src/lib.rs @@ -118,6 +118,7 @@ pub fn set_endpoint_resolver(provider: AwsEndpointResolver, config: &mut Propert /// 3. Apply the endpoint to the URI in the request /// 4. Set the `SigningRegion` and `SigningService` in the property bag to drive downstream /// signing middleware. +#[derive(Clone)] pub struct AwsEndpointStage; #[derive(Debug)] diff --git a/aws/rust-runtime/aws-hyper/Cargo.toml b/aws/rust-runtime/aws-hyper/Cargo.toml new file mode 100644 index 0000000000..1da4efe427 --- /dev/null +++ b/aws/rust-runtime/aws-hyper/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "aws-hyper" +version = "0.1.0" +authors = ["Russell Cohen "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +hyper = { version = "0.14.2", features = ["client", "http1", "http2"] } +tower = { version = "0.4.2", features = ["retry", "buffer"] } +operationwip = { path = "../operationwip" } +middleware-tracing = { path = "../middleware-tracing" } +hyper-tls = "0.5.0" +aws-auth = { path = "../aws-auth" } +aws-sig-auth = { path = "../aws-sig-auth" } +aws-endpoint = { path = "../aws-endpoint" } +http = "0.2.3" +bytes = "1" +http-body = "0.4.0" +tokio = { version = "1", features = ["time"] } +smithy-http = { path = "../../../rust-runtime/smithy-http" } +smithy-http-tower = { path = "../../../rust-runtime/smithy-http-tower" } +pin-utils = "0.1.0" + +[dev-dependencies] +tokio = { version = "1", features = ["full"] } +tower-test = "0.4.0" +aws-types = { path = "../aws-types" } diff --git a/aws/rust-runtime/aws-hyper/src/lib.rs b/aws/rust-runtime/aws-hyper/src/lib.rs new file mode 100644 index 0000000000..38914b1eb1 --- /dev/null +++ b/aws/rust-runtime/aws-hyper/src/lib.rs @@ -0,0 +1,251 @@ +use hyper::Client as HyperClient; +use smithy_http::body::SdkBody; +use smithy_http::operation; +use smithy_http::response::ParseHttpResponse; +use std::error::Error; +use tower::{Service, ServiceBuilder, ServiceExt}; + +type BoxError = Box; + +pub type SdkError = smithy_http::result::SdkError; +pub type SdkSuccess = smithy_http::result::SdkSuccess; + +pub struct Client { + inner: S, +} + +impl Client { + pub fn new(connector: S) -> Self { + Client { inner: connector } + } +} + +impl Client, SdkBody>> { + pub fn default() -> Self { + let https = HttpsConnector::new(); + let client = HyperClient::builder().build::<_, SdkBody>(https); + Client { inner: client } + } +} + +impl Client { + pub fn with_tracing(self) -> Client> { + Client { + inner: RawRequestLogging { inner: self.inner }, + } + } +} + +// In the future, this needs to use the CRT +#[derive(Clone)] +struct RetryStrategy {} + +impl + tower::retry::Policy, Response, Error> for RetryStrategy +where + R: RetryPolicy, +{ + type Future = Pin>>; + + fn retry( + &self, + req: &Operation, + result: Result<&Response, &Error>, + ) -> Option { + let _resp = req.retry_policy().should_retry(result)?; + let next = self.clone(); + let fut = async move { + tokio::time::sleep(Duration::new(5, 0)).await; + next + }; + Some(Box::pin(fut)) + } + + fn clone_request(&self, req: &Operation) -> Option> { + req.try_clone() + } +} + +impl Client +where + S: Service, Response = http::Response> + + Send + + Clone + + 'static, + S::Error: Into + Send + Sync + 'static, + S::Future: Send + 'static, +{ + /// Dispatch this request to the network + /// + /// For ergonomics, this does not include the raw response for successful responses. To + /// access the raw response use `call_raw`. + pub async fn call(&self, input: Operation) -> Result> + where + O: ParseHttpResponse> + Send + Clone + 'static, + Retry: RetryPolicy, SdkError> + Send + Clone + 'static, + { + self.call_raw(input).await.map(|res| res.parsed) + } + + pub async fn call_raw( + &self, + input: Operation, + ) -> Result, SdkError> + where + O: ParseHttpResponse> + Send + Clone + 'static, + Retry: RetryPolicy, SdkError> + Send + Clone + 'static, + { + let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new())); + let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage); + let inner = self.inner.clone(); + let mut svc = ServiceBuilder::new() + .retry(RetryStrategy {}) + .map_request(|r: Operation| r) + .layer(ParseResponseLayer::::new()) + .layer(endpoint_resolver) + .layer(signer) + .layer(DispatchLayer::new()) + .service(inner); + svc.ready_and().await?.call(input).await + + //svc.call(input).await + //todo!() + } +} + +use hyper::client::HttpConnector; +use hyper_tls::HttpsConnector; +use middleware_tracing::RawRequestLogging; +use operationwip::retry_policy::RetryPolicy; + +use smithy_http::operation::Operation; +use std::future::Future; +use std::pin::Pin; + +use aws_endpoint::AwsEndpointStage; +use aws_sig_auth::middleware::SigV4SigningStage; +use aws_sig_auth::signer::SigV4Signer; +use smithy_http_tower::dispatch::DispatchLayer; +use smithy_http_tower::map_request::MapRequestLayer; +use smithy_http_tower::parse_response::ParseResponseLayer; +use std::time::Duration; + +#[cfg(test)] +mod test { + use crate::BoxError; + + use bytes::Bytes; + + use http::{Request, Response}; + + use pin_utils::core_reexport::task::{Context, Poll}; + use smithy_http::body::SdkBody; + + use smithy_http::response::ParseHttpResponse; + + use std::future::Future; + use std::pin::Pin; + use std::sync::mpsc; + + #[derive(Clone)] + struct TestService { + f: fn(&http::Request) -> http::Response, + tx: mpsc::Sender>, + } + + impl TestService { + pub fn new( + f: fn(&http::Request) -> http::Response, + ) -> (Self, mpsc::Receiver>) { + let (tx, rx) = mpsc::channel(); + (TestService { f, tx }, rx) + } + } + + impl tower::Service> for TestService { + type Response = http::Response; + type Error = BoxError; + type Future = Pin> + Send>>; + + fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } + + fn call(&mut self, req: Request) -> Self::Future { + let response = (self.f)(&req); + self.tx.send(req).unwrap(); + Box::pin(std::future::ready(Ok(response))) + } + } + + #[derive(Clone)] + struct TestOperationParser; + + impl ParseHttpResponse for TestOperationParser + where + B: http_body::Body, + { + type Output = Result; + + fn parse_unloaded(&self, _response: &mut Response) -> Option { + Some(Ok("Hello!".to_string())) + } + + fn parse_loaded(&self, _response: &Response) -> Self::Output { + Ok("Hello!".to_string()) + } + } + + /* + #[tokio::test] + async fn e2e_service() { + #[derive(Debug)] + struct TestError; + + impl std::fmt::Display for TestError { + fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result { + unimplemented!() + } + } + impl Error for TestError {} + + let request = operation::Request::new( + Request::builder() + .uri("/some_url") + .body(SdkBody::from("Hello")) + .unwrap(), + ) + .augment(|req, config| { + config.insert(Region::new("some-region")); + config.insert(UNIX_EPOCH + Duration::new(1611160427, 0)); + config.insert_signing_config(OperationSigningConfig::default_config("some-service")); + use operationwip::signing_middleware::CredentialProviderExt; + config.insert_credentials_provider(Arc::new(Credentials::from_keys( + "access", "secret", None, + ))); + config.insert_endpoint_provider(Arc::new(Endpoint::from_uri(Uri::from_static( + "http://localhost:8000", + )))); + Result::<_, ()>::Ok(req) + }) + .expect("valid request"); + + let operation = Operation::new(request, TestOperationParser); + + let (svc, rx) = TestService::new(|_req| http::Response::new(hyper::Body::from("hello!"))); + let client = Client { inner: svc }; + let resp = client.call(operation).await; + println!("{:?}", resp); + let request = rx.try_recv().unwrap(); + + assert_eq!( + request + .headers() + .keys() + .map(|it| it.as_str()) + .collect::>(), + vec!["host", "authorization", "x-amz-date"] + ); + assert_eq!(request.headers().get(AUTHORIZATION).unwrap(), "AWS4-HMAC-SHA256 Credential=access/20210120/some-region/some-service/aws4_request, SignedHeaders=host, Signature=f179c6899f0a11051a11dc1bb022252b0741953663bc5ff33dfa2abfed51e0b1"); + }*/ +} diff --git a/aws/rust-runtime/aws-types/src/lib.rs b/aws/rust-runtime/aws-types/src/lib.rs index cedfd81dcf..487d843ca6 100644 --- a/aws/rust-runtime/aws-types/src/lib.rs +++ b/aws/rust-runtime/aws-types/src/lib.rs @@ -23,6 +23,32 @@ impl Region { } } +pub mod region { + use crate::Region; + + pub trait ProvideRegion { + fn region(&self) -> Option; + } + + impl ProvideRegion for &str { + fn region(&self) -> Option { + Some(Region::new(*self)) + } + } + + struct RegionEnvironment; + + impl ProvideRegion for RegionEnvironment { + fn region(&self) -> Option { + std::env::var("AWS_DEFAULT_REGION").map(Region::new).ok() + } + } + + pub fn default_provider() -> impl ProvideRegion { + RegionEnvironment + } +} + /// The region to use when signing requests /// /// Generally, user code will not need to interact with `SigningRegion`. See `[Region](crate::Region)`. diff --git a/aws/rust-runtime/middleware-tracing/Cargo.toml b/aws/rust-runtime/middleware-tracing/Cargo.toml new file mode 100644 index 0000000000..75abd0a24e --- /dev/null +++ b/aws/rust-runtime/middleware-tracing/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "middleware-tracing" +version = "0.1.0" +authors = ["Russell Cohen "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tracing = "0.1.22" +tower = "0.4.3" +http = "0.2.3" +tracing-futures = "0.2.4" diff --git a/aws/rust-runtime/middleware-tracing/src/lib.rs b/aws/rust-runtime/middleware-tracing/src/lib.rs new file mode 100644 index 0000000000..2ec96edc83 --- /dev/null +++ b/aws/rust-runtime/middleware-tracing/src/lib.rs @@ -0,0 +1,29 @@ +use std::fmt::Debug; +use std::task::{Context, Poll}; +use tower::Service; +use tracing::instrument::{Instrument, Instrumented}; +use tracing::{span, Level}; + +#[derive(Clone)] +pub struct RawRequestLogging { + pub inner: S, +} + +impl Service> for RawRequestLogging +where + B: Debug, + S: Service>, +{ + type Response = S::Response; + type Error = S::Error; + type Future = Instrumented; + + fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { + self.inner.poll_ready(cx) + } + + fn call(&mut self, req: http::Request) -> Self::Future { + let span = span!(Level::TRACE, "request_dispatch", req = ?&req); + self.inner.call(req).instrument(span) + } +} diff --git a/aws/rust-runtime/operationwip/Cargo.toml b/aws/rust-runtime/operationwip/Cargo.toml new file mode 100644 index 0000000000..a677f3699e --- /dev/null +++ b/aws/rust-runtime/operationwip/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "operationwip" +version = "0.1.0" +authors = ["Russell Cohen "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +aws-auth = { path = "../aws-auth" } +aws-sig-auth = { path = "../aws-sig-auth" } +aws-types = { path = "../aws-types" } +http = "0.2.3" +bytes = "1" +tower = { version = "0.4.2", features = ["util"] } +http-body = "0.4.0" +pin-project = "1.0.4" +smithy-http = { path = "../../../rust-runtime/smithy-http"} + +[dev-dependencies] +tokio = { version = "1", features = ["full"] } diff --git a/aws/rust-runtime/operationwip/src/lib.rs b/aws/rust-runtime/operationwip/src/lib.rs new file mode 100644 index 0000000000..27b2a1f3e0 --- /dev/null +++ b/aws/rust-runtime/operationwip/src/lib.rs @@ -0,0 +1 @@ +pub mod retry_policy; diff --git a/aws/rust-runtime/operationwip/src/retry_policy.rs b/aws/rust-runtime/operationwip/src/retry_policy.rs new file mode 100644 index 0000000000..16c83a5039 --- /dev/null +++ b/aws/rust-runtime/operationwip/src/retry_policy.rs @@ -0,0 +1,41 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +use std::time::Duration; + +pub enum RetryType { + /// This is a connection level error such as a socket timeout, socket connect error, + /// tls negotiation timeout etc... + /// + /// Typically these should never be applied for non-idempotent request types + /// since in this scenario, it's impossible to know whether the operation had + /// a side effect on the server. + TransientError, + + /// An error where the server explicitly told the client to back off, such as a 429 or 503 HTTP error. + ThrottlingError, + + /// Server error that isn't explicitly throttling but is considered by the client + /// to be something that should be retried. + ServerError, + + /// Doesn't count against any budgets. This could be something like a 401 challenge in Http. + ClientError, + + /// An explicit retry in a set duration. This allows waiters + /// to be a special case of retries + Explicit(Duration), +} + +pub trait RetryPolicy { + fn should_retry(&self, input: Result<&T, &E>) -> Option; +} + +/// () is the default policy: never retry +impl RetryPolicy for () { + fn should_retry(&self, _: Result<&T, &E>) -> Option { + None + } +} diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt index e7147f391b..737467c299 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt @@ -5,7 +5,10 @@ package software.amazon.smithy.rustsdk +import software.amazon.smithy.aws.traits.auth.SigV4Trait +import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.rust.codegen.smithy.customize.RustCodegenDecorator +import software.amazon.smithy.rust.codegen.smithy.generators.OperationCustomization import software.amazon.smithy.rust.codegen.smithy.generators.ProtocolConfig import software.amazon.smithy.rust.codegen.smithy.generators.config.ConfigCustomization @@ -16,6 +19,20 @@ class AwsCodegenDecorator : RustCodegenDecorator { protocolConfig: ProtocolConfig, baseCustomizations: List ): List { - return listOf(BaseAwsConfig()) + baseCustomizations + val awsCustomizations = mutableListOf() + awsCustomizations += RegionConfig(protocolConfig.runtimeConfig) + awsCustomizations += EndpointConfigCustomization(protocolConfig) + protocolConfig.serviceShape.getTrait(SigV4Trait::class.java).map { trait -> + awsCustomizations += SigV4SigningConfig(trait) + } + return awsCustomizations + baseCustomizations + } + + override fun operationCustomizations( + protocolConfig: ProtocolConfig, + operation: OperationShape, + baseCustomizations: List + ): List { + return listOf(SigV4SigningPlugin(operation, protocolConfig.runtimeConfig), EndpointConfigPlugin(protocolConfig.runtimeConfig, operation), RegionConfigPlugin(operation)) + baseCustomizations } } diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/BaseAwsConfig.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/BaseAwsConfig.kt deleted file mode 100644 index e81d5d52f1..0000000000 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/BaseAwsConfig.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -package software.amazon.smithy.rustsdk - -import software.amazon.smithy.rust.codegen.rustlang.Attribute -import software.amazon.smithy.rust.codegen.rustlang.rust -import software.amazon.smithy.rust.codegen.rustlang.writable -import software.amazon.smithy.rust.codegen.smithy.generators.config.ConfigCustomization -import software.amazon.smithy.rust.codegen.smithy.generators.config.ServiceConfig - -/** - * Just a Stub - * - * Augment the config object with the AWS-specific fields like service and region - */ -class BaseAwsConfig : ConfigCustomization() { - override fun section(section: ServiceConfig) = writable { - when (section) { - ServiceConfig.ConfigStruct -> { - Attribute.AllowUnused.render(this) - rust("pub(crate) region: String,") - } - ServiceConfig.BuilderBuild -> rust("region: \"todo\".to_owned(),") - else -> {} - /*ServiceConfig.ConfigImpl -> TODO() - ServiceConfig.BuilderStruct -> TODO() - ServiceConfig.BuilderImpl -> TODO() - ServiceConfig.BuilderBuild -> TODO()*/ - } - } -} diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/EndpointConfig.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/EndpointConfig.kt new file mode 100644 index 0000000000..b1faca54ba --- /dev/null +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/EndpointConfig.kt @@ -0,0 +1,82 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +package software.amazon.smithy.rustsdk + +import software.amazon.smithy.aws.traits.ServiceTrait +import software.amazon.smithy.model.shapes.OperationShape +import software.amazon.smithy.model.traits.EndpointTrait +import software.amazon.smithy.rust.codegen.rustlang.CargoDependency +import software.amazon.smithy.rust.codegen.rustlang.Local +import software.amazon.smithy.rust.codegen.rustlang.Writable +import software.amazon.smithy.rust.codegen.rustlang.rust +import software.amazon.smithy.rust.codegen.rustlang.writable +import software.amazon.smithy.rust.codegen.smithy.RuntimeConfig +import software.amazon.smithy.rust.codegen.smithy.RuntimeType +import software.amazon.smithy.rust.codegen.smithy.generators.OperationCustomization +import software.amazon.smithy.rust.codegen.smithy.generators.OperationSection +import software.amazon.smithy.rust.codegen.smithy.generators.ProtocolConfig +import software.amazon.smithy.rust.codegen.smithy.generators.config.ConfigCustomization +import software.amazon.smithy.rust.codegen.smithy.generators.config.ServiceConfig +import software.amazon.smithy.rust.codegen.util.dq + +class EndpointConfigCustomization(private val protocolConfig: ProtocolConfig) : ConfigCustomization() { + private val endpointProvider = EndpointProvider(protocolConfig.runtimeConfig) + private val endpointPrefix = protocolConfig.serviceShape.expectTrait(ServiceTrait::class.java).endpointPrefix + override fun section(section: ServiceConfig): Writable = writable { + when (section) { + is ServiceConfig.ConfigStruct -> rust("pub endpoint_provider: ::std::sync::Arc,", endpointProvider) + is ServiceConfig.ConfigImpl -> emptySection + is ServiceConfig.BuilderStruct -> + rust("endpoint_provider: Option<::std::sync::Arc>,", endpointProvider) + ServiceConfig.BuilderImpl -> + rust( + """ + pub fn endpoint_provider(mut self, endpoint_provider: impl #T + 'static) -> Self { + self.endpoint_provider = Some(::std::sync::Arc::new(endpoint_provider)); + self + } + """, + endpointProvider + ) + ServiceConfig.BuilderBuild -> rust( + """endpoint_provider: self.endpoint_provider.unwrap_or_else(|| + ::std::sync::Arc::new( + #T::DefaultAwsEndpointResolver::for_service(${endpointPrefix.dq()}) + ) + ),""", + awsEndpoint(protocolConfig.runtimeConfig) + ) + } + } +} + +fun AwsEndpoint(runtimeConfig: RuntimeConfig) = CargoDependency("aws-endpoint", Local(runtimeConfig.relativePath)) +fun EndpointProvider(runtimeConfig: RuntimeConfig) = + RuntimeType("ResolveAwsEndpoint", AwsEndpoint(runtimeConfig), "aws_endpoint") + +fun awsEndpoint(runtimeConfig: RuntimeConfig) = RuntimeType(null, AwsEndpoint(runtimeConfig), "aws_endpoint") +fun StaticEndpoint(runtimeConfig: RuntimeConfig) = + RuntimeType("Endpoint", CargoDependency.SmithyHttp(runtimeConfig), "smithy_http::endpoint") + +class EndpointConfigPlugin(private val runtimeConfig: RuntimeConfig, private val operationShape: OperationShape) : OperationCustomization() { + override fun section(section: OperationSection): Writable { + if (operationShape.hasTrait(EndpointTrait::class.java)) { + TODO() + } + return when (section) { + OperationSection.ImplBlock -> emptySection + is OperationSection.Feature -> writable { + rust( + """ + + #T::set_endpoint_resolver(${section.config}.endpoint_provider.clone(), &mut ${section.request}.config_mut()); + """, + awsEndpoint(runtimeConfig) + ) + } + } + } +} diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RegionConfig.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RegionConfig.kt new file mode 100644 index 0000000000..2cdf3edd41 --- /dev/null +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RegionConfig.kt @@ -0,0 +1,74 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +package software.amazon.smithy.rustsdk + +import software.amazon.smithy.model.shapes.OperationShape +import software.amazon.smithy.rust.codegen.rustlang.CargoDependency +import software.amazon.smithy.rust.codegen.rustlang.Local +import software.amazon.smithy.rust.codegen.rustlang.Writable +import software.amazon.smithy.rust.codegen.rustlang.rust +import software.amazon.smithy.rust.codegen.rustlang.writable +import software.amazon.smithy.rust.codegen.smithy.RuntimeConfig +import software.amazon.smithy.rust.codegen.smithy.RuntimeType +import software.amazon.smithy.rust.codegen.smithy.generators.OperationCustomization +import software.amazon.smithy.rust.codegen.smithy.generators.OperationSection +import software.amazon.smithy.rust.codegen.smithy.generators.config.ConfigCustomization +import software.amazon.smithy.rust.codegen.smithy.generators.config.ServiceConfig + +class RegionConfig(runtimeConfig: RuntimeConfig) : ConfigCustomization() { + private val region = awsTypes(runtimeConfig) + override fun section(section: ServiceConfig) = writable { + when (section) { + is ServiceConfig.ConfigStruct -> rust("pub region: Option<#T::Region>,", region) + is ServiceConfig.ConfigImpl -> emptySection + is ServiceConfig.BuilderStruct -> + rust("region: Option<#T::Region>,", region) + ServiceConfig.BuilderImpl -> + rust( + """ + pub fn region(mut self, region: impl #T::region::ProvideRegion) -> Self { + self.region = region.region(); + self + } + """, + region + ) + ServiceConfig.BuilderPreamble -> rust( + """ + use #1T::region::ProvideRegion; + let region = self.region.or_else(||#1T::region::default_provider().region()); + """, + region + ) + ServiceConfig.BuilderBuild -> rust( + """region: region.clone(),""", + ) + } + } +} + +class RegionConfigPlugin(private val operationShape: OperationShape) : OperationCustomization() { + override fun section(section: OperationSection): Writable { + return when (section) { + OperationSection.ImplBlock -> emptySection + is OperationSection.Feature -> writable { + rust( + """ + if let Some(region) = &${section.config}.region { + ${section.request}.config_mut().insert(region.clone()); + + } + """ + ) + } + } + } +} + +fun awsTypes(runtimeConfig: RuntimeConfig) = + RuntimeType(null, awsTypesDep(runtimeConfig), "aws_types") + +fun awsTypesDep(runtimeConfig: RuntimeConfig) = CargoDependency("aws-types", Local(runtimeConfig.relativePath)) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigningConfig.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigningConfig.kt new file mode 100644 index 0000000000..193cada628 --- /dev/null +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SigningConfig.kt @@ -0,0 +1,65 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +package software.amazon.smithy.rustsdk + +import software.amazon.smithy.aws.traits.auth.SigV4Trait +import software.amazon.smithy.model.shapes.OperationShape +import software.amazon.smithy.rust.codegen.rustlang.CargoDependency +import software.amazon.smithy.rust.codegen.rustlang.Local +import software.amazon.smithy.rust.codegen.rustlang.Writable +import software.amazon.smithy.rust.codegen.rustlang.rust +import software.amazon.smithy.rust.codegen.rustlang.rustTemplate +import software.amazon.smithy.rust.codegen.rustlang.writable +import software.amazon.smithy.rust.codegen.smithy.RuntimeConfig +import software.amazon.smithy.rust.codegen.smithy.RuntimeType +import software.amazon.smithy.rust.codegen.smithy.generators.OperationCustomization +import software.amazon.smithy.rust.codegen.smithy.generators.OperationSection +import software.amazon.smithy.rust.codegen.smithy.generators.config.ConfigCustomization +import software.amazon.smithy.rust.codegen.smithy.generators.config.ServiceConfig +import software.amazon.smithy.rust.codegen.util.dq + +class SigV4SigningConfig(private val sigV4Trait: SigV4Trait) : ConfigCustomization() { + override fun section(section: ServiceConfig): Writable { + return when (section) { + is ServiceConfig.ConfigImpl -> writable { + rust( + """ + /// The signature version 4 service signing name to use in the credential scope when signing requests. + pub fn signing_service(&self) -> &'static str { + ${sigV4Trait.name.dq()} + } + """ + ) + } + else -> emptySection + } + } +} + +class SigV4SigningPlugin(operationShape: OperationShape, private val runtimeConfig: RuntimeConfig) : + OperationCustomization() { + override fun section(section: OperationSection): Writable { + return when (section) { + is OperationSection.Feature -> writable { + addDependency(CargoDependency.OperationWip(runtimeConfig)) + rustTemplate( + """ + request.config_mut().insert( + #{sig_auth}::signer::OperationSigningConfig::default_config() + ); + request.config_mut().insert(#{aws_types}::SigningService::from_static(${section.config}.signing_service())); + """, + "sig_auth" to awsSigAuth, + "aws_types" to awsTypes(runtimeConfig) + ) + } + else -> emptySection + } + } +} + +val SigAuth = CargoDependency("aws-sig-auth", Local("../")) +val awsSigAuth = RuntimeType(null, SigAuth, "aws_sig_auth") diff --git a/aws/sdk/build.gradle.kts b/aws/sdk/build.gradle.kts index 693a1a6e39..91d23baff6 100644 --- a/aws/sdk/build.gradle.kts +++ b/aws/sdk/build.gradle.kts @@ -21,8 +21,9 @@ val smithyVersion: String by project val sdkOutputDir = buildDir.resolve("aws-sdk") val awsServices = discoverServices() // TODO: smithy-http should be removed -val runtimeModules = listOf("smithy-types", "smithy-http") -val awsModules = listOf("aws-auth", "aws-endpoint", "aws-types") +val runtimeModules = listOf("smithy-types", "smithy-http", "smithy-http-tower") +val examples = listOf("dynamo-helloworld", "kms-helloworld") +val awsModules = listOf("aws-auth", "aws-endpoint", "aws-types", "operationwip", "aws-hyper", "middleware-tracing", "aws-sig-auth") buildscript { val smithyVersion: String by project @@ -104,16 +105,17 @@ task("relocateServices") { } } -tasks.register("relocateAwsRuntime") { - from("$rootDir/aws/rust-runtime") - awsModules.forEach { - include("$it/**") +task("relocateExamples") { + description = "relocate the examples folder & rewrite path dependencies" + doLast { + copy { + from(projectDir) + include("examples/**") + into(sdkOutputDir) + exclude("**/target") + filter { line -> line.replace("build/aws-sdk/", "") } + } } - exclude("**/target") - exclude("**/Cargo.lock") - filter { line -> rewritePathDependency(line) } - into(sdkOutputDir) - outputs.upToDateWhen { false } } /** @@ -133,10 +135,23 @@ tasks.register("relocateRuntime") { exclude("**/Cargo.lock") } into(sdkOutputDir) + +} + +tasks.register("relocateAwsRuntime") { + from("$rootDir/aws/rust-runtime") + awsModules.forEach { + include("$it/**") + } + exclude("**/target") + exclude("**/Cargo.lock") + filter { line -> line.replace("../../rust-runtime/", "") } + into(sdkOutputDir) + outputs.upToDateWhen { false } } fun generateCargoWorkspace(services: List): String { - val modules = services.map(AwsService::module) + runtimeModules + awsModules + val modules = services.map(AwsService::module) + awsModules + runtimeModules + examples.map { "examples/$it" } return """ [workspace] members = [ @@ -152,7 +167,13 @@ task("generateCargoWorkspace") { } task("finalizeSdk") { - finalizedBy("relocateServices", "relocateRuntime", "relocateAwsRuntime", "generateCargoWorkspace") + finalizedBy( + "relocateServices", + "relocateRuntime", + "relocateAwsRuntime", + "generateCargoWorkspace", + "relocateExamples" + ) } tasks["smithyBuildJar"].dependsOn("generateSmithyBuild") @@ -192,7 +213,14 @@ tasks.register("cargoClippy") { dependsOn("assemble") } -tasks["test"].finalizedBy("cargoCheck", "cargoClippy", "cargoTest", "cargoDocs") +tasks.register("dynamoIt") { + workingDir(projectDir.resolve("examples/dynamo-helloworld")) + // disallow warnings + commandLine("cargo", "run") + dependsOn("assemble") +} + +tasks["test"].finalizedBy("cargoCheck", "cargoClippy", "cargoTest", "cargoDocs", "dynamoIt") tasks["clean"].doFirst { delete("smithy-build.json") diff --git a/codegen-test/dynamo-it/.gitignore b/aws/sdk/examples/.gitignore similarity index 100% rename from codegen-test/dynamo-it/.gitignore rename to aws/sdk/examples/.gitignore diff --git a/aws/sdk/examples/dynamo-helloworld/Cargo.lock b/aws/sdk/examples/dynamo-helloworld/Cargo.lock new file mode 100644 index 0000000000..c862db5b87 --- /dev/null +++ b/aws/sdk/examples/dynamo-helloworld/Cargo.lock @@ -0,0 +1,1365 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + +[[package]] +name = "async-stream" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3670df70cbc01729f901f94c887814b3c68db038aad1329a418bae178bc5295c" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "aws-auth" +version = "0.1.0" +dependencies = [ + "smithy-http", +] + +[[package]] +name = "aws-endpoint" +version = "0.1.0" +dependencies = [ + "aws-types", + "http", + "smithy-http", +] + +[[package]] +name = "aws-hyper" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-endpoint", + "aws-sig-auth", + "bytes", + "http", + "http-body", + "hyper", + "hyper-tls", + "middleware-tracing", + "operationwip", + "pin-utils", + "smithy-http", + "smithy-http-tower", + "tokio", + "tower", +] + +[[package]] +name = "aws-sig-auth" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-sigv4", + "aws-types", + "http", + "smithy-http", + "thiserror", +] + +[[package]] +name = "aws-sigv4" +version = "0.0.1" +source = "git+https://github.com/rcoh/sigv4?rev=05f90abc02a868cb570ed3006d950947cc0898b0#05f90abc02a868cb570ed3006d950947cc0898b0" +dependencies = [ + "bytes", + "chrono", + "hex", + "http", + "http-body", + "ring", + "serde", + "serde_urlencoded", +] + +[[package]] +name = "aws-types" +version = "0.1.0" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bumpalo" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f07aa6688c702439a1be0307b6a94dffe1168569e45b9500c1372bc580740d59" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "cc" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "winapi", +] + +[[package]] +name = "core-foundation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + +[[package]] +name = "dynamo-helloworld" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-hyper", + "dynamodb", + "env_logger", + "http", + "kms", + "operationwip", + "smithy-http", + "tokio", +] + +[[package]] +name = "dynamodb" +version = "0.0.1" +dependencies = [ + "aws-auth", + "aws-endpoint", + "aws-sig-auth", + "aws-types", + "bytes", + "fastrand", + "http", + "operationwip", + "serde", + "serde_json", + "smithy-http", + "smithy-types", +] + +[[package]] +name = "env_logger" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "fastrand" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3" +dependencies = [ + "instant", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" + +[[package]] +name = "futures-sink" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" + +[[package]] +name = "futures-task" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" + +[[package]] +name = "futures-util" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "h2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", + "tracing-futures", +] + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" + +[[package]] +name = "hermit-abi" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" + +[[package]] +name = "http" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12219dc884514cb4a6a03737f4413c0e01c23a1b059b0156004b23f1e19dccbe" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project 1.0.4", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "indexmap" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "js-sys" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "kms" +version = "0.0.1" +dependencies = [ + "aws-auth", + "aws-endpoint", + "aws-sig-auth", + "aws-types", + "bytes", + "http", + "operationwip", + "serde", + "serde_json", + "smithy-http", + "smithy-types", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0c4e9c72ee9d69b767adebc5f4788462a3b45624acd919475c92597bcaf4f" + +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "middleware-tracing" +version = "0.1.0" +dependencies = [ + "http", + "tower", + "tracing", + "tracing-futures", +] + +[[package]] +name = "mio" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" +dependencies = [ + "socket2", + "winapi", +] + +[[package]] +name = "native-tls" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + +[[package]] +name = "openssl" +version = "0.10.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "lazy_static", + "libc", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "operationwip" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-sig-auth", + "aws-types", + "bytes", + "http", + "http-body", + "pin-project 1.0.4", + "smithy-http", + "tower", +] + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +dependencies = [ + "pin-project-internal 0.4.27", +] + +[[package]] +name = "pin-project" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b70b68509f17aa2857863b6fa00bf21fc93674c7a8893de2f469f6aa7ca2f2" +dependencies = [ + "pin-project-internal 1.0.4", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa25a6393f22ce819b0f50e0be89287292fda8d425be38ee0ca14c4931d9e71" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "ring" +version = "0.16.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "security-framework" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook-registry" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "smithy-http" +version = "0.0.1" +dependencies = [ + "bytes", + "http", + "http-body", + "smithy-types", +] + +[[package]] +name = "smithy-http-tower" +version = "0.1.0" +dependencies = [ + "bytes", + "http", + "http-body", + "pin-project 1.0.4", + "smithy-http", + "tower", +] + +[[package]] +name = "smithy-types" +version = "0.0.1" +dependencies = [ + "chrono", +] + +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if", + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "syn" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if", + "libc", + "rand", + "redox_syscall 0.2.4", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tokio" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8efab2086f17abcddb8f756117665c958feee6b2e39974c2f1600592ab3a4195" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42517d2975ca3114b22a16192634e8241dc5cc1f130be194645970cc1c371494" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76066865172052eb8796c686f0b441a93df8b08d40a950b062ffb9a426f00edd" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb971a26599ffd28066d387f109746df178eff14d5ea1e235015c5601967a4b" +dependencies = [ + "async-stream", + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", + "tokio-stream", +] + +[[package]] +name = "tower" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd7b451959622e21de79261673d658a0944b835012c58c51878ea55957fb51a" +dependencies = [ + "futures-core", + "futures-util", + "pin-project 1.0.4", + "tokio", + "tokio-stream", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project 0.4.27", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "vcpkg" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.10.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" + +[[package]] +name = "wasm-bindgen" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" + +[[package]] +name = "web-sys" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/aws/sdk/examples/dynamo-helloworld/Cargo.toml b/aws/sdk/examples/dynamo-helloworld/Cargo.toml new file mode 100644 index 0000000000..50a3143a11 --- /dev/null +++ b/aws/sdk/examples/dynamo-helloworld/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "dynamo-helloworld" +version = "0.1.0" +authors = ["Russell Cohen "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +dynamodb = { version = "0.0.1", path = "../../build/aws-sdk/dynamodb" } +kms = { path = "../../build/aws-sdk/kms" } +aws-hyper = { path = "../../build/aws-sdk/aws-hyper" } +operationwip = { path = "../../build/aws-sdk/operationwip" } +aws-auth = { path = "../../build/aws-sdk/aws-auth" } +tokio = { version = "1", features = ["full"] } +smithy-http = { path = "../../build/aws-sdk/smithy-http"} +http = "0.2.3" +env_logger = "0.8.2" diff --git a/aws/sdk/examples/dynamo-helloworld/README.md b/aws/sdk/examples/dynamo-helloworld/README.md new file mode 100644 index 0000000000..a4069339ca --- /dev/null +++ b/aws/sdk/examples/dynamo-helloworld/README.md @@ -0,0 +1,15 @@ +# DynamoDB Hello World Example +This repo has a simple hello-world example for DynamoDB that will create a table if it doesn't exist & list tables present in the database. + +By default, the code is written to target DynamoDB local—A docker compose file is provided for convenience. Usage: + +``` +docker-compose up -d +cargo run +``` + +## Running against real DynamoDB + +This hasn't been tested, but you'd need to: +- Remove the endpoint provider override +- Set real credentials (currently only static credentials are supported) diff --git a/codegen-test/dynamo-it/docker-compose.yml b/aws/sdk/examples/dynamo-helloworld/docker-compose.yml similarity index 100% rename from codegen-test/dynamo-it/docker-compose.yml rename to aws/sdk/examples/dynamo-helloworld/docker-compose.yml diff --git a/aws/sdk/examples/dynamo-helloworld/src/main.rs b/aws/sdk/examples/dynamo-helloworld/src/main.rs new file mode 100644 index 0000000000..535712215f --- /dev/null +++ b/aws/sdk/examples/dynamo-helloworld/src/main.rs @@ -0,0 +1,82 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +use std::error::Error; + +use aws_hyper::{SdkError, SdkSuccess}; +use dynamodb::{ + model::{ + AttributeDefinition, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType, + }, + operation::CreateTable, +}; +use env_logger::Env; +use smithy_http::endpoint::Endpoint; + +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::init_from_env(Env::default().default_filter_or("info")); + let config = dynamodb::Config::builder() + .region("us-east-1") + // To load credentials from environment variables, delete this line + .credentials_provider(aws_auth::Credentials::from_keys( + "", + "", + None + )) + // To use real DynamoDB, delete this line: + .endpoint_provider(Endpoint::immutable(http::Uri::from_static( + "http://localhost:8000", + ))) + .build(); + let client = aws_hyper::Client::default().with_tracing(); + let list_tables = dynamodb::operation::ListTables::builder() + .build(&config); + + let response = client.call(list_tables).await; + let tables = match response { + Ok(output) => output.table_names.unwrap_or_default(), + Err(e) => panic!("err: {:?}", e), + }; + if tables.is_empty() { + let create_table = CreateTable::builder() + .table_name("new_table") + .attribute_definitions(vec![AttributeDefinition::builder() + .attribute_name("ForumName") + .attribute_type(ScalarAttributeType::S) + .build()]) + .key_schema(vec![KeySchemaElement::builder() + .attribute_name("ForumName") + .key_type(KeyType::Hash) + .build()]) + .provisioned_throughput( + ProvisionedThroughput::builder() + .read_capacity_units(100) + .write_capacity_units(100) + .build(), + ) + .build(&config); + match client.call(create_table).await { + Ok(created) => println!("table created! {:#?}", created), + Err(SdkError::ServiceError { err, .. }) => println!("err: {:#?}", err), + Err(failed) => println!("failed to create table: {:?}", failed), + } + } + + let list_tables = dynamodb::operation::ListTables::builder().build(&config); + + let response = client.call(list_tables).await; + match response { + Ok(output) => { + println!( + "tables: {:?}", + output.table_names.unwrap_or_default() + ); + } + Err(e) => panic!("err: {:?}", e.source()), + }; + + Ok(()) +} diff --git a/codegen-test/dynamo-it/Cargo.lock b/aws/sdk/examples/kms-helloworld/Cargo.lock similarity index 60% rename from codegen-test/dynamo-it/Cargo.lock rename to aws/sdk/examples/kms-helloworld/Cargo.lock index 84c3d06af3..7b9f6b9dd4 100644 --- a/codegen-test/dynamo-it/Cargo.lock +++ b/aws/sdk/examples/kms-helloworld/Cargo.lock @@ -1,31 +1,99 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "aws-auth" +version = "0.1.0" +dependencies = [ + "smithy-http", +] + +[[package]] +name = "aws-endpoint" +version = "0.1.0" +dependencies = [ + "aws-types", + "http", + "smithy-http", +] + +[[package]] +name = "aws-hyper" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-endpoint", + "aws-sig-auth", + "bytes", + "http", + "http-body", + "hyper", + "hyper-tls", + "middleware-tracing", + "operationwip", + "pin-utils", + "smithy-http", + "smithy-http-tower", + "tokio", + "tower", +] + +[[package]] +name = "aws-sig-auth" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-sigv4", + "aws-types", + "http", + "smithy-http", + "thiserror", +] + [[package]] name = "aws-sigv4" version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85293e31cbf209322718ff220c48470f5dd31f39f652220bba6f3ceb2579cc81" +source = "git+https://github.com/rcoh/sigv4?rev=05f90abc02a868cb570ed3006d950947cc0898b0#05f90abc02a868cb570ed3006d950947cc0898b0" dependencies = [ - "bytes 0.5.6", + "bytes", "chrono", - "eliza_error", "hex", "http", - "http-body 0.3.1", - "httparse", - "hyper", + "http-body", "ring", "serde", "serde_urlencoded", - "tower", ] +[[package]] +name = "aws-types" +version = "0.1.0" + [[package]] name = "bitflags" version = "1.2.1" @@ -34,15 +102,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" [[package]] name = "bytes" @@ -56,12 +118,6 @@ version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,44 +133,37 @@ dependencies = [ "libc", "num-integer", "num-traits", - "time", - "winapi 0.3.9", + "winapi", ] [[package]] -name = "dtoa" -version = "0.4.6" +name = "core-foundation" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" - -[[package]] -name = "dynamo" -version = "0.0.1" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" dependencies = [ - "http", - "rand", - "serde", - "serde_json", - "smithy-http", - "smithy-types", + "core-foundation-sys", + "libc", ] [[package]] -name = "dynamo-it" -version = "0.1.0" -dependencies = [ - "dynamo", - "io-v0", - "rand", - "smithy-types", - "tokio", -] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] -name = "eliza_error" -version = "0.99.1" +name = "env_logger" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1037d8a172e26e7c3178e0af0d21515e56f8c85fb1c637cfbd31abbb237c31" +checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] [[package]] name = "fnv" @@ -123,78 +172,87 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fuchsia-zircon" -version = "0.3.3" +name = "foreign-types" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "bitflags", - "fuchsia-zircon-sys", + "foreign-types-shared", ] [[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] [[package]] name = "futures-channel" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-sink" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" [[package]] name = "futures-util" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures-core", "futures-task", - "pin-project 1.0.2", + "pin-project-lite", "pin-utils", ] [[package]] name = "getrandom" -version = "0.1.15" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "h2" -version = "0.2.7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" dependencies = [ - "bytes 0.5.6", + "bytes", "fnv", "futures-core", "futures-sink", @@ -216,9 +274,9 @@ checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -235,36 +293,26 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" dependencies = [ - "bytes 1.0.1", + "bytes", "fnv", "itoa", ] -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes 0.5.6", - "http", -] - [[package]] name = "http-body" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" dependencies = [ - "bytes 1.0.1", + "bytes", "http", ] [[package]] name = "httparse" -version = "1.3.4" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "httpdate" @@ -272,23 +320,29 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" -version = "0.13.9" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" dependencies = [ - "bytes 0.5.6", + "bytes", "futures-channel", "futures-core", "futures-util", "h2", "http", - "http-body 0.3.1", + "http-body", "httparse", "httpdate", "itoa", - "pin-project 1.0.2", + "pin-project 1.0.5", "socket2", "tokio", "tower-service", @@ -297,70 +351,77 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.1.5" +name = "hyper-tls" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", ] [[package]] name = "indexmap" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" dependencies = [ "autocfg", "hashbrown", ] [[package]] -name = "io-v0" -version = "0.1.0" -dependencies = [ - "aws-sigv4", - "http", - "http-body 0.3.1", - "hyper", - "pin-utils", - "tokio", -] - -[[package]] -name = "iovec" -version = "0.1.4" +name = "instant" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ - "libc", + "cfg-if", ] [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" dependencies = [ "wasm-bindgen", ] [[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +name = "kms" +version = "0.0.1" +dependencies = [ + "aws-auth", + "aws-endpoint", + "aws-sig-auth", + "aws-types", + "bytes", + "http", + "operationwip", + "serde", + "serde_json", + "smithy-http", + "smithy-types", +] + +[[package]] +name = "kms-helloworld" +version = "0.1.0" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "aws-hyper", + "env_logger", + "kms", + "tokio", ] [[package]] @@ -371,17 +432,26 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.81" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" +checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" + +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard", +] [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -397,78 +467,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +name = "middleware-tracing" +version = "0.1.0" dependencies = [ - "log", - "mio", - "miow 0.3.6", - "winapi 0.3.9", + "http", + "tower", + "tracing", + "tracing-futures", ] [[package]] -name = "mio-uds" -version = "0.6.8" +name = "mio" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" dependencies = [ - "iovec", "libc", - "mio", + "log", + "miow", + "ntapi", + "winapi", ] [[package]] name = "miow" -version = "0.2.2" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "socket2", + "winapi", ] [[package]] -name = "miow" -version = "0.3.6" +name = "native-tls" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" dependencies = [ - "socket2", - "winapi 0.3.9", + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] -name = "net2" -version = "0.2.37" +name = "ntapi" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -506,11 +561,84 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +[[package]] +name = "openssl" +version = "0.10.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "lazy_static", + "libc", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "operationwip" +version = "0.1.0" +dependencies = [ + "aws-auth", + "aws-sig-auth", + "aws-types", + "bytes", + "http", + "http-body", + "pin-project 1.0.5", + "smithy-http", + "tower", +] + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi", +] + [[package]] name = "percent-encoding" -version = "1.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" @@ -523,11 +651,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" dependencies = [ - "pin-project-internal 1.0.2", + "pin-project-internal 1.0.5", ] [[package]] @@ -543,9 +671,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" dependencies = [ "proc-macro2", "quote", @@ -554,15 +682,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" - -[[package]] -name = "pin-project-lite" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" [[package]] name = "pin-utils" @@ -570,6 +692,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + [[package]] name = "ppv-lite86" version = "0.2.10" @@ -587,20 +715,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.7.3" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ - "getrandom", "libc", "rand_chacha", "rand_core", @@ -609,9 +736,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", "rand_core", @@ -619,18 +746,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" dependencies = [ "getrandom", ] [[package]] name = "rand_hc" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ "rand_core", ] @@ -641,11 +768,47 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "redox_syscall" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + [[package]] name = "ring" -version = "0.16.19" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", "libc", @@ -653,7 +816,7 @@ dependencies = [ "spin", "untrusted", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -662,20 +825,59 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "security-framework" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "serde" -version = "1.0.118" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.118" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2", "quote", @@ -684,9 +886,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.60" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" +checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" dependencies = [ "itoa", "ryu", @@ -695,21 +897,21 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.5.5" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ - "dtoa", + "form_urlencoded", "itoa", + "ryu", "serde", - "url", ] [[package]] name = "signal-hook-registry" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce32ea0c6c56d5eacaeb814fbed9960547021d3edd010ded1425f180536b20ab" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" dependencies = [ "libc", ] @@ -720,16 +922,34 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + [[package]] name = "smithy-http" version = "0.0.1" dependencies = [ - "bytes 1.0.1", + "bytes", "http", - "http-body 0.4.0", + "http-body", "smithy-types", ] +[[package]] +name = "smithy-http-tower" +version = "0.1.0" +dependencies = [ + "bytes", + "http", + "http-body", + "pin-project 1.0.5", + "smithy-http", + "tower", +] + [[package]] name = "smithy-types" version = "0.0.1" @@ -739,14 +959,13 @@ dependencies = [ [[package]] name = "socket2" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c29947abdee2a218277abeca306f25789c938e500ea5a9d4b12a5a504466902" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "redox_syscall", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -757,9 +976,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "syn" -version = "1.0.54" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2", "quote", @@ -767,60 +986,42 @@ dependencies = [ ] [[package]] -name = "time" -version = "0.1.44" +name = "tempfile" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ + "cfg-if", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "rand", + "redox_syscall 0.2.4", + "remove_dir_all", + "winapi", ] [[package]] -name = "tinyvec" -version = "1.1.0" +name = "termcolor" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ - "tinyvec_macros", + "winapi-util", ] [[package]] -name = "tinyvec_macros" -version = "0.1.0" +name = "thiserror" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "0.2.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48" +checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio", - "mio-named-pipes", - "mio-uds", - "num_cpus", - "pin-project-lite 0.1.11", - "signal-hook-registry", - "slab", - "tokio-macros", - "winapi 0.3.9", + "thiserror-impl", ] [[package]] -name = "tokio-macros" -version = "0.2.6" +name = "thiserror-impl" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" dependencies = [ "proc-macro2", "quote", @@ -828,169 +1029,126 @@ dependencies = [ ] [[package]] -name = "tokio-util" -version = "0.3.1" +name = "thread_local" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.11", - "tokio", + "once_cell", ] [[package]] -name = "tower" -version = "0.3.1" +name = "tokio" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62" +checksum = "e8190d04c665ea9e6b6a0dc45523ade572c088d2e6566244c1122671dbf4ae3a" dependencies = [ - "futures-core", - "tower-buffer", - "tower-discover", - "tower-layer", - "tower-limit", - "tower-load-shed", - "tower-retry", - "tower-service", - "tower-timeout", - "tower-util", + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "winapi", ] [[package]] -name = "tower-buffer" -version = "0.3.0" +name = "tokio-macros" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a" +checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tokio", - "tower-layer", - "tower-service", - "tracing", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "tower-discover" +name = "tokio-native-tls" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tower-service", + "native-tls", + "tokio", ] [[package]] -name = "tower-layer" -version = "0.3.0" +name = "tokio-stream" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35d656f2638b288b33495d1053ea74c40dc05ec0b92084dd71ca5566c4ed1dc" - -[[package]] -name = "tower-limit" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c3040c5dbed68abffaa0d4517ac1a454cd741044f33ab0eefab6b8d1361404" +checksum = "1981ad97df782ab506a1f43bf82c967326960d278acf3bf8279809648c3ff3ea" dependencies = [ "futures-core", - "pin-project 0.4.27", + "pin-project-lite", "tokio", - "tower-layer", - "tower-load", - "tower-service", ] [[package]] -name = "tower-load" -version = "0.3.0" +name = "tokio-util" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b" +checksum = "ebb7cb2f00c5ae8df755b252306272cd1790d39728363936e01827e11f0b017b" dependencies = [ + "bytes", "futures-core", + "futures-sink", "log", - "pin-project 0.4.27", + "pin-project-lite", "tokio", - "tower-discover", - "tower-service", ] [[package]] -name = "tower-load-shed" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e" -dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-retry" -version = "0.3.0" +name = "tower" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952" +checksum = "5fd7b451959622e21de79261673d658a0944b835012c58c51878ea55957fb51a" dependencies = [ "futures-core", - "pin-project 0.4.27", + "futures-util", + "pin-project 1.0.5", "tokio", + "tokio-stream", "tower-layer", "tower-service", + "tracing", ] [[package]] -name = "tower-service" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" - -[[package]] -name = "tower-timeout" -version = "0.3.0" +name = "tower-layer" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e" -dependencies = [ - "pin-project 0.4.27", - "tokio", - "tower-layer", - "tower-service", -] +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" [[package]] -name = "tower-util" +name = "tower-service" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1093c19826d33807c72511e68f73b4a0469a3f22c2bd5f7d5212178b4b89674" -dependencies = [ - "futures-core", - "futures-util", - "pin-project 0.4.27", - "tower-service", -] +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" +checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", - "pin-project-lite 0.2.0", + "pin-project-lite", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada" +checksum = "43f080ea7e4107844ef4766459426fa2d5c1ada2e47edba05dc7fa99d9629f47" dependencies = [ "proc-macro2", "quote", @@ -1022,24 +1180,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-xid" version = "0.2.1" @@ -1053,15 +1193,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] -name = "url" -version = "1.7.2" +name = "vcpkg" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna", - "matches", - "percent-encoding", -] +checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" [[package]] name = "want" @@ -1075,31 +1210,25 @@ dependencies = [ [[package]] name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" dependencies = [ "bumpalo", "lazy_static", @@ -1112,9 +1241,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1122,9 +1251,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" dependencies = [ "proc-macro2", "quote", @@ -1135,26 +1264,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -1165,12 +1288,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1178,17 +1295,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "winapi-util" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/aws/sdk/examples/kms-helloworld/Cargo.toml b/aws/sdk/examples/kms-helloworld/Cargo.toml new file mode 100644 index 0000000000..0292c4c922 --- /dev/null +++ b/aws/sdk/examples/kms-helloworld/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "kms-helloworld" +version = "0.1.0" +authors = ["Russell Cohen "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +kms = { path = "../../build/aws-sdk/kms" } +aws-hyper = { path = "../../build/aws-sdk/aws-hyper" } +tokio = { version = "1", features = ["full"]} +# optional +env_logger = "0.8.2" diff --git a/aws/sdk/examples/kms-helloworld/src/main.rs b/aws/sdk/examples/kms-helloworld/src/main.rs new file mode 100644 index 0000000000..b39c6500d6 --- /dev/null +++ b/aws/sdk/examples/kms-helloworld/src/main.rs @@ -0,0 +1,17 @@ +use kms::operation::GenerateRandom; +use env_logger::Env; + +#[tokio::main] +async fn main() { + env_logger::init_from_env(Env::default().default_filter_or("info")); + let config = kms::Config::builder() + .region("us-east-1") + // creds loaded from environment variables, or they can be hard coded. Other credential providers not supported + .build(); + let client = aws_hyper::Client::default().with_tracing(); + let data = client + .call(GenerateRandom::builder().number_of_bytes(64).build(&config)) + .await + .expect("failed to generate random"); + println!("{:?}", data); +} diff --git a/aws/sdk/integration-tests/tests/dynamodb.rs b/aws/sdk/integration-tests/tests/dynamodb.rs new file mode 100644 index 0000000000..4be6f90520 --- /dev/null +++ b/aws/sdk/integration-tests/tests/dynamodb.rs @@ -0,0 +1,94 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +use aws_auth::Credentials; +use bytes::Bytes; +use dynamodb::operation::ListTables; +use smithy_http::body::SdkBody; +use std::convert::{TryFrom}; +use std::process::Command; +use serde::Deserialize; +use tower::BoxError; +use reqwest::Certificate; +use std::fs; + +fn start_test(id: &str) { + let _output = Command::new("curl") + .args(&[format!("http://crucible/clear_test")]) + .output() + .expect("test started"); + let _output = Command::new("curl") + .args(&[format!("http://crucible/start_test/{}", id)]) + .output() + .expect("test started"); +} + +fn finish_test() -> TestResults { + let output = Command::new("curl") + .args(&[format!("http://crucible/check_test")]) + .output() + .expect("test started"); + serde_json::from_slice(output.stdout.as_slice()).expect("invalid schema") +} + +#[derive(Deserialize)] +struct TestResults { + errors: Vec +} + +fn make_connector() -> impl tower::Service< + http::Request, + Response = http::Response, + Error = BoxError, + Future = impl Send +> + Clone { + tower::service_fn(|req: http::Request| async move { + let cert = fs::read_to_string("/Users/rcoh/.mitmproxy/mitmproxy-ca-cert.pem").expect("loading cert"); + let cert = Certificate::from_pem(cert.as_bytes()).expect("couldn't load cert"); + let client = reqwest::ClientBuilder::new().add_root_certificate(cert).build().expect("build client"); + let req = req.map(|body| Bytes::copy_from_slice(body.bytes().unwrap())); + let req = reqwest::Request::try_from(req).map_err(|_| "not a request")?; + let response = client.execute(req).await.unwrap(); + let mut builder = http::Response::builder().status(response.status()); + *(builder.headers_mut().unwrap()) = response.headers().clone(); + let data = response.bytes().await.unwrap(); + Result::, BoxError>::Ok( + builder + .body(hyper::Body::from(data)) + .unwrap(), + ) + }) +} + +#[tokio::test] +async fn test_list_tables() { + let config = dynamodb::Config::builder() + .region("us-east-1") + .credentials_provider(Credentials::from_keys("asdf", "asdf", None)) + .build(); + let client = aws_hyper::Client::new(make_connector()); + let request = ListTables::builder().build(&config); + + start_test("list-tables"); + let response = client.call(request).await.expect("success response"); + assert_eq!(response.table_names.unwrap(), vec!["new_table".to_owned()]); + let output = finish_test(); + assert_eq!(output.errors, Vec::::new()); +} + +#[tokio::test] +async fn test_invalid_response() { + let config = dynamodb::Config::builder() + .region("us-east-1") + .credentials_provider(Credentials::from_keys("asdf", "asdf", None)) + .build(); + let client = aws_hyper::Client::new(make_connector()); + let request = ListTables::builder().build(&config); + + start_test("invalid-response"); + let _ = client.call(request).await.expect_err("response does not contain valid JSON"); + let output = finish_test(); + assert_eq!(output.errors, Vec::::new()); +} diff --git a/codegen-test/dynamo-it/Cargo.toml b/codegen-test/dynamo-it/Cargo.toml deleted file mode 100644 index 0ea6fe2555..0000000000 --- a/codegen-test/dynamo-it/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "dynamo-it" -version = "0.1.0" -authors = ["Russell Cohen "] -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -smithy-types = { path = "../../rust-runtime/smithy-types" } -dynamo = { version = "0.0.1", path = "../build/smithyprojections/codegen-test/dynamo/rust-codegen/"} -io-v0 = { path = "../../rust-runtime/io-v0" } -tokio = { version = "0.2", features = ["full"] } -rand = "0.7.3" diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt index a0de96b488..ebb523f298 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt @@ -157,8 +157,12 @@ data class CargoDependency( } companion object { + val Bytes: RustDependency = CargoDependency("bytes", CratesIo("1")) val FastRand = CargoDependency("fastrand", CratesIo("1")) val Http: CargoDependency = CargoDependency("http", CratesIo("0.2")) + // WIP being refactored + fun OperationWip(runtimeConfig: RuntimeConfig): CargoDependency = CargoDependency("operationwip", Local(runtimeConfig.relativePath)) + fun SmithyTypes(runtimeConfig: RuntimeConfig) = CargoDependency("${runtimeConfig.cratePrefix}-types", Local(runtimeConfig.relativePath)) @@ -173,6 +177,5 @@ data class CargoDependency( val SerdeJson: CargoDependency = CargoDependency("serde_json", CratesIo("1"), features = listOf("float_roundtrip")) val Serde = CargoDependency("serde", CratesIo("1"), features = listOf("derive")) - val Bytes: RustDependency = CargoDependency("bytes", CratesIo("1")) } } diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RuntimeTypes.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RuntimeTypes.kt index d43419d873..806d933984 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RuntimeTypes.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RuntimeTypes.kt @@ -53,6 +53,8 @@ data class RuntimeType(val name: String?, val dependency: RustDependency?, val n // TODO: refactor to be RuntimeTypeProvider a la Symbol provider that packages the `RuntimeConfig` state. companion object { + val Bytes = RuntimeType("Bytes", dependency = CargoDependency.Bytes, namespace = "bytes") + // val Blob = RuntimeType("Blob", RustDependency.IO_CORE, "blob") val From = RuntimeType("From", dependency = null, namespace = "std::convert") val AsRef = RuntimeType("AsRef", dependency = null, namespace = "std::convert") @@ -150,7 +152,6 @@ data class RuntimeType(val name: String?, val dependency: RustDependency?, val n fun sdkBody(runtimeConfig: RuntimeConfig): RuntimeType = RuntimeType("SdkBody", dependency = CargoDependency.SmithyHttp(runtimeConfig), "smithy_http::body") fun parseStrict(runtimeConfig: RuntimeConfig) = RuntimeType("ParseStrictResponse", dependency = CargoDependency.SmithyHttp(runtimeConfig), namespace = "smithy_http::response") - val Bytes = RuntimeType("Bytes", dependency = CargoDependency.Bytes, namespace = "bytes") fun BlobSerde(runtimeConfig: RuntimeConfig) = forInlineDependency(InlineDependency.blobSerde(runtimeConfig)) private fun forInlineDependency(inlineDependency: InlineDependency) = diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolMetadataProvider.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolMetadataProvider.kt index b2b190baf5..423870f563 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolMetadataProvider.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/SymbolMetadataProvider.kt @@ -91,7 +91,7 @@ class BaseSymbolMetadataProvider(base: RustSymbolProvider) : SymbolMetadataProvi } companion object { - private val defaultDerives = + val defaultDerives = listOf(RuntimeType.StdFmt("Debug"), RuntimeType.Std("cmp::PartialEq"), RuntimeType.Std("clone::Clone")) } } diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RustCodegenDecorator.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RustCodegenDecorator.kt index e461d1c47f..fd4498f312 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RustCodegenDecorator.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RustCodegenDecorator.kt @@ -33,7 +33,6 @@ interface RustCodegenDecorator { * Enable a deterministic ordering to be applied, with the lowest numbered integrations being applied first */ val order: Byte - fun configCustomizations( protocolConfig: ProtocolConfig, baseCustomizations: List diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/BuilderGenerator.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/BuilderGenerator.kt index 28dc241313..9a360aa31d 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/BuilderGenerator.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/BuilderGenerator.kt @@ -65,17 +65,22 @@ class OperationInputBuilderGenerator( private val shape: OperationShape, private val features: List, ) : BuilderGenerator(model, symbolProvider, shape.inputShape(model)) { + private val runtimeConfig = symbolProvider.config().runtimeConfig + override fun buildFn(implBlockWriter: RustWriter) { val fallibleBuilder = StructureGenerator.fallibleBuilder(shape.inputShape(model), symbolProvider) val retryType = "()" val returnType = "#T<#{T}, $retryType>".letIf(fallibleBuilder) { "Result<$it, String>" } val outputSymbol = symbolProvider.toSymbol(shape) val operationT = RuntimeType.operation(symbolProvider.config().runtimeConfig) - val operationModule = RuntimeType.operationModule(symbolProvider.config().runtimeConfig) - val sdkBody = RuntimeType.sdkBody(symbolProvider.config().runtimeConfig) implBlockWriter.docs("Consumes the builder and constructs an Operation<#D>", outputSymbol) - implBlockWriter.rustBlock("pub fn build(self, _config: &#T::Config) -> $returnType", RuntimeType.Config, operationT, outputSymbol) { + implBlockWriter.rustBlock( + "pub fn build(self, _config: &#T::Config) -> $returnType", + RuntimeType.Config, + RuntimeType.operation(runtimeConfig), + outputSymbol + ) { conditionalBlock("Ok({", "})", conditional = fallibleBuilder) { withBlock("let op = #T::new(", ");", outputSymbol) { coreBuilder(this) @@ -85,7 +90,7 @@ class OperationInputBuilderGenerator( ##[allow(unused_mut)] let mut request = #T::Request::new(op.build_http_request().map(#T::from)); """, - operationModule, sdkBody + RuntimeType.operationModule(runtimeConfig), RuntimeType.sdkBody(runtimeConfig), ) features.forEach { it.section(OperationSection.Feature("request", "_config"))(this) } rust( diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/HttpProtocolGenerator.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/HttpProtocolGenerator.kt index 7bdc7778af..6bf92e87ed 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/HttpProtocolGenerator.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/HttpProtocolGenerator.kt @@ -10,6 +10,7 @@ import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ServiceShape import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.shapes.StructureShape +import software.amazon.smithy.rust.codegen.rustlang.Derives import software.amazon.smithy.rust.codegen.rustlang.RustWriter import software.amazon.smithy.rust.codegen.rustlang.documentShape import software.amazon.smithy.rust.codegen.rustlang.rustBlock @@ -47,7 +48,12 @@ abstract class HttpProtocolGenerator( ) { private val symbolProvider = protocolConfig.symbolProvider private val model = protocolConfig.model - fun renderOperation(operationWriter: RustWriter, inputWriter: RustWriter, operationShape: OperationShape, customizations: List) { + fun renderOperation( + operationWriter: RustWriter, + inputWriter: RustWriter, + operationShape: OperationShape, + customizations: List + ) { val inputShape = operationShape.inputShape(model) val inputSymbol = symbolProvider.toSymbol(inputShape) val builderGenerator = OperationInputBuilderGenerator(model, symbolProvider, operationShape, customizations) @@ -74,6 +80,7 @@ abstract class HttpProtocolGenerator( } val operationName = symbolProvider.toSymbol(operationShape).name operationWriter.documentShape(operationShape, model) + Derives(setOf(RuntimeType.Std("clone::Clone"))).render(operationWriter) operationWriter.rustBlock("pub struct $operationName") { write("input: #T", inputSymbol) } @@ -123,7 +130,11 @@ abstract class HttpProtocolGenerator( } } - protected fun fromResponseFun(implBlockWriter: RustWriter, operationShape: OperationShape, f: RustWriter.() -> Unit) { + protected fun fromResponseFun( + implBlockWriter: RustWriter, + operationShape: OperationShape, + f: RustWriter.() -> Unit + ) { implBlockWriter.rustBlock( "fn from_response(response: &#T>) -> Result<#T, #T>", RuntimeType.Http("response::Response"), @@ -150,5 +161,9 @@ abstract class HttpProtocolGenerator( * * Your implementation MUST call [httpBuilderFun] to create the public method. */ - abstract fun toHttpRequestImpl(implBlockWriter: RustWriter, operationShape: OperationShape, inputShape: StructureShape) + abstract fun toHttpRequestImpl( + implBlockWriter: RustWriter, + operationShape: OperationShape, + inputShape: StructureShape + ) } diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/IdempotencyTokenProviderCustomization.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/IdempotencyTokenProviderCustomization.kt index c3d7d198d1..93f73db681 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/IdempotencyTokenProviderCustomization.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/IdempotencyTokenProviderCustomization.kt @@ -14,30 +14,33 @@ import software.amazon.smithy.rust.codegen.smithy.customize.NamedSectionGenerato /** * Add a `token_provider` field to Service config. See below for the resulting generated code. */ -class IdempotencyTokenProviderCustomization : NamedSectionGenerator() { - override fun section(section: ServiceConfig): Writable { - return when (section) { - is ServiceConfig.ConfigStruct -> writable { - rust("pub (crate) token_provider: Box,", RuntimeType.IdempotencyToken) +class IdempotencyProviderConfig : NamedSectionGenerator() { + override fun section(section: ServiceConfig): Writable = writable { + when (section) { + is ServiceConfig.ConfigStruct -> rust( + "pub (crate) token_provider: Box,", + RuntimeType.IdempotencyToken + ) + is ServiceConfig.ConfigImpl -> { } - ServiceConfig.ConfigImpl -> emptySection - ServiceConfig.BuilderStruct -> writable { - rust("token_provider: Option>,", RuntimeType.IdempotencyToken) - } - ServiceConfig.BuilderImpl -> writable { - rust( - """ + is ServiceConfig.BuilderStruct -> rust( + "token_provider: Option>,", + RuntimeType.IdempotencyToken + ) + is ServiceConfig.BuilderImpl -> rust( + """ pub fn token_provider(mut self, token_provider: impl #T::ProvideIdempotencyToken + 'static) -> Self { self.token_provider = Some(Box::new(token_provider)); self } """, + RuntimeType.IdempotencyToken + ) + is ServiceConfig.BuilderBuild -> + rust( + "token_provider: self.token_provider.unwrap_or_else(|| Box::new(#T::default_provider())),", RuntimeType.IdempotencyToken ) - } - ServiceConfig.BuilderBuild -> writable { - rust("token_provider: self.token_provider.unwrap_or_else(|| Box::new(#T::default_provider())),", RuntimeType.IdempotencyToken) - } } } } diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGenerator.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGenerator.kt index 91699a1aea..8d2b7d1ac2 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGenerator.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGenerator.kt @@ -56,13 +56,17 @@ sealed class ServiceConfig(name: String) : Section(name) { object BuilderStruct : ServiceConfig("BuilderStruct") /** impl block of `ConfigBuilder` **/ object BuilderImpl : ServiceConfig("BuilderImpl") + + /** Setup shared resources in the build method **/ + object BuilderPreamble : ServiceConfig("BuilderBuildPreamble") + /** Convert from a field in the builder to the final field in config * eg. * ```kotlin * rust("""my_field: my_field.unwrap_or_else(||"default")""") * ``` **/ - object BuilderBuild : ServiceConfig("BuilderBuild") + object BuilderBuild : ServiceConfig("BuilderBuildPreamble") } // TODO: if this becomes hot, it may need to be cached in a knowledge index @@ -96,7 +100,7 @@ class ServiceConfigGenerator(private val customizations: List): ServiceConfigGenerator { val baseFeatures = mutableListOf() if (protocolConfig.serviceShape.needsIdempotencyToken(protocolConfig.model)) { - baseFeatures.add(IdempotencyTokenProviderCustomization()) + baseFeatures.add(IdempotencyProviderConfig()) } return ServiceConfigGenerator(baseFeatures + extraCustomizations) } @@ -132,6 +136,7 @@ class ServiceConfigGenerator(private val customizations: List Config") { + customizations.forEach { it.section(ServiceConfig.BuilderPreamble)(this) } rustBlock("Config") { customizations.forEach { it.section(ServiceConfig.BuilderBuild)(this) diff --git a/codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGeneratorTest.kt b/codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGeneratorTest.kt index cc6d9e4d4e..5d6bf490b0 100644 --- a/codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGeneratorTest.kt +++ b/codegen/src/test/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGeneratorTest.kt @@ -60,6 +60,7 @@ internal class ServiceConfigGeneratorTest { ServiceConfig.ConfigImpl -> emptySection ServiceConfig.BuilderStruct -> writable { rust("config_field: Option") } ServiceConfig.BuilderImpl -> emptySection + ServiceConfig.BuilderPreamble -> emptySection ServiceConfig.BuilderBuild -> writable { rust("config_field: self.config_field.unwrap_or_default(),") } } } diff --git a/rust-runtime/smithy-http/src/operation.rs b/rust-runtime/smithy-http/src/operation.rs index 64a37d2eb2..ec4f07b1da 100644 --- a/rust-runtime/smithy-http/src/operation.rs +++ b/rust-runtime/smithy-http/src/operation.rs @@ -13,6 +13,18 @@ impl Operation { pub fn into_request_response(self) -> (Request, H) { (self.request, self.response_handler) } + + pub fn retry_policy(&self) -> &R { + &self._retry_policy + } + + pub fn try_clone(&self) -> Option where H: Clone, R: Clone { + Some(Operation { + request: self.request.try_clone()?, + response_handler: self.response_handler.clone(), + _retry_policy: self._retry_policy.clone() + }) + } } impl Operation { diff --git a/rust-runtime/smithy-http/src/result.rs b/rust-runtime/smithy-http/src/result.rs index bfa8e76b31..0c887ecb6e 100644 --- a/rust-runtime/smithy-http/src/result.rs +++ b/rust-runtime/smithy-http/src/result.rs @@ -4,9 +4,10 @@ */ use std::error::Error; -use std::fmt::Debug; +use std::fmt; +use std::fmt::{Debug, Display, Formatter}; -type BoxError = Box; +type BoxError = Box; /// Body type when a response is returned. Currently, the only use case is introspecting errors /// so it is simply `Debug`. This is an area of potential design iteration. @@ -30,7 +31,7 @@ pub struct SdkSuccess { /// Failing Sdk Result /// -/// Typically, transport implementations will type alias (or entirely wrap / transform) this type +/// Typically, transport implementations will type alias (or wrap / transform) this type /// by specifying a concrete body implementation: /// ```rust /// # mod hyper { @@ -57,3 +58,28 @@ pub enum SdkError { /// An error response was received from the service ServiceError { raw: http::Response, err: E }, } + +impl Display for SdkError +where + E: Error, + B: Debug, +{ + fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result { + unimplemented!() + } +} + +impl Error for SdkError +where + E: Error + 'static, + B: Debug, +{ + fn source(&self) -> Option<&(dyn Error + 'static)> { + match self { + SdkError::ConstructionFailure(err) + | SdkError::DispatchFailure(err) + | SdkError::ResponseError { err, .. } => Some(err.as_ref()), + SdkError::ServiceError { err, .. } => Some(err), + } + } +}