Skip to content

Commit

Permalink
Remove deprecations from rust-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Nov 17, 2023
1 parent faf0648 commit e34f580
Show file tree
Hide file tree
Showing 27 changed files with 25 additions and 382 deletions.
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: 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 @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
17 changes: 0 additions & 17 deletions rust-runtime/aws-smithy-http/src/body.rs

This file was deleted.

34 changes: 0 additions & 34 deletions rust-runtime/aws-smithy-http/src/byte_stream.rs

This file was deleted.

13 changes: 0 additions & 13 deletions rust-runtime/aws-smithy-http/src/connection.rs

This file was deleted.

9 changes: 5 additions & 4 deletions rust-runtime/aws-smithy-http/src/event_stream/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)]
Expand All @@ -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()),
Expand All @@ -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
}
}
Expand Down
4 changes: 0 additions & 4 deletions rust-runtime/aws-smithy-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,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
Expand All @@ -40,10 +38,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;
13 changes: 0 additions & 13 deletions rust-runtime/aws-smithy-http/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
75 changes: 0 additions & 75 deletions rust-runtime/aws-smithy-http/src/result.rs

This file was deleted.

6 changes: 0 additions & 6 deletions rust-runtime/aws-smithy-runtime-api/src/client/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ impl Storable for AuthSchemeOptionResolverParams {
type Storer = StoreReplace<Self>;
}

#[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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions rust-runtime/aws-smithy-runtime-api/src/client/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ impl Storable for EndpointResolverParams {
type Storer = StoreReplace<Self>;
}

#[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.
Expand Down
Loading

0 comments on commit e34f580

Please sign in to comment.