diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 1ba6b2967d..546c671ee3 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -72,3 +72,23 @@ message = "Make some types for various services optional. Previously, they defau references = ["smithy-rs#3228"] meta = { "breaking" = true, "tada" = false, "bug" = true } author = "milesziemer" + +[[smithy-rs]] +message = """ +Types/functions that were deprecated in previous releases were removed. Unfortunately, some of these deprecations +were ignored by the Rust compiler (we found out later that `#[deprecated]` on `pub use` doesn't work). See +the [deprecations removal list](https://github.com/smithy-lang/smithy-rs/discussions/3223) for more details. +""" +references = ["smithy-rs#3222"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } +author = "jdisanti" + +[[aws-sdk-rust]] +message = """ +Types/functions that were deprecated in previous releases were removed. Unfortunately, some of these deprecations +were ignored by the Rust compiler (we found out later that `#[deprecated]` on `pub use` doesn't work). See +the [deprecations removal list](https://github.com/smithy-lang/smithy-rs/discussions/3223) for more details. +""" +references = ["smithy-rs#3222"] +meta = { "breaking" = true, "tada" = false, "bug" = false } +author = "jdisanti" diff --git a/aws/rust-runtime/aws-config/src/environment/app_name.rs b/aws/rust-runtime/aws-config/src/environment/app_name.rs deleted file mode 100644 index 3abf0fdedb..0000000000 --- a/aws/rust-runtime/aws-config/src/environment/app_name.rs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -use aws_smithy_types::error::display::DisplayErrorContext; -use aws_types::app_name::AppName; -use aws_types::os_shim_internal::Env; - -/// Load an app name from the `AWS_SDK_UA_APP_ID` environment variable. -#[derive(Debug, Default)] -#[deprecated(note = "This is unused and will be removed in a future release.")] -pub struct EnvironmentVariableAppNameProvider { - env: Env, -} - -#[allow(deprecated)] -impl EnvironmentVariableAppNameProvider { - /// Create a new `EnvironmentVariableAppNameProvider` - pub fn new() -> Self { - Self { env: Env::real() } - } - - #[doc(hidden)] - /// Create an region provider from a given `Env` - /// - /// This method is used for tests that need to override environment variables. - pub fn new_with_env(env: Env) -> Self { - Self { env } - } - - /// Attempts to create an `AppName` from the `AWS_SDK_UA_APP_ID` environment variable. - pub fn app_name(&self) -> Option { - if let Ok(name) = self.env.get("AWS_SDK_UA_APP_ID") { - match AppName::new(name) { - Ok(name) => Some(name), - Err(err) => { - tracing::warn!(err = %DisplayErrorContext(&err), "`AWS_SDK_UA_APP_ID` environment variable value was invalid"); - None - } - } - } else { - None - } - } -} diff --git a/aws/rust-runtime/aws-config/src/environment/mod.rs b/aws/rust-runtime/aws-config/src/environment/mod.rs index dd2c7cba3b..8a3f658732 100644 --- a/aws/rust-runtime/aws-config/src/environment/mod.rs +++ b/aws/rust-runtime/aws-config/src/environment/mod.rs @@ -5,9 +5,6 @@ //! Providers that load configuration from environment variables -/// Load app name from the environment -pub mod app_name; - use std::error::Error; use std::fmt::{Display, Formatter}; diff --git a/aws/rust-runtime/aws-config/src/lib.rs b/aws/rust-runtime/aws-config/src/lib.rs index e9b2d1890f..5fb0f5592c 100644 --- a/aws/rust-runtime/aws-config/src/lib.rs +++ b/aws/rust-runtime/aws-config/src/lib.rs @@ -355,14 +355,6 @@ mod loader { self } - /// Deprecated. Don't use. - #[deprecated( - note = "HTTP connector configuration changed. See https://github.com/smithy-lang/smithy-rs/discussions/3022 for upgrade guidance." - )] - pub fn http_connector(self, http_client: impl HttpClient + 'static) -> Self { - self.http_client(http_client) - } - /// Override the [`HttpClient`](aws_smithy_runtime_api::client::http::HttpClient) for this [`ConfigLoader`]. /// /// The HTTP client will be used for both AWS services and credentials providers. @@ -399,14 +391,6 @@ mod loader { self } - /// The credentials cache has been replaced. Use the identity_cache() method instead. See its rustdoc for an example. - #[deprecated( - note = "The credentials cache has been replaced. Use the identity_cache() method instead for equivalent functionality. See its rustdoc for an example." - )] - pub fn credentials_cache(self) -> Self { - self - } - /// Override the identity cache used to build [`SdkConfig`](aws_types::SdkConfig). /// /// The identity cache caches AWS credentials and SSO tokens. By default, a lazy cache is used @@ -647,33 +631,6 @@ mod loader { self } - /// Set configuration for all sub-loaders (credentials, region etc.) - /// - /// Update the `ProviderConfig` used for all nested loaders. This can be used to override - /// the HTTPs connector used by providers or to stub in an in memory `Env` or `Fs` for testing. - /// - /// # Examples - /// ```no_run - /// # #[cfg(feature = "hyper-client")] - /// # async fn create_config() { - /// use aws_config::provider_config::ProviderConfig; - /// let custom_https_connector = hyper_rustls::HttpsConnectorBuilder::new() - /// .with_webpki_roots() - /// .https_only() - /// .enable_http1() - /// .build(); - /// let provider_config = ProviderConfig::default().with_tcp_connector(custom_https_connector); - /// let shared_config = aws_config::defaults(BehaviorVersion::latest()).configure(provider_config).load().await; - /// # } - /// ``` - #[deprecated( - note = "Use setters on this builder instead. configure is very hard to use correctly." - )] - pub fn configure(mut self, provider_config: ProviderConfig) -> Self { - self.provider_config = Some(provider_config); - self - } - /// Load the default configuration chain /// /// If fields have been overridden during builder construction, the override values will be used. diff --git a/aws/rust-runtime/aws-config/src/profile/app_name.rs b/aws/rust-runtime/aws-config/src/profile/app_name.rs deleted file mode 100644 index 715681dadf..0000000000 --- a/aws/rust-runtime/aws-config/src/profile/app_name.rs +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -//! Load an app name from an AWS profile - -use super::profile_file::ProfileFiles; -use crate::provider_config::ProviderConfig; -use aws_types::app_name::AppName; - -/// Loads an app name from a profile file -/// -/// This provider will attempt to shared AWS shared configuration and then read the -/// `sdk-ua-app-id` property from the active profile. -/// -#[doc = include_str!("location_of_profile_files.md")] -/// -/// # Examples -/// -/// **Loads "my-app" as the app name** -/// ```ini -/// [default] -/// sdk-ua-app-id = my-app -/// ``` -/// -/// **Loads "my-app" as the app name _if and only if_ the `AWS_PROFILE` environment variable -/// is set to `other`.** -/// ```ini -/// [profile other] -/// sdk-ua-app-id = my-app -/// ``` -/// -/// This provider is part of the [default app name provider chain](crate::default_provider::app_name). -#[derive(Debug, Default)] -#[deprecated( - note = "This is unused and is deprecated for backwards compatibility. It will be removed in a future release." -)] -pub struct ProfileFileAppNameProvider { - provider_config: ProviderConfig, -} - -#[allow(deprecated)] -impl ProfileFileAppNameProvider { - /// Create a new [ProfileFileAppNameProvider} - /// - /// To override the selected profile, set the `AWS_PROFILE` environment variable or use the [`Builder`]. - pub fn new() -> Self { - Self { - provider_config: ProviderConfig::default(), - } - } - - /// [`Builder`] to construct a [`ProfileFileAppNameProvider`] - pub fn builder() -> Builder { - Builder::default() - } - - /// Parses the profile config and attempts to find an app name. - pub async fn app_name(&self) -> Option { - let app_id = self.provider_config.profile().await?.get("sdk-ua-app-id")?; - match AppName::new(app_id.to_owned()) { - Ok(app_name) => Some(app_name), - Err(err) => { - tracing::warn!(err = %err, "`sdk-ua-app-id` property `{}` was invalid", app_id); - None - } - } - } -} - -/// Builder for [ProfileFileAppNameProvider] -#[derive(Debug, Default)] -#[allow(deprecated)] -pub struct Builder { - config: Option, - profile_override: Option, - profile_files: Option, -} - -#[allow(deprecated)] -impl Builder { - /// Override the configuration for this provider - pub fn configure(mut self, config: &ProviderConfig) -> Self { - self.config = Some(config.clone()); - self - } - - /// Override the profile name used by the [ProfileFileAppNameProvider] - pub fn profile_name(mut self, profile_name: impl Into) -> Self { - self.profile_override = Some(profile_name.into()); - self - } - - /// Build a [ProfileFileAppNameProvider] from this builder - #[allow(deprecated)] - pub fn build(self) -> ProfileFileAppNameProvider { - let conf = self - .config - .unwrap_or_default() - .with_profile_config(self.profile_files, self.profile_override); - ProfileFileAppNameProvider { - provider_config: conf, - } - } -} diff --git a/aws/rust-runtime/aws-config/src/profile/mod.rs b/aws/rust-runtime/aws-config/src/profile/mod.rs index bae8db5ee4..56490f3335 100644 --- a/aws/rust-runtime/aws-config/src/profile/mod.rs +++ b/aws/rust-runtime/aws-config/src/profile/mod.rs @@ -18,7 +18,6 @@ pub use parser::ProfileParseError; #[doc(inline)] pub use parser::{load, Profile, ProfileFileLoadError, ProfileSet, Property}; -pub mod app_name; pub mod credentials; pub mod profile_file; pub mod region; diff --git a/aws/rust-runtime/aws-config/src/provider_config.rs b/aws/rust-runtime/aws-config/src/provider_config.rs index 788cdb546f..f7865a3d7a 100644 --- a/aws/rust-runtime/aws-config/src/provider_config.rs +++ b/aws/rust-runtime/aws-config/src/provider_config.rs @@ -347,14 +347,6 @@ impl ProviderConfig { } } - /// Deprecated. Don't use. - #[deprecated( - note = "HTTP connector configuration changed. See https://github.com/smithy-lang/smithy-rs/discussions/3022 for upgrade guidance." - )] - pub fn with_tcp_connector(self, http_client: impl HttpClient + 'static) -> Self { - self.with_http_client(http_client) - } - /// Override the HTTP client for this configuration pub fn with_http_client(self, http_client: impl HttpClient + 'static) -> Self { ProviderConfig { 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 53b23c3cf2..07aa060d31 100644 --- a/aws/rust-runtime/aws-inlineable/src/s3_request_id.rs +++ b/aws/rust-runtime/aws-inlineable/src/s3_request_id.rs @@ -5,11 +5,7 @@ use aws_smithy_runtime_api::client::result::SdkError; use aws_smithy_runtime_api::http::{Headers, Response}; -use aws_smithy_types::error::metadata::{ - Builder as ErrorMetadataBuilder, ErrorMetadata, ProvideErrorMetadata, -}; -#[allow(deprecated)] -use aws_smithy_types::error::Unhandled; +use aws_smithy_types::error::metadata::{Builder as ErrorMetadataBuilder, ErrorMetadata}; const EXTENDED_REQUEST_ID: &str = "s3_extended_request_id"; @@ -37,13 +33,6 @@ impl RequestIdExt for ErrorMetadata { } } -#[allow(deprecated)] -impl RequestIdExt for Unhandled { - fn extended_request_id(&self) -> Option<&str> { - self.meta().extended_request_id() - } -} - impl RequestIdExt for Response { fn extended_request_id(&self) -> Option<&str> { self.headers().extended_request_id() @@ -92,7 +81,7 @@ mod test { fn handle_missing_header() { let resp = Response::try_from(http::Response::builder().status(400).body("").unwrap()).unwrap(); - let mut builder = aws_smithy_types::Error::builder().message("123"); + let mut builder = ErrorMetadata::builder().message("123"); builder = apply_extended_request_id(builder, resp.headers()); assert_eq!(builder.build().extended_request_id(), None); } diff --git a/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs b/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs index 89e5923c1e..9655bec82b 100644 --- a/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs +++ b/aws/rust-runtime/aws-runtime/src/retries/classifiers.rs @@ -167,7 +167,7 @@ mod test { #[test] fn classify_generic() { let policy = AwsErrorCodeClassifier::::new(); - let err = aws_smithy_types::Error::builder().code("SlowDown").build(); + let err = ErrorMetadata::builder().code("SlowDown").build(); let test_response = http::Response::new("OK").map(SdkBody::from); let mut ctx = InterceptorContext::new(Input::doesnt_matter()); @@ -180,7 +180,7 @@ mod test { #[test] fn test_retry_after_header() { let policy = AwsErrorCodeClassifier::::new(); - let err = aws_smithy_types::Error::builder().code("SlowDown").build(); + let err = ErrorMetadata::builder().code("SlowDown").build(); let res = http::Response::builder() .header("x-amz-retry-after", "5000") .body("retry later") diff --git a/aws/rust-runtime/aws-types/src/config.rs b/aws/rust-runtime/aws-types/src/config.rs deleted file mode 100644 index f2fe3da3a2..0000000000 --- a/aws/rust-runtime/aws-types/src/config.rs +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -#![deny(missing_docs)] - -//! AWS Shared Config _(deprecated, replaced with [`sdk_config`](crate::sdk_config))_ -//! -//! This module contains an shared configuration representation that is agnostic from a specific service. - -#[deprecated(since = "0.9.0", note = "renamed to crate::SdkConfig")] -/// AWS Shared Configuration -pub type Config = super::SdkConfig; diff --git a/aws/rust-runtime/aws-types/src/request_id.rs b/aws/rust-runtime/aws-types/src/request_id.rs index 97dff4b110..2d5be5a094 100644 --- a/aws/rust-runtime/aws-types/src/request_id.rs +++ b/aws/rust-runtime/aws-types/src/request_id.rs @@ -8,12 +8,7 @@ use aws_smithy_runtime_api::client::result::SdkError; use aws_smithy_runtime_api::http::Headers; use aws_smithy_runtime_api::http::Response; -use aws_smithy_types::error::metadata::{ - Builder as ErrorMetadataBuilder, ErrorMetadata, ProvideErrorMetadata, -}; - -#[allow(deprecated)] -use aws_smithy_types::error::Unhandled; +use aws_smithy_types::error::metadata::{Builder as ErrorMetadataBuilder, ErrorMetadata}; /// Constant for the [`ErrorMetadata`] extra field that contains the request ID const AWS_REQUEST_ID: &str = "aws_request_id"; @@ -40,13 +35,6 @@ impl RequestId for ErrorMetadata { } } -#[allow(deprecated)] -impl RequestId for Unhandled { - fn request_id(&self) -> Option<&str> { - self.meta().request_id() - } -} - impl RequestId for Response { fn request_id(&self) -> Option<&str> { self.headers().request_id() diff --git a/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs b/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs index 570809842a..1928a49ecb 100644 --- a/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs +++ b/aws/sdk/integration-tests/dynamodb/benches/deserialization_bench.rs @@ -6,7 +6,7 @@ use aws_sdk_dynamodb::operation::query::QueryOutput; use aws_smithy_runtime_api::client::orchestrator::HttpResponse; use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin; -use aws_smithy_runtime_api::client::ser_de::{ResponseDeserializer, SharedResponseDeserializer}; +use aws_smithy_runtime_api::client::ser_de::{DeserializeResponse, SharedResponseDeserializer}; use aws_smithy_types::body::SdkBody; use criterion::{criterion_group, criterion_main, Criterion}; diff --git a/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs b/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs index 6bc0b8a273..bd510b4aa5 100644 --- a/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs +++ b/aws/sdk/integration-tests/dynamodb/benches/serialization_bench.rs @@ -7,7 +7,7 @@ use aws_sdk_dynamodb::operation::put_item::{PutItem, PutItemInput}; use aws_sdk_dynamodb::types::AttributeValue; use aws_smithy_runtime_api::client::interceptors::context::Input; use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin; -use aws_smithy_runtime_api::client::ser_de::{RequestSerializer, SharedRequestSerializer}; +use aws_smithy_runtime_api::client::ser_de::{SerializeRequest, SharedRequestSerializer}; use aws_smithy_types::config_bag::ConfigBag; use criterion::{criterion_group, criterion_main, Criterion}; diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpConnectorConfigDecorator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpConnectorConfigDecorator.kt index 9fcf05e0e7..343292055f 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpConnectorConfigDecorator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpConnectorConfigDecorator.kt @@ -47,14 +47,6 @@ private class HttpConnectorConfigCustomization( is ServiceConfig.ConfigImpl -> writable { rustTemplate( """ - /// Deprecated. Don't use. - ##[deprecated( - note = "HTTP connector configuration changed. See https://github.com/smithy-lang/smithy-rs/discussions/3022 for upgrade guidance." - )] - pub fn http_connector(&self) -> Option<#{SharedHttpClient}> { - self.runtime_components.http_client() - } - /// Return the [`SharedHttpClient`](#{SharedHttpClient}) to use when making requests, if any. pub fn http_client(&self) -> Option<#{SharedHttpClient}> { self.runtime_components.http_client() @@ -67,22 +59,6 @@ private class HttpConnectorConfigCustomization( ServiceConfig.BuilderImpl -> writable { rustTemplate( """ - /// Deprecated. Don't use. - ##[deprecated( - note = "HTTP connector configuration changed. See https://github.com/smithy-lang/smithy-rs/discussions/3022 for upgrade guidance." - )] - pub fn http_connector(self, http_client: impl #{HttpClient} + 'static) -> Self { - self.http_client(http_client) - } - - /// Deprecated. Don't use. - ##[deprecated( - note = "HTTP connector configuration changed. See https://github.com/smithy-lang/smithy-rs/discussions/3022 for upgrade guidance." - )] - pub fn set_http_connector(&mut self, http_client: Option<#{SharedHttpClient}>) -> &mut Self { - self.set_http_client(http_client) - } - /// Sets the HTTP client to use when making requests. /// /// ## Examples diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpAuthDecoratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpAuthDecoratorTest.kt index b2d7984b2d..e235144f2d 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpAuthDecoratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/customizations/HttpAuthDecoratorTest.kt @@ -113,7 +113,6 @@ class HttpAuthDecoratorTest { IdentityFuture, ResolveIdentity, SharedIdentityResolver, }; use aws_smithy_runtime_api::box_error::BoxError; - use aws_smithy_runtime_api::client::auth::Signer; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_runtime_api::client::runtime_components::{ GetIdentityResolver, RuntimeComponentsBuilder, @@ -164,7 +163,7 @@ class HttpAuthDecoratorTest { #[derive(Debug)] struct CustomIdentity(String); - impl Signer for CustomSigner { + impl Sign for CustomSigner { fn sign_http_request( &self, request: &mut HttpRequest, diff --git a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGeneratorTest.kt b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGeneratorTest.kt index 590b7acb9c..1f1b703241 100644 --- a/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGeneratorTest.kt +++ b/codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/OperationErrorGeneratorTest.kt @@ -53,11 +53,12 @@ class OperationErrorGeneratorTest { name = "generates_combined_error_enums", test = """ use crate::operation::greeting::GreetingError; + use aws_smithy_types::error::ErrorMetadata; let error = GreetingError::InvalidGreeting( InvalidGreeting::builder() .message("an error") - .meta(aws_smithy_types::Error::builder().code("InvalidGreeting").message("an error").build()) + .meta(ErrorMetadata::builder().code("InvalidGreeting").message("an error").build()) .build() ); assert_eq!(format!("{}", error), "InvalidGreeting: an error"); @@ -71,7 +72,7 @@ class OperationErrorGeneratorTest { assert_eq!(error.is_complex_error(), false); // Unhandled variants properly delegate message. - let error = GreetingError::generic(aws_smithy_types::Error::builder().message("hello").build()); + let error = GreetingError::generic(ErrorMetadata::builder().message("hello").build()); assert_eq!(error.meta().message(), Some("hello")); let error = GreetingError::unhandled("some other error"); diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEventStreamWrapperGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEventStreamWrapperGenerator.kt index 8594d703c1..d6d7c5bbf9 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEventStreamWrapperGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerEventStreamWrapperGenerator.kt @@ -85,6 +85,7 @@ class PythonServerEventStreamWrapperGenerator( "MarshallMessage" to RuntimeType.smithyEventStream(runtimeConfig).resolve("frame::MarshallMessage"), "SignMessage" to RuntimeType.smithyEventStream(runtimeConfig).resolve("frame::SignMessage"), "MessageStreamAdapter" to RuntimeType.smithyHttp(runtimeConfig).resolve("event_stream::MessageStreamAdapter"), + "SdkError" to RuntimeType.sdkError(runtimeConfig), ) fun render(writer: RustWriter) { @@ -227,7 +228,7 @@ class PythonServerEventStreamWrapperGenerator( match next { Ok(Some(data)) => Ok(#{PyO3}::Python::with_gil(|py| #{PyO3}::IntoPy::into_py(data, py))), Ok(None) => Err(#{PyO3}::exceptions::PyStopAsyncIteration::new_err("stream exhausted")), - Err(#{SmithyHttp}::result::SdkError::ServiceError(service_err)) => Err(service_err.into_err().into()), + Err(#{SdkError}::ServiceError(service_err)) => Err(service_err.into_err().into()), Err(err) => Err(#{PyO3}::exceptions::PyRuntimeError::new_err(err.to_string())), } })?; diff --git a/rust-runtime/aws-smithy-http/src/body.rs b/rust-runtime/aws-smithy-http/src/body.rs deleted file mode 100644 index efcc29b712..0000000000 --- a/rust-runtime/aws-smithy-http/src/body.rs +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -//TODO(runtimeCratesVersioningCleanup): Keep the following deprecated type aliases for at least -// one release since 0.56.1 and then remove this module. - -//! Types for representing the body of an HTTP request or response - -/// 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 deleted file mode 100644 index 06da29636b..0000000000 --- a/rust-runtime/aws-smithy-http/src/byte_stream.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -//TODO(runtimeCratesVersioningCleanup): Keep the following deprecated type aliases for at least -// one release since 0.56.1 and then 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; -} - -/// Builder for creating [`ByteStreams`](aws_smithy_types::byte_stream::ByteStream) from a file/path, with full control over advanced options. -#[cfg(feature = "rt-tokio")] -#[deprecated(note = "Moved to `aws_smithy_types::byte_stream::FsBuilder`.")] -pub type FsBuilder = aws_smithy_types::byte_stream::FsBuilder; - -/// The length (in bytes) to read. Determines whether or not a short read counts as an error. -#[cfg(feature = "rt-tokio")] -#[deprecated(note = "Moved to `aws_smithy_types::byte_stream::Length`.")] -pub type Length = aws_smithy_types::byte_stream::Length; diff --git a/rust-runtime/aws-smithy-http/src/connection.rs b/rust-runtime/aws-smithy-http/src/connection.rs deleted file mode 100644 index e8219a0b60..0000000000 --- a/rust-runtime/aws-smithy-http/src/connection.rs +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -//TODO(runtimeCratesVersioningCleanup): Keep the following deprecated type alias for at least -// one release since 0.56.1 and then remove this module. - -//! Types related to connection monitoring and management. - -/// Metadata that tracks the state of an active connection. -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::connection::ConnectionMetadata`.")] -pub type ConnectionMetadata = aws_smithy_runtime_api::client::connection::ConnectionMetadata; diff --git a/rust-runtime/aws-smithy-http/src/event_stream/sender.rs b/rust-runtime/aws-smithy-http/src/event_stream/sender.rs index f0dc00fa97..c822da96e1 100644 --- a/rust-runtime/aws-smithy-http/src/event_stream/sender.rs +++ b/rust-runtime/aws-smithy-http/src/event_stream/sender.rs @@ -5,6 +5,7 @@ use aws_smithy_eventstream::frame::{write_message_to, MarshallMessage, SignMessage}; use aws_smithy_runtime_api::client::result::SdkError; +use aws_smithy_types::error::ErrorMetadata; use bytes::Bytes; use futures_core::Stream; use std::error::Error as StdError; @@ -55,7 +56,7 @@ where #[derive(Debug)] pub struct MessageStreamError { kind: MessageStreamErrorKind, - pub(crate) meta: aws_smithy_types::Error, + pub(crate) meta: ErrorMetadata, } #[derive(Debug)] @@ -72,8 +73,8 @@ impl MessageStreamError { } } - /// Creates the `MessageStreamError::Unhandled` variant from a `aws_smithy_types::Error`. - pub fn generic(err: aws_smithy_types::Error) -> Self { + /// Creates the `MessageStreamError::Unhandled` variant from an [`ErrorMetadata`]. + pub fn generic(err: ErrorMetadata) -> Self { Self { meta: err.clone(), kind: MessageStreamErrorKind::Unhandled(err.into()), @@ -82,7 +83,7 @@ impl MessageStreamError { /// Returns error metadata, which includes the error code, message, /// request ID, and potentially additional information. - pub fn meta(&self) -> &aws_smithy_types::Error { + pub fn meta(&self) -> &ErrorMetadata { &self.meta } } diff --git a/rust-runtime/aws-smithy-http/src/lib.rs b/rust-runtime/aws-smithy-http/src/lib.rs index 3b6113037c..618f51ed31 100644 --- a/rust-runtime/aws-smithy-http/src/lib.rs +++ b/rust-runtime/aws-smithy-http/src/lib.rs @@ -15,7 +15,6 @@ //! - Endpoint support //! - HTTP header deserialization //! - Event streams -//! - [`ByteStream`](byte_stream::ByteStream): a misuse-resistant abstraction for streaming binary data //! //! | Feature | Description | //! |----------------|-------------| @@ -25,8 +24,6 @@ #![allow(clippy::derive_partial_eq_without_eq)] #![cfg_attr(docsrs, feature(doc_cfg))] -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 @@ -40,10 +37,8 @@ pub mod operation; pub mod query; #[doc(hidden)] pub mod query_writer; -pub mod result; #[cfg(feature = "event-stream")] pub mod event_stream; -pub mod connection; mod urlencode; diff --git a/rust-runtime/aws-smithy-http/src/operation.rs b/rust-runtime/aws-smithy-http/src/operation.rs index 7fad89f1e1..cba5082871 100644 --- a/rust-runtime/aws-smithy-http/src/operation.rs +++ b/rust-runtime/aws-smithy-http/src/operation.rs @@ -9,19 +9,6 @@ use aws_smithy_types::config_bag::{Storable, StoreReplace}; use std::borrow::Cow; -//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 { - /// 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. #[derive(Clone, Debug)] pub struct Metadata { diff --git a/rust-runtime/aws-smithy-http/src/result.rs b/rust-runtime/aws-smithy-http/src/result.rs deleted file mode 100644 index c7e5458845..0000000000 --- a/rust-runtime/aws-smithy-http/src/result.rs +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -//TODO(runtimeCratesVersioningCleanup): Keep the following deprecated type aliases for at least -// one release since 0.56.1 and then remove this module. - -//! Types for [`error`](aws_smithy_runtime_api::client::result::SdkError) responses. - -/// Builders for `SdkError` variant context. -pub mod builders { - /// Builder for [`ConstructionFailure`](aws_smithy_runtime_api::client::result::ConstructionFailure). - #[deprecated( - note = "Moved to `aws_smithy_runtime_api::client::result::builders::ConstructionFailureBuilder`." - )] - pub type ConstructionFailureBuilder = - aws_smithy_runtime_api::client::result::builders::ConstructionFailureBuilder; - - /// Builder for [`TimeoutError`](aws_smithy_runtime_api::client::result::TimeoutError). - #[deprecated( - note = "Moved to `aws_smithy_runtime_api::client::result::builders::TimeoutErrorBuilder`." - )] - pub type TimeoutErrorBuilder = - aws_smithy_runtime_api::client::result::builders::TimeoutErrorBuilder; - - /// Builder for [`DispatchFailure`](aws_smithy_runtime_api::client::result::DispatchFailure). - #[deprecated( - note = "Moved to `aws_smithy_runtime_api::client::result::builders::DispatchFailureBuilder`." - )] - pub type DispatchFailureBuilder = - aws_smithy_runtime_api::client::result::builders::DispatchFailureBuilder; - - /// Builder for [`ResponseError`](aws_smithy_runtime_api::client::result::ResponseError). - #[deprecated( - note = "Moved to `aws_smithy_runtime_api::client::result::builders::ResponseErrorBuilder`." - )] - pub type ResponseErrorBuilder = - aws_smithy_runtime_api::client::result::builders::ResponseErrorBuilder; - - /// Builder for [`ServiceError`](aws_smithy_runtime_api::client::result::ServiceError). - #[deprecated( - note = "Moved to `aws_smithy_runtime_api::client::result::builders::ServiceErrorBuilder`." - )] - pub type ServiceErrorBuilder = - aws_smithy_runtime_api::client::result::builders::ServiceErrorBuilder; -} - -/// Error context for [`aws_smithy_runtime_api::client::result::ConstructionFailure`] -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::ConstructionFailure`.")] -pub type ConstructionFailure = aws_smithy_runtime_api::client::result::ConstructionFailure; - -/// Error context for [`aws_smithy_runtime_api::client::result::TimeoutError`] -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::TimeoutError`.")] -pub type TimeoutError = aws_smithy_runtime_api::client::result::TimeoutError; - -/// Error context for [`aws_smithy_runtime_api::client::result::DispatchFailure`] -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::DispatchFailure`.")] -pub type DispatchFailure = aws_smithy_runtime_api::client::result::DispatchFailure; - -/// Error context for [`aws_smithy_runtime_api::client::result::ResponseError`] -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::ResponseError`.")] -pub type ResponseError = aws_smithy_runtime_api::client::result::ResponseError; - -/// Failed SDK Result -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::ServiceError`.")] -pub type ServiceError = aws_smithy_runtime_api::client::result::ServiceError; - -/// Failed SDK Result -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::SdkError`.")] -pub type SdkError = aws_smithy_runtime_api::client::result::SdkError; - -/// Error from the underlying Connector -#[deprecated(note = "Moved to `aws_smithy_runtime_api::client::result::ConnectorError`.")] -pub type ConnectorError = aws_smithy_runtime_api::client::result::ConnectorError; diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/auth.rs b/rust-runtime/aws-smithy-runtime-api/src/client/auth.rs index 8cc11806f9..3c435ae7e4 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/auth.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/auth.rs @@ -81,9 +81,6 @@ impl Storable for AuthSchemeOptionResolverParams { type Storer = StoreReplace; } -#[deprecated(note = "Renamed to ResolveAuthSchemeOptions.")] -pub use ResolveAuthSchemeOptions as AuthSchemeOptionResolver; - /// Resolver for auth scheme options. /// /// The orchestrator needs to select an auth scheme to sign requests with, and potentially @@ -192,9 +189,6 @@ impl ValidateConfig for SharedAuthScheme {} impl_shared_conversions!(convert SharedAuthScheme from AuthScheme using SharedAuthScheme::new); -#[deprecated(note = "Renamed to Sign.")] -pub use Sign as Signer; - /// Signing implementation for an auth scheme. pub trait Sign: Send + Sync + fmt::Debug { /// Sign the given request with the given identity, components, and config. diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/endpoint.rs b/rust-runtime/aws-smithy-runtime-api/src/client/endpoint.rs index a0818cf4ec..13e9880a4a 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/endpoint.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/endpoint.rs @@ -43,9 +43,6 @@ impl Storable for EndpointResolverParams { type Storer = StoreReplace; } -#[deprecated(note = "Renamed to ResolveEndpoint.")] -pub use ResolveEndpoint as EndpointResolver; - /// Configurable endpoint resolver implementation. pub trait ResolveEndpoint: Send + Sync + fmt::Debug { /// Asynchronously resolves an endpoint to use from the given endpoint parameters. diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/http.rs b/rust-runtime/aws-smithy-runtime-api/src/client/http.rs index 2ea777175c..1e90d40fb1 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/http.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/http.rs @@ -59,26 +59,6 @@ use std::fmt; use std::sync::Arc; use std::time::Duration; -/// Http Request Types -pub mod request { - use aws_smithy_types::body::SdkBody; - /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::HttpError`. - #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::HttpError`.")] - pub type HttpError = crate::http::HttpError; - /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::HeaderValue`. - #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::HeaderValue`.")] - pub type HeaderValue = crate::http::HeaderValue; - /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::Headers`. - #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::Headers`.")] - pub type Headers = crate::http::Headers; - /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::HeadersIter`. - #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::HeadersIter`.")] - pub type HeadersIter<'a> = crate::http::HeadersIter<'a>; - /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::Request`. - #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::Request`.")] - pub type Request = crate::http::Request; -} - new_type_future! { #[doc = "Future for [`HttpConnector::call`]."] pub struct HttpConnectorFuture<'static, HttpResponse, ConnectorError>; @@ -280,19 +260,3 @@ impl HttpConnectorSettings { self.read_timeout } } - -#[cfg(test)] -mod test { - #[test] - #[allow(deprecated)] - fn re_export_has_default_generic() { - let req1 = super::request::Request::empty(); - let req2 = super::request::Request::<()>::new(()); - fn takes_req(_req: &super::request::Request) {} - fn takes_generic_req(_req: &super::request::Request) {} - - takes_req(&req1); - takes_generic_req(&req1); - takes_generic_req(&req2); - } -} diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/identity.rs b/rust-runtime/aws-smithy-runtime-api/src/client/identity.rs index fae5e86055..669c4490ab 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/identity.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/identity.rs @@ -139,9 +139,6 @@ impl ValidateConfig for SharedIdentityCache { impl_shared_conversions!(convert SharedIdentityCache from ResolveCachedIdentity using SharedIdentityCache::new); -#[deprecated(note = "Renamed to ResolveIdentity.")] -pub use ResolveIdentity as IdentityResolver; - /// Resolver for identities. /// /// Every [`AuthScheme`](crate::client::auth::AuthScheme) has one or more compatible diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors.rs b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors.rs index 370742c249..e4fde15ad4 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors.rs @@ -55,9 +55,6 @@ macro_rules! interceptor_trait_fn { }; } -#[deprecated(note = "Renamed to Intercept.")] -pub use Intercept as Interceptor; - /// An interceptor allows injecting code into the SDK ’s request execution pipeline. /// /// ## Terminology: diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/result.rs b/rust-runtime/aws-smithy-runtime-api/src/client/result.rs index 93013abdd8..080940840f 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/result.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/result.rs @@ -493,7 +493,7 @@ impl ProvideErrorMetadata for SdkError where E: ProvideErrorMetadata, { - fn meta(&self) -> &aws_smithy_types::Error { + fn meta(&self) -> &aws_smithy_types::error::ErrorMetadata { match self { SdkError::ConstructionFailure(_) => &EMPTY_ERROR_METADATA, SdkError::TimeoutError(_) => &EMPTY_ERROR_METADATA, diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/ser_de.rs b/rust-runtime/aws-smithy-runtime-api/src/client/ser_de.rs index 913113c466..5ca288cbba 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/ser_de.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/ser_de.rs @@ -13,9 +13,6 @@ use aws_smithy_types::config_bag::{ConfigBag, Storable, StoreReplace}; use std::fmt; use std::sync::Arc; -#[deprecated(note = "Renamed to SerializeRequest.")] -pub use SerializeRequest as RequestSerializer; - /// Serialization implementation that converts an [`Input`] into an [`HttpRequest`]. pub trait SerializeRequest: Send + Sync + fmt::Debug { /// Serializes the input into an HTTP request. @@ -54,9 +51,6 @@ impl Storable for SharedRequestSerializer { impl_shared_conversions!(convert SharedRequestSerializer from SerializeRequest using SharedRequestSerializer::new); -#[deprecated(note = "Renamed to DeserializeResponse.")] -pub use DeserializeResponse as ResponseDeserializer; - /// Deserialization implementation that converts an [`HttpResponse`] into an [`Output`] or [`Error`]. pub trait DeserializeResponse: Send + Sync + fmt::Debug { /// For streaming requests, deserializes the response headers. diff --git a/rust-runtime/aws-smithy-runtime/src/client/identity/cache.rs b/rust-runtime/aws-smithy-runtime/src/client/identity/cache.rs index e18d9c0afc..7e349c78ec 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/identity/cache.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/identity/cache.rs @@ -4,7 +4,7 @@ */ use aws_smithy_runtime_api::client::identity::{ - IdentityFuture, IdentityResolver, ResolveCachedIdentity, SharedIdentityCache, + IdentityFuture, ResolveCachedIdentity, ResolveIdentity, SharedIdentityCache, SharedIdentityResolver, }; use aws_smithy_runtime_api::shared::IntoShared; diff --git a/rust-runtime/aws-smithy-runtime/src/client/identity/cache/lazy.rs b/rust-runtime/aws-smithy-runtime/src/client/identity/cache/lazy.rs index bd1d284017..8581d7c12c 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/identity/cache/lazy.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/identity/cache/lazy.rs @@ -9,7 +9,7 @@ use aws_smithy_async::rt::sleep::{AsyncSleep, SharedAsyncSleep}; use aws_smithy_async::time::{SharedTimeSource, TimeSource}; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::identity::{ - Identity, IdentityCachePartition, IdentityFuture, IdentityResolver, ResolveCachedIdentity, + Identity, IdentityCachePartition, IdentityFuture, ResolveCachedIdentity, ResolveIdentity, SharedIdentityCache, SharedIdentityResolver, }; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; @@ -402,7 +402,7 @@ mod tests { f.write_str("ResolverFn") } } - impl IdentityResolver for ResolverFn + impl ResolveIdentity for ResolverFn where F: Fn() -> IdentityFuture<'static> + Send + Sync, { @@ -428,7 +428,7 @@ mod tests { ) -> (LazyCache, SharedIdentityResolver) { #[derive(Debug)] struct Resolver(Mutex>>); - impl IdentityResolver for Resolver { + impl ResolveIdentity for Resolver { fn resolve_identity<'a>( &'a self, _: &'a RuntimeComponents, diff --git a/rust-runtime/aws-smithy-types/src/byte_stream.rs b/rust-runtime/aws-smithy-types/src/byte_stream.rs index 8a36a9ba1e..2721b1b6b2 100644 --- a/rust-runtime/aws-smithy-types/src/byte_stream.rs +++ b/rust-runtime/aws-smithy-types/src/byte_stream.rs @@ -403,24 +403,6 @@ impl ByteStream { .await } - /// Create a ByteStream from a file - /// - /// NOTE: This will NOT result in a retryable ByteStream. For a ByteStream that can be retried in the case of - /// upstream failures, use [`ByteStream::from_path`](ByteStream::from_path) - #[deprecated( - since = "0.40.0", - note = "Prefer the more extensible ByteStream::read_from() API" - )] - #[cfg(feature = "rt-tokio")] - pub async fn from_file( - file: tokio::fs::File, - ) -> Result { - crate::byte_stream::FsBuilder::new() - .file(file) - .build() - .await - } - #[cfg(feature = "rt-tokio")] /// Convert this `ByteStream` into a struct that implements [`AsyncBufRead`](tokio::io::AsyncBufRead). /// diff --git a/rust-runtime/aws-smithy-types/src/error.rs b/rust-runtime/aws-smithy-types/src/error.rs index 28838e4b76..e2375ddf3f 100644 --- a/rust-runtime/aws-smithy-types/src/error.rs +++ b/rust-runtime/aws-smithy-types/src/error.rs @@ -10,13 +10,9 @@ use std::fmt; pub mod display; pub mod metadata; pub mod operation; -mod unhandled; pub use metadata::ErrorMetadata; -#[allow(deprecated)] -pub use unhandled::Unhandled; - #[derive(Debug)] pub(super) enum TryFromNumberErrorKind { /// Used when the conversion from an integer type into a smaller integer type would be lossy. diff --git a/rust-runtime/aws-smithy-types/src/error/metadata.rs b/rust-runtime/aws-smithy-types/src/error/metadata.rs index 6629753733..4855b6c3ee 100644 --- a/rust-runtime/aws-smithy-types/src/error/metadata.rs +++ b/rust-runtime/aws-smithy-types/src/error/metadata.rs @@ -75,13 +75,13 @@ impl Builder { /// /// Typically, these will be accessed with an extension trait: /// ```rust - /// use aws_smithy_types::Error; + /// use aws_smithy_types::error::ErrorMetadata; /// const HOST_ID: &str = "host_id"; /// trait S3ErrorExt { /// fn extended_request_id(&self) -> Option<&str>; /// } /// - /// impl S3ErrorExt for Error { + /// impl S3ErrorExt for ErrorMetadata { /// fn extended_request_id(&self) -> Option<&str> { /// self.extra(HOST_ID) /// } @@ -90,7 +90,7 @@ impl Builder { /// fn main() { /// // Extension trait must be brought into scope /// use S3ErrorExt; - /// let sdk_response: Result<(), Error> = Err(Error::builder().custom(HOST_ID, "x-1234").build()); + /// let sdk_response: Result<(), ErrorMetadata> = Err(ErrorMetadata::builder().custom(HOST_ID, "x-1234").build()); /// if let Err(err) = sdk_response { /// println!("extended request id: {:?}", err.extended_request_id()); /// } diff --git a/rust-runtime/aws-smithy-types/src/error/unhandled.rs b/rust-runtime/aws-smithy-types/src/error/unhandled.rs deleted file mode 100644 index f0cce422fc..0000000000 --- a/rust-runtime/aws-smithy-types/src/error/unhandled.rs +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -#![allow(deprecated)] - -//! Unhandled error type. - -use crate::error::{metadata::ProvideErrorMetadata, ErrorMetadata}; -use std::error::Error as StdError; - -#[deprecated(note = "The `Unhandled` type is no longer used by errors.")] -/// Builder for [`Unhandled`] -#[derive(Default, Debug)] -pub struct Builder { - source: Option>, - meta: Option, -} - -impl Builder { - /// Sets the error source - pub fn source(mut self, source: impl Into>) -> Self { - self.source = Some(source.into()); - self - } - - /// Sets the error source - pub fn set_source( - &mut self, - source: Option>, - ) -> &mut Self { - self.source = source; - self - } - - /// Sets the error metadata - pub fn meta(mut self, meta: ErrorMetadata) -> Self { - self.meta = Some(meta); - self - } - - /// Sets the error metadata - pub fn set_meta(&mut self, meta: Option) -> &mut Self { - self.meta = meta; - self - } - - /// Builds the unhandled error - pub fn build(self) -> Unhandled { - Unhandled { - source: self.source.expect("unhandled errors must have a source"), - meta: self.meta.unwrap_or_default(), - } - } -} - -/// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). -/// -/// When logging an error from the SDK, it is recommended that you either wrap the error in -/// [`DisplayErrorContext`](crate::error::display::DisplayErrorContext), use another -/// error reporter library that visits the error's cause/source chain, or call -/// [`Error::source`](std::error::Error::source) for more details about the underlying cause. -#[deprecated(note = "This type is no longer used by errors.")] -#[derive(Debug)] -pub struct Unhandled { - source: Box, - meta: ErrorMetadata, -} - -impl Unhandled { - /// Returns a builder to construct an unhandled error. - pub fn builder() -> Builder { - Default::default() - } -} - -impl std::fmt::Display for Unhandled { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - write!(f, "unhandled error") - } -} - -impl StdError for Unhandled { - fn source(&self) -> Option<&(dyn StdError + 'static)> { - Some(self.source.as_ref() as _) - } -} - -impl ProvideErrorMetadata for Unhandled { - fn meta(&self) -> &ErrorMetadata { - &self.meta - } -} diff --git a/rust-runtime/aws-smithy-types/src/lib.rs b/rust-runtime/aws-smithy-types/src/lib.rs index 386c905733..79c0a13f5b 100644 --- a/rust-runtime/aws-smithy-types/src/lib.rs +++ b/rust-runtime/aws-smithy-types/src/lib.rs @@ -38,10 +38,4 @@ pub mod str_bytes; pub use blob::Blob; pub use date_time::DateTime; pub use document::Document; -// TODO(deprecated): Remove deprecated re-export -/// Use [error::ErrorMetadata] instead. -#[deprecated( - note = "`aws_smithy_types::Error` has been renamed to `aws_smithy_types::error::ErrorMetadata`" -)] -pub use error::ErrorMetadata as Error; pub use number::Number; diff --git a/rust-runtime/inlineable/src/json_errors.rs b/rust-runtime/inlineable/src/json_errors.rs index 4106762051..b785bbe63b 100644 --- a/rust-runtime/inlineable/src/json_errors.rs +++ b/rust-runtime/inlineable/src/json_errors.rs @@ -97,7 +97,7 @@ pub fn parse_error_metadata( mod test { use crate::json_errors::{parse_error_body, parse_error_metadata, sanitize_error_code}; use aws_smithy_runtime_api::client::orchestrator::HttpResponse; - use aws_smithy_types::{body::SdkBody, Error}; + use aws_smithy_types::{body::SdkBody, error::ErrorMetadata}; use std::borrow::Cow; #[test] @@ -114,7 +114,7 @@ mod test { parse_error_metadata(response.body().bytes().unwrap(), response.headers()) .unwrap() .build(), - Error::builder() + ErrorMetadata::builder() .code("FooError") .message("Go to foo") .build() @@ -200,7 +200,7 @@ mod test { parse_error_metadata(response.body().bytes().unwrap(), response.headers()) .unwrap() .build(), - Error::builder() + ErrorMetadata::builder() .code("ResourceNotFoundException") .message("Functions from 'us-west-2' are not reachable from us-east-1") .build()