From ed8763e5df356d20b8b8df116c5e4a033f9b1b22 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Thu, 19 Oct 2023 15:15:32 -0500 Subject: [PATCH] Re-point those using `ByteStream` and `SdkBody` to smithy-types (#3076) # Motivation and Context A follow-up on #3026 ## Description #3026 moved - `aws_smithy_http::body::{BoxBody, Error, SdkBody}` to `aws_smithy_types::body::{BoxBody, Error, SdkBody}` - `aws_smithy_http::byte_stream::{AggregatedBytes, ByteStream, error::Error}` to `aws_smithy_types::byte_stream::{AggregatedBytes, ByteStream, error::Error}` and also left "breadcrumbs", so that customers could still consume updated types from `aws_smithy_http` after the move. This PR turns breadcrumbs into deprecation messages (via `#[deprecated(...)]`) and updates existing places that used to use moved types from `aws_smithy_http` to directly depend on `aws_smithy_types`. ## Testing Relied on tests in CI. ## Checklist - [x] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --- CHANGELOG.next.toml | 16 ++++++++ aws/rust-runtime/aws-config/src/ecs.rs | 2 +- .../src/http_credential_provider.rs | 4 +- .../aws-config/src/imds/client.rs | 4 +- .../aws-config/src/imds/client/error.rs | 2 +- .../aws-config/src/imds/client/token.rs | 2 +- .../aws-config/src/imds/credentials.rs | 2 +- .../aws-config/src/imds/region.rs | 2 +- aws/rust-runtime/aws-config/src/sso/token.rs | 2 +- .../aws-config/src/sts/assume_role.rs | 2 +- .../aws-http/src/content_encoding.rs | 8 ++-- aws/rust-runtime/aws-http/src/request_id.rs | 2 +- .../src/glacier_interceptors.rs | 3 +- .../src/http_request_checksum.rs | 7 ++-- .../src/http_response_checksum.rs | 6 +-- .../aws-inlineable/src/s3_request_id.rs | 2 +- .../aws-runtime/src/recursion_detection.rs | 2 +- .../aws-runtime/src/retries/classifiers.rs | 2 +- .../benchmark/src/multipart_get.rs | 2 +- .../benchmark/src/multipart_put.rs | 2 +- .../dynamodb/benches/deserialization_bench.rs | 2 +- .../dynamodb/tests/movies.rs | 2 +- .../dynamodb/tests/paginators.rs | 2 +- .../retries-with-client-rate-limiting.rs | 2 +- aws/sdk/integration-tests/ec2/Cargo.toml | 2 +- .../integration-tests/ec2/tests/paginators.rs | 2 +- .../kms/tests/integration.rs | 2 +- .../qldbsession/tests/integration.rs | 2 +- .../integration-tests/s3/tests/checksums.rs | 4 +- .../s3/tests/ignore-invalid-xml-body-root.rs | 2 +- .../integration-tests/s3/tests/request_id.rs | 2 +- .../tests/retry-classifier-customization.rs | 2 +- .../integration-tests/s3/tests/signing-it.rs | 2 +- .../s3/tests/status-200-errors.rs | 2 +- .../integration-tests/s3control/Cargo.toml | 2 +- .../s3control/tests/signing-it.rs | 2 +- .../integration-tests/webassembly/src/http.rs | 2 +- .../StreamingShapeSymbolProviderTest.kt | 4 +- .../generators/EndpointTraitBindingsTest.kt | 2 +- .../protocols/AwsQueryCompatibleTest.kt | 4 +- .../rust/codegen/core/rustlang/Writable.kt | 4 +- .../rust/codegen/core/smithy/RuntimeType.kt | 4 +- .../customizations/SmithyTypesPubUseExtra.kt | 8 ++-- .../SmithyTypesPubUseExtraTest.kt | 2 +- .../ServerHttpBoundProtocolGenerator.kt | 6 +-- .../smithy/protocols/ServerProtocolLoader.kt | 2 +- examples/pokemon-service-common/Cargo.toml | 2 +- examples/pokemon-service-common/src/lib.rs | 2 +- .../src/body/calculate.rs | 6 +-- .../aws-smithy-checksums/src/body/validate.rs | 8 ++-- .../src/pytests/bytestream.rs | 2 +- .../src/types.rs | 38 +++++++++---------- rust-runtime/aws-smithy-http/src/body.rs | 21 ++++++++++ .../aws-smithy-http/src/byte_stream.rs | 24 ++++++++++++ .../src/event_stream/receiver.rs | 4 +- .../src/futures_stream_adapter.rs | 6 +-- rust-runtime/aws-smithy-http/src/lib.rs | 7 +--- rust-runtime/aws-smithy-http/src/result.rs | 2 +- .../src/client/http/request.rs | 4 +- .../src/client/interceptors/context.rs | 2 +- .../src/client/orchestrator.rs | 2 +- .../src/client/runtime_plugin.rs | 2 +- .../src/client/auth/http.rs | 2 +- .../src/client/http/hyper_014.rs | 2 +- .../client/http/test_util/capture_request.rs | 2 +- .../src/client/http/test_util/dvr.rs | 4 +- .../src/client/http/test_util/dvr/record.rs | 2 +- .../src/client/http/test_util/dvr/replay.rs | 2 +- .../src/client/http/test_util/infallible.rs | 2 +- .../src/client/http/test_util/replay.rs | 2 +- .../src/client/interceptors.rs | 2 +- .../src/client/orchestrator.rs | 4 +- .../src/client/orchestrator/http.rs | 2 +- .../src/client/orchestrator/operation.rs | 2 +- .../src/client/retries/classifiers.rs | 2 +- .../tests/reconnect_on_transient_error.rs | 2 +- 76 files changed, 183 insertions(+), 127 deletions(-) create mode 100644 rust-runtime/aws-smithy-http/src/body.rs create mode 100644 rust-runtime/aws-smithy-http/src/byte_stream.rs diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index b91b0009aa..cfeb53879e 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -434,3 +434,19 @@ message = """ references = ["smithy-rs#3054", "smithy-rs#3070"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } author = "ysaito1001" + +[[smithy-rs]] +message = """ +`aws_smithy_http::body::{BoxBody, Error, SdkBody}` have been moved to `aws_smithy_types::body::{BoxBody, Error, SdkBody}`. Type aliases for them are left in `aws_smithy_http` for backwards compatibility but are deprecated. +""" +references = ["smithy-rs#3076"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } +author = "ysaito1001" + +[[smithy-rs]] +message = """ +`aws_smithy_http::byte_stream::{AggregatedBytes, ByteStream, error::Error}` have been moved to `aws_smithy_types::byte_stream::{AggregatedBytes, ByteStream, error::Error}`. Type aliases for them are left in `aws_smithy_http` for backwards compatibility but are deprecated. +""" +references = ["smithy-rs#3076"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } +author = "ysaito1001" diff --git a/aws/rust-runtime/aws-config/src/ecs.rs b/aws/rust-runtime/aws-config/src/ecs.rs index e8c709bf6d..ed0125b69a 100644 --- a/aws/rust-runtime/aws-config/src/ecs.rs +++ b/aws/rust-runtime/aws-config/src/ecs.rs @@ -442,11 +442,11 @@ mod test { use aws_credential_types::Credentials; use aws_smithy_async::future::never::Never; use aws_smithy_async::rt::sleep::TokioSleep; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; use aws_smithy_runtime_api::client::dns::DnsFuture; use aws_smithy_runtime_api::client::http::HttpClient; use aws_smithy_runtime_api::shared::IntoShared; + use aws_smithy_types::body::SdkBody; use aws_types::os_shim_internal::Env; use futures_util::FutureExt; use http::header::AUTHORIZATION; diff --git a/aws/rust-runtime/aws-config/src/http_credential_provider.rs b/aws/rust-runtime/aws-config/src/http_credential_provider.rs index e6dc79bd24..87687590cd 100644 --- a/aws/rust-runtime/aws-config/src/http_credential_provider.rs +++ b/aws/rust-runtime/aws-config/src/http_credential_provider.rs @@ -12,7 +12,6 @@ use crate::json_credentials::{parse_json_credentials, JsonCredentials, Refreshab use crate::provider_config::ProviderConfig; use aws_credential_types::provider::{self, error::CredentialsError}; use aws_credential_types::Credentials; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::SdkError; use aws_smithy_runtime::client::orchestrator::operation::Operation; use aws_smithy_runtime::client::retries::classifiers::{ @@ -26,6 +25,7 @@ use aws_smithy_runtime_api::client::orchestrator::{ use aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry; use aws_smithy_runtime_api::client::retries::classifiers::RetryAction; use aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::Layer; use aws_smithy_types::retry::RetryConfig; use aws_smithy_types::timeout::TimeoutConfig; @@ -220,8 +220,8 @@ impl ClassifyRetry for HttpCredentialRetryClassifier { mod test { use super::*; use aws_credential_types::provider::error::CredentialsError; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; + use aws_smithy_types::body::SdkBody; use http::{Request, Response, Uri}; use std::time::SystemTime; diff --git a/aws/rust-runtime/aws-config/src/imds/client.rs b/aws/rust-runtime/aws-config/src/imds/client.rs index 823aa7c636..e956193e38 100644 --- a/aws/rust-runtime/aws-config/src/imds/client.rs +++ b/aws/rust-runtime/aws-config/src/imds/client.rs @@ -13,7 +13,6 @@ use crate::provider_config::ProviderConfig; use crate::PKG_VERSION; use aws_http::user_agent::{ApiMetadata, AwsUserAgent}; use aws_runtime::user_agent::UserAgentInterceptor; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::ConnectorError; use aws_smithy_http::result::SdkError; use aws_smithy_runtime::client::orchestrator::operation::Operation; @@ -31,6 +30,7 @@ use aws_smithy_runtime_api::client::retries::classifiers::{ }; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder; use aws_smithy_runtime_api::client::runtime_plugin::{RuntimePlugin, SharedRuntimePlugin}; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::{FrozenLayer, Layer}; use aws_smithy_types::endpoint::Endpoint; use aws_smithy_types::retry::RetryConfig; @@ -583,7 +583,6 @@ pub(crate) mod test { use crate::provider_config::ProviderConfig; use aws_smithy_async::rt::sleep::TokioSleep; use aws_smithy_async::test_util::{instant_time_and_sleep, InstantSleep}; - use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::ConnectorError; use aws_smithy_runtime::client::http::test_util::{ capture_request, ReplayEvent, StaticReplayClient, @@ -596,6 +595,7 @@ pub(crate) mod test { HttpRequest, HttpResponse, OrchestratorError, }; use aws_smithy_runtime_api::client::retries::classifiers::{ClassifyRetry, RetryAction}; + use aws_smithy_types::body::SdkBody; use aws_smithy_types::error::display::DisplayErrorContext; use aws_types::os_shim_internal::{Env, Fs}; use http::header::USER_AGENT; diff --git a/aws/rust-runtime/aws-config/src/imds/client/error.rs b/aws/rust-runtime/aws-config/src/imds/client/error.rs index a97c3961c7..4b5aacb894 100644 --- a/aws/rust-runtime/aws-config/src/imds/client/error.rs +++ b/aws/rust-runtime/aws-config/src/imds/client/error.rs @@ -5,10 +5,10 @@ //! Error types for [`ImdsClient`](crate::imds::client::Client) -use aws_smithy_http::body::SdkBody; use aws_smithy_http::endpoint::error::InvalidEndpointError; use aws_smithy_http::result::SdkError; use aws_smithy_runtime_api::client::orchestrator::HttpResponse; +use aws_smithy_types::body::SdkBody; use std::error::Error; use std::fmt; diff --git a/aws/rust-runtime/aws-config/src/imds/client/token.rs b/aws/rust-runtime/aws-config/src/imds/client/token.rs index 76b286583d..57c0aeddd1 100644 --- a/aws/rust-runtime/aws-config/src/imds/client/token.rs +++ b/aws/rust-runtime/aws-config/src/imds/client/token.rs @@ -17,7 +17,6 @@ use crate::imds::client::error::{ImdsError, TokenError, TokenErrorKind}; use aws_credential_types::cache::ExpiringCache; use aws_smithy_async::time::SharedTimeSource; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::orchestrator::operation::Operation; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolver; @@ -32,6 +31,7 @@ use aws_smithy_runtime_api::client::runtime_components::{ GetIdentityResolver, RuntimeComponents, RuntimeComponentsBuilder, }; use aws_smithy_runtime_api::client::runtime_plugin::{RuntimePlugin, SharedRuntimePlugin}; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::ConfigBag; use http::{HeaderValue, Uri}; use std::borrow::Cow; diff --git a/aws/rust-runtime/aws-config/src/imds/credentials.rs b/aws/rust-runtime/aws-config/src/imds/credentials.rs index 52cf0bb6af..845a53b877 100644 --- a/aws/rust-runtime/aws-config/src/imds/credentials.rs +++ b/aws/rust-runtime/aws-config/src/imds/credentials.rs @@ -289,8 +289,8 @@ mod test { use crate::provider_config::ProviderConfig; use aws_credential_types::provider::ProvideCredentials; use aws_smithy_async::test_util::instant_time_and_sleep; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; + use aws_smithy_types::body::SdkBody; use std::time::{Duration, UNIX_EPOCH}; use tracing_test::traced_test; diff --git a/aws/rust-runtime/aws-config/src/imds/region.rs b/aws/rust-runtime/aws-config/src/imds/region.rs index bc19642a64..213e4a5c36 100644 --- a/aws/rust-runtime/aws-config/src/imds/region.rs +++ b/aws/rust-runtime/aws-config/src/imds/region.rs @@ -111,8 +111,8 @@ mod test { use crate::imds::region::ImdsRegionProvider; use crate::provider_config::ProviderConfig; use aws_smithy_async::rt::sleep::TokioSleep; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; + use aws_smithy_types::body::SdkBody; use aws_types::region::Region; use tracing_test::traced_test; diff --git a/aws/rust-runtime/aws-config/src/sso/token.rs b/aws/rust-runtime/aws-config/src/sso/token.rs index b543fdc26f..11870a241f 100644 --- a/aws/rust-runtime/aws-config/src/sso/token.rs +++ b/aws/rust-runtime/aws-config/src/sso/token.rs @@ -389,13 +389,13 @@ mod tests { use aws_smithy_async::rt::sleep::TokioSleep; use aws_smithy_async::test_util::instant_time_and_sleep; use aws_smithy_async::time::{StaticTimeSource, TimeSource}; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ capture_request, ReplayEvent, StaticReplayClient, }; use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs; use aws_smithy_runtime_api::client::http::HttpClient; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder; + use aws_smithy_types::body::SdkBody; use aws_smithy_types::date_time::Format; use aws_smithy_types::retry::RetryConfig; use aws_smithy_types::DateTime; diff --git a/aws/rust-runtime/aws-config/src/sts/assume_role.rs b/aws/rust-runtime/aws-config/src/sts/assume_role.rs index 84c60c9a96..112358ec90 100644 --- a/aws/rust-runtime/aws-config/src/sts/assume_role.rs +++ b/aws/rust-runtime/aws-config/src/sts/assume_role.rs @@ -349,11 +349,11 @@ mod test { use aws_smithy_async::rt::sleep::{SharedAsyncSleep, TokioSleep}; use aws_smithy_async::test_util::instant_time_and_sleep; use aws_smithy_async::time::StaticTimeSource; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ capture_request, ReplayEvent, StaticReplayClient, }; use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs; + use aws_smithy_types::body::SdkBody; use aws_types::os_shim_internal::Env; use aws_types::region::Region; use aws_types::SdkConfig; diff --git a/aws/rust-runtime/aws-http/src/content_encoding.rs b/aws/rust-runtime/aws-http/src/content_encoding.rs index 6b900ab750..dc9c62a1c7 100644 --- a/aws/rust-runtime/aws-http/src/content_encoding.rs +++ b/aws/rust-runtime/aws-http/src/content_encoding.rs @@ -199,10 +199,10 @@ fn total_rendered_length_of_trailers(trailer_map: Option<&HeaderMap>) -> u64 { impl Body for AwsChunkedBody where - Inner: Body, + Inner: Body, { type Data = Bytes; - type Error = aws_smithy_http::body::Error; + type Error = aws_smithy_types::body::Error; fn poll_data( self: Pin<&mut Self>, @@ -354,7 +354,7 @@ mod tests { AwsChunkedBodyOptions, CHUNK_TERMINATOR, CRLF, }; - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; use bytes::{Buf, Bytes}; use bytes_utils::SegmentedBuf; use http::{HeaderMap, HeaderValue}; @@ -382,7 +382,7 @@ mod tests { impl Body for SputteringBody { type Data = Bytes; - type Error = aws_smithy_http::body::Error; + type Error = aws_smithy_types::body::Error; fn poll_data( self: Pin<&mut Self>, diff --git a/aws/rust-runtime/aws-http/src/request_id.rs b/aws/rust-runtime/aws-http/src/request_id.rs index 692e9cc86f..a7b429169f 100644 --- a/aws/rust-runtime/aws-http/src/request_id.rs +++ b/aws/rust-runtime/aws-http/src/request_id.rs @@ -94,7 +94,7 @@ fn extract_request_id(headers: &HeaderMap) -> Option<&str> { #[cfg(test)] mod tests { use super::*; - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; use http::Response; #[test] diff --git a/aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs b/aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs index 7cb27aaa1b..845b2ef21f 100644 --- a/aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs +++ b/aws/rust-runtime/aws-inlineable/src/glacier_interceptors.rs @@ -15,15 +15,14 @@ use ring::digest::{Context, Digest, SHA256}; use aws_runtime::auth::SigV4OperationSigningConfig; use aws_sigv4::http_request::SignableBody; -use aws_smithy_http::byte_stream; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::interceptors::context::{ BeforeSerializationInterceptorContextMut, BeforeTransmitInterceptorContextMut, }; use aws_smithy_runtime_api::client::interceptors::Intercept; - use aws_smithy_runtime_api::client::orchestrator::{HttpRequest, LoadedRequestBody}; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; +use aws_smithy_types::byte_stream; use aws_smithy_types::config_bag::ConfigBag; /// The default account ID when none is set on an input diff --git a/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs b/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs index b3a6f059b2..846fbb5274 100644 --- a/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs +++ b/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs @@ -12,15 +12,14 @@ use aws_runtime::auth::SigV4OperationSigningConfig; use aws_sigv4::http_request::SignableBody; use aws_smithy_checksums::ChecksumAlgorithm; use aws_smithy_checksums::{body::calculate, http::HttpChecksum}; -use aws_smithy_http::body::{BoxBody, SdkBody}; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::interceptors::context::{ BeforeSerializationInterceptorContextRef, BeforeTransmitInterceptorContextMut, Input, }; use aws_smithy_runtime_api::client::interceptors::Intercept; - use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; +use aws_smithy_types::body::{BoxBody, SdkBody}; use aws_smithy_types::config_bag::{ConfigBag, Layer, Storable, StoreReplace}; use aws_smithy_types::error::operation::BuildError; use http::HeaderValue; @@ -214,10 +213,10 @@ fn wrap_streaming_request_body_in_checksum_calculating_body( mod tests { use crate::http_request_checksum::wrap_streaming_request_body_in_checksum_calculating_body; use aws_smithy_checksums::ChecksumAlgorithm; - use aws_smithy_http::body::SdkBody; - use aws_smithy_http::byte_stream::ByteStream; use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_types::base64; + use aws_smithy_types::body::SdkBody; + use aws_smithy_types::byte_stream::ByteStream; use bytes::BytesMut; use http_body::Body; use tempfile::NamedTempFile; diff --git a/aws/rust-runtime/aws-inlineable/src/http_response_checksum.rs b/aws/rust-runtime/aws-inlineable/src/http_response_checksum.rs index e9663b1dec..d770b44bf3 100644 --- a/aws/rust-runtime/aws-inlineable/src/http_response_checksum.rs +++ b/aws/rust-runtime/aws-inlineable/src/http_response_checksum.rs @@ -8,13 +8,13 @@ //! Interceptor for handling Smithy `@httpChecksum` response checksumming use aws_smithy_checksums::ChecksumAlgorithm; -use aws_smithy_http::body::{BoxBody, SdkBody}; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::interceptors::context::{ BeforeDeserializationInterceptorContextMut, BeforeSerializationInterceptorContextRef, Input, }; use aws_smithy_runtime_api::client::interceptors::Intercept; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; +use aws_smithy_types::body::{BoxBody, SdkBody}; use aws_smithy_types::config_bag::{ConfigBag, Layer, Storable, StoreReplace}; use http::HeaderValue; use std::{fmt, mem}; @@ -219,8 +219,8 @@ fn is_part_level_checksum(checksum: &str) -> bool { #[cfg(test)] mod tests { use super::{is_part_level_checksum, wrap_body_with_checksum_validator}; - use aws_smithy_http::body::SdkBody; - use aws_smithy_http::byte_stream::ByteStream; + use aws_smithy_types::body::SdkBody; + use aws_smithy_types::byte_stream::ByteStream; use aws_smithy_types::error::display::DisplayErrorContext; use bytes::Bytes; diff --git a/aws/rust-runtime/aws-inlineable/src/s3_request_id.rs b/aws/rust-runtime/aws-inlineable/src/s3_request_id.rs index 226eed5f7a..93d2d850fe 100644 --- a/aws/rust-runtime/aws-inlineable/src/s3_request_id.rs +++ b/aws/rust-runtime/aws-inlineable/src/s3_request_id.rs @@ -94,8 +94,8 @@ fn extract_extended_request_id(headers: &HeaderMap) -> Option<&str> #[cfg(test)] mod test { use super::*; - use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::SdkError; + use aws_smithy_types::body::SdkBody; use http::Response; #[test] diff --git a/aws/rust-runtime/aws-runtime/src/recursion_detection.rs b/aws/rust-runtime/aws-runtime/src/recursion_detection.rs index b37ad2f5d1..21239e9c3b 100644 --- a/aws/rust-runtime/aws-runtime/src/recursion_detection.rs +++ b/aws/rust-runtime/aws-runtime/src/recursion_detection.rs @@ -78,10 +78,10 @@ fn encode_header(value: &[u8]) -> HeaderValue { #[cfg(test)] mod tests { use super::*; - use aws_smithy_http::body::SdkBody; use aws_smithy_protocol_test::{assert_ok, validate_headers}; use aws_smithy_runtime_api::client::interceptors::context::{Input, InterceptorContext}; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder; + use aws_smithy_types::body::SdkBody; use aws_types::os_shim_internal::Env; use http::HeaderValue; use proptest::{prelude::*, proptest}; diff --git a/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs b/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs index 7dcb4f9a86..11c4346bba 100644 --- a/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs +++ b/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs @@ -111,11 +111,11 @@ where #[cfg(test)] mod test { use crate::retries::classifiers::AwsErrorCodeClassifier; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext; use aws_smithy_runtime_api::client::interceptors::context::{Error, Input}; use aws_smithy_runtime_api::client::orchestrator::OrchestratorError; use aws_smithy_runtime_api::client::retries::classifiers::{ClassifyRetry, RetryAction}; + use aws_smithy_types::body::SdkBody; use aws_smithy_types::error::metadata::ProvideErrorMetadata; use aws_smithy_types::error::ErrorMetadata; use aws_smithy_types::retry::ErrorKind; diff --git a/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_get.rs b/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_get.rs index ab8832816c..10e209776e 100644 --- a/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_get.rs +++ b/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_get.rs @@ -8,7 +8,7 @@ use async_trait::async_trait; use aws_config::SdkConfig; use aws_sdk_s3 as s3; use aws_sdk_s3::Client; -use aws_smithy_http::byte_stream::AggregatedBytes; +use aws_smithy_types::byte_stream::AggregatedBytes; use std::fmt; use std::fs::File; use std::os::unix::fs::FileExt; diff --git a/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_put.rs b/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_put.rs index 942c3d8020..d5bc8c8a97 100644 --- a/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_put.rs +++ b/aws/sdk/benchmarks/s3-throughput/benchmark/src/multipart_put.rs @@ -9,7 +9,7 @@ use async_trait::async_trait; use aws_config::SdkConfig; use aws_sdk_s3 as s3; use aws_sdk_s3::Client; -use aws_smithy_http::byte_stream::ByteStream; +use aws_smithy_types::byte_stream::ByteStream; use s3::types::CompletedMultipartUpload; use s3::types::CompletedPart; use std::io::SeekFrom; diff --git a/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs b/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs index 58d3db0702..cf4b58e646 100644 --- a/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs +++ b/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs @@ -4,9 +4,9 @@ */ use aws_sdk_dynamodb::operation::query::QueryOutput; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin; use aws_smithy_runtime_api::client::ser_de::{ResponseDeserializer, SharedResponseDeserializer}; +use aws_smithy_types::body::SdkBody; use criterion::{criterion_group, criterion_main, Criterion}; fn do_bench() { diff --git a/aws/sdk/integration-tests/dynamodb/tests/movies.rs b/aws/sdk/integration-tests/dynamodb/tests/movies.rs index 2880100106..6254dd6ece 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/movies.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/movies.rs @@ -5,8 +5,8 @@ use aws_sdk_dynamodb as dynamodb; use aws_smithy_async::assert_elapsed; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; use dynamodb::config::{Credentials, Region}; use dynamodb::operation::query::QueryOutput; use dynamodb::types::{ diff --git a/aws/sdk/integration-tests/dynamodb/tests/paginators.rs b/aws/sdk/integration-tests/dynamodb/tests/paginators.rs index 711feb1e01..7cb07f0767 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/paginators.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/paginators.rs @@ -9,12 +9,12 @@ use std::iter::FromIterator; use aws_credential_types::Credentials; use aws_sdk_dynamodb::types::AttributeValue; use aws_sdk_dynamodb::{Client, Config}; -use aws_smithy_http::body::SdkBody; use aws_smithy_protocol_test::{assert_ok, validate_body, MediaType}; use aws_smithy_runtime::client::http::test_util::{ capture_request, ReplayEvent, StaticReplayClient, }; use aws_smithy_runtime_api::client::http::HttpClient; +use aws_smithy_types::body::SdkBody; use aws_types::region::Region; fn stub_config(http_client: impl HttpClient + 'static) -> Config { diff --git a/aws/sdk/integration-tests/dynamodb/tests/retries-with-client-rate-limiting.rs b/aws/sdk/integration-tests/dynamodb/tests/retries-with-client-rate-limiting.rs index 225bbabebd..bb87a2626e 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/retries-with-client-rate-limiting.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/retries-with-client-rate-limiting.rs @@ -7,10 +7,10 @@ use aws_sdk_dynamodb::config::{Credentials, Region, SharedAsyncSleep}; use aws_sdk_dynamodb::{config::retry::RetryConfig, error::ProvideErrorMetadata}; use aws_smithy_async::test_util::instant_time_and_sleep; use aws_smithy_async::time::SharedTimeSource; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; use aws_smithy_runtime::client::retries::RetryPartition; use aws_smithy_runtime_api::client::orchestrator::HttpResponse; +use aws_smithy_types::body::SdkBody; use std::time::{Duration, SystemTime}; fn req() -> http::Request { diff --git a/aws/sdk/integration-tests/ec2/Cargo.toml b/aws/sdk/integration-tests/ec2/Cargo.toml index 9e2757bea2..a3a44d610c 100644 --- a/aws/sdk/integration-tests/ec2/Cargo.toml +++ b/aws/sdk/integration-tests/ec2/Cargo.toml @@ -9,9 +9,9 @@ publish = false [dev-dependencies] aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] } aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async" } -aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" } aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] } aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["client"] } +aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" } aws-sdk-ec2 = { path = "../../build/aws-sdk/sdk/ec2" } tokio = { version = "1.23.1", features = ["full"]} http = "0.2.0" diff --git a/aws/sdk/integration-tests/ec2/tests/paginators.rs b/aws/sdk/integration-tests/ec2/tests/paginators.rs index a9ab25a4a1..0ab3be626c 100644 --- a/aws/sdk/integration-tests/ec2/tests/paginators.rs +++ b/aws/sdk/integration-tests/ec2/tests/paginators.rs @@ -4,9 +4,9 @@ */ use aws_sdk_ec2::{config::Credentials, config::Region, types::InstanceType, Client, Config}; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; use aws_smithy_runtime_api::client::http::HttpClient; +use aws_smithy_types::body::SdkBody; fn stub_config(http_client: impl HttpClient + 'static) -> Config { Config::builder() diff --git a/aws/sdk/integration-tests/kms/tests/integration.rs b/aws/sdk/integration-tests/kms/tests/integration.rs index 624dfd9d39..1227eb24bc 100644 --- a/aws/sdk/integration-tests/kms/tests/integration.rs +++ b/aws/sdk/integration-tests/kms/tests/integration.rs @@ -5,9 +5,9 @@ use aws_sdk_kms as kms; use aws_sdk_kms::operation::RequestId; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::SdkError; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; use http::header::AUTHORIZATION; use http::Uri; use kms::config::{Config, Credentials, Region}; diff --git a/aws/sdk/integration-tests/qldbsession/tests/integration.rs b/aws/sdk/integration-tests/qldbsession/tests/integration.rs index 61f0a7e539..6cdb32d1f1 100644 --- a/aws/sdk/integration-tests/qldbsession/tests/integration.rs +++ b/aws/sdk/integration-tests/qldbsession/tests/integration.rs @@ -8,8 +8,8 @@ use aws_sdk_qldbsession::config::{Config, Credentials, Region}; use aws_sdk_qldbsession::types::StartSessionRequest; use aws_sdk_qldbsession::Client; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; use http::Uri; #[cfg(feature = "test-util")] diff --git a/aws/sdk/integration-tests/s3/tests/checksums.rs b/aws/sdk/integration-tests/s3/tests/checksums.rs index b7b3d5be8a..37782182e0 100644 --- a/aws/sdk/integration-tests/s3/tests/checksums.rs +++ b/aws/sdk/integration-tests/s3/tests/checksums.rs @@ -11,10 +11,10 @@ use aws_sdk_s3::config::{Credentials, Region}; use aws_sdk_s3::types::ChecksumMode; use aws_sdk_s3::{operation::get_object::GetObjectOutput, types::ChecksumAlgorithm}; use aws_sdk_s3::{Client, Config}; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ capture_request, ReplayEvent, StaticReplayClient, }; +use aws_smithy_types::body::SdkBody; use http::header::AUTHORIZATION; use http::{HeaderValue, Uri}; use std::time::{Duration, UNIX_EPOCH}; @@ -315,7 +315,7 @@ async fn test_sha256_checksum_on_streaming_request() { .await } -async fn collect_body_into_string(mut body: aws_smithy_http::body::SdkBody) -> String { +async fn collect_body_into_string(mut body: aws_smithy_types::body::SdkBody) -> String { use bytes::Buf; use bytes_utils::SegmentedBuf; use http_body::Body; diff --git a/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs b/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs index 3b8034a673..89b15ba58c 100644 --- a/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs +++ b/aws/sdk/integration-tests/s3/tests/ignore-invalid-xml-body-root.rs @@ -8,8 +8,8 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_sdk_s3::Config; use aws_sdk_s3::{config::Credentials, config::Region, types::ObjectAttributes, Client}; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; use http::header::AUTHORIZATION; const RESPONSE_BODY_XML: &[u8] = b"\ne1AsOh9IyGCa4hLN+2Od7jlnP14="; diff --git a/aws/sdk/integration-tests/s3/tests/request_id.rs b/aws/sdk/integration-tests/s3/tests/request_id.rs index d46bfe66da..1ea7204426 100644 --- a/aws/sdk/integration-tests/s3/tests/request_id.rs +++ b/aws/sdk/integration-tests/s3/tests/request_id.rs @@ -6,8 +6,8 @@ use aws_sdk_s3::operation::get_object::GetObjectError; use aws_sdk_s3::operation::{RequestId, RequestIdExt}; use aws_sdk_s3::{config::Credentials, config::Region, Client, Config}; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::capture_request; +use aws_smithy_types::body::SdkBody; #[tokio::test] async fn get_request_id_from_modeled_error() { diff --git a/aws/sdk/integration-tests/s3/tests/retry-classifier-customization.rs b/aws/sdk/integration-tests/s3/tests/retry-classifier-customization.rs index 15af110369..cda97da363 100644 --- a/aws/sdk/integration-tests/s3/tests/retry-classifier-customization.rs +++ b/aws/sdk/integration-tests/s3/tests/retry-classifier-customization.rs @@ -7,8 +7,8 @@ use aws_sdk_s3::config::interceptors::InterceptorContext; use aws_sdk_s3::config::retry::{ClassifyRetry, RetryAction, RetryConfig}; use aws_sdk_s3::config::SharedAsyncSleep; use aws_smithy_async::rt::sleep::TokioSleep; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; use std::sync::{Arc, Mutex}; #[derive(Debug, Clone)] diff --git a/aws/sdk/integration-tests/s3/tests/signing-it.rs b/aws/sdk/integration-tests/s3/tests/signing-it.rs index d690e31cf3..450f4ba43f 100644 --- a/aws/sdk/integration-tests/s3/tests/signing-it.rs +++ b/aws/sdk/integration-tests/s3/tests/signing-it.rs @@ -8,8 +8,8 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_sdk_s3::config::{Credentials, Region}; use aws_sdk_s3::{Client, Config}; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; #[tokio::test] async fn test_signer() { diff --git a/aws/sdk/integration-tests/s3/tests/status-200-errors.rs b/aws/sdk/integration-tests/s3/tests/status-200-errors.rs index ad53f1fedb..20217b2db2 100644 --- a/aws/sdk/integration-tests/s3/tests/status-200-errors.rs +++ b/aws/sdk/integration-tests/s3/tests/status-200-errors.rs @@ -6,8 +6,8 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_credential_types::Credentials; use aws_sdk_s3::Client; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::infallible_client_fn; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::error::metadata::ProvideErrorMetadata; use aws_types::region::Region; use aws_types::SdkConfig; diff --git a/aws/sdk/integration-tests/s3control/Cargo.toml b/aws/sdk/integration-tests/s3control/Cargo.toml index cf1fd7f23b..9bd9484f9b 100644 --- a/aws/sdk/integration-tests/s3control/Cargo.toml +++ b/aws/sdk/integration-tests/s3control/Cargo.toml @@ -20,7 +20,7 @@ aws-http = { path = "../../build/aws-sdk/sdk/aws-http" } aws-sdk-s3control = { path = "../../build/aws-sdk/sdk/s3control", features = ["test-util"] } aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async" } aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] } -aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" } +aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" } aws-types = { path = "../../build/aws-sdk/sdk/aws-types" } bytes = "1.0.0" http = "0.2.0" diff --git a/aws/sdk/integration-tests/s3control/tests/signing-it.rs b/aws/sdk/integration-tests/s3control/tests/signing-it.rs index 242f2f2d78..7917b836eb 100644 --- a/aws/sdk/integration-tests/s3control/tests/signing-it.rs +++ b/aws/sdk/integration-tests/s3control/tests/signing-it.rs @@ -6,8 +6,8 @@ use aws_credential_types::provider::SharedCredentialsProvider; use aws_sdk_s3control::config::{Credentials, Region}; use aws_sdk_s3control::{Client, Config}; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +use aws_smithy_types::body::SdkBody; #[tokio::test] async fn test_signer() { diff --git a/aws/sdk/integration-tests/webassembly/src/http.rs b/aws/sdk/integration-tests/webassembly/src/http.rs index b13f4bf2b0..930ebaf547 100644 --- a/aws/sdk/integration-tests/webassembly/src/http.rs +++ b/aws/sdk/integration-tests/webassembly/src/http.rs @@ -3,13 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::http::{ HttpClient, HttpConnector, HttpConnectorFuture, HttpConnectorSettings, SharedHttpConnector, }; use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::shared::IntoShared; +use aws_smithy_types::body::SdkBody; pub(crate) fn make_request(_req: http::Request) -> Result, ()> { // Consumers here would pass the HTTP request to diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt index 61d97317f2..9846d9b0c0 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/StreamingShapeSymbolProviderTest.kt @@ -43,13 +43,13 @@ internal class StreamingShapeSymbolProviderTest { modelWithOperationTraits.lookup("test.synthetic#GenerateSpeechOutput\$data").also { shape -> symbolProvider.toSymbol(shape).also { symbol -> symbol.name shouldBe "data" - symbol.rustType() shouldBe RustType.Opaque("ByteStream", "::aws_smithy_http::byte_stream") + symbol.rustType() shouldBe RustType.Opaque("ByteStream", "::aws_smithy_types::byte_stream") } } modelWithOperationTraits.lookup("test.synthetic#GenerateSpeechInput\$data").also { shape -> symbolProvider.toSymbol(shape).also { symbol -> symbol.name shouldBe "data" - symbol.rustType() shouldBe RustType.Opaque("ByteStream", "::aws_smithy_http::byte_stream") + symbol.rustType() shouldBe RustType.Opaque("ByteStream", "::aws_smithy_types::byte_stream") } } } diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt index be5d38a016..c645759040 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingsTest.kt @@ -159,10 +159,10 @@ internal class EndpointTraitBindingsTest { """ async fn test_endpoint_prefix() { use #{capture_request}; - use aws_smithy_http::body::SdkBody; use aws_smithy_http::endpoint::EndpointPrefix; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; + use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::ConfigBag; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::{Arc, Mutex}; diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryCompatibleTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryCompatibleTest.kt index 64c7cae3ba..706e7b81c0 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryCompatibleTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/AwsQueryCompatibleTest.kt @@ -58,7 +58,7 @@ class AwsQueryCompatibleTest { ##[cfg(test)] ##[#{tokio}::test] async fn should_parse_code_and_type_fields() { - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; let response = |_: http::Request| { http::Response::builder() @@ -138,7 +138,7 @@ class AwsQueryCompatibleTest { ##[cfg(test)] ##[#{tokio}::test] async fn should_parse_code_from_payload() { - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; let response = |_: http::Request| { http::Response::builder() diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/Writable.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/Writable.kt index a0c2c2f245..8ef68e9ef2 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/Writable.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/Writable.kt @@ -95,14 +95,14 @@ fun Array.join(separator: Writable) = asIterable().join(separator) * "type_params" to rustTypeParameters( * symbolProvider.toSymbol(operation), * RustType.Unit, - * runtimeConfig.smithyHttp().resolve("body::SdkBody"), + * runtimeConfig.smithyTypes().resolve("body::SdkBody"), * GenericsGenerator(GenericTypeArg("A"), GenericTypeArg("B")), * ) * ) * ``` * would write out something like: * ```rust - * some_fn::(); + * some_fn::(); * ``` */ fun rustTypeParameters( diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt index d583a7d163..7ccf2e9479 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt @@ -394,7 +394,7 @@ data class RuntimeType(val path: String, val dependency: RustDependency? = null) smithyRuntimeApi(runtimeConfig).resolve("client::interceptors::context::FinalizerInterceptorContextMut") fun blob(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("Blob") - fun byteStream(runtimeConfig: RuntimeConfig) = smithyHttp(runtimeConfig).resolve("byte_stream::ByteStream") + fun byteStream(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("byte_stream::ByteStream") fun dateTime(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("DateTime") fun document(runtimeConfig: RuntimeConfig): RuntimeType = smithyTypes(runtimeConfig).resolve("Document") fun format(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("date_time::Format") @@ -429,7 +429,7 @@ data class RuntimeType(val path: String, val dependency: RustDependency? = null) smithyTypes(runtimeConfig).resolve("retry::ProvideErrorKind") fun queryFormat(runtimeConfig: RuntimeConfig, func: String) = smithyHttp(runtimeConfig).resolve("query::$func") - fun sdkBody(runtimeConfig: RuntimeConfig): RuntimeType = smithyHttp(runtimeConfig).resolve("body::SdkBody") + fun sdkBody(runtimeConfig: RuntimeConfig): RuntimeType = smithyTypes(runtimeConfig).resolve("body::SdkBody") fun sdkError(runtimeConfig: RuntimeConfig): RuntimeType = smithyHttp(runtimeConfig).resolve("result::SdkError") fun sdkSuccess(runtimeConfig: RuntimeConfig): RuntimeType = smithyHttp(runtimeConfig).resolve("result::SdkSuccess") diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt index 14d081b2cb..d59b4a9623 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt @@ -64,10 +64,10 @@ fun pubUseSmithyPrimitives(codegenContext: CodegenContext, model: Model): Writab pub use #{Error} as ByteStreamError; pub use #{SdkBody}; """, - "ByteStream" to RuntimeType.smithyHttp(rc).resolve("byte_stream::ByteStream"), - "AggregatedBytes" to RuntimeType.smithyHttp(rc).resolve("byte_stream::AggregatedBytes"), - "Error" to RuntimeType.smithyHttp(rc).resolve("byte_stream::error::Error"), - "SdkBody" to RuntimeType.smithyHttp(rc).resolve("body::SdkBody"), + "ByteStream" to RuntimeType.smithyTypes(rc).resolve("byte_stream::ByteStream"), + "AggregatedBytes" to RuntimeType.smithyTypes(rc).resolve("byte_stream::AggregatedBytes"), + "Error" to RuntimeType.smithyTypes(rc).resolve("byte_stream::error::Error"), + "SdkBody" to RuntimeType.smithyTypes(rc).resolve("body::SdkBody"), ) } } diff --git a/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt index b02574e6a5..62a54905af 100644 --- a/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt +++ b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt @@ -105,7 +105,7 @@ class SmithyTypesPubUseExtraTest { @Test fun `it re-exports ByteStream and AggregatedBytes when a model has streaming`() { val streamingTypes = - listOf("::aws_smithy_http::byte_stream::ByteStream", "::aws_smithy_http::byte_stream::AggregatedBytes") + listOf("::aws_smithy_types::byte_stream::ByteStream", "::aws_smithy_types::byte_stream::AggregatedBytes") val streamingShape = "@streaming blob Streaming" this.assertDoesntHaveReexports(reexportsWithEmptyModel(), streamingTypes) diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt index 11a9a9558b..f8c18f3965 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt @@ -98,7 +98,7 @@ sealed class ServerHttpBoundProtocolSection(name: String) : Section(name) { * Represent a section for rendering the serialized stream payload. * * If the payload does not implement the `futures_core::stream::Stream`, which is the case for - * `aws_smithy_http::byte_stream::ByteStream`, the section needs to be overridden and renders a new-type wrapper + * `aws_smithy_types::byte_stream::ByteStream`, the section needs to be overridden and renders a new-type wrapper * around the payload to enable the `Stream` trait. */ data class WrapStreamPayload(val params: StreamPayloadSerializerParams) : @@ -189,8 +189,8 @@ class ServerHttpBoundProtocolTraitImplGenerator( "OnceCell" to RuntimeType.OnceCell, "PercentEncoding" to RuntimeType.PercentEncoding, "Regex" to RuntimeType.Regex, - "SmithyHttp" to RuntimeType.smithyHttp(runtimeConfig), "SmithyHttpServer" to ServerCargoDependency.smithyHttpServer(runtimeConfig).toType(), + "SmithyTypes" to RuntimeType.smithyTypes(runtimeConfig), "RuntimeError" to protocol.runtimeError(runtimeConfig), "RequestRejection" to protocol.requestRejection(runtimeConfig), "ResponseRejection" to protocol.responseRejection(runtimeConfig), @@ -1269,7 +1269,7 @@ class ServerHttpBoundProtocolTraitImplGenerator( private fun streamingBodyTraitBounds(operationShape: OperationShape) = if (operationShape.inputShape(model).hasStreamingMember(model)) { - "\n B: Into<#{SmithyHttp}::byte_stream::ByteStream>," + "\n B: Into<#{SmithyTypes}::byte_stream::ByteStream>," } else { "" } diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerProtocolLoader.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerProtocolLoader.kt index 92dde3b2f6..a72ad201c0 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerProtocolLoader.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerProtocolLoader.kt @@ -28,7 +28,7 @@ class StreamPayloadSerializerCustomization() : ServerHttpBoundProtocolCustomizat // implements the `Stream` trait, so no need to wrap it in the new-type. section.params.payloadGenerator.generatePayload(this, section.params.shapeName, section.params.shape) } else { - // Otherwise, the stream payload is `aws_smithy_http::byte_stream::ByteStream`. We wrap it in the + // Otherwise, the stream payload is `aws_smithy_types::byte_stream::ByteStream`. We wrap it in the // new-type to enable the `Stream` trait. withBlockTemplate( "#{FuturesStreamCompatByteStream}::new(", diff --git a/examples/pokemon-service-common/Cargo.toml b/examples/pokemon-service-common/Cargo.toml index 6a63045004..e23a3c8dbf 100644 --- a/examples/pokemon-service-common/Cargo.toml +++ b/examples/pokemon-service-common/Cargo.toml @@ -18,8 +18,8 @@ tower = "0.4" # Local paths aws-smithy-runtime = { path = "../../rust-runtime/aws-smithy-runtime", features = ["client", "connector-hyper-0-14-x"] } aws-smithy-runtime-api = { path = "../../rust-runtime/aws-smithy-runtime-api", features = ["client"] } -aws-smithy-http = { path = "../../rust-runtime/aws-smithy-http" } aws-smithy-http-server = { path = "../../rust-runtime/aws-smithy-http-server" } +aws-smithy-types = { path = "../../rust-runtime/aws-smithy-types" } pokemon-service-client = { path = "../pokemon-service-client" } pokemon-service-server-sdk = { path = "../pokemon-service-server-sdk" } diff --git a/examples/pokemon-service-common/src/lib.rs b/examples/pokemon-service-common/src/lib.rs index c4c8bc4e75..851a07865b 100644 --- a/examples/pokemon-service-common/src/lib.rs +++ b/examples/pokemon-service-common/src/lib.rs @@ -15,10 +15,10 @@ use std::{ }; use async_stream::stream; -use aws_smithy_http::{body::SdkBody, byte_stream::ByteStream}; use aws_smithy_http_server::Extension; use aws_smithy_runtime::client::http::hyper_014::HyperConnector; use aws_smithy_runtime_api::client::http::HttpConnector; +use aws_smithy_types::{body::SdkBody, byte_stream::ByteStream}; use http::Uri; use pokemon_service_server_sdk::{ error, input, model, model::CapturingPayload, output, types::Blob, diff --git a/rust-runtime/aws-smithy-checksums/src/body/calculate.rs b/rust-runtime/aws-smithy-checksums/src/body/calculate.rs index 2ac3f09896..8c9fcb368b 100644 --- a/rust-runtime/aws-smithy-checksums/src/body/calculate.rs +++ b/rust-runtime/aws-smithy-checksums/src/body/calculate.rs @@ -7,8 +7,8 @@ use crate::http::HttpChecksum; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::header::append_merge_header_maps; +use aws_smithy_types::body::SdkBody; use http::HeaderMap; use http_body::SizeHint; @@ -38,7 +38,7 @@ impl ChecksumBody { impl http_body::Body for ChecksumBody { type Data = bytes::Bytes; - type Error = aws_smithy_http::body::Error; + type Error = aws_smithy_types::body::Error; fn poll_data( self: Pin<&mut Self>, @@ -99,8 +99,8 @@ impl http_body::Body for ChecksumBody { mod tests { use super::ChecksumBody; use crate::{http::CRC_32_HEADER_NAME, ChecksumAlgorithm, CRC_32_NAME}; - use aws_smithy_http::body::SdkBody; use aws_smithy_types::base64; + use aws_smithy_types::body::SdkBody; use bytes::Buf; use bytes_utils::SegmentedBuf; use http_body::Body; diff --git a/rust-runtime/aws-smithy-checksums/src/body/validate.rs b/rust-runtime/aws-smithy-checksums/src/body/validate.rs index 5af263bf02..cf15815772 100644 --- a/rust-runtime/aws-smithy-checksums/src/body/validate.rs +++ b/rust-runtime/aws-smithy-checksums/src/body/validate.rs @@ -8,7 +8,7 @@ use crate::http::HttpChecksum; -use aws_smithy_http::body::SdkBody; +use aws_smithy_types::body::SdkBody; use bytes::Bytes; use http::{HeaderMap, HeaderValue}; @@ -48,7 +48,7 @@ impl ChecksumBody { fn poll_inner( self: Pin<&mut Self>, cx: &mut Context<'_>, - ) -> Poll>> { + ) -> Poll>> { use http_body::Body; let this = self.project(); @@ -126,7 +126,7 @@ impl std::error::Error for Error {} impl http_body::Body for ChecksumBody { type Data = Bytes; - type Error = aws_smithy_http::body::Error; + type Error = aws_smithy_types::body::Error; fn poll_data( self: Pin<&mut Self>, @@ -155,7 +155,7 @@ impl http_body::Body for ChecksumBody { mod tests { use crate::body::validate::{ChecksumBody, Error}; use crate::ChecksumAlgorithm; - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; use bytes::{Buf, Bytes}; use bytes_utils::SegmentedBuf; use http_body::Body; diff --git a/rust-runtime/aws-smithy-http-server-python/src/pytests/bytestream.rs b/rust-runtime/aws-smithy-http-server-python/src/pytests/bytestream.rs index 30cc997e76..c82ffb233b 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/pytests/bytestream.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/pytests/bytestream.rs @@ -10,8 +10,8 @@ use futures_util::stream; use hyper::Body; use pyo3::{prelude::*, py_run}; -use aws_smithy_http::body::SdkBody; use aws_smithy_http_server_python::types::ByteStream; +use aws_smithy_types::body::SdkBody; #[pyo3_asyncio::tokio::test] fn consuming_stream_on_python_synchronously() -> PyResult<()> { diff --git a/rust-runtime/aws-smithy-http-server-python/src/types.rs b/rust-runtime/aws-smithy-http-server-python/src/types.rs index a274efe086..1af75dbd27 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/types.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/types.rs @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -//! Python wrapped types from aws-smithy-types and aws-smithy-http. +//! Python wrapped types from aws-smithy-types. //! //! ## `Deref` hacks for Json serializer //! [aws_smithy_json::serialize::JsonValueWriter] expects references to the types @@ -301,11 +301,11 @@ impl Deref for DateTime { } } -/// Python Wrapper for [aws_smithy_http::byte_stream::ByteStream]. +/// Python Wrapper for [aws_smithy_types::byte_stream::ByteStream]. /// /// ByteStream provides misuse-resistant primitives to make it easier to handle common patterns with streaming data. /// -/// On the Rust side, The Python implementation wraps the original [ByteStream](aws_smithy_http::byte_stream::ByteStream) +/// On the Rust side, The Python implementation wraps the original [ByteStream](aws_smithy_types::byte_stream::ByteStream) /// in a clonable structure and implements the [Stream](futures::stream::Stream) trait for it to /// allow Rust to handle the type transparently. /// @@ -332,17 +332,17 @@ impl Deref for DateTime { /// effectively maintaining the asyncronous behavior that Rust exposes, while the sync one is blocking the Tokio runtime to be able /// to await one chunk at a time. /// -/// The original Rust [ByteStream](aws_smithy_http::byte_stream::ByteStream) is wrapped inside a `Arc` to allow the type to be +/// The original Rust [ByteStream](aws_smithy_types::byte_stream::ByteStream) is wrapped inside a `Arc` to allow the type to be /// [Clone] (required by PyO3) and to allow internal mutability, required to fetch the next chunk of data. /// /// :param input bytes: /// :rtype None: #[pyclass] #[derive(Debug, Clone)] -pub struct ByteStream(Arc>); +pub struct ByteStream(Arc>); impl futures::stream::Stream for ByteStream { - type Item = Result; + type Item = Result; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { let stream = self.0.lock(); @@ -356,7 +356,7 @@ impl futures::stream::Stream for ByteStream { /// Return a new data chunk from the stream. async fn yield_data_chunk( - body: Arc>, + body: Arc>, ) -> PyResult> { let mut stream = body.lock().await; stream @@ -367,37 +367,37 @@ async fn yield_data_chunk( } impl ByteStream { - /// Construct a new [ByteStream](aws_smithy_http::byte_stream::ByteStream) from a - /// [SdkBody](aws_smithy_http::body::SdkBody). + /// Construct a new [`ByteStream`](aws_smithy_types::byte_stream::ByteStream) from a + /// [`SdkBody`](aws_smithy_types::body::SdkBody). /// /// This method is available only to Rust and it is required to comply with the /// interface required by the code generator. - pub fn new(body: aws_smithy_http::body::SdkBody) -> Self { + pub fn new(body: aws_smithy_types::body::SdkBody) -> Self { Self(Arc::new(Mutex::new( - aws_smithy_http::byte_stream::ByteStream::new(body), + aws_smithy_types::byte_stream::ByteStream::new(body), ))) } } impl Default for ByteStream { fn default() -> Self { - Self::new(aws_smithy_http::body::SdkBody::from("")) + Self::new(aws_smithy_types::body::SdkBody::from("")) } } #[pymethods] impl ByteStream { - /// Create a new [ByteStream](aws_smithy_http::byte_stream::ByteStream) from a slice of bytes. + /// Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a slice of bytes. #[new] pub fn newpy(input: &[u8]) -> Self { Self(Arc::new(Mutex::new( - aws_smithy_http::byte_stream::ByteStream::new(aws_smithy_http::body::SdkBody::from( + aws_smithy_types::byte_stream::ByteStream::new(aws_smithy_types::body::SdkBody::from( input, )), ))) } - /// Create a new [ByteStream](aws_smithy_http::byte_stream::ByteStream) from a path, without + /// Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, without /// requiring Python to await this method. /// /// **NOTE:** This method will block the Rust event loop when it is running. @@ -407,7 +407,7 @@ impl ByteStream { #[staticmethod] pub fn from_path_blocking(py: Python, path: String) -> PyResult> { let byte_stream = Handle::current().block_on(async { - aws_smithy_http::byte_stream::ByteStream::from_path(path) + aws_smithy_types::byte_stream::ByteStream::from_path(path) .await .map_err(|e| PyRuntimeError::new_err(e.to_string())) })?; @@ -415,7 +415,7 @@ impl ByteStream { Ok(result.into_py(py)) } - /// Create a new [ByteStream](aws_smithy_http::byte_stream::ByteStream) from a path, forcing + /// Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, forcing /// Python to await this coroutine. /// /// :param path str: @@ -423,7 +423,7 @@ impl ByteStream { #[staticmethod] pub fn from_path(py: Python, path: String) -> PyResult<&PyAny> { pyo3_asyncio::tokio::future_into_py(py, async move { - let byte_stream = aws_smithy_http::byte_stream::ByteStream::from_path(path) + let byte_stream = aws_smithy_types::byte_stream::ByteStream::from_path(path) .await .map_err(|e| PyRuntimeError::new_err(e.to_string()))?; Ok(Self(Arc::new(Mutex::new(byte_stream)))) @@ -440,7 +440,7 @@ impl ByteStream { /// Return the next item from the iterator. If there are no further items, raise the StopIteration exception. /// PyO3 allows to raise the correct exception using the enum [IterNextOutput](pyo3::pyclass::IterNextOutput). /// - /// To get tnext value of the iterator, the `Arc` inner stream is cloned and the Rust call to `next()` is executed + /// To get the next value of the iterator, the `Arc` inner stream is cloned and the Rust call to `next()` is executed /// inside a call blocking the Tokio runtime. /// /// More info: `` diff --git a/rust-runtime/aws-smithy-http/src/body.rs b/rust-runtime/aws-smithy-http/src/body.rs new file mode 100644 index 0000000000..bd961ce383 --- /dev/null +++ b/rust-runtime/aws-smithy-http/src/body.rs @@ -0,0 +1,21 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//TODO(runtimeCratesVersioningCleanup): Re-point those who use the deprecated type aliases to +// directly depend on `aws_smithy_types` and remove this module. + +//! Types for representing the body of an HTTP request or response + +/// A boxed generic HTTP body that, when consumed, will result in [`Bytes`](bytes::Bytes) or an [`Error`](aws_smithy_types::body::Error). +#[deprecated(note = "Moved to `aws_smithy_types::body::BoxBody`.")] +pub type BoxBody = aws_smithy_types::body::BoxBody; + +/// A generic, boxed error that's `Send` and `Sync` +#[deprecated(note = "`Moved to `aws_smithy_types::body::Error`.")] +pub type Error = aws_smithy_types::body::Error; + +/// SdkBody type +#[deprecated(note = "Moved to `aws_smithy_types::body::SdkBody`.")] +pub type SdkBody = aws_smithy_types::body::SdkBody; diff --git a/rust-runtime/aws-smithy-http/src/byte_stream.rs b/rust-runtime/aws-smithy-http/src/byte_stream.rs new file mode 100644 index 0000000000..e97a395b8e --- /dev/null +++ b/rust-runtime/aws-smithy-http/src/byte_stream.rs @@ -0,0 +1,24 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +//TODO(runtimeCratesVersioningCleanup): Re-point those who use the deprecated type aliases to +// directly depend on `aws_smithy_types` and remove this module. + +//! ByteStream Abstractions + +/// Non-contiguous Binary Data Storage +#[deprecated(note = "Moved to `aws_smithy_types::byte_stream::AggregatedBytes`.")] +pub type AggregatedBytes = aws_smithy_types::byte_stream::AggregatedBytes; + +/// Stream of binary data +#[deprecated(note = "Moved to `aws_smithy_types::byte_stream::ByteStream`.")] +pub type ByteStream = aws_smithy_types::byte_stream::ByteStream; + +/// Errors related to bytestreams. +pub mod error { + /// An error occurred in the byte stream + #[deprecated(note = "Moved to `aws_smithy_types::byte_stream::error::Error`.")] + pub type Error = aws_smithy_types::byte_stream::error::Error; +} diff --git a/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs b/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs index eb931900a5..eb6e754431 100644 --- a/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs +++ b/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs @@ -3,11 +3,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -use crate::body::SdkBody; use crate::result::{ConnectorError, SdkError}; use aws_smithy_eventstream::frame::{ DecodedFrame, Message, MessageFrameDecoder, UnmarshallMessage, UnmarshalledMessage, }; +use aws_smithy_types::body::SdkBody; use bytes::Buf; use bytes::Bytes; use bytes_utils::SegmentedBuf; @@ -276,10 +276,10 @@ impl Receiver { #[cfg(test)] mod tests { use super::{Receiver, UnmarshallMessage}; - use crate::body::SdkBody; use crate::result::SdkError; use aws_smithy_eventstream::error::Error as EventStreamError; use aws_smithy_eventstream::frame::{Header, HeaderValue, Message, UnmarshalledMessage}; + use aws_smithy_types::body::SdkBody; use bytes::Bytes; use hyper::body::Body; use std::error::Error as StdError; diff --git a/rust-runtime/aws-smithy-http/src/futures_stream_adapter.rs b/rust-runtime/aws-smithy-http/src/futures_stream_adapter.rs index 65b5d5d042..74b1adb144 100644 --- a/rust-runtime/aws-smithy-http/src/futures_stream_adapter.rs +++ b/rust-runtime/aws-smithy-http/src/futures_stream_adapter.rs @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -use crate::body::SdkBody; -use crate::byte_stream::error::Error as ByteStreamError; -use crate::byte_stream::ByteStream; +use aws_smithy_types::body::SdkBody; +use aws_smithy_types::byte_stream::error::Error as ByteStreamError; +use aws_smithy_types::byte_stream::ByteStream; use bytes::Bytes; use futures_core::stream::Stream; use std::pin::Pin; diff --git a/rust-runtime/aws-smithy-http/src/lib.rs b/rust-runtime/aws-smithy-http/src/lib.rs index 245a477fb4..6a77d08043 100644 --- a/rust-runtime/aws-smithy-http/src/lib.rs +++ b/rust-runtime/aws-smithy-http/src/lib.rs @@ -25,11 +25,8 @@ #![allow(clippy::derive_partial_eq_without_eq)] #![cfg_attr(docsrs, feature(doc_cfg))] -//TODO(runtimeCratesVersioningCleanup): Re-point those who use the following reexports to -// directly depend on `aws_smithy_types` and remove the reexports below. -pub use aws_smithy_types::body; -pub use aws_smithy_types::byte_stream; - +pub mod body; +pub mod byte_stream; pub mod endpoint; // Marked as `doc(hidden)` because a type in the module is used both by this crate and by the code // generator, but not by external users. Also, by the module being `doc(hidden)` instead of it being diff --git a/rust-runtime/aws-smithy-http/src/result.rs b/rust-runtime/aws-smithy-http/src/result.rs index 03119ef64f..8ac6b1b613 100644 --- a/rust-runtime/aws-smithy-http/src/result.rs +++ b/rust-runtime/aws-smithy-http/src/result.rs @@ -5,8 +5,8 @@ //! Types for [error](SdkError) responses. -use crate::body::SdkBody; use crate::connection::ConnectionMetadata; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::error::metadata::{ProvideErrorMetadata, EMPTY_ERROR_METADATA}; use aws_smithy_types::error::ErrorMetadata; use aws_smithy_types::retry::ErrorKind; diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs index caae96e18e..8619c2841a 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs @@ -5,7 +5,7 @@ //! Http Request Types -use aws_smithy_http::body::SdkBody; +use aws_smithy_types::body::SdkBody; use http as http0; use http::header::{InvalidHeaderName, InvalidHeaderValue}; use http::uri::InvalidUri; @@ -616,7 +616,7 @@ fn header_value(value: MaybeStatic) -> Result { #[cfg(test)] mod test { use crate::client::orchestrator::HttpRequest; - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; use http::header::{AUTHORIZATION, CONTENT_LENGTH}; use http::{HeaderValue, Uri}; diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs index 8f976903c7..051f3ebf58 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs @@ -428,7 +428,7 @@ impl fmt::Display for RewindResult { #[cfg(all(test, feature = "test-util"))] mod tests { use super::*; - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; use http::header::{AUTHORIZATION, CONTENT_LENGTH}; use http::{HeaderValue, Uri}; diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/orchestrator.rs b/rust-runtime/aws-smithy-runtime-api/src/client/orchestrator.rs index b59a69b0c9..350c399e1e 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/orchestrator.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/orchestrator.rs @@ -20,8 +20,8 @@ use crate::box_error::BoxError; use crate::client::interceptors::context::phase::Phase; use crate::client::interceptors::context::Error; use crate::client::interceptors::InterceptorError; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::{ConnectorError, SdkError}; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::{Storable, StoreReplace}; use bytes::Bytes; use std::error::Error as StdError; diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs b/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs index f55cfa6e1f..bae79b74d5 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs @@ -308,7 +308,7 @@ mod tests { use crate::client::runtime_components::RuntimeComponentsBuilder; use crate::client::runtime_plugin::{Order, SharedRuntimePlugin}; use crate::shared::IntoShared; - use aws_smithy_http::body::SdkBody; + use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::ConfigBag; use http::HeaderValue; use std::borrow::Cow; diff --git a/rust-runtime/aws-smithy-runtime/src/client/auth/http.rs b/rust-runtime/aws-smithy-runtime/src/client/auth/http.rs index affff101d0..3a6281373b 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/auth/http.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/auth/http.rs @@ -284,9 +284,9 @@ impl Sign for DigestAuthSigner { #[cfg(test)] mod tests { use super::*; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::identity::http::Login; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder; + use aws_smithy_types::body::SdkBody; #[test] fn test_api_key_signing_headers() { diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs b/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs index 541b11d699..7bcdc13082 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs @@ -6,7 +6,6 @@ use crate::client::http::connection_poisoning::CaptureSmithyConnection; use aws_smithy_async::future::timeout::TimedOutError; use aws_smithy_async::rt::sleep::{default_async_sleep, AsyncSleep, SharedAsyncSleep}; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::connection::ConnectionMetadata; use aws_smithy_http::result::ConnectorError; use aws_smithy_runtime_api::box_error::BoxError; @@ -17,6 +16,7 @@ use aws_smithy_runtime_api::client::http::{ use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::shared::IntoShared; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::error::display::DisplayErrorContext; use aws_smithy_types::retry::ErrorKind; use http::{Extensions, Uri}; diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/capture_request.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/capture_request.rs index 06915c942e..f694840b61 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/capture_request.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/capture_request.rs @@ -3,13 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::http::{ HttpClient, HttpConnector, HttpConnectorFuture, HttpConnectorSettings, SharedHttpConnector, }; use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::shared::IntoShared; +use aws_smithy_types::body::SdkBody; use std::fmt::Debug; use std::sync::{Arc, Mutex}; use tokio::sync::oneshot; diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr.rs index 95a3b2be14..5f50faaed7 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr.rs @@ -246,9 +246,9 @@ impl From for BodyData { #[cfg(test)] mod tests { use super::*; - use aws_smithy_http::body::SdkBody; - use aws_smithy_http::byte_stream::ByteStream; use aws_smithy_runtime_api::client::http::{HttpConnector, SharedHttpConnector}; + use aws_smithy_types::body::SdkBody; + use aws_smithy_types::byte_stream::ByteStream; use bytes::Bytes; use http::Uri; use std::error::Error; diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/record.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/record.rs index 1c682ad7ed..912a409b26 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/record.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/record.rs @@ -7,13 +7,13 @@ use super::{ Action, BodyData, ConnectionId, Direction, Error, Event, NetworkTraffic, Request, Response, Version, }; -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::http::{ HttpClient, HttpConnector, HttpConnectorFuture, HttpConnectorSettings, SharedHttpConnector, }; use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::shared::IntoShared; +use aws_smithy_types::body::SdkBody; use http_body::Body; use std::path::Path; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs index 72c4d2d861..d0f868a19c 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs @@ -4,7 +4,6 @@ */ use super::{Action, ConnectionId, Direction, Event, NetworkTraffic}; -use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::ConnectorError; use aws_smithy_protocol_test::MediaType; use aws_smithy_runtime_api::client::http::{ @@ -13,6 +12,7 @@ use aws_smithy_runtime_api::client::http::{ use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::shared::IntoShared; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::error::display::DisplayErrorContext; use bytes::{Bytes, BytesMut}; use http::{Request, Version}; diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs index 3c4cea5065..2715b31c9e 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::ConnectorError; use aws_smithy_runtime_api::client::http::{ HttpClient, HttpConnector, HttpConnectorFuture, HttpConnectorSettings, SharedHttpClient, @@ -12,6 +11,7 @@ use aws_smithy_runtime_api::client::http::{ use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::shared::IntoShared; +use aws_smithy_types::body::SdkBody; use std::fmt; use std::sync::Arc; diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/replay.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/replay.rs index 0ad6623da5..b34e0aa0ff 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/replay.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/replay.rs @@ -116,8 +116,8 @@ impl ValidateRequest { /// # Example /// /// ```no_run -/// use aws_smithy_http::body::SdkBody; /// use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient}; +/// use aws_smithy_types::body::SdkBody; /// /// let http_client = StaticReplayClient::new(vec![ /// // Event that covers the first request/response diff --git a/rust-runtime/aws-smithy-runtime/src/client/interceptors.rs b/rust-runtime/aws-smithy-runtime/src/client/interceptors.rs index 0457f59122..8b2522bf95 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/interceptors.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/interceptors.rs @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::interceptors::context::{ BeforeSerializationInterceptorContextRef, BeforeTransmitInterceptorContextMut, @@ -17,6 +16,7 @@ use aws_smithy_runtime_api::client::interceptors::{ }; use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::ConfigBag; use aws_smithy_types::error::display::DisplayErrorContext; use std::error::Error as StdError; diff --git a/rust-runtime/aws-smithy-runtime/src/client/orchestrator.rs b/rust-runtime/aws-smithy-runtime/src/client/orchestrator.rs index bc0fd973cc..ab328e5356 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/orchestrator.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/orchestrator.rs @@ -12,8 +12,6 @@ use crate::client::orchestrator::endpoints::orchestrate_endpoint; use crate::client::orchestrator::http::{log_response_body, read_body}; use crate::client::timeout::{MaybeTimeout, MaybeTimeoutConfig, TimeoutKind}; use aws_smithy_async::rt::sleep::AsyncSleep; -use aws_smithy_http::body::SdkBody; -use aws_smithy_http::byte_stream::ByteStream; use aws_smithy_http::result::SdkError; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::http::{HttpClient, HttpConnector, HttpConnectorSettings}; @@ -29,6 +27,8 @@ use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins; use aws_smithy_runtime_api::client::ser_de::{ DeserializeResponse, SerializeRequest, SharedRequestSerializer, SharedResponseDeserializer, }; +use aws_smithy_types::body::SdkBody; +use aws_smithy_types::byte_stream::ByteStream; use aws_smithy_types::config_bag::ConfigBag; use aws_smithy_types::timeout::TimeoutConfig; use std::mem; diff --git a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/http.rs b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/http.rs index 24baa8f414..ca15aed5fb 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/http.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/http.rs @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::orchestrator::{HttpResponse, SensitiveOutput}; +use aws_smithy_types::body::SdkBody; use aws_smithy_types::config_bag::ConfigBag; use bytes::{Buf, Bytes}; use http_body::Body; diff --git a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/operation.rs b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/operation.rs index 4777f313a6..569b5b0b13 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/operation.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/operation.rs @@ -398,8 +398,8 @@ mod tests { use crate::client::http::test_util::{capture_request, ReplayEvent, StaticReplayClient}; use crate::client::retries::classifiers::HttpStatusCodeClassifier; use aws_smithy_async::rt::sleep::{SharedAsyncSleep, TokioSleep}; - use aws_smithy_http::body::SdkBody; use aws_smithy_http::result::ConnectorError; + use aws_smithy_types::body::SdkBody; use std::convert::Infallible; #[tokio::test] diff --git a/rust-runtime/aws-smithy-runtime/src/client/retries/classifiers.rs b/rust-runtime/aws-smithy-runtime/src/client/retries/classifiers.rs index a1abd092c9..9a093687ba 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/retries/classifiers.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/retries/classifiers.rs @@ -218,10 +218,10 @@ mod test { use crate::client::retries::classifiers::{ HttpStatusCodeClassifier, ModeledAsRetryableClassifier, }; - use aws_smithy_http::body::SdkBody; use aws_smithy_runtime_api::client::interceptors::context::{Error, Input, InterceptorContext}; use aws_smithy_runtime_api::client::orchestrator::OrchestratorError; use aws_smithy_runtime_api::client::retries::classifiers::{ClassifyRetry, RetryAction}; + use aws_smithy_types::body::SdkBody; use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind}; use std::fmt; diff --git a/rust-runtime/aws-smithy-runtime/tests/reconnect_on_transient_error.rs b/rust-runtime/aws-smithy-runtime/tests/reconnect_on_transient_error.rs index 91cf73bdf7..9b4f4c2666 100644 --- a/rust-runtime/aws-smithy-runtime/tests/reconnect_on_transient_error.rs +++ b/rust-runtime/aws-smithy-runtime/tests/reconnect_on_transient_error.rs @@ -13,7 +13,6 @@ use ::aws_smithy_runtime::client::retries::classifiers::{ HttpStatusCodeClassifier, TransientErrorClassifier, }; use aws_smithy_async::rt::sleep::TokioSleep; -use aws_smithy_http::body::{BoxBody, SdkBody}; use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder; use aws_smithy_runtime::client::http::test_util::wire::{ RecordedEvent, ReplayedEvent, WireMockServer, @@ -24,6 +23,7 @@ use aws_smithy_runtime::{ev, match_events}; use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext; use aws_smithy_runtime_api::client::orchestrator::OrchestratorError; use aws_smithy_runtime_api::client::retries::classifiers::{ClassifyRetry, RetryAction}; +use aws_smithy_types::body::{BoxBody, SdkBody}; use aws_smithy_types::retry::{ErrorKind, ProvideErrorKind, ReconnectMode, RetryConfig}; use aws_smithy_types::timeout::TimeoutConfig; use hyper::client::Builder as HyperBuilder;