AWS SDK

AWS SDK

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5

Files changed:

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime-api/Cargo.toml

@@ -1,1 +62,63 @@
    1      1   
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
[package]
    3      3   
name = "aws-smithy-runtime-api"
    4         -
version = "1.10.0"
           4  +
version = "1.11.0"
    5      5   
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Zelda Hessler <zhessler@amazon.com>"]
    6      6   
description = "Smithy runtime types."
    7      7   
edition = "2021"
    8      8   
license = "Apache-2.0"
    9      9   
repository = "https://github.com/smithy-lang/smithy-rs"
   10     10   
rust-version = "1.88"
   11     11   
[package.metadata.docs.rs]
   12     12   
all-features = true
   13     13   
targets = ["x86_64-unknown-linux-gnu"]
   14     14   
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
   15     15   
rustdoc-args = ["--cfg", "docsrs"]
   16     16   
   17     17   
[package.metadata.smithy-rs-release-tooling]
   18     18   
stable = true
   19     19   
   20     20   
[features]
   21     21   
default = []
   22     22   
client = []
   23     23   
http-auth = ["dep:zeroize"]
   24     24   
test-util = ["aws-smithy-types/test-util", "http-1x"]
   25     25   
http-02x = []
   26     26   
http-1x = []
   27     27   
   28     28   
[dependencies]
   29     29   
bytes = "1.10.0"
   30     30   
pin-project-lite = "0.2.14"
   31     31   
tracing = "0.1.40"
   32     32   
   33     33   
[dependencies.aws-smithy-async]
   34     34   
path = "../aws-smithy-async"
   35         -
version = "1.2.7"
          35  +
version = "1.2.8"
   36     36   
   37     37   
[dependencies.aws-smithy-types]
   38     38   
path = "../aws-smithy-types"
   39         -
version = "1.3.6"
          39  +
features = ["http-body-1-x"]
          40  +
version = "1.4.0"
   40     41   
   41     42   
[dependencies.http-02x]
   42     43   
package = "http"
   43         -
version = "0.2.9"
          44  +
version = "0.2.12"
   44     45   
   45     46   
[dependencies.http-1x]
   46     47   
package = "http"
   47         -
version = "1"
          48  +
version = "1.3.1"
   48     49   
   49     50   
[dependencies.tokio]
   50         -
version = "1.40.0"
          51  +
version = "1.46.0"
   51     52   
features = ["sync"]
   52     53   
   53     54   
[dependencies.zeroize]
   54     55   
version = "1.7.0"
   55     56   
optional = true
   56     57   
   57     58   
[dev-dependencies]
   58     59   
proptest = "1"
   59     60   
   60     61   
[dev-dependencies.tokio]

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime-api/src/client/waiters.rs

@@ -1,1 +54,55 @@
   15     15   
        ErrorMetadata,
   16     16   
    };
   17     17   
    use std::{fmt, time::Duration};
   18     18   
   19     19   
    /// An error occurred while waiting.
   20     20   
    ///
   21     21   
    /// This error type is useful for distinguishing between the max wait
   22     22   
    /// time being exceeded, or some other failure occurring.
   23     23   
    #[derive(Debug)]
   24     24   
    #[non_exhaustive]
          25  +
    #[allow(clippy::large_enum_variant)] // For `OperationFailed` variant
   25     26   
    pub enum WaiterError<O, E> {
   26     27   
        /// An error occurred during waiter initialization.
   27     28   
        ///
   28     29   
        /// This can happen if the input/config is invalid.
   29     30   
        ConstructionFailure(ConstructionFailure),
   30     31   
   31     32   
        /// The maximum wait time was exceeded without completion.
   32     33   
        ExceededMaxWait(ExceededMaxWait),
   33     34   
   34     35   
        /// Waiting ended in a failure state.

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime-api/src/http/request.rs

@@ -159,159 +218,225 @@
  179    179   
  180    180   
#[cfg(feature = "http-02x")]
  181    181   
impl<B> TryInto<http_02x::Request<B>> for Request<B> {
  182    182   
    type Error = HttpError;
  183    183   
  184    184   
    fn try_into(self) -> Result<http_02x::Request<B>, Self::Error> {
  185    185   
        self.try_into_http02x()
  186    186   
    }
  187    187   
}
  188    188   
         189  +
#[cfg(feature = "http-1x")]
         190  +
impl From<http_1x::Uri> for Uri {
         191  +
    fn from(value: http_1x::Uri) -> Self {
         192  +
        Uri::from_http1x_uri(value)
         193  +
    }
         194  +
}
         195  +
  189    196   
#[cfg(feature = "http-1x")]
  190    197   
impl<B> TryInto<http_1x::Request<B>> for Request<B> {
  191    198   
    type Error = HttpError;
  192    199   
  193    200   
    fn try_into(self) -> Result<http_1x::Request<B>, Self::Error> {
  194    201   
        self.try_into_http1x()
  195    202   
    }
  196    203   
}
  197    204   
  198    205   
impl<B> Request<B> {

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/Cargo.toml

@@ -1,1 +124,125 @@
    1      1   
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
[package]
    3      3   
name = "aws-smithy-runtime"
    4         -
version = "1.9.8"
           4  +
version = "1.10.0"
    5      5   
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Zelda Hessler <zhessler@amazon.com>"]
    6      6   
description = "The new smithy runtime crate"
    7      7   
edition = "2021"
    8      8   
license = "Apache-2.0"
    9      9   
repository = "https://github.com/smithy-lang/smithy-rs"
   10     10   
rust-version = "1.88"
   11     11   
[package.metadata.docs.rs]
   12     12   
all-features = true
   13     13   
targets = ["x86_64-unknown-linux-gnu"]
   14     14   
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
   15     15   
rustdoc-args = ["--cfg", "docsrs"]
   16     16   
   17     17   
[package.metadata.smithy-rs-release-tooling]
   18     18   
stable = true
   19     19   
[package.metadata.cargo-udeps.ignore]
   20     20   
normal = ["aws-smithy-http"]
   21     21   
   22     22   
[features]
   23     23   
client = ["aws-smithy-runtime-api/client", "aws-smithy-types/http-body-1-x"]
   24     24   
http-auth = ["aws-smithy-runtime-api/http-auth"]
   25     25   
connector-hyper-0-14-x = ["dep:aws-smithy-http-client", "aws-smithy-http-client?/hyper-014"]
   26     26   
tls-rustls = ["dep:aws-smithy-http-client", "aws-smithy-http-client?/legacy-rustls-ring", "connector-hyper-0-14-x"]
   27     27   
default-https-client = ["dep:aws-smithy-http-client", "aws-smithy-http-client?/rustls-aws-lc"]
   28     28   
rt-tokio = ["tokio/rt"]
   29     29   
test-util = ["aws-smithy-runtime-api/test-util", "dep:tracing-subscriber", "aws-smithy-http-client/test-util", "legacy-test-util"]
   30     30   
legacy-test-util = ["aws-smithy-runtime-api/test-util", "dep:tracing-subscriber", "aws-smithy-http-client/test-util", "connector-hyper-0-14-x", "aws-smithy-http-client/legacy-test-util"]
   31     31   
wire-mock = ["legacy-test-util", "aws-smithy-http-client/wire-mock"]
   32     32   
   33     33   
[dependencies]
   34     34   
bytes = "1.10.0"
   35     35   
fastrand = "2.3.0"
          36  +
http-body-util = "0.1.3"
   36     37   
pin-project-lite = "0.2.14"
   37     38   
pin-utils = "0.1.0"
   38     39   
tracing = "0.1.40"
   39     40   
   40     41   
[dependencies.aws-smithy-async]
   41     42   
path = "../aws-smithy-async"
   42         -
version = "1.2.7"
          43  +
version = "1.2.8"
   43     44   
   44     45   
[dependencies.aws-smithy-http]
   45     46   
path = "../aws-smithy-http"
   46         -
version = "0.62.6"
          47  +
version = "0.63.0"
   47     48   
   48     49   
[dependencies.aws-smithy-observability]
   49     50   
path = "../aws-smithy-observability"
   50         -
version = "0.2.0"
          51  +
version = "0.2.1"
   51     52   
   52     53   
[dependencies.aws-smithy-runtime-api]
   53     54   
path = "../aws-smithy-runtime-api"
   54         -
version = "1.10.0"
          55  +
version = "1.11.0"
   55     56   
   56     57   
[dependencies.aws-smithy-types]
   57     58   
path = "../aws-smithy-types"
   58     59   
features = ["http-body-0-4-x"]
   59         -
version = "1.3.6"
          60  +
version = "1.4.0"
   60     61   
   61     62   
[dependencies.aws-smithy-http-client]
   62     63   
path = "../aws-smithy-http-client"
   63     64   
optional = true
   64         -
version = "1.1.5"
          65  +
version = "1.1.6"
   65     66   
   66     67   
[dependencies.http-02x]
   67     68   
package = "http"
   68         -
version = "0.2.9"
          69  +
version = "0.2.12"
   69     70   
   70     71   
[dependencies.http-1x]
   71     72   
package = "http"
   72         -
version = "1"
          73  +
version = "1.3.1"
   73     74   
   74     75   
[dependencies.http-body-04x]
   75     76   
package = "http-body"
   76         -
version = "0.4.5"
          77  +
version = "0.4.6"
   77     78   
   78     79   
[dependencies.http-body-1x]
   79     80   
package = "http-body"
   80         -
version = "1"
          81  +
version = "1.0.1"
   81     82   
   82     83   
[dependencies.tokio]
   83         -
version = "1.40.0"
          84  +
version = "1.46.0"
   84     85   
features = []
   85     86   
   86     87   
[dependencies.tracing-subscriber]
   87     88   
version = "0.3.16"
   88     89   
optional = true
   89     90   
features = ["env-filter", "fmt", "json"]
   90     91   
   91     92   
[dev-dependencies]
   92     93   
approx = "0.5.1"
   93     94   
fastrand = "2.3.0"
   94     95   
futures-util = "0.3.29"
   95     96   
pretty_assertions = "1.4.0"
   96     97   
tracing-test = "0.2.1"
   97     98   
   98     99   
[dev-dependencies.aws-smithy-async]
   99    100   
path = "../aws-smithy-async"
  100    101   
features = ["rt-tokio", "test-util"]
  101         -
version = "1.2.7"
         102  +
version = "1.2.8"
  102    103   
  103    104   
[dev-dependencies.aws-smithy-runtime-api]
  104    105   
path = "../aws-smithy-runtime-api"
  105    106   
features = ["test-util"]
  106         -
version = "1.10.0"
         107  +
version = "1.11.0"
  107    108   
  108    109   
[dev-dependencies.aws-smithy-types]
  109    110   
path = "../aws-smithy-types"
  110    111   
features = ["test-util"]
  111         -
version = "1.3.6"
         112  +
version = "1.4.0"
  112    113   
  113    114   
[dev-dependencies.tokio]
  114    115   
version = "1.25"
  115    116   
features = ["macros", "rt", "rt-multi-thread", "test-util", "full"]
  116    117   
  117    118   
[dev-dependencies.tracing-subscriber]
  118    119   
version = "0.3.16"
  119    120   
features = ["env-filter"]
  120    121   
  121    122   
[dev-dependencies.hyper_0_14]

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/auth/http.rs

@@ -78,78 +257,257 @@
   98     98   
                        format!("{} {}", self.scheme, api_key.token()),
   99     99   
                    )
  100    100   
                    .map_err(|_| {
  101    101   
                        "API key contains characters that can't be included in a HTTP header"
  102    102   
                    })?;
  103    103   
            }
  104    104   
            ApiKeyLocation::Query => {
  105    105   
                let mut query = QueryWriter::new_from_string(request.uri())?;
  106    106   
                query.insert(&self.name, api_key.token());
  107    107   
                request
  108         -
                    .set_uri(query.build_uri())
         108  +
                    .set_uri(query.build_uri().to_string())
  109    109   
                    .expect("query writer returns a valid URI")
  110    110   
            }
  111    111   
        }
  112    112   
  113    113   
        Ok(())
  114    114   
    }
  115    115   
}
  116    116   
  117    117   
/// Auth implementation for Smithy's `@httpBasicAuth` auth scheme
  118    118   
#[derive(Debug, Default)]
  119    119   
pub struct BasicAuthScheme {
  120    120   
    signer: BasicAuthSigner,
  121    121   
}
  122    122   
  123    123   
impl BasicAuthScheme {
  124    124   
    /// Creates a new `BasicAuthScheme`.
  125    125   
    pub fn new() -> Self {
  126    126   
        Self {
  127    127   
            signer: BasicAuthSigner,
  128    128   
        }
  129    129   
    }
  130    130   
}
  131    131   
  132    132   
impl AuthScheme for BasicAuthScheme {
  133    133   
    fn scheme_id(&self) -> AuthSchemeId {
  134    134   
        HTTP_BASIC_AUTH_SCHEME_ID
  135    135   
    }
  136    136   
  137    137   
    fn identity_resolver(
  138    138   
        &self,
  139    139   
        identity_resolvers: &dyn GetIdentityResolver,
  140    140   
    ) -> Option<SharedIdentityResolver> {
  141    141   
        identity_resolvers.identity_resolver(self.scheme_id())
  142    142   
    }
  143    143   
  144    144   
    fn signer(&self) -> &dyn Sign {
  145    145   
        &self.signer
  146    146   
    }
  147    147   
}
  148    148   
  149    149   
#[derive(Debug, Default)]
  150    150   
struct BasicAuthSigner;
  151    151   
  152    152   
impl Sign for BasicAuthSigner {
  153    153   
    fn sign_http_request(
  154    154   
        &self,
  155    155   
        request: &mut HttpRequest,
  156    156   
        identity: &Identity,
  157    157   
        _auth_scheme_endpoint_config: AuthSchemeEndpointConfig<'_>,
  158    158   
        _runtime_components: &RuntimeComponents,
  159    159   
        _config_bag: &ConfigBag,
  160    160   
    ) -> Result<(), BoxError> {
  161    161   
        let login = identity
  162    162   
            .data::<Login>()
  163    163   
            .ok_or("HTTP basic auth requires a `Login` identity")?;
  164    164   
        request.headers_mut().insert(
  165         -
            http_02x::header::AUTHORIZATION,
  166         -
            http_02x::HeaderValue::from_str(&format!(
         165  +
            http_1x::header::AUTHORIZATION,
         166  +
            http_1x::HeaderValue::from_str(&format!(
  167    167   
                "Basic {}",
  168    168   
                encode(format!("{}:{}", login.user(), login.password()))
  169    169   
            ))
  170    170   
            .expect("valid header value"),
  171    171   
        );
  172    172   
        Ok(())
  173    173   
    }
  174    174   
}
  175    175   
  176    176   
/// Auth implementation for Smithy's `@httpBearerAuth` auth scheme
  177    177   
#[derive(Debug, Default)]
  178    178   
pub struct BearerAuthScheme {
  179    179   
    signer: BearerAuthSigner,
  180    180   
}
  181    181   
  182    182   
impl BearerAuthScheme {
  183    183   
    /// Creates a new `BearerAuthScheme`.
  184    184   
    pub fn new() -> Self {
  185    185   
        Self {
  186    186   
            signer: BearerAuthSigner,
  187    187   
        }
  188    188   
    }
  189    189   
}
  190    190   
  191    191   
impl AuthScheme for BearerAuthScheme {
  192    192   
    fn scheme_id(&self) -> AuthSchemeId {
  193    193   
        HTTP_BEARER_AUTH_SCHEME_ID
  194    194   
    }
  195    195   
  196    196   
    fn identity_resolver(
  197    197   
        &self,
  198    198   
        identity_resolvers: &dyn GetIdentityResolver,
  199    199   
    ) -> Option<SharedIdentityResolver> {
  200    200   
        identity_resolvers.identity_resolver(self.scheme_id())
  201    201   
    }
  202    202   
  203    203   
    fn signer(&self) -> &dyn Sign {
  204    204   
        &self.signer
  205    205   
    }
  206    206   
}
  207    207   
  208    208   
#[derive(Debug, Default)]
  209    209   
struct BearerAuthSigner;
  210    210   
  211    211   
impl Sign for BearerAuthSigner {
  212    212   
    fn sign_http_request(
  213    213   
        &self,
  214    214   
        request: &mut HttpRequest,
  215    215   
        identity: &Identity,
  216    216   
        _auth_scheme_endpoint_config: AuthSchemeEndpointConfig<'_>,
  217    217   
        _runtime_components: &RuntimeComponents,
  218    218   
        _config_bag: &ConfigBag,
  219    219   
    ) -> Result<(), BoxError> {
  220    220   
        let token = identity
  221    221   
            .data::<Token>()
  222    222   
            .ok_or("HTTP bearer auth requires a `Token` identity")?;
  223    223   
        request.headers_mut().insert(
  224         -
            http_02x::header::AUTHORIZATION,
  225         -
            http_02x::HeaderValue::from_str(&format!("Bearer {}", token.token())).map_err(
  226         -
                |_| "Bearer token contains characters that can't be included in a HTTP header",
  227         -
            )?,
         224  +
            http_1x::header::AUTHORIZATION,
         225  +
            http_1x::HeaderValue::from_str(&format!("Bearer {}", token.token())).map_err(|_| {
         226  +
                "Bearer token contains characters that can't be included in a HTTP header"
         227  +
            })?,
  228    228   
        );
  229    229   
        Ok(())
  230    230   
    }
  231    231   
}
  232    232   
  233    233   
/// Auth implementation for Smithy's `@httpDigestAuth` auth scheme
  234    234   
#[derive(Debug, Default)]
  235    235   
pub struct DigestAuthScheme {
  236    236   
    signer: DigestAuthSigner,
  237    237   
}
@@ -270,270 +435,435 @@
  290    290   
    #[test]
  291    291   
    fn test_api_key_signing_headers() {
  292    292   
        let signer = ApiKeySigner {
  293    293   
            scheme: "SomeSchemeName".into(),
  294    294   
            location: ApiKeyLocation::Header,
  295    295   
            name: "some-header-name".into(),
  296    296   
        };
  297    297   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  298    298   
        let config_bag = ConfigBag::base();
  299    299   
        let identity = Identity::new(Token::new("some-token", None), None);
  300         -
        let mut request: HttpRequest = http_02x::Request::builder()
         300  +
        let mut request: HttpRequest = http_1x::Request::builder()
  301    301   
            .uri("http://example.com/Foobaz")
  302    302   
            .body(SdkBody::empty())
  303    303   
            .unwrap()
  304    304   
            .try_into()
  305    305   
            .unwrap();
  306    306   
        signer
  307    307   
            .sign_http_request(
  308    308   
                &mut request,
  309    309   
                &identity,
  310    310   
                AuthSchemeEndpointConfig::empty(),
  311    311   
                &runtime_components,
  312    312   
                &config_bag,
  313    313   
            )
  314    314   
            .expect("success");
  315    315   
        assert_eq!(
  316    316   
            "SomeSchemeName some-token",
  317    317   
            request.headers().get("some-header-name").unwrap()
  318    318   
        );
  319    319   
        assert_eq!("http://example.com/Foobaz", request.uri().to_string());
  320    320   
    }
  321    321   
  322    322   
    #[test]
  323    323   
    fn test_api_key_signing_query() {
  324    324   
        let signer = ApiKeySigner {
  325    325   
            scheme: "".into(),
  326    326   
            location: ApiKeyLocation::Query,
  327    327   
            name: "some-query-name".into(),
  328    328   
        };
  329    329   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  330    330   
        let config_bag = ConfigBag::base();
  331    331   
        let identity = Identity::new(Token::new("some-token", None), None);
  332         -
        let mut request: HttpRequest = http_02x::Request::builder()
         332  +
        let mut request: HttpRequest = http_1x::Request::builder()
  333    333   
            .uri("http://example.com/Foobaz")
  334    334   
            .body(SdkBody::empty())
  335    335   
            .unwrap()
  336    336   
            .try_into()
  337    337   
            .unwrap();
  338    338   
        signer
  339    339   
            .sign_http_request(
  340    340   
                &mut request,
  341    341   
                &identity,
  342    342   
                AuthSchemeEndpointConfig::empty(),
  343    343   
                &runtime_components,
  344    344   
                &config_bag,
  345    345   
            )
  346    346   
            .expect("success");
  347    347   
        assert!(request.headers().get("some-query-name").is_none());
  348    348   
        assert_eq!(
  349    349   
            "http://example.com/Foobaz?some-query-name=some-token",
  350    350   
            request.uri().to_string()
  351    351   
        );
  352    352   
    }
  353    353   
  354    354   
    #[test]
  355    355   
    fn test_basic_auth() {
  356    356   
        let signer = BasicAuthSigner;
  357    357   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  358    358   
        let config_bag = ConfigBag::base();
  359    359   
        let identity = Identity::new(Login::new("Aladdin", "open sesame", None), None);
  360         -
        let mut request = http_02x::Request::builder()
         360  +
        let mut request = http_1x::Request::builder()
  361    361   
            .body(SdkBody::empty())
  362    362   
            .unwrap()
  363    363   
            .try_into()
  364    364   
            .unwrap();
  365    365   
  366    366   
        signer
  367    367   
            .sign_http_request(
  368    368   
                &mut request,
  369    369   
                &identity,
  370    370   
                AuthSchemeEndpointConfig::empty(),
  371    371   
                &runtime_components,
  372    372   
                &config_bag,
  373    373   
            )
  374    374   
            .expect("success");
  375    375   
        assert_eq!(
  376    376   
            "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
  377    377   
            request.headers().get("Authorization").unwrap()
  378    378   
        );
  379    379   
    }
  380    380   
  381    381   
    #[test]
  382    382   
    fn test_bearer_auth() {
  383    383   
        let signer = BearerAuthSigner;
  384    384   
  385    385   
        let config_bag = ConfigBag::base();
  386    386   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  387    387   
        let identity = Identity::new(Token::new("some-token", None), None);
  388         -
        let mut request = http_02x::Request::builder()
         388  +
        let mut request = http_1x::Request::builder()
  389    389   
            .body(SdkBody::empty())
  390    390   
            .unwrap()
  391    391   
            .try_into()
  392    392   
            .unwrap();
  393    393   
        signer
  394    394   
            .sign_http_request(
  395    395   
                &mut request,
  396    396   
                &identity,
  397    397   
                AuthSchemeEndpointConfig::empty(),
  398    398   
                &runtime_components,
  399    399   
                &config_bag,
  400    400   
            )
  401    401   
            .expect("success");
  402    402   
        assert_eq!(
  403    403   
            "Bearer some-token",
  404    404   
            request.headers().get("Authorization").unwrap()
  405    405   
        );
  406    406   
    }
  407    407   
  408    408   
    #[test]
  409    409   
    fn test_bearer_auth_overwrite_existing_header() {
  410    410   
        let signer = BearerAuthSigner;
  411    411   
  412    412   
        let config_bag = ConfigBag::base();
  413    413   
        let runtime_components = RuntimeComponentsBuilder::for_tests().build().unwrap();
  414    414   
        let identity = Identity::new(Token::new("some-token", None), None);
  415         -
        let mut request = http_02x::Request::builder()
         415  +
        let mut request = http_1x::Request::builder()
  416    416   
            .header("Authorization", "wrong")
  417    417   
            .body(SdkBody::empty())
  418    418   
            .unwrap()
  419    419   
            .try_into()
  420    420   
            .unwrap();
  421    421   
        signer
  422    422   
            .sign_http_request(
  423    423   
                &mut request,
  424    424   
                &identity,
  425    425   
                AuthSchemeEndpointConfig::empty(),

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/http/body/content_length_enforcement.rs

@@ -190,190 +309,309 @@
  210    210   
mod test {
  211    211   
    use crate::assert_str_contains;
  212    212   
    use crate::client::http::body::content_length_enforcement::{
  213    213   
        extract_content_length, ContentLengthEnforcingBody,
  214    214   
    };
  215    215   
    use aws_smithy_runtime_api::http::Response;
  216    216   
    use aws_smithy_types::body::SdkBody;
  217    217   
    use aws_smithy_types::byte_stream::ByteStream;
  218    218   
    use aws_smithy_types::error::display::DisplayErrorContext;
  219    219   
    use bytes::Bytes;
  220         -
    use http_02x::header::CONTENT_LENGTH;
  221         -
    use http_body_04x::Body;
         220  +
    use http_1x::header::CONTENT_LENGTH;
  222    221   
    use http_body_1x::Frame;
  223    222   
    use std::error::Error;
  224    223   
    use std::pin::Pin;
  225    224   
    use std::task::{Context, Poll};
  226    225   
  227    226   
    /// Body for tests so we ensure our code works on a body split across multiple frames
  228    227   
    struct ManyFrameBody {
  229    228   
        data: Vec<u8>,
  230    229   
    }
  231    230   
  232    231   
    impl ManyFrameBody {
  233    232   
        #[allow(clippy::new_ret_no_self)]
  234    233   
        fn new(input: impl Into<String>) -> SdkBody {
  235    234   
            let mut data = input.into().as_bytes().to_vec();
  236    235   
            data.reverse();
  237    236   
            SdkBody::from_body_1_x(Self { data })
  238    237   
        }
  239    238   
    }
  240    239   
  241    240   
    impl http_body_1x::Body for ManyFrameBody {
  242    241   
        type Data = Bytes;
  243         -
        type Error = <SdkBody as Body>::Error;
         242  +
        type Error = <SdkBody as http_body_1x::Body>::Error;
  244    243   
  245    244   
        fn poll_frame(
  246    245   
            mut self: Pin<&mut Self>,
  247    246   
            _cx: &mut Context<'_>,
  248    247   
        ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
  249    248   
            match self.data.pop() {
  250    249   
                Some(next) => Poll::Ready(Some(Ok(Frame::data(Bytes::from(vec![next]))))),
  251    250   
                None => Poll::Ready(None),
  252    251   
            }
  253    252   
        }
  254    253   
    }
  255    254   
  256    255   
    #[tokio::test]
  257    256   
    async fn stream_too_short() {
  258    257   
        let body = ManyFrameBody::new("123");
  259    258   
        let enforced = ContentLengthEnforcingBody::wrap(body, 10);
  260    259   
        let err = expect_body_error(enforced).await;
  261    260   
        assert_str_contains!(
  262    261   
            format!("{}", DisplayErrorContext(err)),
  263    262   
            "Expected 10 bytes but 3 bytes were received"
  264    263   
        );
  265    264   
    }
  266    265   
  267    266   
    #[tokio::test]
  268    267   
    async fn stream_too_long() {
  269    268   
        let body = ManyFrameBody::new("abcdefghijk");
  270    269   
        let enforced = ContentLengthEnforcingBody::wrap(body, 5);
  271    270   
        let err = expect_body_error(enforced).await;
  272    271   
        assert_str_contains!(
  273    272   
            format!("{}", DisplayErrorContext(err)),
  274    273   
            "Expected 5 bytes but 11 bytes were received"
  275    274   
        );
  276    275   
    }
  277    276   
  278    277   
    #[tokio::test]
  279    278   
    async fn stream_just_right() {
         279  +
        use http_body_util::BodyExt;
  280    280   
        let body = ManyFrameBody::new("abcdefghijk");
  281    281   
        let enforced = ContentLengthEnforcingBody::wrap(body, 11);
  282    282   
        let data = enforced.collect().await.unwrap().to_bytes();
  283    283   
        assert_eq!(b"abcdefghijk", data.as_ref());
  284    284   
    }
  285    285   
  286    286   
    async fn expect_body_error(body: SdkBody) -> impl Error {
  287    287   
        ByteStream::new(body)
  288    288   
            .collect()
  289    289   
            .await

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/http/body/minimum_throughput.rs

@@ -1,1 +42,45 @@
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
//! A body-wrapping type that ensures data is being streamed faster than some lower limit.
    7      7   
//!
    8      8   
//! If data is being streamed too slowly, this body type will emit an error next time it's polled.
    9      9   
   10     10   
/// An implementation of v0.4 `http_body::Body` for `MinimumThroughputBody` and related code.
   11     11   
pub mod http_body_0_4_x;
   12     12   
          13  +
/// An implementation of v1.0 `http_body::Body` for `MinimumThroughputBody` and related code.
          14  +
pub mod http_body_1_x;
          15  +
   13     16   
/// Options for a [`MinimumThroughputBody`].
   14     17   
pub mod options;
   15     18   
pub use throughput::Throughput;
   16     19   
mod throughput;
   17     20   
   18     21   
use crate::client::http::body::minimum_throughput::throughput::ThroughputReport;
   19     22   
use aws_smithy_async::rt::sleep::Sleep;
   20     23   
use aws_smithy_async::rt::sleep::{AsyncSleep, SharedAsyncSleep};
   21     24   
use aws_smithy_async::time::{SharedTimeSource, TimeSource};
   22     25   
use aws_smithy_runtime_api::{

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/http/body/minimum_throughput/http_body_0_4_x.rs

@@ -1,1 +98,56 @@
    1      1   
/*
    2      2   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
use super::{BoxError, Error, MinimumThroughputDownloadBody};
    7         -
use crate::client::http::body::minimum_throughput::{
    8         -
    throughput::ThroughputReport, Throughput, ThroughputReadingBody,
    9         -
};
           7  +
use crate::client::http::body::minimum_throughput::throughput::DownloadReport;
           8  +
use crate::client::http::body::minimum_throughput::ThroughputReadingBody;
   10      9   
use aws_smithy_async::rt::sleep::AsyncSleep;
   11         -
use http_body_04x::Body;
   12     10   
use std::future::Future;
   13     11   
use std::pin::{pin, Pin};
   14     12   
use std::task::{Context, Poll};
   15     13   
   16         -
const ZERO_THROUGHPUT: Throughput = Throughput::new_bytes_per_second(0);
   17         -
   18         -
// Helper trait for interpreting the throughput report.
   19         -
trait DownloadReport {
   20         -
    fn minimum_throughput_violated(self, minimum_throughput: Throughput) -> (bool, Throughput);
   21         -
}
   22         -
impl DownloadReport for ThroughputReport {
   23         -
    fn minimum_throughput_violated(self, minimum_throughput: Throughput) -> (bool, Throughput) {
   24         -
        let throughput = match self {
   25         -
            ThroughputReport::Complete => return (false, ZERO_THROUGHPUT),
   26         -
            // If the report is incomplete, then we don't have enough data yet to
   27         -
            // decide if minimum throughput was violated.
   28         -
            ThroughputReport::Incomplete => {
   29         -
                tracing::trace!(
   30         -
                    "not enough data to decide if minimum throughput has been violated"
   31         -
                );
   32         -
                return (false, ZERO_THROUGHPUT);
   33         -
            }
   34         -
            // If no polling is taking place, then the user has stalled.
   35         -
            // In this case, we don't want to say minimum throughput was violated.
   36         -
            ThroughputReport::NoPolling => {
   37         -
                tracing::debug!(
   38         -
                    "the user has stalled; this will not become a minimum throughput violation"
   39         -
                );
   40         -
                return (false, ZERO_THROUGHPUT);
   41         -
            }
   42         -
            // If we're stuck in Poll::Pending, then the server has stalled. Alternatively,
   43         -
            // if we're transferring data, but it's too slow, then we also want to say
   44         -
            // that the minimum throughput has been violated.
   45         -
            ThroughputReport::Pending => ZERO_THROUGHPUT,
   46         -
            ThroughputReport::Transferred(tp) => tp,
   47         -
        };
   48         -
        let violated = throughput < minimum_throughput;
   49         -
        if violated {
   50         -
            tracing::debug!(
   51         -
                "current throughput: {throughput} is below minimum: {minimum_throughput}"
   52         -
            );
   53         -
        }
   54         -
        (violated, throughput)
   55         -
    }
   56         -
}
   57         -
   58         -
impl<B> Body for MinimumThroughputDownloadBody<B>
          14  +
impl<B> http_body_04x::Body for MinimumThroughputDownloadBody<B>
   59     15   
where
   60         -
    B: Body<Data = bytes::Bytes, Error = BoxError>,
          16  +
    B: http_body_04x::Body<Data = bytes::Bytes, Error = BoxError>,
   61     17   
{
   62     18   
    type Data = bytes::Bytes;
   63     19   
    type Error = BoxError;
   64     20   
   65     21   
    fn poll_data(
   66     22   
        mut self: Pin<&mut Self>,
   67     23   
        cx: &mut Context<'_>,
   68     24   
    ) -> Poll<Option<Result<Self::Data, Self::Error>>> {
          25  +
        #[allow(unused_imports)]
          26  +
        use crate::client::http::body::minimum_throughput::throughput::ThroughputReport;
   69     27   
        // this code is called quite frequently in production—one every millisecond or so when downloading
   70     28   
        // a stream. However, SystemTime::now is on the order of nanoseconds
   71     29   
        let now = self.time_source.now();
   72     30   
        // Attempt to read the data from the inner body, then update the
   73     31   
        // throughput logs.
   74     32   
        let mut this = self.as_mut().project();
   75     33   
        let poll_res = match this.inner.poll_data(cx) {
   76     34   
            Poll::Ready(Some(Ok(bytes))) => {
   77     35   
                tracing::trace!("received data: {}", bytes.len());
   78     36   
                this.throughput_logs
@@ -127,85 +189,147 @@
  147    105   
  148    106   
    fn is_end_stream(&self) -> bool {
  149    107   
        self.inner.is_end_stream()
  150    108   
    }
  151    109   
  152    110   
    fn size_hint(&self) -> http_body_04x::SizeHint {
  153    111   
        self.inner.size_hint()
  154    112   
    }
  155    113   
}
  156    114   
  157         -
impl<B> Body for ThroughputReadingBody<B>
         115  +
impl<B> http_body_04x::Body for ThroughputReadingBody<B>
  158    116   
where
  159         -
    B: Body<Data = bytes::Bytes, Error = BoxError>,
         117  +
    B: http_body_04x::Body<Data = bytes::Bytes, Error = BoxError>,
  160    118   
{
  161    119   
    type Data = bytes::Bytes;
  162    120   
    type Error = BoxError;
  163    121   
  164    122   
    fn poll_data(
  165    123   
        mut self: Pin<&mut Self>,
  166    124   
        cx: &mut Context<'_>,
  167    125   
    ) -> Poll<Option<Result<Self::Data, Self::Error>>> {
  168    126   
        // this code is called quite frequently in production—one every millisecond or so when downloading
  169    127   
        // a stream. However, SystemTime::now is on the order of nanoseconds

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/http/body/minimum_throughput/http_body_1_x.rs

@@ -0,1 +0,177 @@
           1  +
/*
           2  +
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
           3  +
 * SPDX-License-Identifier: Apache-2.0
           4  +
 */
           5  +
           6  +
use super::{BoxError, Error, MinimumThroughputDownloadBody};
           7  +
use crate::client::http::body::minimum_throughput::throughput::DownloadReport;
           8  +
use crate::client::http::body::minimum_throughput::ThroughputReadingBody;
           9  +
use aws_smithy_async::rt::sleep::AsyncSleep;
          10  +
use http_body_1x::Frame;
          11  +
use std::future::Future;
          12  +
use std::pin::{pin, Pin};
          13  +
use std::task::{Context, Poll};
          14  +
          15  +
impl<B> http_body_1x::Body for MinimumThroughputDownloadBody<B>
          16  +
where
          17  +
    B: http_body_1x::Body<Data = bytes::Bytes, Error = BoxError>,
          18  +
{
          19  +
    type Data = bytes::Bytes;
          20  +
    type Error = BoxError;
          21  +
          22  +
    fn poll_frame(
          23  +
        mut self: Pin<&mut Self>,
          24  +
        cx: &mut Context<'_>,
          25  +
    ) -> Poll<Option<Result<http_body_1x::Frame<Self::Data>, Self::Error>>> {
          26  +
        #[allow(unused_imports)]
          27  +
        use crate::client::http::body::minimum_throughput::throughput::ThroughputReport;
          28  +
        // this code is called quite frequently in production—one every millisecond or so when downloading
          29  +
        // a stream. However, SystemTime::now is on the order of nanoseconds
          30  +
        let now = self.time_source.now();
          31  +
        // Attempt to read the data from the inner body, then update the
          32  +
        // throughput logs.
          33  +
        let mut this = self.as_mut().project();
          34  +
        let poll_res = match this.inner.poll_frame(cx) {
          35  +
            Poll::Ready(Some(Ok(frame))) => {
          36  +
                if frame.is_data() {
          37  +
                    let bytes = frame.into_data().expect("Is data frame");
          38  +
                    tracing::trace!("received data: {}", bytes.len());
          39  +
                    this.throughput_logs
          40  +
                        .push_bytes_transferred(now, bytes.len() as u64);
          41  +
                    Poll::Ready(Some(Ok(Frame::data(bytes))))
          42  +
                } else {
          43  +
                    tracing::trace!("received trailer");
          44  +
                    Poll::Ready(Some(Ok(frame)))
          45  +
                }
          46  +
            }
          47  +
            Poll::Pending => {
          48  +
                tracing::trace!("received poll pending");
          49  +
                this.throughput_logs.push_pending(now);
          50  +
                Poll::Pending
          51  +
            }
          52  +
            // If we've read all the data or an error occurred, then return that result.
          53  +
            res => return res,
          54  +
        };
          55  +
          56  +
        // Check the sleep future to see if it needs refreshing.
          57  +
        let mut sleep_fut = this
          58  +
            .sleep_fut
          59  +
            .take()
          60  +
            .unwrap_or_else(|| this.async_sleep.sleep(*this.resolution));
          61  +
        if let Poll::Ready(()) = pin!(&mut sleep_fut).poll(cx) {
          62  +
            tracing::trace!("sleep future triggered—triggering a wakeup");
          63  +
            // Whenever the sleep future expires, we replace it.
          64  +
            sleep_fut = this.async_sleep.sleep(*this.resolution);
          65  +
          66  +
            // We also schedule a wake up for current task to ensure that
          67  +
            // it gets polled at least one more time.
          68  +
            cx.waker().wake_by_ref();
          69  +
        };
          70  +
        this.sleep_fut.replace(sleep_fut);
          71  +
          72  +
        // Calculate the current throughput and emit an error if it's too low and
          73  +
        // the grace period has elapsed.
          74  +
        let report = this.throughput_logs.report(now);
          75  +
        let (violated, current_throughput) =
          76  +
            report.minimum_throughput_violated(this.options.minimum_throughput());
          77  +
        if violated {
          78  +
            if this.grace_period_fut.is_none() {
          79  +
                tracing::debug!("entering minimum throughput grace period");
          80  +
            }
          81  +
            let mut grace_period_fut = this
          82  +
                .grace_period_fut
          83  +
                .take()
          84  +
                .unwrap_or_else(|| this.async_sleep.sleep(this.options.grace_period()));
          85  +
            if let Poll::Ready(()) = pin!(&mut grace_period_fut).poll(cx) {
          86  +
                // The grace period has ended!
          87  +
                return Poll::Ready(Some(Err(Box::new(Error::ThroughputBelowMinimum {
          88  +
                    expected: self.options.minimum_throughput(),
          89  +
                    actual: current_throughput,
          90  +
                }))));
          91  +
            };
          92  +
            this.grace_period_fut.replace(grace_period_fut);
          93  +
        } else {
          94  +
            // Ensure we don't have an active grace period future if we're not
          95  +
            // currently below the minimum throughput.
          96  +
            if this.grace_period_fut.is_some() {
          97  +
                tracing::debug!("throughput recovered; exiting grace period");
          98  +
            }
          99  +
            let _ = this.grace_period_fut.take();
         100  +
        }
         101  +
         102  +
        poll_res
         103  +
    }
         104  +
         105  +
    fn is_end_stream(&self) -> bool {
         106  +
        self.inner.is_end_stream()
         107  +
    }
         108  +
         109  +
    fn size_hint(&self) -> http_body_1x::SizeHint {
         110  +
        self.inner.size_hint()
         111  +
    }
         112  +
}
         113  +
         114  +
impl<B> http_body_1x::Body for ThroughputReadingBody<B>
         115  +
where
         116  +
    B: http_body_1x::Body<Data = bytes::Bytes, Error = BoxError>,
         117  +
{
         118  +
    type Data = bytes::Bytes;
         119  +
    type Error = BoxError;
         120  +
         121  +
    fn poll_frame(
         122  +
        mut self: Pin<&mut Self>,
         123  +
        cx: &mut Context<'_>,
         124  +
    ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
         125  +
        // this code is called quite frequently in production—one every millisecond or so when downloading
         126  +
        // a stream. However, SystemTime::now is on the order of nanoseconds
         127  +
        let now = self.time_source.now();
         128  +
        // Attempt to read the data from the inner body, then update the
         129  +
        // throughput logs.
         130  +
        let this = self.as_mut().project();
         131  +
        match this.inner.poll_frame(cx) {
         132  +
            Poll::Ready(Some(Ok(frame))) => {
         133  +
                if frame.is_data() {
         134  +
                    let bytes = frame.into_data().expect("Is data frame");
         135  +
                    tracing::trace!("received data: {}", bytes.len());
         136  +
                    this.throughput
         137  +
                        .push_bytes_transferred(now, bytes.len() as u64);
         138  +
         139  +
                    // hyper will optimistically stop polling when end of stream is reported
         140  +
                    // (e.g. when content-length amount of data has been consumed) which means
         141  +
                    // we may never get to `Poll:Ready(None)`. Check for same condition and
         142  +
                    // attempt to stop checking throughput violations _now_ as we may never
         143  +
                    // get polled again. The caveat here is that it depends on `Body` implementations
         144  +
                    // implementing `is_end_stream()` correctly. Users can also disable SSP as an
         145  +
                    // alternative for such fringe use cases.
         146  +
                    if self.is_end_stream() {
         147  +
                        tracing::trace!("stream reported end of stream before Poll::Ready(None) reached; marking stream complete");
         148  +
                        self.throughput.mark_complete();
         149  +
                    }
         150  +
                    Poll::Ready(Some(Ok(Frame::data(bytes))))
         151  +
                } else {
         152  +
                    Poll::Ready(Some(Ok(frame)))
         153  +
                }
         154  +
            }
         155  +
            Poll::Pending => {
         156  +
                tracing::trace!("received poll pending");
         157  +
                this.throughput.push_pending(now);
         158  +
                Poll::Pending
         159  +
            }
         160  +
            // If we've read all the data or an error occurred, then return that result.
         161  +
            res => {
         162  +
                if this.throughput.mark_complete() {
         163  +
                    tracing::trace!("stream completed: {:?}", res);
         164  +
                }
         165  +
                res
         166  +
            }
         167  +
        }
         168  +
    }
         169  +
         170  +
    fn is_end_stream(&self) -> bool {
         171  +
        self.inner.is_end_stream()
         172  +
    }
         173  +
         174  +
    fn size_hint(&self) -> http_body_1x::SizeHint {
         175  +
        self.inner.size_hint()
         176  +
    }
         177  +
}

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/http/body/minimum_throughput/throughput.rs

@@ -376,376 +435,476 @@
  396    396   
        let half = BIN_COUNT / 2;
  397    397   
        match (transferred > 0, no_polling >= half, pending >= half) {
  398    398   
            (true, _, _) => ThroughputReport::Transferred(throughput),
  399    399   
            (_, true, _) => ThroughputReport::NoPolling,
  400    400   
            (_, _, true) => ThroughputReport::Pending,
  401    401   
            _ => ThroughputReport::Incomplete,
  402    402   
        }
  403    403   
    }
  404    404   
}
  405    405   
         406  +
const ZERO_THROUGHPUT: Throughput = Throughput::new_bytes_per_second(0);
         407  +
// Helper trait for interpreting the throughput report.
         408  +
pub(crate) trait DownloadReport {
         409  +
    fn minimum_throughput_violated(self, minimum_throughput: Throughput) -> (bool, Throughput);
         410  +
}
         411  +
impl DownloadReport for ThroughputReport {
         412  +
    fn minimum_throughput_violated(self, minimum_throughput: Throughput) -> (bool, Throughput) {
         413  +
        let throughput = match self {
         414  +
            ThroughputReport::Complete => return (false, ZERO_THROUGHPUT),
         415  +
            // If the report is incomplete, then we don't have enough data yet to
         416  +
            // decide if minimum throughput was violated.
         417  +
            ThroughputReport::Incomplete => {
         418  +
                tracing::trace!(
         419  +
                    "not enough data to decide if minimum throughput has been violated"
         420  +
                );
         421  +
                return (false, ZERO_THROUGHPUT);
         422  +
            }
         423  +
            // If no polling is taking place, then the user has stalled.
         424  +
            // In this case, we don't want to say minimum throughput was violated.
         425  +
            ThroughputReport::NoPolling => {
         426  +
                tracing::debug!(
         427  +
                    "the user has stalled; this will not become a minimum throughput violation"
         428  +
                );
         429  +
                return (false, ZERO_THROUGHPUT);
         430  +
            }
         431  +
            // If we're stuck in Poll::Pending, then the server has stalled. Alternatively,
         432  +
            // if we're transferring data, but it's too slow, then we also want to say
         433  +
            // that the minimum throughput has been violated.
         434  +
            ThroughputReport::Pending => ZERO_THROUGHPUT,
         435  +
            ThroughputReport::Transferred(tp) => tp,
         436  +
        };
         437  +
        let violated = throughput < minimum_throughput;
         438  +
        if violated {
         439  +
            tracing::debug!(
         440  +
                "current throughput: {throughput} is below minimum: {minimum_throughput}"
         441  +
            );
         442  +
        }
         443  +
        (violated, throughput)
         444  +
    }
         445  +
}
         446  +
  406    447   
#[cfg(test)]
  407    448   
mod test {
  408    449   
    use super::*;
  409    450   
    use std::time::Duration;
  410    451   
  411    452   
    #[test]
  412    453   
    fn test_log_buffer_bin_label_priority() {
  413    454   
        use BinLabel::*;
  414    455   
        assert!(Empty < NoPolling);
  415    456   
        assert!(NoPolling < Pending);

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/orchestrator.rs

@@ -498,498 +589,589 @@
  518    518   
        RuntimeComponents, RuntimeComponentsBuilder,
  519    519   
    };
  520    520   
    use aws_smithy_runtime_api::client::runtime_plugin::{RuntimePlugin, RuntimePlugins};
  521    521   
    use aws_smithy_runtime_api::client::ser_de::{
  522    522   
        SharedRequestSerializer, SharedResponseDeserializer,
  523    523   
    };
  524    524   
    use aws_smithy_runtime_api::shared::IntoShared;
  525    525   
    use aws_smithy_types::body::SdkBody;
  526    526   
    use aws_smithy_types::config_bag::{ConfigBag, FrozenLayer, Layer};
  527    527   
    use aws_smithy_types::timeout::TimeoutConfig;
  528         -
    use http_02x::{Response, StatusCode};
         528  +
    use http_1x::{Response, StatusCode};
  529    529   
    use std::borrow::Cow;
  530    530   
    use std::sync::atomic::{AtomicBool, Ordering};
  531    531   
    use std::sync::Arc;
  532    532   
    use tracing_test::traced_test;
  533    533   
  534    534   
    fn new_request_serializer() -> CannedRequestSerializer {
  535    535   
        CannedRequestSerializer::success(HttpRequest::empty())
  536    536   
    }
  537    537   
  538    538   
    fn new_response_deserializer() -> CannedResponseDeserializer {
  539    539   
        CannedResponseDeserializer::new(
  540    540   
            Response::builder()
  541    541   
                .status(StatusCode::OK)
  542    542   
                .body(SdkBody::empty())
  543    543   
                .map_err(|err| OrchestratorError::other(Box::new(err)))
  544    544   
                .map(Output::erase),
  545    545   
        )
  546    546   
    }
  547    547   
  548    548   
    #[derive(Debug, Default)]
  549    549   
    struct OkConnector {}
  550    550   
  551    551   
    impl OkConnector {
  552    552   
        fn new() -> Self {
  553    553   
            Self::default()
  554    554   
        }
  555    555   
    }
  556    556   
  557    557   
    impl HttpConnector for OkConnector {
  558    558   
        fn call(&self, _request: HttpRequest) -> HttpConnectorFuture {
  559         -
            HttpConnectorFuture::ready(Ok(http_02x::Response::builder()
         559  +
            HttpConnectorFuture::ready(Ok(http_1x::Response::builder()
  560    560   
                .status(200)
  561    561   
                .body(SdkBody::empty())
  562    562   
                .expect("OK response is valid")
  563    563   
                .try_into()
  564    564   
                .unwrap()))
  565    565   
        }
  566    566   
    }
  567    567   
  568    568   
    #[derive(Debug)]
  569    569   
    struct TestOperationRuntimePlugin {

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/orchestrator/auth.rs

@@ -446,446 +506,506 @@
  466    466   
            fn sign_http_request(
  467    467   
                &self,
  468    468   
                request: &mut HttpRequest,
  469    469   
                _identity: &Identity,
  470    470   
                _auth_scheme_endpoint_config: AuthSchemeEndpointConfig<'_>,
  471    471   
                _runtime_components: &RuntimeComponents,
  472    472   
                _config_bag: &ConfigBag,
  473    473   
            ) -> Result<(), BoxError> {
  474    474   
                request
  475    475   
                    .headers_mut()
  476         -
                    .insert(http_02x::header::AUTHORIZATION, "success!");
         476  +
                    .insert(http_1x::header::AUTHORIZATION, "success!");
  477    477   
                Ok(())
  478    478   
            }
  479    479   
        }
  480    480   
  481    481   
        const TEST_SCHEME_ID: AuthSchemeId = AuthSchemeId::new("test-scheme");
  482    482   
  483    483   
        #[derive(Debug)]
  484    484   
        struct TestAuthScheme {
  485    485   
            signer: TestSigner,
  486    486   
        }
@@ -757,757 +817,817 @@
  777    777   
                _config_bag: &'a ConfigBag,
  778    778   
            ) -> IdentityFuture<'a> {
  779    779   
                IdentityFuture::ready(Ok(Identity::new(Token::new("cached (pass)", None), None)))
  780    780   
            }
  781    781   
        }
  782    782   
  783    783   
        async fn run_test(add_more_to_layer: impl Fn(Layer) -> Layer) {
  784    784   
            let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  785    785   
            ctx.enter_serialization_phase();
  786    786   
            ctx.set_request(
  787         -
                http_02x::Request::builder()
         787  +
                http_1x::Request::builder()
  788    788   
                    .body(SdkBody::empty())
  789    789   
                    .unwrap()
  790    790   
                    .try_into()
  791    791   
                    .unwrap(),
  792    792   
            );
  793    793   
            let _ = ctx.take_input();
  794    794   
            ctx.enter_before_transmit_phase();
  795    795   
  796    796   
            let runtime_components = RuntimeComponentsBuilder::for_tests()
  797    797   
                .with_auth_scheme(SharedAuthScheme::new(ApiKeyAuthScheme::new(

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/orchestrator/endpoints.rs

@@ -1,1 +48,48 @@
    6      6   
use aws_smithy_runtime_api::client::endpoint::{
    7      7   
    error::ResolveEndpointError, EndpointFuture, EndpointResolverParams, ResolveEndpoint,
    8      8   
};
    9      9   
use aws_smithy_runtime_api::client::identity::Identity;
   10     10   
use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;
   11     11   
use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
   12     12   
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
   13     13   
use aws_smithy_runtime_api::{box_error::BoxError, client::endpoint::EndpointPrefix};
   14     14   
use aws_smithy_types::config_bag::ConfigBag;
   15     15   
use aws_smithy_types::endpoint::Endpoint;
   16         -
use http_02x::header::HeaderName;
   17         -
use http_02x::uri::PathAndQuery;
   18         -
use http_02x::{HeaderValue, Uri};
          16  +
use http_1x::header::HeaderName;
          17  +
use http_1x::uri::PathAndQuery;
          18  +
use http_1x::{HeaderValue, Uri};
   19     19   
use std::borrow::Cow;
   20     20   
use std::fmt::Debug;
   21     21   
use std::str::FromStr;
   22     22   
use tracing::trace;
   23     23   
   24     24   
/// An endpoint resolver that uses a static URI.
   25     25   
#[derive(Clone, Debug)]
   26     26   
pub struct StaticUriEndpointResolver {
   27     27   
    endpoint: String,
   28     28   
}

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/orchestrator/http.rs

@@ -1,1 +54,49 @@
    1      1   
/*
    2      2   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
use aws_smithy_runtime_api::client::orchestrator::{HttpResponse, SensitiveOutput};
    7      7   
use aws_smithy_types::body::SdkBody;
    8      8   
use aws_smithy_types::config_bag::ConfigBag;
    9         -
use bytes::{Buf, Bytes};
   10         -
use http_body_04x::Body;
           9  +
use bytes::Bytes;
   11     10   
use pin_utils::pin_mut;
   12     11   
use tracing::trace;
   13     12   
   14     13   
const LOG_SENSITIVE_BODIES: &str = "LOG_SENSITIVE_BODIES";
   15     14   
   16         -
async fn body_to_bytes(body: SdkBody) -> Result<Bytes, <SdkBody as Body>::Error> {
   17         -
    let mut output = Vec::new();
          15  +
async fn body_to_bytes(body: SdkBody) -> Result<Bytes, <SdkBody as http_body_1x::Body>::Error> {
          16  +
    use http_body_util::BodyExt;
   18     17   
    pin_mut!(body);
   19         -
    while let Some(buf) = body.data().await {
   20         -
        let mut buf = buf?;
   21         -
        while buf.has_remaining() {
   22         -
            output.extend_from_slice(buf.chunk());
   23         -
            buf.advance(buf.chunk().len())
   24         -
        }
   25         -
    }
          18  +
    let collected = body.collect().await?;
   26     19   
   27         -
    Ok(Bytes::from(output))
          20  +
    Ok(collected.to_bytes())
   28     21   
}
   29     22   
   30         -
pub(crate) async fn read_body(response: &mut HttpResponse) -> Result<(), <SdkBody as Body>::Error> {
          23  +
pub(crate) async fn read_body(
          24  +
    response: &mut HttpResponse,
          25  +
) -> Result<(), <SdkBody as http_body_1x::Body>::Error> {
   31     26   
    let mut body = SdkBody::taken();
   32     27   
    std::mem::swap(&mut body, response.body_mut());
   33     28   
   34     29   
    let bytes = body_to_bytes(body).await?;
   35     30   
    let mut body = SdkBody::from(bytes);
   36     31   
    std::mem::swap(&mut body, response.body_mut());
   37     32   
   38     33   
    Ok(())
   39     34   
}
   40     35   

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/retries/classifiers.rs

@@ -214,214 +287,287 @@
  234    234   
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  235    235   
            write!(f, "UnmodeledError")
  236    236   
        }
  237    237   
    }
  238    238   
  239    239   
    impl std::error::Error for UnmodeledError {}
  240    240   
  241    241   
    #[test]
  242    242   
    fn classify_by_response_status() {
  243    243   
        let policy = HttpStatusCodeClassifier::default();
  244         -
        let res = http_02x::Response::builder()
         244  +
        let res = http_1x::Response::builder()
  245    245   
            .status(500)
  246    246   
            .body("error!")
  247    247   
            .unwrap()
  248    248   
            .map(SdkBody::from);
  249    249   
        let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  250    250   
        ctx.set_response(res.try_into().unwrap());
  251    251   
        assert_eq!(policy.classify_retry(&ctx), RetryAction::transient_error());
  252    252   
    }
  253    253   
  254    254   
    #[test]
  255    255   
    fn classify_by_response_status_not_retryable() {
  256    256   
        let policy = HttpStatusCodeClassifier::default();
  257         -
        let res = http_02x::Response::builder()
         257  +
        let res = http_1x::Response::builder()
  258    258   
            .status(408)
  259    259   
            .body("error!")
  260    260   
            .unwrap()
  261    261   
            .map(SdkBody::from);
  262    262   
        let mut ctx = InterceptorContext::new(Input::doesnt_matter());
  263    263   
        ctx.set_response(res.try_into().unwrap());
  264    264   
        assert_eq!(policy.classify_retry(&ctx), RetryAction::NoActionIndicated);
  265    265   
    }
  266    266   
  267    267   
    #[test]

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-runtime/src/client/stalled_stream_protection.rs

@@ -55,55 +139,139 @@
   75     75   
                let now = time_source.now();
   76     76   
   77     77   
                let options: MinimumThroughputBodyOptions = sspcfg.into();
   78     78   
                let throughput = UploadThroughput::new(options.check_window(), now);
   79     79   
                cfg.interceptor_state().store_put(throughput.clone());
   80     80   
   81     81   
                tracing::trace!("adding stalled stream protection to request body");
   82     82   
                let it = mem::replace(context.request_mut().body_mut(), SdkBody::taken());
   83     83   
                let it = it.map_preserve_contents(move |body| {
   84     84   
                    let time_source = time_source.clone();
   85         -
                    SdkBody::from_body_0_4(ThroughputReadingBody::new(
          85  +
                    SdkBody::from_body_1_x(ThroughputReadingBody::new(
   86     86   
                        time_source,
   87     87   
                        throughput.clone(),
   88     88   
                        body,
   89     89   
                    ))
   90     90   
                });
   91     91   
                let _ = mem::replace(context.request_mut().body_mut(), it);
   92     92   
            }
   93     93   
        }
   94     94   
   95     95   
        Ok(())
   96     96   
    }
   97     97   
   98     98   
    fn modify_before_deserialization(
   99     99   
        &self,
  100    100   
        context: &mut BeforeDeserializationInterceptorContextMut<'_>,
  101    101   
        runtime_components: &RuntimeComponents,
  102    102   
        cfg: &mut ConfigBag,
  103    103   
    ) -> Result<(), BoxError> {
  104    104   
        if let Some(sspcfg) = cfg.load::<StalledStreamProtectionConfig>() {
  105    105   
            if sspcfg.download_enabled() {
  106    106   
                let (async_sleep, time_source) = get_runtime_component_deps(runtime_components)?;
  107    107   
                tracing::trace!("adding stalled stream protection to response body");
  108    108   
                let sspcfg = sspcfg.clone();
  109    109   
                let it = mem::replace(context.response_mut().body_mut(), SdkBody::taken());
  110    110   
                let it = it.map_preserve_contents(move |body| {
  111    111   
                    let sspcfg = sspcfg.clone();
  112    112   
                    let async_sleep = async_sleep.clone();
  113    113   
                    let time_source = time_source.clone();
  114    114   
                    let mtb = MinimumThroughputDownloadBody::new(
  115    115   
                        time_source,
  116    116   
                        async_sleep,
  117    117   
                        body,
  118    118   
                        sspcfg.into(),
  119    119   
                    );
  120         -
                    SdkBody::from_body_0_4(mtb)
         120  +
                    SdkBody::from_body_1_x(mtb)
  121    121   
                });
  122    122   
                let _ = mem::replace(context.response_mut().body_mut(), it);
  123    123   
            }
  124    124   
        }
  125    125   
        Ok(())
  126    126   
    }
  127    127   
}
  128    128   
  129    129   
fn get_runtime_component_deps(
  130    130   
    runtime_components: &RuntimeComponents,