AWS SDK

AWS SDK

rev. b312272346d50bcdc13e1914e37467d343d63934 (ignoring whitespace)

Files changed:

tmp-codegen-diff/aws-sdk/README.md

@@ -1,1 +57,57 @@
   17     17   
   18     18   
> For a step-by-step guide including several advanced use cases, check out the [Developer Guide](https://docs.aws.amazon.com/sdk-for-rust/latest/dg/welcome.html).
   19     19   
   20     20   
The SDK provides one crate per AWS service. You must add [Tokio](https://crates.io/crates/tokio) as a dependency within your Rust project to execute asynchronous code.
   21     21   
   22     22   
1. Create a new Rust project: `cargo new sdk-example`
   23     23   
2. Add dependencies to DynamoDB and Tokio to your **Cargo.toml** file:
   24     24   
   25     25   
    ```toml
   26     26   
    [dependencies]
   27         -
    aws-config = { version= "1.5.1", features = ["behavior-version-latest"] }
          27  +
    aws-config = { version= "1.5.2", features = ["behavior-version-latest"] }
   28     28   
    aws-sdk-dynamodb = "0.0.0-local"
   29     29   
    tokio = { version = "1", features = ["full"] }
   30     30   
    ```
   31     31   
   32     32   
3. Provide your AWS credentials with the default credential provider chain, which currently looks in:
   33     33   
   - Environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_REGION`
   34     34   
   - The default credentials files located in `~/.aws/config` and `~/.aws/credentials` (location can vary per platform)
   35     35   
   - Web Identity Token credentials from the environment or container (including EKS)
   36     36   
   - ECS Container Credentials (IAM roles for tasks)
   37     37   
   - EC2 Instance Metadata Service (IAM Roles attached to instance)

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

@@ -1,1 +156,156 @@
    1      1   
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
[package]
    3      3   
name = "aws-config"
    4         -
version = "1.5.1"
           4  +
version = "1.5.2"
    5      5   
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Russell Cohen <rcoh@amazon.com>"]
    6      6   
description = "AWS SDK config and credential provider implementations."
    7      7   
edition = "2021"
    8      8   
exclude = ["test-data/*", "integration-tests/*"]
    9      9   
license = "Apache-2.0"
   10     10   
repository = "https://github.com/smithy-lang/smithy-rs"
   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   
behavior-version-latest = []
   22     22   
client-hyper = ["aws-smithy-runtime/connector-hyper-0-14-x"]
   23     23   
credentials-process = ["tokio/process"]
   24     24   
default = ["client-hyper", "rustls", "rt-tokio", "credentials-process", "sso"]
   25     25   
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-runtime/rt-tokio", "tokio/rt"]
   26     26   
rustls = ["aws-smithy-runtime/tls-rustls", "client-hyper"]
   27     27   
sso = ["dep:aws-sdk-sso", "dep:aws-sdk-ssooidc", "dep:ring", "dep:hex", "dep:zeroize", "aws-smithy-runtime-api/http-auth"]
   28     28   
allow-compilation = []
   29     29   
   30     30   
[dependencies]
   31     31   
bytes = "1.1.0"
   32     32   
http = "0.2.4"
   33     33   
url = "2.3.1"
   34     34   
fastrand = "2.0.0"
   35     35   
   36     36   
[dependencies.aws-credential-types]
   37     37   
path = "../aws-credential-types"
   38     38   
features = ["test-util"]
   39     39   
version = "1.2.0"
   40     40   
   41     41   
[dependencies.aws-runtime]
   42     42   
path = "../aws-runtime"
   43         -
version = "1.2.3"
          43  +
version = "1.2.2"
   44     44   
   45     45   
[dependencies.aws-sdk-sts]
   46     46   
path = "../sts"
   47     47   
default-features = false
   48     48   
version = "0.0.0-local"
   49     49   
   50     50   
[dependencies.aws-smithy-async]
   51     51   
path = "../aws-smithy-async"
   52     52   
version = "1.2.1"
   53     53   
   54     54   
[dependencies.aws-smithy-http]
   55     55   
path = "../aws-smithy-http"
   56     56   
version = "0.60.8"
   57     57   
   58     58   
[dependencies.aws-smithy-json]
   59     59   
path = "../aws-smithy-json"
   60     60   
version = "0.60.7"
   61     61   
   62     62   
[dependencies.aws-smithy-runtime]
   63     63   
path = "../aws-smithy-runtime"
   64     64   
features = ["client"]
   65         -
version = "1.6.0"
          65  +
version = "1.5.7"
   66     66   
   67     67   
[dependencies.aws-smithy-runtime-api]
   68     68   
path = "../aws-smithy-runtime-api"
   69     69   
features = ["client"]
   70         -
version = "1.7.0"
          70  +
version = "1.6.3"
   71     71   
   72     72   
[dependencies.aws-smithy-types]
   73     73   
path = "../aws-smithy-types"
   74     74   
version = "1.2.0"
   75     75   
   76     76   
[dependencies.aws-types]
   77     77   
path = "../aws-types"
   78     78   
version = "1.3.1"
   79     79   
   80     80   
[dependencies.hyper]
   81     81   
version = "0.14.26"
   82     82   
default-features = false
   83     83   
   84     84   
[dependencies.time]
   85     85   
version = "0.3.4"
   86     86   
features = ["parsing"]
   87     87   
   88     88   
[dependencies.tokio]
   89     89   
version = "1.13.1"
   90     90   
features = ["sync"]
   91     91   
   92     92   
[dependencies.tracing]
   93     93   
version = "0.1"
   94     94   
   95     95   
[dependencies.aws-sdk-sso]
   96     96   
path = "../sso"
   97     97   
default-features = false
   98     98   
optional = true
   99     99   
version = "0.0.0-local"
  100    100   
  101    101   
[dependencies.ring]
  102    102   
version = "0.17.5"
  103    103   
optional = true
  104    104   
  105    105   
[dependencies.hex]
  106    106   
version = "0.4.3"
  107    107   
optional = true
  108    108   
  109    109   
[dependencies.zeroize]
  110    110   
version = "1"
  111    111   
optional = true
  112    112   
  113    113   
[dependencies.aws-sdk-ssooidc]
  114    114   
path = "../ssooidc"
  115    115   
default-features = false
  116    116   
optional = true
  117    117   
version = "0.0.0-local"
  118    118   
  119    119   
[dev-dependencies]
  120    120   
tracing-test = "0.2.4"
  121    121   
serde_json = "1"
  122    122   
  123    123   
[dev-dependencies.aws-smithy-runtime]
  124    124   
path = "../aws-smithy-runtime"
  125    125   
features = ["client", "connector-hyper-0-14-x", "test-util"]
  126         -
version = "1.6.0"
         126  +
version = "1.5.7"
  127    127   
  128    128   
[dev-dependencies.aws-smithy-runtime-api]
  129    129   
path = "../aws-smithy-runtime-api"
  130    130   
features = ["test-util"]
  131         -
version = "1.7.0"
         131  +
version = "1.6.3"
  132    132   
  133    133   
[dev-dependencies.futures-util]
  134    134   
version = "0.3.29"
  135    135   
default-features = false
  136    136   
  137    137   
[dev-dependencies.tracing-subscriber]
  138    138   
version = "0.3.16"
  139    139   
features = ["fmt", "json"]
  140    140   
  141    141   
[dev-dependencies.tokio]

tmp-codegen-diff/aws-sdk/sdk/aws-config/fuzz/Cargo.toml

@@ -1,1 +30,30 @@
   13     13   
edition = "2021"
   14     14   
   15     15   
[package.metadata]
   16     16   
cargo-fuzz = true
   17     17   
   18     18   
[dependencies]
   19     19   
libfuzzer-sys = "0.4"
   20     20   
   21     21   
[dependencies.aws-config]
   22     22   
path = ".."
   23         -
version = "1.5.1"
          23  +
version = "1.5.2"
   24     24   
   25     25   
[dependencies.aws-types]
   26     26   
path = "../../../sdk/build/aws-sdk/sdk/aws-types"
   27     27   
version = "1.3.1"
   28     28   
   29     29   
[workspace]
   30     30   
members = ["."]

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/lib.rs

@@ -118,118 +233,245 @@
  138    138   
pub mod sso;
  139    139   
pub mod stalled_stream_protection;
  140    140   
pub mod sts;
  141    141   
pub mod timeout;
  142    142   
pub mod web_identity_token;
  143    143   
  144    144   
/// Create a config loader with the _latest_ defaults.
  145    145   
///
  146    146   
/// This loader will always set [`BehaviorVersion::latest`].
  147    147   
///
         148  +
/// For more information about default configuration, refer to the documentation at:
         149  +
/// <https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html>
         150  +
///
  148    151   
/// # Examples
  149    152   
/// ```no_run
  150    153   
/// # async fn create_config() {
  151    154   
/// let config = aws_config::from_env().region("us-east-1").load().await;
  152    155   
/// # }
  153    156   
/// ```
  154    157   
#[cfg(feature = "behavior-version-latest")]
  155    158   
pub fn from_env() -> ConfigLoader {
  156    159   
    ConfigLoader::default().behavior_version(BehaviorVersion::latest())
  157    160   
}
  158    161   
  159    162   
/// Load default configuration with the _latest_ defaults.
  160    163   
///
  161    164   
/// Convenience wrapper equivalent to `aws_config::load_defaults(BehaviorVersion::latest()).await`
         165  +
///
         166  +
/// For more information about default configuration, refer to the documentation at:
         167  +
/// <https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html>
  162    168   
#[cfg(feature = "behavior-version-latest")]
  163    169   
pub async fn load_from_env() -> SdkConfig {
  164    170   
    from_env().load().await
  165    171   
}
  166    172   
  167    173   
/// Create a config loader with the _latest_ defaults.
  168    174   
#[cfg(not(feature = "behavior-version-latest"))]
  169    175   
#[deprecated(
  170    176   
    note = "Use the `aws_config::defaults` function. If you don't care about future default behavior changes, you can continue to use this function by enabling the `behavior-version-latest` feature. Doing so will make this deprecation notice go away."
  171    177   
)]
  172    178   
pub fn from_env() -> ConfigLoader {
  173    179   
    ConfigLoader::default().behavior_version(BehaviorVersion::latest())
  174    180   
}
  175    181   
  176    182   
/// Load default configuration with the _latest_ defaults.
  177    183   
#[cfg(not(feature = "behavior-version-latest"))]
  178    184   
#[deprecated(
  179    185   
    note = "Use the `aws_config::load_defaults` function. If you don't care about future default behavior changes, you can continue to use this function by enabling the `behavior-version-latest` feature. Doing so will make this deprecation notice go away."
  180    186   
)]
  181    187   
pub async fn load_from_env() -> SdkConfig {
  182    188   
    load_defaults(BehaviorVersion::latest()).await
  183    189   
}
  184    190   
  185    191   
/// Create a config loader with the defaults for the given behavior version.
  186    192   
///
         193  +
/// For more information about default configuration, refer to the documentation at:
         194  +
/// <https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html>
         195  +
///
  187    196   
/// # Examples
  188    197   
/// ```no_run
  189    198   
/// # async fn create_config() {
  190    199   
/// use aws_config::BehaviorVersion;
  191    200   
/// let config = aws_config::defaults(BehaviorVersion::v2023_11_09())
  192    201   
///     .region("us-east-1")
  193    202   
///     .load()
  194    203   
///     .await;
  195    204   
/// # }
  196    205   
/// ```
  197    206   
pub fn defaults(version: BehaviorVersion) -> ConfigLoader {
  198    207   
    ConfigLoader::default().behavior_version(version)
  199    208   
}
  200    209   
  201    210   
/// Load default configuration with the given behavior version.
  202    211   
///
  203    212   
/// Convenience wrapper equivalent to `aws_config::defaults(behavior_version).load().await`
         213  +
///
         214  +
/// For more information about default configuration, refer to the documentation at:
         215  +
/// <https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html>
  204    216   
pub async fn load_defaults(version: BehaviorVersion) -> SdkConfig {
  205    217   
    defaults(version).load().await
  206    218   
}
  207    219   
  208    220   
mod loader {
  209    221   
    use crate::env_service_config::EnvServiceConfig;
  210    222   
    use aws_credential_types::provider::{
  211    223   
        token::{ProvideToken, SharedTokenProvider},
  212    224   
        ProvideCredentials, SharedCredentialsProvider,
  213    225   
    };

tmp-codegen-diff/aws-sdk/sdk/aws-credential-types/Cargo.toml

@@ -7,7 +44,44 @@
   27     27   
path = "../aws-smithy-async"
   28     28   
version = "1.2.1"
   29     29   
   30     30   
[dependencies.aws-smithy-types]
   31     31   
path = "../aws-smithy-types"
   32     32   
version = "1.2.0"
   33     33   
   34     34   
[dependencies.aws-smithy-runtime-api]
   35     35   
path = "../aws-smithy-runtime-api"
   36     36   
features = ["client", "http-auth"]
   37         -
version = "1.7.0"
          37  +
version = "1.6.3"
   38     38   
   39     39   
[dev-dependencies]
   40     40   
async-trait = "0.1.74"
   41     41   
   42     42   
[dev-dependencies.tokio]
   43     43   
version = "1.23.1"
   44     44   
features = ["full", "test-util", "rt"]

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

@@ -1,1 +0,18 @@
    8      8   
license = "Apache-2.0"
    9      9   
repository = "https://github.com/smithy-lang/smithy-rs"
   10     10   
[package.metadata.docs.rs]
   11     11   
all-features = true
   12     12   
targets = ["x86_64-unknown-linux-gnu"]
   13     13   
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
   14     14   
rustdoc-args = ["--cfg", "docsrs"]
   15     15   
[dependencies.aws-runtime]
   16     16   
path = "../aws-runtime"
   17     17   
features = ["http-02x"]
   18         -
version = "1.2.3"
          18  +
version = "1.2.2"

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

@@ -1,1 +117,117 @@
    1      1   
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
[package]
    3      3   
name = "aws-runtime"
    4         -
version = "1.2.3"
           4  +
version = "1.2.2"
    5      5   
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
    6      6   
description = "Runtime support code for the AWS SDK. This crate isn't intended to be used directly."
    7      7   
edition = "2021"
    8      8   
license = "Apache-2.0"
    9      9   
repository = "https://github.com/smithy-lang/smithy-rs"
   10     10   
[package.metadata.docs.rs]
   11     11   
all-features = true
   12     12   
targets = ["x86_64-unknown-linux-gnu"]
   13     13   
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
   14     14   
rustdoc-args = ["--cfg", "docsrs"]
   15     15   
   16     16   
[package.metadata.smithy-rs-release-tooling]
   17     17   
stable = true
   18     18   
   19     19   
[features]
   20     20   
event-stream = ["dep:aws-smithy-eventstream", "aws-sigv4/sign-eventstream"]
   21     21   
http-02x = []
   22     22   
test-util = []
   23     23   
sigv4a = ["aws-sigv4/sigv4a"]
   24     24   
   25     25   
[dependencies]
   26     26   
bytes = "1.1"
   27     27   
fastrand = "2.0.0"
   28     28   
http = "0.2.3"
   29     29   
http-body = "0.4.5"
   30     30   
percent-encoding = "2.1.0"
   31     31   
pin-project-lite = "0.2.9"
   32     32   
tracing = "0.1"
   33     33   
   34     34   
[dependencies.aws-credential-types]
   35     35   
path = "../aws-credential-types"
   36     36   
version = "1.2.0"
   37     37   
   38     38   
[dependencies.aws-sigv4]
   39     39   
path = "../aws-sigv4"
   40     40   
features = ["http0-compat"]
   41     41   
version = "1.2.2"
   42     42   
   43     43   
[dependencies.aws-smithy-async]
   44     44   
path = "../aws-smithy-async"
   45     45   
version = "1.2.1"
   46     46   
   47     47   
[dependencies.aws-smithy-eventstream]
   48     48   
path = "../aws-smithy-eventstream"
   49     49   
optional = true
   50     50   
version = "0.60.4"
   51     51   
   52     52   
[dependencies.aws-smithy-http]
   53     53   
path = "../aws-smithy-http"
   54     54   
version = "0.60.8"
   55     55   
   56     56   
[dependencies.aws-smithy-runtime-api]
   57     57   
path = "../aws-smithy-runtime-api"
   58     58   
features = ["client"]
   59         -
version = "1.7.0"
          59  +
version = "1.6.3"
   60     60   
   61     61   
[dependencies.aws-smithy-types]
   62     62   
path = "../aws-smithy-types"
   63     63   
version = "1.2.0"
   64     64   
   65     65   
[dependencies.aws-types]
   66     66   
path = "../aws-types"
   67     67   
version = "1.3.1"
   68     68   
   69     69   
[dependencies.uuid]
   70     70   
version = "1"
   71     71   
   72     72   
[dev-dependencies]
   73     73   
arbitrary = "1.3"
   74     74   
bytes-utils = "0.1.2"
   75     75   
proptest = "1.2"
   76     76   
serde_json = "1"
   77     77   
tracing-test = "0.2.4"
   78     78   
   79     79   
[dev-dependencies.aws-credential-types]
   80     80   
path = "../aws-credential-types"
   81     81   
features = ["test-util"]
   82     82   
version = "1.2.0"
   83     83   
   84     84   
[dev-dependencies.aws-smithy-async]
   85     85   
path = "../aws-smithy-async"
   86     86   
features = ["test-util"]
   87     87   
version = "1.2.1"
   88     88   
   89     89   
[dev-dependencies.aws-smithy-protocol-test]
   90     90   
path = "../aws-smithy-protocol-test"
   91     91   
version = "0.60.7"
   92     92   
   93     93   
[dev-dependencies.aws-smithy-runtime-api]
   94     94   
path = "../aws-smithy-runtime-api"
   95     95   
features = ["test-util"]
   96         -
version = "1.7.0"
          96  +
version = "1.6.3"
   97     97   
   98     98   
[dev-dependencies.aws-smithy-types]
   99     99   
path = "../aws-smithy-types"
  100    100   
features = ["test-util"]
  101    101   
version = "1.2.0"
  102    102   
  103    103   
[dev-dependencies.futures-util]
  104    104   
version = "0.3.29"
  105    105   
default-features = false
  106    106   

tmp-codegen-diff/aws-sdk/sdk/aws-runtime/src/user_agent.rs

@@ -1,1 +247,228 @@
    5      5   
    6      6   
use aws_smithy_types::config_bag::{Storable, StoreReplace};
    7      7   
use aws_types::app_name::AppName;
    8      8   
use aws_types::build_metadata::{OsFamily, BUILD_METADATA};
    9      9   
use aws_types::os_shim_internal::Env;
   10     10   
use std::borrow::Cow;
   11     11   
use std::error::Error;
   12     12   
use std::fmt;
   13     13   
   14     14   
mod interceptor;
   15         -
   16     15   
pub use interceptor::UserAgentInterceptor;
   17     16   
   18     17   
/// AWS User Agent
   19     18   
///
   20     19   
/// Ths struct should be inserted into the [`ConfigBag`](aws_smithy_types::config_bag::ConfigBag)
   21     20   
/// during operation construction. The `UserAgentInterceptor` reads `AwsUserAgent`
   22     21   
/// from the config bag and sets the `User-Agent` and `x-amz-user-agent` headers.
   23     22   
#[derive(Clone, Debug)]
   24     23   
pub struct AwsUserAgent {
   25     24   
    sdk_metadata: SdkMetadata,
   26     25   
    api_metadata: ApiMetadata,
   27     26   
    os_metadata: OsMetadata,
   28     27   
    language_metadata: LanguageMetadata,
   29     28   
    exec_env_metadata: Option<ExecEnvMetadata>,
   30     29   
    feature_metadata: Vec<FeatureMetadata>,
   31     30   
    config_metadata: Vec<ConfigMetadata>,
   32     31   
    framework_metadata: Vec<FrameworkMetadata>,
   33     32   
    app_name: Option<AppName>,
   34     33   
    build_env_additional_metadata: Option<AdditionalMetadata>,
   35         -
    additional_metadata: Vec<AdditionalMetadata>,
   36     34   
}
   37     35   
   38     36   
impl AwsUserAgent {
   39     37   
    /// Load a User Agent configuration from the environment
   40     38   
    ///
   41     39   
    /// This utilizes [`BUILD_METADATA`](const@aws_types::build_metadata::BUILD_METADATA) from `aws_types`
   42     40   
    /// to capture the Rust version & target platform. `ApiMetadata` provides
   43     41   
    /// the version & name of the specific service.
   44     42   
    pub fn new_from_environment(env: Env, api_metadata: ApiMetadata) -> Self {
   45     43   
        let build_metadata = &BUILD_METADATA;
   46     44   
        let sdk_metadata = SdkMetadata {
   47     45   
            name: "rust",
   48     46   
            version: build_metadata.core_pkg_version,
   49     47   
        };
   50     48   
        let os_metadata = OsMetadata {
   51     49   
            os_family: &build_metadata.os_family,
   52     50   
            version: None,
   53     51   
        };
   54     52   
        let exec_env_metadata = env
   55     53   
            .get("AWS_EXECUTION_ENV")
   56     54   
            .ok()
   57     55   
            .map(|name| ExecEnvMetadata { name });
   58     56   
   59     57   
        // Retrieve additional metadata at compile-time from the AWS_SDK_RUST_BUILD_UA_METADATA env var
   60     58   
        let build_env_additional_metadata = option_env!("AWS_SDK_RUST_BUILD_UA_METADATA")
   61     59   
            .and_then(|value| AdditionalMetadata::new(value).ok());
   62     60   
   63     61   
        AwsUserAgent {
   64     62   
            sdk_metadata,
   65     63   
            api_metadata,
   66     64   
            os_metadata,
   67     65   
            language_metadata: LanguageMetadata {
   68     66   
                lang: "rust",
   69     67   
                version: BUILD_METADATA.rust_version,
   70     68   
                extras: Default::default(),
   71     69   
            },
   72     70   
            exec_env_metadata,
   73     71   
            feature_metadata: Default::default(),
   74     72   
            config_metadata: Default::default(),
   75     73   
            framework_metadata: Default::default(),
   76     74   
            app_name: Default::default(),
   77     75   
            build_env_additional_metadata,
   78         -
            additional_metadata: Default::default(),
   79     76   
        }
   80     77   
    }
   81     78   
   82     79   
    /// For test purposes, construct an environment-independent User Agent
   83     80   
    ///
   84     81   
    /// Without this, running CI on a different platform would produce different user agent strings
   85     82   
    pub fn for_tests() -> Self {
   86     83   
        Self {
   87     84   
            sdk_metadata: SdkMetadata {
   88     85   
                name: "rust",
   89     86   
                version: "0.123.test",
   90     87   
            },
   91     88   
            api_metadata: ApiMetadata {
   92     89   
                service_id: "test-service".into(),
   93     90   
                version: "0.123",
   94     91   
            },
   95     92   
            os_metadata: OsMetadata {
   96     93   
                os_family: &OsFamily::Windows,
   97     94   
                version: Some("XPSP3".to_string()),
   98     95   
            },
   99     96   
            language_metadata: LanguageMetadata {
  100     97   
                lang: "rust",
  101     98   
                version: "1.50.0",
  102     99   
                extras: Default::default(),
  103    100   
            },
  104    101   
            exec_env_metadata: None,
  105    102   
            feature_metadata: Vec::new(),
  106    103   
            config_metadata: Vec::new(),
  107    104   
            framework_metadata: Vec::new(),
  108    105   
            app_name: None,
  109    106   
            build_env_additional_metadata: None,
  110         -
            additional_metadata: Vec::new(),
  111    107   
        }
  112    108   
    }
  113    109   
  114    110   
    #[doc(hidden)]
  115    111   
    /// Adds feature metadata to the user agent.
  116    112   
    pub fn with_feature_metadata(mut self, metadata: FeatureMetadata) -> Self {
  117    113   
        self.feature_metadata.push(metadata);
  118    114   
        self
  119    115   
    }
  120    116   
  121    117   
    #[doc(hidden)]
  122    118   
    /// Adds feature metadata to the user agent.
  123    119   
    pub fn add_feature_metadata(&mut self, metadata: FeatureMetadata) -> &mut Self {
  124    120   
        self.feature_metadata.push(metadata);
  125    121   
        self
  126    122   
    }
  127    123   
  128    124   
    #[doc(hidden)]
  129    125   
    /// Adds config metadata to the user agent.
  130    126   
    pub fn with_config_metadata(mut self, metadata: ConfigMetadata) -> Self {
  131    127   
        self.config_metadata.push(metadata);
  132    128   
        self
  133    129   
    }
  134    130   
  135    131   
    #[doc(hidden)]
  136    132   
    /// Adds config metadata to the user agent.
  137    133   
    pub fn add_config_metadata(&mut self, metadata: ConfigMetadata) -> &mut Self {
  138    134   
        self.config_metadata.push(metadata);
  139    135   
        self
  140    136   
    }
  141    137   
  142    138   
    #[doc(hidden)]
  143    139   
    /// Adds framework metadata to the user agent.
  144    140   
    pub fn with_framework_metadata(mut self, metadata: FrameworkMetadata) -> Self {
  145    141   
        self.framework_metadata.push(metadata);
  146    142   
        self
  147    143   
    }
  148    144   
  149    145   
    #[doc(hidden)]
  150    146   
    /// Adds framework metadata to the user agent.
  151    147   
    pub fn add_framework_metadata(&mut self, metadata: FrameworkMetadata) -> &mut Self {
  152    148   
        self.framework_metadata.push(metadata);
  153    149   
        self
  154    150   
    }
  155    151   
  156         -
    /// Adds additional metadata to the user agent.
  157         -
    pub fn with_additional_metadata(mut self, metadata: AdditionalMetadata) -> Self {
  158         -
        self.additional_metadata.push(metadata);
  159         -
        self
  160         -
    }
  161         -
  162         -
    /// Adds additional metadata to the user agent.
  163         -
    pub fn add_additional_metadata(&mut self, metadata: AdditionalMetadata) -> &mut Self {
  164         -
        self.additional_metadata.push(metadata);
  165         -
        self
  166         -
    }
  167         -
  168    152   
    /// Sets the app name for the user agent.
  169    153   
    pub fn with_app_name(mut self, app_name: AppName) -> Self {
  170    154   
        self.app_name = Some(app_name);
  171    155   
        self
  172    156   
    }
  173    157   
  174    158   
    /// Sets the app name for the user agent.
  175    159   
    pub fn set_app_name(&mut self, app_name: AppName) -> &mut Self {
  176    160   
        self.app_name = Some(app_name);
  177    161   
        self
  178    162   
    }
  179    163   
  180    164   
    /// Generate a new-style user agent style header
  181    165   
    ///
  182    166   
    /// This header should be set at `x-amz-user-agent`
  183    167   
    pub fn aws_ua_header(&self) -> String {
  184    168   
        /*
  185    169   
        ABNF for the user agent (see the bottom of the file for complete ABNF):
  186    170   
        ua-string = sdk-metadata RWS
  187    171   
                    [api-metadata RWS]
  188    172   
                    os-metadata RWS
  189    173   
                    language-metadata RWS
  190    174   
                    [env-metadata RWS]
  191    175   
                    *(feat-metadata RWS)
  192    176   
                    *(config-metadata RWS)
  193    177   
                    *(framework-metadata RWS)
  194    178   
                    [appId]
  195    179   
        */
  196    180   
        let mut ua_value = String::new();
  197    181   
        use std::fmt::Write;
  198    182   
        // unwrap calls should never fail because string formatting will always succeed.
  199    183   
        write!(ua_value, "{} ", &self.sdk_metadata).unwrap();
  200    184   
        write!(ua_value, "{} ", &self.api_metadata).unwrap();
  201    185   
        write!(ua_value, "{} ", &self.os_metadata).unwrap();
  202    186   
        write!(ua_value, "{} ", &self.language_metadata).unwrap();
  203    187   
        if let Some(ref env_meta) = self.exec_env_metadata {
  204    188   
            write!(ua_value, "{} ", env_meta).unwrap();
  205    189   
        }
  206    190   
        for feature in &self.feature_metadata {
  207    191   
            write!(ua_value, "{} ", feature).unwrap();
  208    192   
        }
  209    193   
        for config in &self.config_metadata {
  210    194   
            write!(ua_value, "{} ", config).unwrap();
  211    195   
        }
  212    196   
        for framework in &self.framework_metadata {
  213    197   
            write!(ua_value, "{} ", framework).unwrap();
  214    198   
        }
  215         -
        for additional_metadata in &self.additional_metadata {
  216         -
            write!(ua_value, "{} ", additional_metadata).unwrap();
  217         -
        }
  218    199   
        if let Some(app_name) = &self.app_name {
  219    200   
            write!(ua_value, "app/{}", app_name).unwrap();
  220    201   
        }
  221    202   
        if let Some(additional_metadata) = &self.build_env_additional_metadata {
  222    203   
            write!(ua_value, "{}", additional_metadata).unwrap();
  223    204   
        }
  224    205   
        if ua_value.ends_with(' ') {
  225    206   
            ua_value.truncate(ua_value.len() - 1);
  226    207   
        }
  227    208   
        ua_value

tmp-codegen-diff/aws-sdk/sdk/aws-runtime/src/user_agent/interceptor.rs

@@ -1,1 +153,131 @@
    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         -
use std::borrow::Cow;
    7         -
use std::fmt;
    8         -
    9         -
use http::header::{InvalidHeaderValue, USER_AGENT};
   10         -
use http::{HeaderName, HeaderValue};
   11         -
           6  +
use crate::user_agent::{ApiMetadata, AwsUserAgent};
   12      7   
use aws_smithy_runtime_api::box_error::BoxError;
   13         -
use aws_smithy_runtime_api::client::http::HttpClient;
   14      8   
use aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
   15      9   
use aws_smithy_runtime_api::client::interceptors::Intercept;
   16     10   
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
   17     11   
use aws_smithy_types::config_bag::ConfigBag;
   18     12   
use aws_types::app_name::AppName;
   19     13   
use aws_types::os_shim_internal::Env;
   20         -
   21         -
use crate::user_agent::{AdditionalMetadata, ApiMetadata, AwsUserAgent, InvalidMetadataValue};
          14  +
use http::header::{InvalidHeaderValue, USER_AGENT};
          15  +
use http::{HeaderName, HeaderValue};
          16  +
use std::borrow::Cow;
          17  +
use std::fmt;
   22     18   
   23     19   
#[allow(clippy::declare_interior_mutable_const)] // we will never mutate this
   24     20   
const X_AMZ_USER_AGENT: HeaderName = HeaderName::from_static("x-amz-user-agent");
   25     21   
   26     22   
#[derive(Debug)]
   27     23   
enum UserAgentInterceptorError {
   28     24   
    MissingApiMetadata,
   29     25   
    InvalidHeaderValue(InvalidHeaderValue),
   30         -
    InvalidMetadataValue(InvalidMetadataValue),
   31     26   
}
   32     27   
   33     28   
impl std::error::Error for UserAgentInterceptorError {
   34     29   
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
   35     30   
        match self {
   36     31   
            Self::InvalidHeaderValue(source) => Some(source),
   37         -
            Self::InvalidMetadataValue(source) => Some(source),
   38     32   
            Self::MissingApiMetadata => None,
   39     33   
        }
   40     34   
    }
   41     35   
}
   42     36   
   43     37   
impl fmt::Display for UserAgentInterceptorError {
   44     38   
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
   45     39   
        f.write_str(match self {
   46     40   
            Self::InvalidHeaderValue(_) => "AwsUserAgent generated an invalid HTTP header value. This is a bug. Please file an issue.",
   47         -
            Self::InvalidMetadataValue(_) => "AwsUserAgent generated an invalid metadata value. This is a bug. Please file an issue.",
   48     41   
            Self::MissingApiMetadata => "The UserAgentInterceptor requires ApiMetadata to be set before the request is made. This is a bug. Please file an issue.",
   49     42   
        })
   50     43   
    }
   51     44   
}
   52     45   
   53     46   
impl From<InvalidHeaderValue> for UserAgentInterceptorError {
   54     47   
    fn from(err: InvalidHeaderValue) -> Self {
   55     48   
        UserAgentInterceptorError::InvalidHeaderValue(err)
   56     49   
    }
   57     50   
}
   58     51   
   59         -
impl From<InvalidMetadataValue> for UserAgentInterceptorError {
   60         -
    fn from(err: InvalidMetadataValue) -> Self {
   61         -
        UserAgentInterceptorError::InvalidMetadataValue(err)
   62         -
    }
   63         -
}
   64         -
   65     52   
/// Generates and attaches the AWS SDK's user agent to a HTTP request
   66     53   
#[non_exhaustive]
   67     54   
#[derive(Debug, Default)]
   68     55   
pub struct UserAgentInterceptor;
   69     56   
   70     57   
impl UserAgentInterceptor {
   71     58   
    /// Creates a new `UserAgentInterceptor`
   72     59   
    pub fn new() -> Self {
   73     60   
        UserAgentInterceptor
   74     61   
    }
   75     62   
}
   76     63   
   77     64   
fn header_values(
   78     65   
    ua: &AwsUserAgent,
   79     66   
) -> Result<(HeaderValue, HeaderValue), UserAgentInterceptorError> {
   80     67   
    // Pay attention to the extremely subtle difference between ua_header and aws_ua_header below...
   81     68   
    Ok((
   82     69   
        HeaderValue::try_from(ua.ua_header())?,
   83     70   
        HeaderValue::try_from(ua.aws_ua_header())?,
   84     71   
    ))
   85     72   
}
   86     73   
   87     74   
impl Intercept for UserAgentInterceptor {
   88     75   
    fn name(&self) -> &'static str {
   89     76   
        "UserAgentInterceptor"
   90     77   
    }
   91     78   
   92     79   
    fn modify_before_signing(
   93     80   
        &self,
   94     81   
        context: &mut BeforeTransmitInterceptorContextMut<'_>,
   95         -
        runtime_components: &RuntimeComponents,
          82  +
        _runtime_components: &RuntimeComponents,
   96     83   
        cfg: &mut ConfigBag,
   97     84   
    ) -> Result<(), BoxError> {
   98     85   
        // Allow for overriding the user agent by an earlier interceptor (so, for example,
   99     86   
        // tests can use `AwsUserAgent::for_tests()`) by attempting to grab one out of the
  100     87   
        // config bag before creating one.
  101     88   
        let ua: Cow<'_, AwsUserAgent> = cfg
  102     89   
            .load::<AwsUserAgent>()
  103     90   
            .map(Cow::Borrowed)
  104     91   
            .map(Result::<_, UserAgentInterceptorError>::Ok)
  105     92   
            .unwrap_or_else(|| {
  106     93   
                let api_metadata = cfg
  107     94   
                    .load::<ApiMetadata>()
  108     95   
                    .ok_or(UserAgentInterceptorError::MissingApiMetadata)?;
  109     96   
                let mut ua = AwsUserAgent::new_from_environment(Env::real(), api_metadata.clone());
  110     97   
  111     98   
                let maybe_app_name = cfg.load::<AppName>();
  112     99   
                if let Some(app_name) = maybe_app_name {
  113    100   
                    ua.set_app_name(app_name.clone());
  114    101   
                }
  115         -
  116         -
                let maybe_connector_metadata = runtime_components
  117         -
                    .http_client()
  118         -
                    .and_then(|c| c.connector_metadata());
  119         -
                if let Some(connector_metadata) = maybe_connector_metadata {
  120         -
                    let am = AdditionalMetadata::new(Cow::Owned(connector_metadata.to_string()))?;
  121         -
                    ua.add_additional_metadata(am);
  122         -
                }
  123         -
  124    102   
                Ok(Cow::Owned(ua))
  125    103   
            })?;
  126    104   
  127    105   
        let headers = context.request_mut().headers_mut();
  128    106   
        let (user_agent, x_amz_user_agent) = header_values(&ua)?;
  129    107   
        headers.append(USER_AGENT, user_agent);
  130    108   
        headers.append(X_AMZ_USER_AGENT, x_amz_user_agent);
  131    109   
        Ok(())
  132    110   
    }
  133    111   
}

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

@@ -32,32 +92,92 @@
   52     52   
optional = true
   53     53   
version = "0.60.4"
   54     54   
   55     55   
[dependencies.aws-smithy-http]
   56     56   
path = "../aws-smithy-http"
   57     57   
version = "0.60.8"
   58     58   
   59     59   
[dependencies.aws-smithy-runtime-api]
   60     60   
path = "../aws-smithy-runtime-api"
   61     61   
features = ["client"]
   62         -
version = "1.7.0"
          62  +
version = "1.6.3"
   63     63   
   64     64   
[dependencies.aws-smithy-types]
   65     65   
path = "../aws-smithy-types"
   66     66   
version = "1.2.0"
   67     67   
   68     68   
[dependencies.form_urlencoded]
   69     69   
version = "1.0"
   70     70   
optional = true
   71     71   
   72     72   
[dependencies.http0]
@@ -96,96 +132,132 @@
  116    116   
criterion = "0.5"
  117    117   
  118    118   
[dev-dependencies.aws-credential-types]
  119    119   
path = "../aws-credential-types"
  120    120   
features = ["test-util", "hardcoded-credentials"]
  121    121   
version = "1.2.0"
  122    122   
  123    123   
[dev-dependencies.aws-smithy-runtime-api]
  124    124   
path = "../aws-smithy-runtime-api"
  125    125   
features = ["client", "test-util"]
  126         -
version = "1.7.0"
         126  +
version = "1.6.3"
  127    127   
  128    128   
[dev-dependencies.time]
  129    129   
version = "0.3.5"
  130    130   
features = ["parsing"]
  131    131   
[target."cfg(not(any(target_arch = \"powerpc\", target_arch = \"powerpc64\")))".dev-dependencies]
  132    132   
ring = "0.17.5"

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

@@ -1,1 +44,44 @@
    1      1   
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
[package]
    3      3   
name = "aws-smithy-checksums"
    4         -
version = "0.60.10"
           4  +
version = "0.60.9"
    5      5   
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "Zelda Hessler <zhessler@amazon.com>"]
    6      6   
description = "Checksum calculation and verification callbacks"
    7      7   
edition = "2021"
    8      8   
license = "Apache-2.0"
    9      9   
repository = "https://github.com/smithy-lang/smithy-rs"
   10     10   
[package.metadata.docs.rs]
   11     11   
all-features = true
   12     12   
targets = ["x86_64-unknown-linux-gnu"]
   13     13   
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
   14     14   
rustdoc-args = ["--cfg", "docsrs"]
   15     15   
   16     16   
[dependencies]
   17     17   
bytes = "1"
   18         -
crc32c = "=0.6.8"
          18  +
crc32c = "=0.6.5"
   19     19   
crc32fast = "1.3"
   20     20   
hex = "0.4.3"
   21     21   
http = "0.2.8"
   22     22   
http-body = "0.4.4"
   23     23   
md-5 = "0.10"
   24     24   
pin-project-lite = "0.2.9"
   25     25   
sha1 = "0.10"
   26     26   
sha2 = "0.10"
   27     27   
tracing = "0.1"
   28     28   

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

@@ -2,2 +62,62 @@
   22     22   
flate2 = "1.0.30"
   23     23   
pin-project-lite = "0.2.14"
   24     24   
tracing = "0.1.40"
   25     25   
   26     26   
[dependencies.aws-smithy-types]
   27     27   
path = "../aws-smithy-types"
   28     28   
version = "1.2.0"
   29     29   
   30     30   
[dependencies.aws-smithy-runtime-api]
   31     31   
path = "../aws-smithy-runtime-api"
   32         -
version = "1.7.0"
          32  +
version = "1.6.3"
   33     33   
   34     34   
[dependencies.http-0-2]
   35     35   
package = "http"
   36     36   
version = "0.2.9"
   37     37   
optional = true
   38     38   
   39     39   
[dependencies.http-1-0]
   40     40   
package = "http"
   41     41   
version = "1"
   42     42   
optional = true

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

@@ -1,1 +86,86 @@
    9      9   
required-features = ["crypto-aws-lc", "crypto-aws-lc-fips"]
   10     10   
doc-scrape-examples = true
   11     11   
   12     12   
[[example]]
   13     13   
name = "custom-dns"
   14     14   
required-features = ["crypto-ring"]
   15     15   
doc-scrape-examples = true
   16     16   
   17     17   
[package]
   18     18   
name = "aws-smithy-experimental"
   19         -
version = "0.1.2"
          19  +
version = "0.1.1"
   20     20   
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
   21     21   
description = "Experiments for the smithy-rs ecosystem"
   22     22   
edition = "2021"
   23     23   
license = "Apache-2.0"
   24     24   
repository = "https://github.com/smithy-lang/smithy-rs"
   25     25   
[package.metadata.docs.rs]
   26     26   
all-features = true
   27     27   
targets = ["x86_64-unknown-linux-gnu"]
   28     28   
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
   29     29   
rustdoc-args = ["--cfg", "docsrs"]
   30     30   
[package.metadata.cargo-udeps.ignore]
   31     31   
normal = ["fs_extra"]
   32     32   
   33     33   
[features]
   34     34   
crypto-ring = ["rustls/ring"]
   35     35   
crypto-aws-lc = ["rustls/aws_lc_rs"]
   36     36   
crypto-aws-lc-fips = ["rustls/fips"]
   37     37   
   38     38   
[dependencies]
   39     39   
pin-project-lite = "0.2.13"
   40     40   
hyper-util = "0.1.3"
   41     41   
http = "1"
   42     42   
tokio = "1"
   43     43   
h2 = "0.4"
   44     44   
once_cell = "1.18.0"
   45     45   
tracing = "0.1.40"
   46     46   
tower = "0.4.1"
   47     47   
   48     48   
[dependencies.aws-smithy-types]
   49     49   
path = "../aws-smithy-types"
   50     50   
features = ["http-body-1-x"]
   51     51   
version = "1.2.0"
   52     52   
   53     53   
[dependencies.aws-smithy-runtime-api]
   54     54   
features = ["client", "http-1x"]
   55     55   
path = "../aws-smithy-runtime-api"
   56         -
version = "1.7.0"
          56  +
version = "1.6.3"
   57     57   
   58     58   
[dependencies.aws-smithy-async]
   59     59   
path = "../aws-smithy-async"
   60     60   
version = "1.2.1"
   61     61   
   62     62   
[dependencies.hyper]
   63     63   
version = "1"
   64     64   
features = ["client", "http1", "http2"]
   65     65   
   66     66   
[dependencies.hyper-rustls]
   67     67   
version = "0.27"
   68     68   
features = ["http2", "http1", "native-tokio", "tls12"]
   69     69   
default-features = false
   70     70   
   71     71   
[dependencies.rustls]
   72     72   
version = "0.23"
   73     73   
default-features = false
   74     74   
[dev-dependencies.aws-smithy-async]
   75     75   
path = "../aws-smithy-async"
   76     76   
features = ["rt-tokio", "test-util"]
   77     77   
version = "1.2.1"
   78     78   
   79     79   
[dev-dependencies.aws-smithy-runtime]
   80     80   
path = "../aws-smithy-runtime"
   81     81   
features = ["client", "test-util", "connector-hyper-0-14-x"]
   82         -
version = "1.6.0"
          82  +
version = "1.5.7"
   83     83   
   84     84   
[dev-dependencies.tokio]
   85     85   
version = "1"
   86     86   
features = ["full", "test-util"]

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-experimental/src/hyper_1_0.rs

@@ -1,1 +74,76 @@
    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  +
use std::collections::HashMap;
           7  +
use std::error::Error;
           8  +
use std::fmt::Debug;
           9  +
use std::future::Future;
          10  +
use std::net::SocketAddr;
          11  +
use std::pin::Pin;
          12  +
use std::sync::RwLock;
          13  +
use std::task::{Context, Poll};
          14  +
use std::time::Duration;
          15  +
use std::{fmt, vec};
          16  +
          17  +
use client::connect::Connection;
          18  +
use h2::Reason;
          19  +
use http::Uri;
          20  +
use hyper::rt::{Read, Write};
          21  +
use hyper_util::client::legacy as client;
          22  +
use hyper_util::client::legacy::connect::dns::Name;
          23  +
use hyper_util::client::legacy::connect::Connect;
          24  +
use hyper_util::rt::TokioExecutor;
          25  +
use rustls::crypto::CryptoProvider;
          26  +
    6     27   
use aws_smithy_async::future::timeout::TimedOutError;
    7     28   
use aws_smithy_async::rt::sleep::{default_async_sleep, AsyncSleep, SharedAsyncSleep};
    8     29   
use aws_smithy_runtime_api::box_error::BoxError;
    9         -
use aws_smithy_runtime_api::client::connector_metadata::ConnectorMetadata;
   10     30   
use aws_smithy_runtime_api::client::dns::ResolveDns;
   11     31   
use aws_smithy_runtime_api::client::http::{
   12     32   
    HttpClient, HttpConnector, HttpConnectorFuture, HttpConnectorSettings, SharedHttpClient,
   13     33   
    SharedHttpConnector,
   14     34   
};
   15     35   
use aws_smithy_runtime_api::client::orchestrator::{HttpRequest, HttpResponse};
   16     36   
use aws_smithy_runtime_api::client::result::ConnectorError;
   17     37   
use aws_smithy_runtime_api::client::runtime_components::{
   18     38   
    RuntimeComponents, RuntimeComponentsBuilder,
   19     39   
};
   20     40   
use aws_smithy_runtime_api::shared::IntoShared;
   21     41   
use aws_smithy_types::body::SdkBody;
   22     42   
use aws_smithy_types::config_bag::ConfigBag;
   23     43   
use aws_smithy_types::error::display::DisplayErrorContext;
   24     44   
use aws_smithy_types::retry::ErrorKind;
   25         -
use client::connect::Connection;
   26         -
use h2::Reason;
   27         -
use http::Uri;
   28         -
use hyper::rt::{Read, Write};
   29         -
use hyper_util::client::legacy as client;
   30         -
use hyper_util::client::legacy::connect::dns::Name;
   31         -
use hyper_util::client::legacy::connect::Connect;
   32         -
use hyper_util::rt::TokioExecutor;
   33         -
use rustls::crypto::CryptoProvider;
   34         -
use std::borrow::Cow;
   35         -
use std::collections::HashMap;
   36         -
use std::error::Error;
   37         -
use std::future::Future;
   38         -
use std::net::SocketAddr;
   39         -
use std::pin::Pin;
   40         -
use std::sync::RwLock;
   41         -
use std::task::{Context, Poll};
   42         -
use std::time::Duration;
   43         -
use std::{fmt, vec};
   44     45   
          46  +
use crate::hyper_1_0::timeout_middleware::{ConnectTimeout, HttpTimeoutError};
   45     47   
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
   46     48   
#[non_exhaustive]
   47     49   
pub enum CryptoMode {
   48     50   
    #[cfg(feature = "crypto-ring")]
   49     51   
    Ring,
   50     52   
    #[cfg(feature = "crypto-aws-lc")]
   51     53   
    AwsLc,
   52     54   
    #[cfg(feature = "crypto-aws-lc-fips")]
   53     55   
    AwsLcFips,
   54     56   
}
@@ -78,80 +235,243 @@
   98    100   
                .into_iter()
   99    101   
                .map(|ip_addr| SocketAddr::new(ip_addr, 0))
  100    102   
                .collect::<Vec<_>>()
  101    103   
                .into_iter())
  102    104   
        })
  103    105   
    }
  104    106   
}
  105    107   
  106    108   
#[allow(unused_imports)]
  107    109   
mod cached_connectors {
         110  +
  108    111   
    use client::connect::HttpConnector;
         112  +
    use hyper_rustls::HttpsConnector;
  109    113   
    use hyper_util::client::legacy as client;
  110    114   
    use hyper_util::client::legacy::connect::dns::GaiResolver;
  111    115   
  112    116   
    use crate::hyper_1_0::build_connector::make_tls;
  113    117   
    use crate::hyper_1_0::{CryptoMode, Inner};
  114    118   
  115    119   
    #[cfg(feature = "crypto-ring")]
  116    120   
    pub(crate) static HTTPS_NATIVE_ROOTS_RING: once_cell::sync::Lazy<
  117         -
        hyper_rustls::HttpsConnector<HttpConnector>,
         121  +
        HttpsConnector<HttpConnector>,
  118    122   
    > = once_cell::sync::Lazy::new(|| make_tls(GaiResolver::new(), CryptoMode::Ring.provider()));
  119    123   
  120    124   
    #[cfg(feature = "crypto-aws-lc")]
  121    125   
    pub(crate) static HTTPS_NATIVE_ROOTS_AWS_LC: once_cell::sync::Lazy<
  122         -
        hyper_rustls::HttpsConnector<HttpConnector>,
         126  +
        HttpsConnector<HttpConnector>,
  123    127   
    > = once_cell::sync::Lazy::new(|| make_tls(GaiResolver::new(), CryptoMode::AwsLc.provider()));
  124    128   
  125    129   
    #[cfg(feature = "crypto-aws-lc-fips")]
  126    130   
    pub(crate) static HTTPS_NATIVE_ROOTS_AWS_LC_FIPS: once_cell::sync::Lazy<
  127         -
        hyper_rustls::HttpsConnector<HttpConnector>,
         131  +
        HttpsConnector<HttpConnector>,
  128    132   
    > = once_cell::sync::Lazy::new(|| {
  129    133   
        make_tls(GaiResolver::new(), CryptoMode::AwsLcFips.provider())
  130    134   
    });
  131    135   
  132    136   
    pub(super) fn cached_https(mode: Inner) -> hyper_rustls::HttpsConnector<HttpConnector> {
  133    137   
        match mode {
  134    138   
            #[cfg(feature = "crypto-ring")]
  135    139   
            Inner::Standard(CryptoMode::Ring) => HTTPS_NATIVE_ROOTS_RING.clone(),
  136    140   
            #[cfg(feature = "crypto-aws-lc")]
  137    141   
            Inner::Standard(CryptoMode::AwsLc) => HTTPS_NATIVE_ROOTS_AWS_LC.clone(),
  138    142   
            #[cfg(feature = "crypto-aws-lc-fips")]
  139    143   
            Inner::Standard(CryptoMode::AwsLcFips) => HTTPS_NATIVE_ROOTS_AWS_LC_FIPS.clone(),
  140    144   
            #[allow(unreachable_patterns)]
  141    145   
            Inner::Standard(_) => unreachable!("unexpected mode"),
  142    146   
            Inner::Custom(provider) => make_tls(GaiResolver::new(), provider),
  143    147   
        }
  144    148   
    }
  145    149   
}
  146    150   
  147    151   
mod build_connector {
  148         -
    use crate::hyper_1_0::{HyperUtilResolver, Inner};
  149         -
    use aws_smithy_runtime_api::client::dns::ResolveDns;
         152  +
    use std::sync::Arc;
         153  +
  150    154   
    use client::connect::HttpConnector;
         155  +
    use hyper_rustls::HttpsConnector;
  151    156   
    use hyper_util::client::legacy as client;
  152    157   
    use rustls::crypto::CryptoProvider;
  153         -
    use std::sync::Arc;
         158  +
         159  +
    use aws_smithy_runtime_api::client::dns::ResolveDns;
         160  +
         161  +
    use crate::hyper_1_0::{HyperUtilResolver, Inner};
  154    162   
  155    163   
    fn restrict_ciphers(base: CryptoProvider) -> CryptoProvider {
  156    164   
        let suites = &[
  157    165   
            rustls::CipherSuite::TLS13_AES_256_GCM_SHA384,
  158    166   
            rustls::CipherSuite::TLS13_AES_128_GCM_SHA256,
  159    167   
            // TLS1.2 suites
  160    168   
            rustls::CipherSuite::TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
  161    169   
            rustls::CipherSuite::TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
  162    170   
            rustls::CipherSuite::TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
  163    171   
            rustls::CipherSuite::TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
  164    172   
            rustls::CipherSuite::TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
  165    173   
        ];
  166    174   
        let supported_suites = suites
  167    175   
            .iter()
  168    176   
            .flat_map(|suite| {
  169    177   
                base.cipher_suites
  170    178   
                    .iter()
  171    179   
                    .find(|s| &s.suite() == suite)
  172    180   
                    .cloned()
  173    181   
            })
  174    182   
            .collect::<Vec<_>>();
  175    183   
        CryptoProvider {
  176    184   
            cipher_suites: supported_suites,
  177    185   
            ..base
  178    186   
        }
  179    187   
    }
  180    188   
  181    189   
    pub(crate) fn make_tls<R>(
  182    190   
        resolver: R,
  183    191   
        crypto_provider: CryptoProvider,
  184         -
    ) -> hyper_rustls::HttpsConnector<HttpConnector<R>> {
         192  +
    ) -> HttpsConnector<HttpConnector<R>> {
  185    193   
        use hyper_rustls::ConfigBuilderExt;
  186    194   
        let mut base_connector = HttpConnector::new_with_resolver(resolver);
  187    195   
        base_connector.enforce_http(false);
  188    196   
        hyper_rustls::HttpsConnectorBuilder::new()
  189    197   
               .with_tls_config(
  190    198   
                rustls::ClientConfig::builder_with_provider(Arc::new(restrict_ciphers(crypto_provider)))
  191    199   
                    .with_safe_default_protocol_versions()
  192    200   
                    .expect("Error with the TLS configuration. Please file a bug report under https://github.com/smithy-lang/smithy-rs/issues.")
  193    201   
                    .with_native_roots().expect("error with TLS configuration.")
  194    202   
                    .with_no_client_auth()
  195    203   
            )
  196    204   
            .https_or_http()
  197    205   
            .enable_http1()
  198    206   
            .enable_http2()
  199    207   
            .wrap_connector(base_connector)
  200    208   
    }
  201    209   
  202    210   
    pub(super) fn https_with_resolver<R: ResolveDns>(
  203    211   
        crypto_provider: Inner,
  204    212   
        resolver: R,
  205         -
    ) -> hyper_rustls::HttpsConnector<HttpConnector<HyperUtilResolver<R>>> {
         213  +
    ) -> HttpsConnector<HttpConnector<HyperUtilResolver<R>>> {
  206    214   
        make_tls(HyperUtilResolver { resolver }, crypto_provider.provider())
  207    215   
    }
  208    216   
}
  209    217   
  210    218   
/// [`HttpConnector`] that uses [`hyper`] to make HTTP requests.
  211    219   
///
  212    220   
/// This connector also implements socket connect and read timeouts.
  213    221   
///
  214    222   
/// This shouldn't be used directly in most cases.
  215    223   
/// See the docs on [`HyperClientBuilder`] for examples of how
@@ -257,265 +317,325 @@
  277    285   
        self.build(connector)
  278    286   
    }
  279    287   
}
  280    288   
  281    289   
impl<Any> HyperConnectorBuilder<Any> {
  282    290   
    /// Create a [`HyperConnector`] from this builder and a given connector.
  283    291   
    pub(crate) fn build<C>(self, tcp_connector: C) -> HyperConnector
  284    292   
    where
  285    293   
        C: Send + Sync + 'static,
  286    294   
        C: Clone,
  287         -
        C: tower::Service<Uri>,
         295  +
        C: tower::Service<http::Uri>,
  288    296   
        C::Response: Read + Write + Connection + Send + Sync + Unpin,
  289    297   
        C: Connect,
  290    298   
        C::Future: Unpin + Send + 'static,
  291    299   
        C::Error: Into<BoxError>,
  292    300   
    {
  293    301   
        let client_builder =
  294    302   
            self.client_builder
  295    303   
                .unwrap_or(hyper_util::client::legacy::Builder::new(
  296    304   
                    TokioExecutor::new(),
  297    305   
                ));
@@ -405,413 +561,569 @@
  425    433   
    } else {
  426    434   
        None
  427    435   
    }
  428    436   
}*/
  429    437   
  430    438   
impl<C> HttpConnector for Adapter<C>
  431    439   
where
  432    440   
    C: Clone + Send + Sync + 'static,
  433    441   
    C: tower::Service<Uri>,
  434    442   
    C::Response: Connection + Read + Write + Unpin + 'static,
  435         -
    timeout_middleware::ConnectTimeout<C>: Connect,
         443  +
    ConnectTimeout<C>: Connect,
  436    444   
    C::Future: Unpin + Send + 'static,
  437    445   
    C::Error: Into<BoxError>,
  438    446   
{
  439    447   
    fn call(&self, request: HttpRequest) -> HttpConnectorFuture {
  440    448   
        let request = match request.try_into_http1x() {
  441    449   
            Ok(request) => request,
  442    450   
            Err(err) => {
  443    451   
                return HttpConnectorFuture::ready(Err(ConnectorError::user(err.into())));
  444    452   
            }
  445    453   
        };
  446    454   
        /*let capture_connection = capture_connection(&mut request);
  447    455   
        if let Some(capture_smithy_connection) =
  448    456   
            request.extensions().get::<CaptureSmithyConnection>()
  449    457   
        {
  450    458   
            capture_smithy_connection
  451    459   
                .set_connection_retriever(move || extract_smithy_connection(&capture_connection));
  452    460   
        }*/
  453    461   
        let mut client = self.client.clone();
  454    462   
        use tower::Service;
  455    463   
        let fut = client.call(request);
  456    464   
        HttpConnectorFuture::new(async move {
  457    465   
            let response = fut
  458    466   
                .await
  459    467   
                .map_err(downcast_error)?
  460    468   
                .map(SdkBody::from_body_1_x);
  461    469   
            match HttpResponse::try_from(response) {
  462    470   
                Ok(response) => Ok(response),
  463    471   
                Err(err) => Err(ConnectorError::other(err.into(), None)),
  464    472   
            }
  465    473   
        })
  466    474   
    }
  467    475   
}
  468    476   
  469    477   
/// Downcast errors coming out of hyper into an appropriate `ConnectorError`
  470    478   
fn downcast_error(err: BoxError) -> ConnectorError {
  471    479   
    // is a `TimedOutError` (from aws_smithy_async::timeout) in the chain? if it is, this is a timeout
  472    480   
    if find_source::<TimedOutError>(err.as_ref()).is_some() {
  473    481   
        return ConnectorError::timeout(err);
  474    482   
    }
  475    483   
    // is the top of chain error actually already a `ConnectorError`? return that directly
  476    484   
    let err = match err.downcast::<ConnectorError>() {
  477    485   
        Ok(connector_error) => return *connector_error,
  478    486   
        Err(box_error) => box_error,
  479    487   
    };
  480    488   
    // generally, the top of chain will probably be a hyper error. Go through a set of hyper specific
  481    489   
    // error classifications
  482    490   
    let err = match find_source::<hyper::Error>(err.as_ref()) {
  483    491   
        Some(hyper_error) => return to_connector_error(hyper_error)(err),
  484    492   
        None => err,
  485    493   
    };
  486    494   
  487    495   
    // otherwise, we have no idea!
  488    496   
    ConnectorError::other(err, None)
  489    497   
}
  490    498   
  491    499   
/// Convert a [`hyper::Error`] into a [`ConnectorError`]
  492    500   
fn to_connector_error(err: &hyper::Error) -> fn(BoxError) -> ConnectorError {
  493         -
    if err.is_timeout() || find_source::<timeout_middleware::HttpTimeoutError>(err).is_some() {
         501  +
    if err.is_timeout() || find_source::<HttpTimeoutError>(err).is_some() {
  494    502   
        return ConnectorError::timeout;
  495    503   
    }
  496    504   
    if err.is_user() {
  497    505   
        return ConnectorError::user;
  498    506   
    }
  499    507   
    if err.is_closed() || err.is_canceled() || find_source::<std::io::Error>(err).is_some() {
  500    508   
        return ConnectorError::io;
  501    509   
    }
  502    510   
    // We sometimes receive this from S3: hyper::Error(IncompleteMessage)
  503    511   
    if err.is_incomplete_message() {
  504    512   
        return |err: BoxError| ConnectorError::other(err, Some(ErrorKind::TransientError));
  505    513   
    }
  506    514   
  507    515   
    if let Some(h2_err) = find_source::<h2::Error>(err) {
  508    516   
        if h2_err.is_go_away()
  509    517   
            || (h2_err.is_reset() && h2_err.reason() == Some(Reason::REFUSED_STREAM))
  510    518   
        {
  511    519   
            return ConnectorError::io;
  512    520   
        }
  513    521   
    }
  514    522   
  515    523   
    tracing::warn!(err = %DisplayErrorContext(&err), "unrecognized error from Hyper. If this error should be retried, please file an issue.");
  516    524   
    |err: BoxError| ConnectorError::other(err, None)
  517    525   
}
  518    526   
  519    527   
fn find_source<'a, E: Error + 'static>(err: &'a (dyn Error + 'static)) -> Option<&'a E> {
  520    528   
    let mut next = Some(err);
  521    529   
    while let Some(err) = next {
  522    530   
        if let Some(matching_err) = err.downcast_ref::<E>() {
  523    531   
            return Some(matching_err);
  524    532   
        }
  525    533   
        next = err.source();
  526    534   
    }
  527    535   
    None
  528    536   
}
  529    537   
  530    538   
// TODO(https://github.com/awslabs/aws-sdk-rust/issues/1090): CacheKey must also include ptr equality to any
  531         -
// runtime components that are used—sleep_impl as a base (unless we prohibit overriding sleep impl)
         539  +
// runtime components that are used—sleep_impl as a base (unless we prohibit overridding sleep impl)
  532    540   
// If we decide to put a DnsResolver in RuntimeComponents, then we'll need to handle that as well.
  533    541   
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
  534    542   
struct CacheKey {
  535    543   
    connect_timeout: Option<Duration>,
  536    544   
    read_timeout: Option<Duration>,
  537    545   
}
  538    546   
  539    547   
impl From<&HttpConnectorSettings> for CacheKey {
  540    548   
    fn from(value: &HttpConnectorSettings) -> Self {
  541    549   
        Self {
@@ -588,596 +651,655 @@
  608    616   
        _: &ConfigBag,
  609    617   
    ) -> Result<(), BoxError> {
  610    618   
        // Initialize the TCP connector at this point so that native certs load
  611    619   
        // at client initialization time instead of upon first request. We do it
  612    620   
        // here rather than at construction so that it won't run if this is not
  613    621   
        // the selected HTTP client for the base config (for example, if this was
  614    622   
        // the default HTTP client, and it was overridden by a later plugin).
  615    623   
        let _ = (self.tcp_connector_fn)();
  616    624   
        Ok(())
  617    625   
    }
  618         -
  619         -
    fn connector_metadata(&self) -> Option<ConnectorMetadata> {
  620         -
        Some(ConnectorMetadata::new("hyper", Some(Cow::Borrowed("1.x"))))
  621         -
    }
  622    626   
}
  623    627   
  624    628   
/// Builder for a hyper-backed [`HttpClient`] implementation.
  625    629   
///
  626    630   
/// This builder can be used to customize the underlying TCP connector used, as well as
  627    631   
/// hyper client configuration.
  628    632   
///
  629    633   
/// # Examples
  630    634   
///
  631    635   
/// Construct a Hyper client with the RusTLS TLS implementation.

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

@@ -10,10 +61,61 @@
   30     30   
futures-core = "0.3.29"
   31     31   
   32     32   
[dependencies.aws-smithy-eventstream]
   33     33   
path = "../aws-smithy-eventstream"
   34     34   
optional = true
   35     35   
version = "0.60.4"
   36     36   
   37     37   
[dependencies.aws-smithy-runtime-api]
   38     38   
path = "../aws-smithy-runtime-api"
   39     39   
features = ["client", "http-02x"]
   40         -
version = "1.7.0"
          40  +
version = "1.6.3"
   41     41   
   42     42   
[dependencies.aws-smithy-types]
   43     43   
path = "../aws-smithy-types"
   44     44   
features = ["byte-stream-poll-next", "http-body-0-4-x"]
   45     45   
version = "1.2.0"
   46     46   
   47     47   
[dev-dependencies]
   48     48   
async-stream = "0.3"
   49     49   
proptest = "1"
   50     50