diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index c17e89a4cf96d8fd399b09758decbe3afd69e112..b91b0009aa7f37479cf363cb756ae467fb590a93 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -426,3 +426,11 @@ message = "**This change has [detailed upgrade guidance](https://github.com/awsl references = ["smithy-rs#3043", "smithy-rs#3078"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } author = "rcoh" + +[[smithy-rs]] +message = """ +`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`. Type aliases for them are left in `aws_smithy_http` for backwards compatibility but are deprecated. +""" +references = ["smithy-rs#3054", "smithy-rs#3070"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } +author = "ysaito1001" diff --git a/aws/rust-runtime/aws-inlineable/Cargo.toml b/aws/rust-runtime/aws-inlineable/Cargo.toml index 56ccc8068e2e00b869b845892e6dcb0b6c28df69..2e902d277603fe748279d78af72aa95f7bd06d79 100644 --- a/aws/rust-runtime/aws-inlineable/Cargo.toml +++ b/aws/rust-runtime/aws-inlineable/Cargo.toml @@ -16,12 +16,12 @@ aws-credential-types = { path = "../aws-credential-types" } aws-http = { path = "../aws-http" } aws-runtime = { path = "../aws-runtime" } aws-sigv4 = { path = "../aws-sigv4" } +aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] } aws-smithy-checksums = { path = "../../../rust-runtime/aws-smithy-checksums" } aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" } -aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] } aws-smithy-runtime = { path = "../../../rust-runtime/aws-smithy-runtime", features = ["client"] } +aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] } aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" } -aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] } bytes = "1" hex = "0.4.3" http = "0.2.9" 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 3dc9cd449ddf9cc5d684c9e14b9b32c6a3c21685..b3a6f059b2d03dea654eb4a3264f8ec9aa28da97 100644 --- a/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs +++ b/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs @@ -13,7 +13,6 @@ 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_http::operation::error::BuildError; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::interceptors::context::{ BeforeSerializationInterceptorContextRef, BeforeTransmitInterceptorContextMut, Input, @@ -23,6 +22,7 @@ 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::config_bag::{ConfigBag, Layer, Storable, StoreReplace}; +use aws_smithy_types::error::operation::BuildError; use http::HeaderValue; use http_body::Body; use std::{fmt, mem}; diff --git a/aws/sdk/integration-tests/s3/tests/required-query-params.rs b/aws/sdk/integration-tests/s3/tests/required-query-params.rs index 1df7f44e4e5b59e3a60f1ae7b137cd35d5548a0d..d9604260ea209fac2d4c44606b0bb67850b30a86 100644 --- a/aws/sdk/integration-tests/s3/tests/required-query-params.rs +++ b/aws/sdk/integration-tests/s3/tests/required-query-params.rs @@ -6,8 +6,8 @@ use aws_sdk_s3::config::{Credentials, Region}; use aws_sdk_s3::error::DisplayErrorContext; use aws_sdk_s3::Client; -use aws_smithy_http::operation::error::BuildError; use aws_smithy_runtime::client::http::test_util::capture_request; +use aws_smithy_types::error::operation::BuildError; #[tokio::test] async fn test_error_when_required_query_param_is_unset() { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt index 80b9329d63612b99089ed76b19d8050a7ea4cce1..9369423757bf7a89291d0281e7f67b99a681407c 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt @@ -75,8 +75,8 @@ sealed class BuilderSection(name: String) : Section(name) { /** Customizations for BuilderGenerator */ abstract class BuilderCustomization : NamedCustomization() -fun RuntimeConfig.operationBuildError() = RuntimeType.operationModule(this).resolve("error::BuildError") -fun RuntimeConfig.serializationError() = RuntimeType.operationModule(this).resolve("error::SerializationError") +fun RuntimeConfig.operationBuildError() = RuntimeType.smithyTypes(this).resolve("error::operation::BuildError") +fun RuntimeConfig.serializationError() = RuntimeType.smithyTypes(this).resolve("error::operation::SerializationError") fun MemberShape.enforceRequired( field: Writable, diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs b/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs index 491e865dd6adbd8d18ce4146df465802846e7b29..514b06da63b6ff071ab316c44d63a5b849da6d53 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs @@ -9,7 +9,7 @@ use thiserror::Error; #[derive(Debug, Error)] pub enum ResponseRejection { #[error("error serializing JSON-encoded body: {0}")] - Serialization(#[from] aws_smithy_http::operation::error::SerializationError), + Serialization(#[from] aws_smithy_types::error::operation::SerializationError), #[error("error building HTTP response: {0}")] HttpBuild(#[from] http::Error), } diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs b/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs index 8577d4a5571143685277acbf1395676c7b67bcd8..963b56c4c1a8f32a3b72812e284fa710146c30fa 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs @@ -67,7 +67,7 @@ pub enum ResponseRejection { /// `httpHeader` or `httpPrefixHeaders`. /// Used when failing to serialize an `httpPayload`-bound struct into an HTTP response body. #[error("error building HTTP response: {0}")] - Build(#[from] aws_smithy_http::operation::error::BuildError), + Build(#[from] aws_smithy_types::error::operation::BuildError), /// Used when failing to serialize a struct into a `String` for the JSON-encoded HTTP response /// body. @@ -76,7 +76,7 @@ pub enum ResponseRejection { /// supplied timestamp is outside of the valid range when formatting using RFC-3339, i.e. a /// date outside the `0001-01-01T00:00:00.000Z`-`9999-12-31T23:59:59.999Z` range is supplied. #[error("error serializing JSON-encoded body: {0}")] - Serialization(#[from] aws_smithy_http::operation::error::SerializationError), + Serialization(#[from] aws_smithy_types::error::operation::SerializationError), /// Used when consuming an [`http::response::Builder`] into the constructed [`http::Response`] /// when calling [`http::response::Builder::body`]. diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs b/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs index 3e1bed00ca397e04dd105b9bb7d4ba44c2e31cd0..6c44adaa2839dbb71382bc0f85d608d5fc80ad41 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs @@ -16,9 +16,9 @@ pub enum ResponseRejection { #[error("invalid bound HTTP status code; status codes must be inside the 100-999 range: {0}")] InvalidHttpStatusCode(TryFromIntError), #[error("error building HTTP response: {0}")] - Build(#[from] aws_smithy_http::operation::error::BuildError), + Build(#[from] aws_smithy_types::error::operation::BuildError), #[error("error serializing XML-encoded body: {0}")] - Serialization(#[from] aws_smithy_http::operation::error::SerializationError), + Serialization(#[from] aws_smithy_types::error::operation::SerializationError), #[error("error building HTTP response: {0}")] HttpBuild(#[from] http::Error), } diff --git a/rust-runtime/aws-smithy-http/src/operation.rs b/rust-runtime/aws-smithy-http/src/operation.rs index 0fed557b79b1339310e3e6d0c73374dbfa3060fb..7fad89f1e145aeeb839832314eb0a2f55198b410 100644 --- a/rust-runtime/aws-smithy-http/src/operation.rs +++ b/rust-runtime/aws-smithy-http/src/operation.rs @@ -9,11 +9,17 @@ use aws_smithy_types::config_bag::{Storable, StoreReplace}; use std::borrow::Cow; -//TODO(runtimeCratesVersioningCleanup): Re-point those who use the following reexport to -// directly depend on `aws_smithy_types` and remove the reexport below. +//TODO(runtimeCratesVersioningCleanup): Re-point those who use the deprecated type aliases to +// directly depend on `aws_smithy_types` and remove the type aliases below. /// Errors for operations pub mod error { - pub use aws_smithy_types::error::operation::{BuildError, SerializationError}; + /// An error occurred attempting to build an `Operation` from an input. + #[deprecated(note = "Moved to `aws_smithy_types::error::operation::BuildError`.")] + pub type BuildError = aws_smithy_types::error::operation::BuildError; + + /// An error that occurs when serialization of an operation fails. + #[deprecated(note = "Moved to `aws_smithy_types::error::operation::SerializationError`.")] + pub type SerializationError = aws_smithy_types::error::operation::SerializationError; } /// Metadata added to the [`ConfigBag`](aws_smithy_types::config_bag::ConfigBag) that identifies the API being called.