Commit 280e400a authored by Russell Cohen's avatar Russell Cohen Committed by AWS SDK Rust Bot
Browse files

[smithy-rs] Http updates (#3059)

## Motivation and Context
- [ ] Upgrade guidance
- [x] changelog

To allow seamless adoption of the incoming `http` crate, we're updating
our client crates to use an intermediate type.

## Description

Update _client_ code to use `HttpRequest`. Some internal code still uses
`http::Request` but those usages are limited.

## Testing
CI

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK 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._
parent ee54c311
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -36,13 +36,13 @@ impl<T, E, B> CustomizableOperation<T, E, B> {
        }
    }

    /// Adds an [`Interceptor`](::aws_smithy_runtime_api::client::interceptors::Interceptor) that runs at specific stages of the request execution pipeline.
    /// Adds an [interceptor](::aws_smithy_runtime_api::client::interceptors::Intercept) that runs at specific stages of the request execution pipeline.
    ///
    /// Note that interceptors can also be added to `CustomizableOperation` by `config_override`,
    /// `map_request`, and `mutate_request` (the last two are implemented via interceptors under the hood).
    /// The order in which those user-specified operation interceptors are invoked should not be relied upon
    /// as it is an implementation detail.
    pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Interceptor + 'static) -> Self {
    pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Intercept + 'static) -> Self {
        self.interceptors
            .push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(interceptor));
        self
+2 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
use crate::idempotency_token::IdempotencyTokenProvider;
use aws_smithy_runtime_api::box_error::BoxError;
use aws_smithy_runtime_api::client::interceptors::context::{BeforeSerializationInterceptorContextMut, Input};
use aws_smithy_runtime_api::client::interceptors::{Interceptor, SharedInterceptor};
use aws_smithy_runtime_api::client::interceptors::{Intercept, SharedInterceptor};
use aws_smithy_runtime_api::client::runtime_components::{RuntimeComponents, RuntimeComponentsBuilder};
use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
use aws_smithy_types::config_bag::ConfigBag;
@@ -47,7 +47,7 @@ impl<S> fmt::Debug for IdempotencyTokenInterceptor<S> {
    }
}

impl<S> Interceptor for IdempotencyTokenInterceptor<S>
impl<S> Intercept for IdempotencyTokenInterceptor<S>
where
    S: Fn(IdempotencyTokenProvider, &mut Input) + Send + Sync,
{
+5 −5
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ impl Builder {
        retry_partition.map(|r| self.config.store_put(r));
        self
    }
    /// Add an [`Interceptor`](::aws_smithy_runtime_api::client::interceptors::Interceptor) that runs at specific stages of the request execution pipeline.
    /// Add an [interceptor](::aws_smithy_runtime_api::client::interceptors::Intercept) that runs at specific stages of the request execution pipeline.
    ///
    /// Interceptors targeted at a certain stage are executed according to the pre-defined priority.
    /// The SDK provides a default set of interceptors. An interceptor configured by this method
@@ -479,7 +479,7 @@ impl Builder {
    ///
    /// #[derive(Debug)]
    /// pub struct UriModifierInterceptor;
    /// impl Interceptor for UriModifierInterceptor {
    /// impl Intercept for UriModifierInterceptor {
    ///     fn modify_before_signing(
    ///         &self,
    ///         context: &mut InterceptorContext<BeforeTransmit>,
@@ -499,7 +499,7 @@ impl Builder {
    /// # }
    /// # }
    /// ```
    pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Interceptor + 'static) -> Self {
    pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Intercept + 'static) -> Self {
        self.push_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(interceptor));
        self
    }
@@ -529,7 +529,7 @@ impl Builder {
    /// fn modify_request_uri(builder: &mut Builder) {
    ///     #[derive(Debug)]
    ///     pub struct UriModifierInterceptor;
    ///     impl Interceptor for UriModifierInterceptor {
    ///     impl Intercept for UriModifierInterceptor {
    ///         fn modify_before_signing(
    ///             &self,
    ///             context: &mut InterceptorContext<BeforeTransmit>,
@@ -1142,7 +1142,7 @@ impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ConfigO
    }
}

pub use ::aws_smithy_runtime_api::client::interceptors::Interceptor;
pub use ::aws_smithy_runtime_api::client::interceptors::Intercept;
pub use ::aws_smithy_runtime_api::client::interceptors::SharedInterceptor;
pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
pub use ::aws_smithy_types::config_bag::ConfigBag;
+4 −4
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ApplyAr

#[derive(Debug)]
struct ApplyArchiveRuleResponseDeserializer;
impl ::aws_smithy_runtime_api::client::ser_de::ResponseDeserializer for ApplyArchiveRuleResponseDeserializer {
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ApplyArchiveRuleResponseDeserializer {
    fn deserialize_nonstreaming(
        &self,
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
@@ -162,7 +162,7 @@ impl ::aws_smithy_runtime_api::client::ser_de::ResponseDeserializer for ApplyArc
}
#[derive(Debug)]
struct ApplyArchiveRuleRequestSerializer;
impl ::aws_smithy_runtime_api::client::ser_de::RequestSerializer for ApplyArchiveRuleRequestSerializer {
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ApplyArchiveRuleRequestSerializer {
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
    fn serialize_input(
        &self,
@@ -203,13 +203,13 @@ impl ::aws_smithy_runtime_api::client::ser_de::RequestSerializer for ApplyArchiv
            let content_length = content_length.to_string();
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
        }
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request"))
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
    }
}
#[derive(Debug)]
struct ApplyArchiveRuleEndpointParamsInterceptor;

impl ::aws_smithy_runtime_api::client::interceptors::Interceptor for ApplyArchiveRuleEndpointParamsInterceptor {
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ApplyArchiveRuleEndpointParamsInterceptor {
    fn name(&self) -> &'static str {
        "ApplyArchiveRuleEndpointParamsInterceptor"
    }
+4 −4
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CancelP

#[derive(Debug)]
struct CancelPolicyGenerationResponseDeserializer;
impl ::aws_smithy_runtime_api::client::ser_de::ResponseDeserializer for CancelPolicyGenerationResponseDeserializer {
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CancelPolicyGenerationResponseDeserializer {
    fn deserialize_nonstreaming(
        &self,
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
@@ -161,7 +161,7 @@ impl ::aws_smithy_runtime_api::client::ser_de::ResponseDeserializer for CancelPo
}
#[derive(Debug)]
struct CancelPolicyGenerationRequestSerializer;
impl ::aws_smithy_runtime_api::client::ser_de::RequestSerializer for CancelPolicyGenerationRequestSerializer {
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CancelPolicyGenerationRequestSerializer {
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
    fn serialize_input(
        &self,
@@ -206,13 +206,13 @@ impl ::aws_smithy_runtime_api::client::ser_de::RequestSerializer for CancelPolic
        };
        let body = ::aws_smithy_http::body::SdkBody::from("");

        ::std::result::Result::Ok(request_builder.body(body).expect("valid request"))
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
    }
}
#[derive(Debug)]
struct CancelPolicyGenerationEndpointParamsInterceptor;

impl ::aws_smithy_runtime_api::client::interceptors::Interceptor for CancelPolicyGenerationEndpointParamsInterceptor {
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CancelPolicyGenerationEndpointParamsInterceptor {
    fn name(&self) -> &'static str {
        "CancelPolicyGenerationEndpointParamsInterceptor"
    }
Loading