AWS SDK

AWS SDK

rev. ee474c7509d7728618c23068f3741e8e5b339ef9 (ignoring whitespace)

Files changed:

tmp-codegen-diff/aws-sdk/sdk/route53/src/operation/list_vpc_association_authorizations.rs

@@ -209,209 +276,276 @@
  229    229   
                if let ::std::option::Option::Some(inner_3) = &_input.max_results {
  230    230   
                    {
  231    231   
                        query.push_kv("maxresults", ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode());
  232    232   
                    }
  233    233   
                }
  234    234   
                ::std::result::Result::Ok(())
  235    235   
            }
  236    236   
            #[allow(clippy::unnecessary_wraps)]
  237    237   
            fn update_http_builder(
  238    238   
                input: &crate::operation::list_vpc_association_authorizations::ListVpcAssociationAuthorizationsInput,
  239         -
                builder: ::http::request::Builder,
  240         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         239  +
                builder: ::http_1x::request::Builder,
         240  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  241    241   
                let mut uri = ::std::string::String::new();
  242    242   
                uri_base(input, &mut uri)?;
  243    243   
                uri_query(input, &mut uri)?;
  244    244   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  245    245   
            }
  246         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         246  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  247    247   
            builder
  248    248   
        };
  249    249   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  250    250   
  251    251   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  252    252   
    }
  253    253   
}
  254    254   
#[derive(Debug)]
  255    255   
struct ListVPCAssociationAuthorizationsEndpointParamsInterceptor;
  256    256   

tmp-codegen-diff/aws-sdk/sdk/route53/src/operation/test_dns_answer.rs

@@ -211,211 +278,278 @@
  231    231   
                if let ::std::option::Option::Some(inner_6) = &_input.edns0_client_subnet_mask {
  232    232   
                    {
  233    233   
                        query.push_kv("edns0clientsubnetmask", &::aws_smithy_http::query::fmt_string(inner_6));
  234    234   
                    }
  235    235   
                }
  236    236   
                ::std::result::Result::Ok(())
  237    237   
            }
  238    238   
            #[allow(clippy::unnecessary_wraps)]
  239    239   
            fn update_http_builder(
  240    240   
                input: &crate::operation::test_dns_answer::TestDnsAnswerInput,
  241         -
                builder: ::http::request::Builder,
  242         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         241  +
                builder: ::http_1x::request::Builder,
         242  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  243    243   
                let mut uri = ::std::string::String::new();
  244    244   
                uri_base(input, &mut uri)?;
  245    245   
                uri_query(input, &mut uri)?;
  246    246   
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  247    247   
            }
  248         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         248  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  249    249   
            builder
  250    250   
        };
  251    251   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  252    252   
  253    253   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  254    254   
    }
  255    255   
}
  256    256   
#[derive(Debug)]
  257    257   
struct TestDNSAnswerEndpointParamsInterceptor;
  258    258   

tmp-codegen-diff/aws-sdk/sdk/route53/src/operation/update_health_check.rs

@@ -176,176 +251,251 @@
  196    196   
                        "health_check_id",
  197    197   
                        "cannot be empty or unset",
  198    198   
                    ));
  199    199   
                }
  200    200   
                ::std::write!(output, "/2013-04-01/healthcheck/{HealthCheckId}", HealthCheckId = health_check_id).expect("formatting should succeed");
  201    201   
                ::std::result::Result::Ok(())
  202    202   
            }
  203    203   
            #[allow(clippy::unnecessary_wraps)]
  204    204   
            fn update_http_builder(
  205    205   
                input: &crate::operation::update_health_check::UpdateHealthCheckInput,
  206         -
                builder: ::http::request::Builder,
  207         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         206  +
                builder: ::http_1x::request::Builder,
         207  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  208    208   
                let mut uri = ::std::string::String::new();
  209    209   
                uri_base(input, &mut uri)?;
  210    210   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  211    211   
            }
  212         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  213         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
         212  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         213  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
  214    214   
            builder
  215    215   
        };
  216    216   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_update_health_check::ser_update_health_check_op_input(
  217    217   
            &input,
  218    218   
        )?);
  219    219   
        if let Some(content_length) = body.content_length() {
  220    220   
            let content_length = content_length.to_string();
  221         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         221  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  222    222   
        }
  223    223   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  224    224   
    }
  225    225   
}
  226    226   
#[derive(Debug)]
  227    227   
struct UpdateHealthCheckEndpointParamsInterceptor;
  228    228   
  229    229   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateHealthCheckEndpointParamsInterceptor {
  230    230   
    fn name(&self) -> &'static str {
  231    231   
        "UpdateHealthCheckEndpointParamsInterceptor"

tmp-codegen-diff/aws-sdk/sdk/route53/src/operation/update_hosted_zone_comment.rs

@@ -179,179 +254,254 @@
  199    199   
                        "id",
  200    200   
                        "cannot be empty or unset",
  201    201   
                    ));
  202    202   
                }
  203    203   
                ::std::write!(output, "/2013-04-01/hostedzone/{Id}", Id = id).expect("formatting should succeed");
  204    204   
                ::std::result::Result::Ok(())
  205    205   
            }
  206    206   
            #[allow(clippy::unnecessary_wraps)]
  207    207   
            fn update_http_builder(
  208    208   
                input: &crate::operation::update_hosted_zone_comment::UpdateHostedZoneCommentInput,
  209         -
                builder: ::http::request::Builder,
  210         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         209  +
                builder: ::http_1x::request::Builder,
         210  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  211    211   
                let mut uri = ::std::string::String::new();
  212    212   
                uri_base(input, &mut uri)?;
  213    213   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  214    214   
            }
  215         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  216         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
         215  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         216  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
  217    217   
            builder
  218    218   
        };
  219    219   
        let body = ::aws_smithy_types::body::SdkBody::from(
  220    220   
            crate::protocol_serde::shape_update_hosted_zone_comment::ser_update_hosted_zone_comment_op_input(&input)?,
  221    221   
        );
  222    222   
        if let Some(content_length) = body.content_length() {
  223    223   
            let content_length = content_length.to_string();
  224         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         224  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  225    225   
        }
  226    226   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  227    227   
    }
  228    228   
}
  229    229   
#[derive(Debug)]
  230    230   
struct UpdateHostedZoneCommentEndpointParamsInterceptor;
  231    231   
  232    232   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateHostedZoneCommentEndpointParamsInterceptor {
  233    233   
    fn name(&self) -> &'static str {
  234    234   
        "UpdateHostedZoneCommentEndpointParamsInterceptor"

tmp-codegen-diff/aws-sdk/sdk/route53/src/operation/update_traffic_policy_comment.rs

@@ -194,194 +269,269 @@
  214    214   
                        "version",
  215    215   
                        "cannot be empty or unset",
  216    216   
                    ));
  217    217   
                }
  218    218   
                ::std::write!(output, "/2013-04-01/trafficpolicy/{Id}/{Version}", Id = id, Version = version).expect("formatting should succeed");
  219    219   
                ::std::result::Result::Ok(())
  220    220   
            }
  221    221   
            #[allow(clippy::unnecessary_wraps)]
  222    222   
            fn update_http_builder(
  223    223   
                input: &crate::operation::update_traffic_policy_comment::UpdateTrafficPolicyCommentInput,
  224         -
                builder: ::http::request::Builder,
  225         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         224  +
                builder: ::http_1x::request::Builder,
         225  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  226    226   
                let mut uri = ::std::string::String::new();
  227    227   
                uri_base(input, &mut uri)?;
  228    228   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  229    229   
            }
  230         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  231         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
         230  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         231  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
  232    232   
            builder
  233    233   
        };
  234    234   
        let body = ::aws_smithy_types::body::SdkBody::from(
  235    235   
            crate::protocol_serde::shape_update_traffic_policy_comment::ser_update_traffic_policy_comment_op_input(&input)?,
  236    236   
        );
  237    237   
        if let Some(content_length) = body.content_length() {
  238    238   
            let content_length = content_length.to_string();
  239         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         239  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  240    240   
        }
  241    241   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  242    242   
    }
  243    243   
}
  244    244   
#[derive(Debug)]
  245    245   
struct UpdateTrafficPolicyCommentEndpointParamsInterceptor;
  246    246   
  247    247   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateTrafficPolicyCommentEndpointParamsInterceptor {
  248    248   
    fn name(&self) -> &'static str {
  249    249   
        "UpdateTrafficPolicyCommentEndpointParamsInterceptor"

tmp-codegen-diff/aws-sdk/sdk/route53/src/operation/update_traffic_policy_instance.rs

@@ -182,182 +257,257 @@
  202    202   
                        "id",
  203    203   
                        "cannot be empty or unset",
  204    204   
                    ));
  205    205   
                }
  206    206   
                ::std::write!(output, "/2013-04-01/trafficpolicyinstance/{Id}", Id = id).expect("formatting should succeed");
  207    207   
                ::std::result::Result::Ok(())
  208    208   
            }
  209    209   
            #[allow(clippy::unnecessary_wraps)]
  210    210   
            fn update_http_builder(
  211    211   
                input: &crate::operation::update_traffic_policy_instance::UpdateTrafficPolicyInstanceInput,
  212         -
                builder: ::http::request::Builder,
  213         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         212  +
                builder: ::http_1x::request::Builder,
         213  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  214    214   
                let mut uri = ::std::string::String::new();
  215    215   
                uri_base(input, &mut uri)?;
  216    216   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  217    217   
            }
  218         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  219         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
         218  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         219  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
  220    220   
            builder
  221    221   
        };
  222    222   
        let body = ::aws_smithy_types::body::SdkBody::from(
  223    223   
            crate::protocol_serde::shape_update_traffic_policy_instance::ser_update_traffic_policy_instance_op_input(&input)?,
  224    224   
        );
  225    225   
        if let Some(content_length) = body.content_length() {
  226    226   
            let content_length = content_length.to_string();
  227         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         227  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  228    228   
        }
  229    229   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  230    230   
    }
  231    231   
}
  232    232   
#[derive(Debug)]
  233    233   
struct UpdateTrafficPolicyInstanceEndpointParamsInterceptor;
  234    234   
  235    235   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateTrafficPolicyInstanceEndpointParamsInterceptor {
  236    236   
    fn name(&self) -> &'static str {
  237    237   
        "UpdateTrafficPolicyInstanceEndpointParamsInterceptor"

tmp-codegen-diff/aws-sdk/sdk/route53/src/serialization_settings.rs

@@ -1,1 +78,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/*
    3      3   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4      4   
 * SPDX-License-Identifier: Apache-2.0
    5      5   
 */
    6      6   
    7      7   
#![allow(dead_code)]
    8      8   
    9      9   
use aws_smithy_http::header::set_request_header_if_absent;
   10     10   
use aws_smithy_types::config_bag::{Storable, StoreReplace};
   11         -
use http::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
          11  +
use http_1x::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
   12     12   
   13     13   
/// Configuration for how default protocol headers are serialized
   14     14   
#[derive(Clone, Debug, Default)]
   15     15   
pub(crate) struct HeaderSerializationSettings {
   16     16   
    omit_default_content_length: bool,
   17     17   
    omit_default_content_type: bool,
   18     18   
}
   19     19   
   20     20   
impl HeaderSerializationSettings {
   21     21   
    /// Creates new [`HeaderSerializationSettings`]
   22     22   
    pub(crate) fn new() -> Self {
   23     23   
        Default::default()
   24     24   
    }
   25     25   
   26     26   
    /// Omit the default `Content-Length` header during serialization
   27     27   
    pub(crate) fn omit_default_content_length(self) -> Self {
   28     28   
        Self {
   29     29   
            omit_default_content_length: true,
   30     30   
            ..self
   31     31   
        }
   32     32   
    }
   33     33   
   34     34   
    /// Omit the default `Content-Type` header during serialization
   35     35   
    pub(crate) fn omit_default_content_type(self) -> Self {
   36     36   
        Self {
   37     37   
            omit_default_content_type: true,
   38     38   
            ..self
   39     39   
        }
   40     40   
    }
   41     41   
   42     42   
    /// Returns true if the given default header name should be serialized
   43     43   
    fn include_header(&self, header: &HeaderName) -> bool {
   44     44   
        (!self.omit_default_content_length || header != CONTENT_LENGTH) && (!self.omit_default_content_type || header != CONTENT_TYPE)
   45     45   
    }
   46     46   
   47     47   
    /// Sets a default header on the given request builder if it should be serialized
   48         -
    pub(crate) fn set_default_header(&self, mut request: http::request::Builder, header_name: HeaderName, value: &str) -> http::request::Builder {
          48  +
    pub(crate) fn set_default_header(
          49  +
        &self,
          50  +
        mut request: http_1x::request::Builder,
          51  +
        header_name: HeaderName,
          52  +
        value: &str,
          53  +
    ) -> http_1x::request::Builder {
   49     54   
        if self.include_header(&header_name) {
   50     55   
            request = set_request_header_if_absent(request, header_name, value);
   51     56   
        }
   52     57   
        request
   53     58   
    }
   54     59   
}
   55     60   
   56     61   
impl Storable for HeaderSerializationSettings {
   57     62   
    type Storer = StoreReplace<Self>;
   58     63   
}

tmp-codegen-diff/aws-sdk/sdk/s3/Cargo.toml

@@ -1,1 +238,234 @@
   14     14   
protocol = "aws.protocols#restXml"
   15     15   
[package.metadata.docs.rs]
   16     16   
all-features = true
   17     17   
targets = ["x86_64-unknown-linux-gnu"]
   18     18   
[dependencies.aws-credential-types]
   19     19   
path = "../aws-credential-types"
   20     20   
version = "1.2.11"
   21     21   
   22     22   
[dependencies.aws-runtime]
   23     23   
path = "../aws-runtime"
   24         -
features = ["event-stream", "http-02x"]
   25         -
version = "1.5.18"
          24  +
features = ["event-stream", "http-1x", "http-02x"]
          25  +
version = "1.6.0"
   26     26   
   27     27   
[dependencies.aws-sigv4]
   28     28   
path = "../aws-sigv4"
   29         -
version = "1.3.7"
          29  +
version = "1.3.8"
   30     30   
   31     31   
[dependencies.aws-smithy-async]
   32     32   
path = "../aws-smithy-async"
   33         -
version = "1.2.7"
          33  +
version = "1.2.8"
   34     34   
   35     35   
[dependencies.aws-smithy-checksums]
   36     36   
path = "../aws-smithy-checksums"
   37         -
version = "0.63.13"
          37  +
version = "0.64.0"
   38     38   
   39     39   
[dependencies.aws-smithy-eventstream]
   40     40   
path = "../aws-smithy-eventstream"
   41         -
version = "0.60.14"
          41  +
version = "0.60.15"
   42     42   
   43     43   
[dependencies.aws-smithy-http]
   44     44   
path = "../aws-smithy-http"
   45     45   
features = ["event-stream"]
   46         -
version = "0.62.6"
          46  +
version = "0.63.0"
   47     47   
   48     48   
[dependencies.aws-smithy-json]
   49     49   
path = "../aws-smithy-json"
   50         -
version = "0.61.9"
          50  +
version = "0.62.0"
   51     51   
   52     52   
[dependencies.aws-smithy-observability]
   53     53   
path = "../aws-smithy-observability"
   54         -
version = "0.2.0"
          54  +
version = "0.2.1"
   55     55   
   56     56   
[dependencies.aws-smithy-runtime]
   57     57   
path = "../aws-smithy-runtime"
   58     58   
features = ["client"]
   59         -
version = "1.9.8"
          59  +
version = "1.10.0"
   60     60   
   61     61   
[dependencies.aws-smithy-runtime-api]
   62     62   
path = "../aws-smithy-runtime-api"
   63         -
features = ["client", "http-02x"]
   64         -
version = "1.10.0"
          63  +
features = ["client", "http-1x", "http-02x"]
          64  +
version = "1.11.0"
   65     65   
   66     66   
[dependencies.aws-smithy-types]
   67     67   
path = "../aws-smithy-types"
   68         -
version = "1.3.6"
          68  +
features = ["http-body-1-x"]
          69  +
version = "1.4.0"
   69     70   
   70     71   
[dependencies.aws-smithy-xml]
   71     72   
path = "../aws-smithy-xml"
   72     73   
version = "0.60.13"
   73     74   
   74     75   
[dependencies.aws-types]
   75     76   
path = "../aws-types"
   76     77   
version = "1.3.11"
   77     78   
   78     79   
[dependencies.bytes]
   79     80   
version = "1.4.0"
   80     81   
   81     82   
[dependencies.fastrand]
   82     83   
version = "2.0.0"
   83     84   
   84     85   
[dependencies.hex]
   85     86   
version = "0.4.3"
   86     87   
   87     88   
[dependencies.hmac]
   88     89   
version = "0.12"
   89     90   
   90     91   
[dependencies.http]
   91     92   
version = "0.2.9"
   92     93   
   93     94   
[dependencies.http-1x]
   94     95   
version = "1"
   95     96   
package = "http"
   96     97   
   97     98   
[dependencies.http-body]
   98     99   
version = "0.4.4"
   99    100   
  100    101   
[dependencies.http-body-1x]
  101    102   
version = "1"
  102         -
optional = true
  103    103   
package = "http-body"
  104    104   
  105    105   
[dependencies.lru]
  106    106   
version = "0.16.3"
  107    107   
  108    108   
[dependencies.percent-encoding]
  109    109   
version = "2.0.0"
  110    110   
  111    111   
[dependencies.regex-lite]
  112    112   
version = "0.1.5"
  113    113   
  114    114   
[dependencies.sha2]
  115    115   
version = "0.10"
  116    116   
  117    117   
[dependencies.tracing]
  118    118   
version = "0.1"
  119    119   
  120    120   
[dependencies.url]
  121    121   
version = "2.3.1"
  122    122   
[dev-dependencies.async-std]
  123    123   
version = "1.12.0"
  124    124   
  125    125   
[dev-dependencies.aws-config]
  126    126   
path = "../aws-config"
  127    127   
features = ["behavior-version-latest"]
  128    128   
version = "1.8.12"
  129    129   
  130    130   
[dev-dependencies.aws-credential-types]
  131    131   
path = "../aws-credential-types"
  132    132   
features = ["test-util"]
  133    133   
version = "1.2.11"
  134    134   
  135    135   
[dev-dependencies.aws-runtime]
  136    136   
path = "../aws-runtime"
  137    137   
features = ["test-util"]
  138         -
version = "1.5.18"
         138  +
version = "1.6.0"
  139    139   
  140    140   
[dev-dependencies.aws-smithy-async]
  141    141   
path = "../aws-smithy-async"
  142    142   
features = ["test-util"]
  143         -
version = "1.2.7"
         143  +
version = "1.2.8"
  144    144   
  145    145   
[dev-dependencies.aws-smithy-eventstream]
  146    146   
path = "../aws-smithy-eventstream"
  147    147   
features = ["test-util"]
  148         -
version = "0.60.14"
         148  +
version = "0.60.15"
  149    149   
  150    150   
[dev-dependencies.aws-smithy-http-client]
  151    151   
path = "../aws-smithy-http-client"
  152    152   
features = ["test-util", "wire-mock", "rustls-ring"]
  153         -
version = "1.1.5"
         153  +
version = "1.1.6"
  154    154   
  155    155   
[dev-dependencies.aws-smithy-mocks]
  156    156   
path = "../aws-smithy-mocks"
  157         -
version = "0.2.3"
         157  +
version = "0.2.4"
  158    158   
  159    159   
[dev-dependencies.aws-smithy-protocol-test]
  160    160   
path = "../aws-smithy-protocol-test"
  161         -
version = "0.63.7"
         161  +
version = "0.63.8"
  162    162   
  163    163   
[dev-dependencies.aws-smithy-runtime]
  164    164   
path = "../aws-smithy-runtime"
  165    165   
features = ["test-util"]
  166         -
version = "1.9.8"
         166  +
version = "1.10.0"
  167    167   
  168    168   
[dev-dependencies.aws-smithy-runtime-api]
  169    169   
path = "../aws-smithy-runtime-api"
  170         -
features = ["test-util", "client", "http-02x"]
  171         -
version = "1.10.0"
         170  +
features = ["test-util", "client", "http-1x"]
         171  +
version = "1.11.0"
  172    172   
  173    173   
[dev-dependencies.aws-smithy-types]
  174    174   
path = "../aws-smithy-types"
  175         -
features = ["test-util"]
  176         -
version = "1.3.6"
         175  +
features = ["http-body-1-x", "test-util"]
         176  +
version = "1.4.0"
  177    177   
  178    178   
[dev-dependencies.bytes-utils]
  179    179   
version = "0.1.0"
  180    180   
  181    181   
[dev-dependencies.futures-util]
  182    182   
version = "0.3.25"
  183    183   
features = ["alloc"]
  184    184   
default-features = false
  185    185   
  186    186   
[dev-dependencies.hdrhistogram]
  187    187   
version = "7.5.2"
  188    188   
  189         -
[dev-dependencies.http-body-1x]
  190         -
version = "1"
  191         -
package = "http-body"
  192         -
  193    189   
[dev-dependencies.http-body-util]
  194    190   
version = "0.1.3"
  195    191   
  196    192   
[dev-dependencies.pretty_assertions]
  197    193   
version = "1.3.0"
  198    194   
  199    195   
[dev-dependencies.proptest]
  200    196   
version = "1"
  201    197   
  202    198   
[dev-dependencies.serde_json]
  203    199   
version = "1.0.0"
  204    200   
  205    201   
[dev-dependencies.smol]
  206    202   
version = "1.2.0"
  207    203   
  208    204   
[dev-dependencies.tempfile]
  209    205   
version = "3.2.0"
  210    206   
  211    207   
[dev-dependencies.tokio]
  212    208   
version = "1.23.1"
  213    209   
features = ["macros", "test-util", "rt-multi-thread"]
  214    210   
  215    211   
[dev-dependencies.tracing-appender]
  216    212   
version = "0.2.2"
  217    213   
  218    214   
[dev-dependencies.tracing-subscriber]
  219    215   
version = "0.3.16"
  220    216   
features = ["env-filter", "json"]
  221    217   
  222    218   
[dev-dependencies.tracing-test]
  223    219   
version = "0.2.5"
  224    220   
features = ["no-env-filter"]
  225    221   
  226    222   
[features]
  227    223   
sigv4a = ["aws-runtime/sigv4a"]
  228         -
http-1x = ["dep:http-body-1x", "aws-smithy-runtime-api/http-1x"]
         224  +
http-1x = ["aws-smithy-runtime-api/http-1x"]
  229    225   
behavior-version-latest = []
  230    226   
rustls = ["aws-smithy-runtime/tls-rustls"]
  231    227   
default-https-client = ["aws-smithy-runtime/default-https-client"]
  232    228   
test-util = ["aws-credential-types/test-util", "aws-smithy-runtime/test-util"]
  233         -
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
         229  +
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/http-body-1-x", "aws-smithy-types/rt-tokio"]
  234    230   
gated-tests = []
  235         -
default = ["sigv4a", "rustls", "default-https-client", "rt-tokio"]
         231  +
default = ["sigv4a", "http-1x", "rustls", "default-https-client", "rt-tokio"]
  236    232   
  237    233   
[hints]
  238    234   
mostly-unused = true

tmp-codegen-diff/aws-sdk/sdk/s3/src/aws_chunked.rs

@@ -1,1 +55,55 @@
   14     14   
};
   15     15   
use aws_smithy_runtime_api::{
   16     16   
    box_error::BoxError,
   17     17   
    client::{
   18     18   
        interceptors::{context::BeforeTransmitInterceptorContextMut, Intercept},
   19     19   
        runtime_components::RuntimeComponents,
   20     20   
    },
   21     21   
    http::Request,
   22     22   
};
   23     23   
use aws_smithy_types::{body::SdkBody, config_bag::ConfigBag, error::operation::BuildError};
   24         -
use http::{header, HeaderValue};
   25         -
use http_body::Body;
          24  +
use http_1x::{header, HeaderValue};
          25  +
use http_body_1x::Body;
   26     26   
   27     27   
const X_AMZ_DECODED_CONTENT_LENGTH: &str = "x-amz-decoded-content-length";
   28     28   
   29     29   
/// Errors related to constructing aws-chunked encoded HTTP requests.
   30     30   
#[derive(Debug)]
   31     31   
enum Error {
   32     32   
    UnsizedRequestBody,
   33     33   
}
   34     34   
   35     35   
impl fmt::Display for Error {
@@ -101,101 +284,289 @@
  121    121   
        let request = ctx.request_mut();
  122    122   
  123    123   
        let mut body = {
  124    124   
            let body = std::mem::replace(request.body_mut(), SdkBody::taken());
  125    125   
            let opt = cfg
  126    126   
                .get_mut_from_interceptor_state::<AwsChunkedBodyOptions>()
  127    127   
                .ok_or_else(|| BuildError::other("AwsChunkedBodyOptions missing from config bag"))?;
  128    128   
            let aws_chunked_body_options = std::mem::take(opt);
  129    129   
            body.map(move |body| {
  130    130   
                let body = AwsChunkedBody::new(body, aws_chunked_body_options.clone());
  131         -
                SdkBody::from_body_0_4(body)
         131  +
                SdkBody::from_body_1_x(body)
  132    132   
            })
  133    133   
        };
  134    134   
  135    135   
        std::mem::swap(request.body_mut(), &mut body);
  136    136   
  137    137   
        Ok(())
  138    138   
    }
  139    139   
}
  140    140   
  141    141   
// Determine if chunked encoding must not be used; returns true when any of the following is true:
  142    142   
// - If the body is in-memory
  143    143   
// - If chunked encoding is disabled via `AwsChunkedBodyOptions`
  144    144   
fn must_not_use_chunked_encoding(request: &Request, cfg: &ConfigBag) -> bool {
  145    145   
    match (request.body().bytes(), cfg.load::<AwsChunkedBodyOptions>()) {
  146    146   
        (Some(_), _) => true,
  147    147   
        (_, Some(options)) if options.disabled() => true,
  148    148   
        _ => false,
  149    149   
    }
  150    150   
}
  151    151   
  152    152   
#[cfg(test)]
  153    153   
mod tests {
  154    154   
    use super::*;
  155    155   
    use aws_smithy_runtime_api::client::interceptors::context::{BeforeTransmitInterceptorContextMut, Input, InterceptorContext};
  156    156   
    use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
  157    157   
    use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
  158    158   
    use aws_smithy_types::byte_stream::ByteStream;
  159    159   
    use bytes::BytesMut;
  160         -
    use http_body::Body;
         160  +
    use http_body_util::BodyExt;
  161    161   
    use tempfile::NamedTempFile;
  162    162   
  163    163   
    #[tokio::test]
  164    164   
    async fn test_aws_chunked_body_is_retryable() {
  165    165   
        use std::io::Write;
  166    166   
        let mut file = NamedTempFile::new().unwrap();
  167    167   
  168    168   
        for i in 0..10000 {
  169    169   
            let line = format!("This is a large file created for testing purposes {}", i);
  170    170   
            file.as_file_mut().write_all(line.as_bytes()).unwrap();
  171    171   
        }
  172    172   
  173    173   
        let stream_length = file.as_file().metadata().unwrap().len();
  174    174   
        let request = HttpRequest::new(ByteStream::read_from().path(&file).buffer_size(1024).build().await.unwrap().into_inner());
  175    175   
  176    176   
        // ensure original SdkBody is retryable
  177    177   
        assert!(request.body().try_clone().is_some());
  178    178   
  179    179   
        let interceptor = AwsChunkedContentEncodingInterceptor;
  180    180   
        let mut cfg = ConfigBag::base();
  181    181   
        cfg.interceptor_state()
  182    182   
            .store_put(AwsChunkedBodyOptions::default().with_stream_length(stream_length));
  183    183   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  184    184   
        let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  185    185   
        ctx.enter_serialization_phase();
  186    186   
        let _ = ctx.take_input();
  187    187   
        ctx.set_request(request);
  188    188   
        ctx.enter_before_transmit_phase();
  189    189   
        let mut ctx: BeforeTransmitInterceptorContextMut<'_> = (&mut ctx).into();
  190    190   
        interceptor.modify_before_transmit(&mut ctx, &runtime_components, &mut cfg).unwrap();
  191    191   
  192    192   
        // ensure wrapped SdkBody is retryable
  193    193   
        let mut body = ctx.request().body().try_clone().expect("body is retryable");
  194    194   
  195    195   
        let mut body_data = BytesMut::new();
  196         -
        while let Some(data) = body.data().await {
  197         -
            body_data.extend_from_slice(&data.unwrap())
         196  +
        while let Some(Ok(frame)) = body.frame().await {
         197  +
            if frame.is_data() {
         198  +
                let data = frame.into_data().unwrap();
         199  +
                body_data.extend_from_slice(&data);
         200  +
            }
  198    201   
        }
  199    202   
        let body_str = std::str::from_utf8(&body_data).unwrap();
  200         -
  201    203   
        let expected = "This is a large file created for testing purposes 9999\r\n0\r\n\r\n";
  202    204   
        assert!(body_str.ends_with(expected), "expected '{body_str}' to end with '{expected}'");
  203    205   
    }
  204    206   
  205    207   
    #[tokio::test]
  206    208   
    async fn test_short_circuit_modify_before_signing() {
  207    209   
        let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  208    210   
        ctx.enter_serialization_phase();
  209    211   
        let _ = ctx.take_input();
  210    212   
        let request = HttpRequest::new(SdkBody::from("in-memory body, must not use chunked encoding"));
  211    213   
        ctx.set_request(request);
  212    214   
        ctx.enter_before_transmit_phase();
  213    215   
        let mut ctx: BeforeTransmitInterceptorContextMut<'_> = (&mut ctx).into();
  214    216   
  215    217   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  216    218   
  217    219   
        let mut cfg = ConfigBag::base();
  218    220   
        cfg.interceptor_state().store_put(AwsChunkedBodyOptions::default());
  219    221   
  220    222   
        let interceptor = AwsChunkedContentEncodingInterceptor;
  221    223   
        interceptor.modify_before_signing(&mut ctx, &runtime_components, &mut cfg).unwrap();
  222    224   
  223    225   
        let request = ctx.request();
  224    226   
        assert!(request.headers().get(header::CONTENT_ENCODING).is_none());
  225    227   
        assert!(request
  226    228   
            .headers()
  227    229   
            .get(header::HeaderName::from_static(X_AMZ_DECODED_CONTENT_LENGTH))
  228    230   
            .is_none());
  229    231   
    }
  230    232   
  231    233   
    #[tokio::test]
  232    234   
    async fn test_short_circuit_modify_before_transmit() {
  233    235   
        let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  234    236   
        ctx.enter_serialization_phase();
  235    237   
        let _ = ctx.take_input();
  236    238   
        let request = HttpRequest::new(SdkBody::from("in-memory body, must not use chunked encoding"));
  237    239   
        ctx.set_request(request);
  238    240   
        ctx.enter_before_transmit_phase();
  239    241   
        let mut ctx: BeforeTransmitInterceptorContextMut<'_> = (&mut ctx).into();
  240    242   
  241    243   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  242    244   
  243    245   
        let mut cfg = ConfigBag::base();
  244    246   
        // Don't need to set the stream length properly because we expect the body won't be wrapped by `AwsChunkedBody`.
  245    247   
        cfg.interceptor_state().store_put(AwsChunkedBodyOptions::default());
  246    248   
  247    249   
        let interceptor = AwsChunkedContentEncodingInterceptor;
  248    250   
        interceptor.modify_before_transmit(&mut ctx, &runtime_components, &mut cfg).unwrap();
  249    251   
  250    252   
        let mut body = ctx.request().body().try_clone().expect("body is retryable");
  251    253   
  252    254   
        let mut body_data = BytesMut::new();
  253         -
        while let Some(data) = body.data().await {
  254         -
            body_data.extend_from_slice(&data.unwrap())
         255  +
        while let Some(Ok(frame)) = body.frame().await {
         256  +
            if frame.is_data() {
         257  +
                let data = frame.into_data().unwrap();
         258  +
                body_data.extend_from_slice(&data);
         259  +
            }
  255    260   
        }
  256    261   
        let body_str = std::str::from_utf8(&body_data).unwrap();
  257    262   
        // Also implies that `assert!(!body_str.ends_with("0\r\n\r\n"));`, i.e., shouldn't see chunked encoding epilogue.
  258    263   
        assert_eq!("in-memory body, must not use chunked encoding", body_str);
  259    264   
    }
  260    265   
  261    266   
    #[test]
  262    267   
    fn test_must_not_use_chunked_encoding_with_in_memory_body() {
  263    268   
        let request = HttpRequest::new(SdkBody::from("test body"));
  264    269   
        let cfg = ConfigBag::base();

tmp-codegen-diff/aws-sdk/sdk/s3/src/endpoint_lib/parse_url.rs

@@ -1,1 +38,38 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/*
    3      3   
 *  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4      4   
 *  SPDX-License-Identifier: Apache-2.0
    5      5   
 */
    6      6   
    7      7   
use crate::endpoint_lib::diagnostic::DiagnosticCollector;
    8         -
use http::Uri;
           8  +
use http_1x::Uri;
    9      9   
use url::{Host, Url as ParsedUrl};
   10     10   
   11     11   
#[derive(PartialEq, Debug)]
   12     12   
pub(crate) struct Url<'a> {
   13     13   
    uri: Uri,
   14     14   
    url: ParsedUrl,
   15     15   
    raw: &'a str,
   16     16   
}
   17     17   
   18     18   
// individual methods on parse_url might not be used (although the [`parse_url`] itself _MUST_ be used

tmp-codegen-diff/aws-sdk/sdk/s3/src/http_request_checksum.rs

@@ -1,1 +56,56 @@
   16     16   
use aws_smithy_checksums::ChecksumAlgorithm;
   17     17   
use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
   18     18   
use aws_smithy_runtime_api::box_error::BoxError;
   19     19   
use aws_smithy_runtime_api::client::interceptors::context::{BeforeSerializationInterceptorContextMut, BeforeTransmitInterceptorContextMut, Input};
   20     20   
use aws_smithy_runtime_api::client::interceptors::Intercept;
   21     21   
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
   22     22   
use aws_smithy_runtime_api::http::Request;
   23     23   
use aws_smithy_types::body::SdkBody;
   24     24   
use aws_smithy_types::checksum_config::RequestChecksumCalculation;
   25     25   
use aws_smithy_types::config_bag::{ConfigBag, Storable, StoreReplace};
   26         -
use http::HeaderMap;
          26  +
use http_1x::{HeaderMap, HeaderName};
   27     27   
use std::str::FromStr;
   28     28   
use std::sync::atomic::AtomicBool;
   29     29   
use std::sync::atomic::Ordering;
   30     30   
use std::sync::Arc;
   31     31   
use std::{fmt, mem};
   32     32   
   33     33   
/// Errors related to constructing checksum-validated HTTP requests
   34     34   
#[derive(Debug)]
   35     35   
pub(crate) enum Error {
   36     36   
    ChecksumHeadersAreUnsupportedForStreamingBody,
@@ -137,137 +308,308 @@
  157    157   
        _runtime_components: &RuntimeComponents,
  158    158   
        cfg: &mut ConfigBag,
  159    159   
    ) -> Result<(), BoxError> {
  160    160   
        let user_set_checksum_value = (self.checksum_mutator)(context.request_mut(), cfg).expect("Checksum header mutation should not fail");
  161    161   
        let is_presigned = cfg.load::<PresigningMarker>().is_some();
  162    162   
  163    163   
        // If the user manually set a checksum header or if this is a presigned request, we short circuit
  164    164   
        if user_set_checksum_value || is_presigned {
  165    165   
            // Disable aws-chunked encoding since either the user has set a custom checksum
  166    166   
            cfg.interceptor_state().store_put(AwsChunkedBodyOptions::disable_chunked_encoding());
         167  +
  167    168   
            return Ok(());
  168    169   
        }
  169    170   
  170    171   
        let state = cfg
  171    172   
            .get_mut_from_interceptor_state::<RequestChecksumInterceptorState>()
  172    173   
            .expect("set in `read_before_serialization`");
  173    174   
  174    175   
        // If the algorithm fails to parse it is not one we support and we error
  175    176   
        let checksum_algorithm = state
  176    177   
            .checksum_algorithm
  177    178   
            .clone()
  178    179   
            .map(|s| ChecksumAlgorithm::from_str(s.as_str()))
  179    180   
            .transpose()?;
  180    181   
  181    182   
        let mut state = std::mem::take(state);
  182    183   
  183    184   
        if calculate_checksum(cfg, &state) {
  184    185   
            state.calculate_checksum.store(true, Ordering::Release);
  185    186   
  186    187   
            // If a checksum override is set in the ConfigBag we use that instead (currently only used by S3Express)
  187    188   
            // If we have made it this far without a checksum being set we set the default (currently Crc32)
  188    189   
            let checksum_algorithm = incorporate_custom_default(checksum_algorithm, cfg).unwrap_or_default();
  189    190   
            state.checksum_algorithm = Some(checksum_algorithm.as_str().to_owned());
  190    191   
  191    192   
            // NOTE: We have to do this in modify_before_retry_loop since UA interceptor also runs
  192    193   
            // in modify_before_signing but is registered before this interceptor (client level vs operation level).
  193    194   
            track_metric_for_selected_checksum_algorithm(cfg, &checksum_algorithm);
  194    195   
        } else {
  195    196   
            // No checksum calculation needed so disable aws-chunked encoding
  196    197   
            cfg.interceptor_state().store_put(AwsChunkedBodyOptions::disable_chunked_encoding());
  197    198   
        }
  198    199   
  199    200   
        cfg.interceptor_state().store_put(state);
  200         -
  201    201   
        Ok(())
  202    202   
    }
  203    203   
  204    204   
    /// Calculate a checksum and modify the request to do either of the following:
  205    205   
    /// - include the checksum as a header for signing with in-memory request bodies.
  206    206   
    /// - include the checksum as a trailer for streaming request bodies.
  207    207   
    fn modify_before_signing(
  208    208   
        &self,
  209    209   
        context: &mut BeforeTransmitInterceptorContextMut<'_>,
  210    210   
        _runtime_components: &RuntimeComponents,
  211    211   
        cfg: &mut ConfigBag,
  212    212   
    ) -> Result<(), BoxError> {
  213    213   
        let state = cfg.load::<RequestChecksumInterceptorState>().expect("set in `read_before_serialization`");
  214    214   
  215    215   
        if !state.calculate_checksum() {
  216    216   
            return Ok(());
  217    217   
        }
  218    218   
  219    219   
        let checksum_algorithm = state.checksum_algorithm().expect("set in `modify_before_retry_loop`");
  220    220   
        let mut checksum = checksum_algorithm.into_impl();
  221    221   
  222    222   
        match context.request().body().bytes() {
  223    223   
            Some(data) => {
  224    224   
                tracing::debug!("applying {checksum_algorithm:?} of the request body as a header");
  225    225   
                checksum.update(data);
  226    226   
  227    227   
                for (hdr_name, hdr_value) in get_or_cache_headers(checksum.headers(), &state.checksum_cache).iter() {
  228    228   
                    context.request_mut().headers_mut().insert(hdr_name.clone(), hdr_value.clone());
  229    229   
                }
  230    230   
            }
  231    231   
            None => {
  232    232   
                tracing::debug!("applying {checksum_algorithm:?} of the request body as a trailer");
  233    233   
                context
  234    234   
                    .request_mut()
  235    235   
                    .headers_mut()
  236         -
                    .insert(http::header::HeaderName::from_static("x-amz-trailer"), checksum.header_name());
         236  +
                    .insert(HeaderName::from_static("x-amz-trailer"), checksum.header_name());
  237    237   
  238    238   
                // Take checksum header into account for `AwsChunkedBodyOptions`'s trailer length
  239    239   
                let trailer_len = HttpChecksum::size(checksum.as_ref());
  240    240   
                let chunked_body_options = AwsChunkedBodyOptions::default().with_trailer_len(trailer_len);
  241    241   
                cfg.interceptor_state().store_put(chunked_body_options);
  242    242   
            }
  243    243   
        }
  244    244   
  245    245   
        Ok(())
  246    246   
    }
  247    247   
  248    248   
    fn modify_before_transmit(
  249    249   
        &self,
  250    250   
        ctx: &mut BeforeTransmitInterceptorContextMut<'_>,
  251    251   
        _runtime_components: &RuntimeComponents,
  252    252   
        cfg: &mut ConfigBag,
  253    253   
    ) -> Result<(), BoxError> {
  254    254   
        if ctx.request().body().bytes().is_some() {
  255    255   
            // Nothing to do for non-streaming bodies since the checksum was added to the the header
  256    256   
            // in `modify_before_signing` and signing has already been done by the time this hook is called.
  257    257   
            return Ok(());
  258    258   
        }
  259    259   
  260    260   
        let state = cfg.load::<RequestChecksumInterceptorState>().expect("set in `read_before_serialization`");
  261    261   
  262    262   
        if !state.calculate_checksum() {
  263    263   
            return Ok(());
  264    264   
        }
  265    265   
  266    266   
        let request = ctx.request_mut();
  267    267   
  268    268   
        let mut body = {
  269    269   
            let body = mem::replace(request.body_mut(), SdkBody::taken());
  270    270   
  271    271   
            let checksum_algorithm = state.checksum_algorithm().expect("set in `modify_before_retry_loop`");
  272    272   
            let checksum_cache = state.checksum_cache.clone();
  273    273   
  274    274   
            body.map(move |body| {
  275    275   
                let checksum = checksum_algorithm.into_impl();
  276    276   
                let body = calculate::ChecksumBody::new(body, checksum).with_cache(checksum_cache.clone());
  277    277   
  278         -
                SdkBody::from_body_0_4(body)
         278  +
                SdkBody::from_body_1_x(body)
  279    279   
            })
  280    280   
        };
  281    281   
  282    282   
        mem::swap(request.body_mut(), &mut body);
  283    283   
  284    284   
        Ok(())
  285    285   
    }
  286    286   
}
  287    287   
  288    288   
fn incorporate_custom_default(checksum: Option<ChecksumAlgorithm>, cfg: &ConfigBag) -> Option<ChecksumAlgorithm> {
@@ -345,345 +448,464 @@
  365    365   
#[cfg(test)]
  366    366   
mod tests {
  367    367   
    use super::*;
  368    368   
    use aws_smithy_checksums::ChecksumAlgorithm;
  369    369   
    use aws_smithy_runtime_api::client::interceptors::context::{BeforeTransmitInterceptorContextMut, InterceptorContext};
  370    370   
    use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
  371    371   
    use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
  372    372   
    use aws_smithy_types::base64;
  373    373   
    use aws_smithy_types::byte_stream::ByteStream;
  374    374   
    use bytes::BytesMut;
  375         -
    use http_body::Body;
         375  +
    use http_body_util::BodyExt;
  376    376   
    use tempfile::NamedTempFile;
  377    377   
  378    378   
    fn create_test_interceptor() -> RequestChecksumInterceptor<
  379    379   
        impl Fn(&Input) -> (Option<String>, bool) + Send + Sync,
  380    380   
        impl Fn(&mut Request, &ConfigBag) -> Result<bool, BoxError> + Send + Sync,
  381    381   
    > {
  382    382   
        fn algo(_: &Input) -> (Option<String>, bool) {
  383    383   
            (Some("crc32".to_string()), false)
  384    384   
        }
  385    385   
        fn mutator(_: &mut Request, _: &ConfigBag) -> Result<bool, BoxError> {
  386    386   
            Ok(false)
  387    387   
        }
  388    388   
        RequestChecksumInterceptor::new(algo, mutator)
  389    389   
    }
  390    390   
  391    391   
    #[tokio::test]
  392    392   
    async fn test_checksum_body_is_retryable() {
  393    393   
        use std::io::Write;
  394    394   
        let mut file = NamedTempFile::new().unwrap();
  395    395   
        let algorithm_str = "crc32c";
  396    396   
        let checksum_algorithm: ChecksumAlgorithm = algorithm_str.parse().unwrap();
  397    397   
  398    398   
        let mut crc32c_checksum = checksum_algorithm.into_impl();
  399    399   
        for i in 0..10000 {
  400    400   
            let line = format!("This is a large file created for testing purposes {}", i);
  401    401   
            file.as_file_mut().write_all(line.as_bytes()).unwrap();
  402    402   
            crc32c_checksum.update(line.as_bytes());
  403    403   
        }
  404    404   
        let crc32c_checksum = crc32c_checksum.finalize();
  405    405   
  406    406   
        let request = HttpRequest::new(ByteStream::read_from().path(&file).buffer_size(1024).build().await.unwrap().into_inner());
  407    407   
  408    408   
        // ensure original SdkBody is retryable
  409    409   
        assert!(request.body().try_clone().is_some());
  410    410   
  411    411   
        let interceptor = create_test_interceptor();
  412    412   
        let mut cfg = ConfigBag::base();
  413    413   
        cfg.interceptor_state().store_put(RequestChecksumInterceptorState {
  414    414   
            checksum_algorithm: Some(algorithm_str.to_string()),
  415    415   
            calculate_checksum: Arc::new(AtomicBool::new(true)),
  416    416   
            ..Default::default()
  417    417   
        });
  418    418   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  419    419   
        let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  420    420   
        ctx.enter_serialization_phase();
  421    421   
        let _ = ctx.take_input();
  422    422   
        ctx.set_request(request);
  423    423   
        ctx.enter_before_transmit_phase();
  424    424   
        let mut ctx: BeforeTransmitInterceptorContextMut<'_> = (&mut ctx).into();
  425    425   
        interceptor.modify_before_transmit(&mut ctx, &runtime_components, &mut cfg).unwrap();
  426    426   
  427    427   
        // ensure wrapped SdkBody is retryable
  428    428   
        let mut body = ctx.request().body().try_clone().expect("body is retryable");
  429    429   
  430    430   
        let mut body_data = BytesMut::new();
  431         -
        while let Some(data) = body.data().await {
  432         -
            body_data.extend_from_slice(&data.unwrap())
         431  +
        let mut header_value = None;
         432  +
        while let Some(Ok(frame)) = body.frame().await {
         433  +
            if frame.is_data() {
         434  +
                let data = frame.into_data().unwrap();
         435  +
                body_data.extend_from_slice(&data);
         436  +
            } else {
         437  +
                let trailers = frame.into_trailers().unwrap();
         438  +
                if let Some(hv) = trailers.get("x-amz-checksum-crc32c") {
         439  +
                    header_value = Some(hv.to_str().unwrap().to_owned());
         440  +
                }
         441  +
            }
  433    442   
        }
  434    443   
        let body_str = std::str::from_utf8(&body_data).unwrap();
  435    444   
        let expected = format!("This is a large file created for testing purposes 9999");
  436    445   
        assert!(body_str.ends_with(&expected), "expected '{body_str}' to end with '{expected}'");
  437    446   
        let expected_checksum = base64::encode(&crc32c_checksum);
  438         -
        while let Ok(Some(trailer)) = body.trailers().await {
         447  +
        assert_eq!(
         448  +
            header_value.as_ref(),
         449  +
            Some(&expected_checksum),
         450  +
            "expected checksum '{header_value:?}' to match '{expected_checksum}'"
         451  +
        );
         452  +
         453  +
        let collected_body = body.collect().await.unwrap();
         454  +
        while let Some(trailer) = collected_body.trailers() {
  439    455   
            if let Some(header_value) = trailer.get("x-amz-checksum-crc32c") {
  440    456   
                let header_value = header_value.to_str().unwrap();
  441    457   
                assert_eq!(
  442    458   
                    header_value, expected_checksum,
  443    459   
                    "expected checksum '{header_value}' to match '{expected_checksum}'"
  444    460   
                );
  445    461   
            }
  446    462   
        }
  447    463   
    }
  448    464   
}

tmp-codegen-diff/aws-sdk/sdk/s3/src/http_response_checksum.rs

@@ -126,126 +187,187 @@
  146    146   
/// Given an `SdkBody`, a `aws_smithy_checksums::ChecksumAlgorithm`, and a pre-calculated checksum,
  147    147   
/// return an `SdkBody` where the body will processed with the checksum algorithm and checked
  148    148   
/// against the pre-calculated checksum.
  149    149   
pub(crate) fn wrap_body_with_checksum_validator(
  150    150   
    body: SdkBody,
  151    151   
    checksum_algorithm: ChecksumAlgorithm,
  152    152   
    precalculated_checksum: bytes::Bytes,
  153    153   
) -> SdkBody {
  154    154   
    use aws_smithy_checksums::body::validate;
  155    155   
  156         -
    body.map(move |body| {
  157         -
        SdkBody::from_body_0_4(validate::ChecksumBody::new(
         156  +
    body.map(move |body: SdkBody| {
         157  +
        SdkBody::from_body_1_x(validate::ChecksumBody::new(
  158    158   
            body,
  159    159   
            checksum_algorithm.into_impl(),
  160    160   
            precalculated_checksum.clone(),
  161    161   
        ))
  162    162   
    })
  163    163   
}
  164    164   
  165    165   
/// Given a `HeaderMap`, extract any checksum included in the headers as `Some(Bytes)`.
  166    166   
/// If no checksum header is set, return `None`. If multiple checksum headers are set, the one that
  167    167   
/// is fastest to compute will be chosen.

tmp-codegen-diff/aws-sdk/sdk/s3/src/operation/abort_multipart_upload.rs

@@ -197,197 +265,265 @@
  217    217   
                        "upload_id",
  218    218   
                        "cannot be empty or unset",
  219    219   
                    ));
  220    220   
                }
  221    221   
                query.push_kv("uploadId", &::aws_smithy_http::query::fmt_string(inner_2));
  222    222   
                ::std::result::Result::Ok(())
  223    223   
            }
  224    224   
            #[allow(clippy::unnecessary_wraps)]
  225    225   
            fn update_http_builder(
  226    226   
                input: &crate::operation::abort_multipart_upload::AbortMultipartUploadInput,
  227         -
                builder: ::http::request::Builder,
  228         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         227  +
                builder: ::http_1x::request::Builder,
         228  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  229    229   
                let mut uri = ::std::string::String::new();
  230    230   
                uri_base(input, &mut uri)?;
  231    231   
                uri_query(input, &mut uri)?;
  232    232   
                let builder = crate::protocol_serde::shape_abort_multipart_upload::ser_abort_multipart_upload_headers(input, builder)?;
  233    233   
                ::std::result::Result::Ok(builder.method("DELETE").uri(uri))
  234    234   
            }
  235         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         235  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  236    236   
            builder
  237    237   
        };
  238    238   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  239    239   
  240    240   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  241    241   
    }
  242    242   
}
  243    243   
#[derive(Debug)]
  244    244   
struct AbortMultipartUploadEndpointParamsInterceptor;
  245    245   

tmp-codegen-diff/aws-sdk/sdk/s3/src/operation/complete_multipart_upload.rs

@@ -207,207 +284,284 @@
  227    227   
                        "upload_id",
  228    228   
                        "cannot be empty or unset",
  229    229   
                    ));
  230    230   
                }
  231    231   
                query.push_kv("uploadId", &::aws_smithy_http::query::fmt_string(inner_2));
  232    232   
                ::std::result::Result::Ok(())
  233    233   
            }
  234    234   
            #[allow(clippy::unnecessary_wraps)]
  235    235   
            fn update_http_builder(
  236    236   
                input: &crate::operation::complete_multipart_upload::CompleteMultipartUploadInput,
  237         -
                builder: ::http::request::Builder,
  238         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         237  +
                builder: ::http_1x::request::Builder,
         238  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  239    239   
                let mut uri = ::std::string::String::new();
  240    240   
                uri_base(input, &mut uri)?;
  241    241   
                uri_query(input, &mut uri)?;
  242    242   
                let builder = crate::protocol_serde::shape_complete_multipart_upload::ser_complete_multipart_upload_headers(input, builder)?;
  243    243   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  244    244   
            }
  245         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  246         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
         245  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         246  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
  247    247   
            builder
  248    248   
        };
  249    249   
        let body = ::aws_smithy_types::body::SdkBody::from(
  250    250   
            crate::protocol_serde::shape_complete_multipart_upload_input::ser_multipart_upload_http_payload(&input.multipart_upload)?,
  251    251   
        );
  252    252   
        if let Some(content_length) = body.content_length() {
  253    253   
            let content_length = content_length.to_string();
  254         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         254  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  255    255   
        }
  256    256   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  257    257   
    }
  258    258   
}
  259    259   
#[derive(Debug)]
  260    260   
struct CompleteMultipartUploadEndpointParamsInterceptor;
  261    261   
  262    262   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CompleteMultipartUploadEndpointParamsInterceptor {
  263    263   
    fn name(&self) -> &'static str {
  264    264   
        "CompleteMultipartUploadEndpointParamsInterceptor"

tmp-codegen-diff/aws-sdk/sdk/s3/src/operation/copy_object.rs

@@ -189,189 +257,257 @@
  209    209   
                _input: &crate::operation::copy_object::CopyObjectInput,
  210    210   
                mut output: &mut ::std::string::String,
  211    211   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  212    212   
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  213    213   
                query.push_kv("x-id", "CopyObject");
  214    214   
                ::std::result::Result::Ok(())
  215    215   
            }
  216    216   
            #[allow(clippy::unnecessary_wraps)]
  217    217   
            fn update_http_builder(
  218    218   
                input: &crate::operation::copy_object::CopyObjectInput,
  219         -
                builder: ::http::request::Builder,
  220         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         219  +
                builder: ::http_1x::request::Builder,
         220  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  221    221   
                let mut uri = ::std::string::String::new();
  222    222   
                uri_base(input, &mut uri)?;
  223    223   
                uri_query(input, &mut uri)?;
  224    224   
                let builder = crate::protocol_serde::shape_copy_object::ser_copy_object_headers(input, builder)?;
  225    225   
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  226    226   
            }
  227         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         227  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  228    228   
            builder
  229    229   
        };
  230    230   
        let body = ::aws_smithy_types::body::SdkBody::from("");
  231    231   
  232    232   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  233    233   
    }
  234    234   
}
  235    235   
#[derive(Debug)]
  236    236   
struct CopyObjectEndpointParamsInterceptor;
  237    237   

tmp-codegen-diff/aws-sdk/sdk/s3/src/operation/create_bucket.rs

@@ -172,172 +248,248 @@
  192    192   
                _input: &crate::operation::create_bucket::CreateBucketInput,
  193    193   
                output: &mut ::std::string::String,
  194    194   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  195    195   
                use ::std::fmt::Write as _;
  196    196   
                ::std::write!(output, "/").expect("formatting should succeed");
  197    197   
                ::std::result::Result::Ok(())
  198    198   
            }
  199    199   
            #[allow(clippy::unnecessary_wraps)]
  200    200   
            fn update_http_builder(
  201    201   
                input: &crate::operation::create_bucket::CreateBucketInput,
  202         -
                builder: ::http::request::Builder,
  203         -
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         202  +
                builder: ::http_1x::request::Builder,
         203  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  204    204   
                let mut uri = ::std::string::String::new();
  205    205   
                uri_base(input, &mut uri)?;
  206    206   
                let builder = crate::protocol_serde::shape_create_bucket::ser_create_bucket_headers(input, builder)?;
  207    207   
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  208    208   
            }
  209         -
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  210         -
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
         209  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         210  +
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/xml");
  211    211   
            builder
  212    212   
        };
  213    213   
        let body = ::aws_smithy_types::body::SdkBody::from(
  214    214   
            crate::protocol_serde::shape_create_bucket_input::ser_create_bucket_configuration_http_payload(&input.create_bucket_configuration)?,
  215    215   
        );
  216    216   
        if let Some(content_length) = body.content_length() {
  217    217   
            let content_length = content_length.to_string();
  218         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         218  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  219    219   
        }
  220    220   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  221    221   
    }
  222    222   
}
  223    223   
#[derive(Debug)]
  224    224   
struct CreateBucketEndpointParamsInterceptor;
  225    225   
  226    226   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateBucketEndpointParamsInterceptor {
  227    227   
    fn name(&self) -> &'static str {
  228    228   
        "CreateBucketEndpointParamsInterceptor"