Skip to content

Commit

Permalink
Remove deprecations from rust-runtime (#3222)
Browse files Browse the repository at this point in the history
This PR removes deprecations throughout smithy-rs client and the SDK.
Some of these deprecations were ignored by the compiler (in the case
where `#[deprecated]` was used with `pub use`), so these will need to be
explicitly called out in the changelog.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: Russell Cohen <[email protected]>
  • Loading branch information
2 people authored and aws-sdk-rust-ci committed Nov 17, 2023
1 parent a055471 commit 04ede19
Show file tree
Hide file tree
Showing 39 changed files with 49 additions and 631 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
46 changes: 0 additions & 46 deletions aws/rust-runtime/aws-config/src/environment/app_name.rs

This file was deleted.

3 changes: 0 additions & 3 deletions aws/rust-runtime/aws-config/src/environment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
43 changes: 0 additions & 43 deletions aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
106 changes: 0 additions & 106 deletions aws/rust-runtime/aws-config/src/profile/app_name.rs

This file was deleted.

1 change: 0 additions & 1 deletion aws/rust-runtime/aws-config/src/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions aws/rust-runtime/aws-config/src/provider_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 2 additions & 13 deletions aws/rust-runtime/aws-inlineable/src/s3_request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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<B> RequestIdExt for Response<B> {
fn extended_request_id(&self) -> Option<&str> {
self.headers().extended_request_id()
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-runtime/src/retries/classifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ mod test {
#[test]
fn classify_generic() {
let policy = AwsErrorCodeClassifier::<ErrorMetadata>::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());
Expand All @@ -180,7 +180,7 @@ mod test {
#[test]
fn test_retry_after_header() {
let policy = AwsErrorCodeClassifier::<ErrorMetadata>::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")
Expand Down
14 changes: 0 additions & 14 deletions aws/rust-runtime/aws-types/src/config.rs

This file was deleted.

14 changes: 1 addition & 13 deletions aws/rust-runtime/aws-types/src/request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<B> RequestId for Response<B> {
fn request_id(&self) -> Option<&str> {
self.headers().request_id()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
Loading

0 comments on commit 04ede19

Please sign in to comment.