AWS SDK

AWS SDK

rev. c177bc6112cbc5135de1e24e8d7509ab305c676a

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.8.3", features = ["behavior-version-latest"] }
          27  +
    aws-config = { version= "1.8.4", 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 +157,157 @@
    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.8.3"
           4  +
version = "1.8.4"
    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   
[package.metadata.cargo-udeps.ignore]
   20     20   
normal = ["proc-macro2"]
   21     21   
   22     22   
[features]
   23     23   
behavior-version-latest = []
   24     24   
credentials-process = ["tokio/process"]
   25     25   
default = ["default-https-client", "rt-tokio", "credentials-process", "sso"]
   26     26   
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-runtime/rt-tokio", "tokio/rt"]
   27     27   
client-hyper = ["aws-smithy-runtime/default-https-client"]
   28     28   
rustls = ["client-hyper"]
   29     29   
default-https-client = ["aws-smithy-runtime/default-https-client"]
   30     30   
sso = ["dep:aws-sdk-sso", "dep:aws-sdk-ssooidc", "dep:ring", "dep:hex", "dep:zeroize", "aws-smithy-runtime-api/http-auth"]
   31         -
test-util = ["aws-runtime/test-util"]
          31  +
test-util = ["aws-runtime/test-util", "aws-smithy-http-client/test-util", "aws-smithy-async/test-util"]
   32     32   
allow-compilation = []
   33     33   
   34     34   
[dependencies]
   35     35   
bytes = "1.1.0"
   36     36   
http = "1"
   37     37   
url = "2.5.4"
   38     38   
fastrand = "2.3.0"
   39     39   
   40     40   
[dependencies.aws-credential-types]
   41     41   
path = "../aws-credential-types"
   42     42   
features = ["test-util"]
   43     43   
version = "1.2.5"
   44     44   
   45     45   
[dependencies.aws-runtime]
   46     46   
path = "../aws-runtime"
   47     47   
version = "1.5.10"
   48     48   
   49     49   
[dependencies.aws-sdk-sts]
   50     50   
path = "../sts"
   51     51   
default-features = false
   52     52   
version = "0.0.0-local"
   53     53   
   54     54   
[dependencies.aws-smithy-async]
   55     55   
path = "../aws-smithy-async"
   56     56   
version = "1.2.5"
   57     57   
   58     58   
[dependencies.aws-smithy-http]
   59     59   
path = "../aws-smithy-http"
   60     60   
version = "0.62.2"
   61     61   
          62  +
[dependencies.aws-smithy-http-client]
          63  +
path = "../aws-smithy-http-client"
          64  +
features = ["default-client"]
          65  +
version = "1.0.6"
          66  +
   62     67   
[dependencies.aws-smithy-json]
   63     68   
path = "../aws-smithy-json"
   64     69   
version = "0.61.4"
   65     70   
   66     71   
[dependencies.aws-smithy-runtime]
   67     72   
path = "../aws-smithy-runtime"
   68     73   
features = ["client"]
   69     74   
version = "1.8.6"
   70     75   
   71     76   
[dependencies.aws-smithy-runtime-api]
   72     77   
path = "../aws-smithy-runtime-api"
   73     78   
features = ["client"]
   74         -
version = "1.8.5"
          79  +
version = "1.8.6"
   75     80   
   76     81   
[dependencies.aws-smithy-types]
   77     82   
path = "../aws-smithy-types"
   78     83   
version = "1.3.2"
   79     84   
   80     85   
[dependencies.aws-types]
   81     86   
path = "../aws-types"
   82     87   
version = "1.3.8"
   83     88   
   84     89   
[dependencies.time]
   85     90   
version = "0.3.4"
   86     91   
features = ["parsing"]
   87     92   
   88     93   
[dependencies.tokio]
   89     94   
version = "1.13.1"
   90     95   
features = ["sync"]
   91     96   
   92     97   
[dependencies.tracing]
   93     98   
version = "0.1"
   94     99   
   95    100   
[dependencies.aws-sdk-sso]
   96    101   
path = "../sso"
   97    102   
default-features = false
   98    103   
optional = true
   99    104   
version = "0.0.0-local"
  100    105   
  101    106   
[dependencies.ring]
  102    107   
version = "0.17.5"
  103    108   
optional = true
  104    109   
  105    110   
[dependencies.hex]
  106    111   
version = "0.4.3"
  107    112   
optional = true
  108    113   
  109    114   
[dependencies.zeroize]
  110    115   
version = "1"
  111    116   
optional = true
  112    117   
  113    118   
[dependencies.aws-sdk-ssooidc]
  114    119   
path = "../ssooidc"
  115    120   
default-features = false
  116    121   
optional = true
  117    122   
version = "0.0.0-local"
  118    123   
  119    124   
[dev-dependencies]
  120    125   
tracing-test = "0.2.4"
  121    126   
serde_json = "1"
  122    127   
  123    128   
[dev-dependencies.aws-smithy-async]
  124    129   
path = "../aws-smithy-async"
  125    130   
features = ["rt-tokio", "test-util"]
  126    131   
version = "1.2.5"
  127    132   
  128    133   
[dev-dependencies.aws-smithy-runtime]
  129    134   
path = "../aws-smithy-runtime"
  130    135   
features = ["client", "test-util"]
  131    136   
version = "1.8.6"
  132    137   
  133         -
[dev-dependencies.aws-smithy-http-client]
  134         -
path = "../aws-smithy-http-client"
  135         -
features = ["default-client", "test-util"]
  136         -
version = "1.0.6"
  137         -
  138    138   
[dev-dependencies.aws-smithy-runtime-api]
  139    139   
path = "../aws-smithy-runtime-api"
  140    140   
features = ["test-util"]
  141         -
version = "1.8.5"
         141  +
version = "1.8.6"
  142    142   
  143    143   
[dev-dependencies.futures-util]
  144    144   
version = "0.3.29"
  145    145   
default-features = false
  146    146   
  147    147   
[dev-dependencies.tracing-subscriber]
  148    148   
version = "0.3.16"
  149    149   
features = ["fmt", "json"]
  150    150   
  151    151   
[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.7"
   20     20   
   21     21   
[dependencies.aws-config]
   22     22   
path = ".."
   23         -
version = "1.8.3"
          23  +
version = "1.8.4"
   24     24   
   25     25   
[dependencies.aws-types]
   26     26   
path = "../../../sdk/build/aws-sdk/sdk/aws-types"
   27     27   
version = "1.3.8"
   28     28   
   29     29   
[workspace]
   30     30   
members = ["."]

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

@@ -1,1 +42,43 @@
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
#![cfg(feature = "credentials-process")]
    7      7   
    8      8   
//! Credentials Provider for external process
    9      9   
   10     10   
use crate::json_credentials::{json_parse_loop, InvalidJsonCredentials};
   11     11   
use crate::sensitive_command::CommandWithSensitiveArgs;
   12     12   
use aws_credential_types::attributes::AccountId;
          13  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
   13     14   
use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials};
   14     15   
use aws_credential_types::Credentials;
   15     16   
use aws_smithy_json::deserialize::Token;
   16     17   
use std::borrow::Cow;
   17     18   
use std::process::Command;
   18     19   
use std::time::SystemTime;
   19     20   
use time::format_description::well_known::Rfc3339;
   20     21   
use time::OffsetDateTime;
   21     22   
   22     23   
/// External process credentials provider
@@ -95,96 +162,168 @@
  115    116   
            )));
  116    117   
        }
  117    118   
  118    119   
        let output = std::str::from_utf8(&output.stdout).map_err(|e| {
  119    120   
            CredentialsError::provider_error(format!(
  120    121   
                "Error retrieving credentials from external process: could not decode output as UTF-8: {}",
  121    122   
                e
  122    123   
            ))
  123    124   
        })?;
  124    125   
  125         -
        parse_credential_process_json_credentials(output, self.profile_account_id.as_ref()).map_err(
  126         -
            |invalid| {
         126  +
        parse_credential_process_json_credentials(output, self.profile_account_id.as_ref())
         127  +
            .map(|mut creds| {
         128  +
                creds
         129  +
                    .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
         130  +
                    .push(AwsCredentialFeature::CredentialsProcess);
         131  +
                creds
         132  +
            })
         133  +
            .map_err(|invalid| {
  127    134   
                CredentialsError::provider_error(format!(
  128    135   
                "Error retrieving credentials from external process, could not parse response: {}",
  129    136   
                invalid
  130    137   
            ))
  131         -
            },
  132         -
        )
         138  +
            })
  133    139   
    }
  134    140   
}
  135    141   
  136    142   
#[derive(Debug, Default)]
  137    143   
pub(crate) struct Builder {
  138    144   
    command: Option<CommandWithSensitiveArgs<String>>,
  139    145   
    profile_account_id: Option<AccountId>,
  140    146   
}
  141    147   
  142    148   
impl Builder {

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/environment/credentials.rs

@@ -1,1 +106,120 @@
    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 std::env::VarError;
    7      7   
    8      8   
use aws_credential_types::attributes::AccountId;
           9  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
    9     10   
use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials};
   10     11   
use aws_credential_types::Credentials;
   11     12   
use aws_types::os_shim_internal::Env;
   12     13   
   13     14   
/// Load Credentials from Environment Variables
   14     15   
///
   15     16   
/// `EnvironmentVariableCredentialsProvider` uses the following variables:
   16     17   
/// - `AWS_ACCESS_KEY_ID`
   17     18   
/// - `AWS_SECRET_ACCESS_KEY` with fallback to `SECRET_ACCESS_KEY`
   18     19   
/// - `AWS_SESSION_TOKEN` (optional)
   19     20   
/// - `AWS_ACCOUNT_ID` (optional)
   20     21   
#[derive(Debug, Clone)]
   21     22   
pub struct EnvironmentVariableCredentialsProvider {
   22     23   
    env: Env,
   23     24   
}
   24     25   
   25     26   
impl EnvironmentVariableCredentialsProvider {
   26     27   
    fn credentials(&self) -> provider::Result {
   27     28   
        let access_key = self
   28     29   
            .env
   29     30   
            .get("AWS_ACCESS_KEY_ID")
   30     31   
            .and_then(err_if_blank)
   31     32   
            .map_err(to_cred_error)?;
   32     33   
        let secret_key = self
   33     34   
            .env
   34     35   
            .get("AWS_SECRET_ACCESS_KEY")
   35     36   
            .and_then(err_if_blank)
   36     37   
            .or_else(|_| self.env.get("SECRET_ACCESS_KEY"))
   37     38   
            .and_then(err_if_blank)
   38     39   
            .map_err(to_cred_error)?;
   39     40   
        let session_token =
   40     41   
            self.env
   41     42   
                .get("AWS_SESSION_TOKEN")
   42     43   
                .ok()
   43     44   
                .and_then(|token| match token.trim() {
   44     45   
                    "" => None,
   45     46   
                    s => Some(s.to_string()),
   46     47   
                });
   47     48   
        let account_id =
   48     49   
            self.env
   49     50   
                .get("AWS_ACCOUNT_ID")
   50     51   
                .ok()
   51     52   
                .and_then(|account_id| match account_id.trim() {
   52     53   
                    "" => None,
   53     54   
                    s => Some(AccountId::from(s)),
   54     55   
                });
   55     56   
        let mut builder = Credentials::builder()
   56     57   
            .access_key_id(access_key)
   57     58   
            .secret_access_key(secret_key)
   58     59   
            .provider_name(ENV_PROVIDER);
   59     60   
        builder.set_session_token(session_token);
   60     61   
        builder.set_account_id(account_id);
   61         -
        Ok(builder.build())
          62  +
        let mut creds = builder.build();
          63  +
        creds
          64  +
            .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
          65  +
            .push(AwsCredentialFeature::CredentialsEnvVars);
          66  +
        Ok(creds)
   62     67   
    }
   63     68   
}
   64     69   
   65     70   
impl EnvironmentVariableCredentialsProvider {
   66     71   
    /// Create a `EnvironmentVariableCredentialsProvider`
   67     72   
    pub fn new() -> Self {
   68     73   
        Self::new_with_env(Env::real())
   69     74   
    }
   70     75   
   71     76   
    /// Create a new `EnvironmentVariableCredentialsProvider` with `Env` overridden
   72     77   
    ///
   73     78   
    /// This function is intended for tests that mock out the process environment.
          79  +
    #[cfg(not(feature = "test-util"))]
   74     80   
    pub(crate) fn new_with_env(env: Env) -> Self {
   75     81   
        Self { env }
   76     82   
    }
          83  +
          84  +
    /// Create a new `EnvironmentVariableCredentialsProvider` with `Env` overridden
          85  +
    ///
          86  +
    /// This function is intended for tests that mock out the process environment.
          87  +
    #[cfg(feature = "test-util")]
          88  +
    pub fn new_with_env(env: Env) -> Self {
          89  +
        Self { env }
          90  +
    }
   77     91   
}
   78     92   
   79     93   
impl Default for EnvironmentVariableCredentialsProvider {
   80     94   
    fn default() -> Self {
   81     95   
        Self::new()
   82     96   
    }
   83     97   
}
   84     98   
   85     99   
const ENV_PROVIDER: &str = "EnvironmentVariable";
   86    100   

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

@@ -1,1 +87,97 @@
    4      4   
 */
    5      5   
    6      6   
//! Generalized HTTP credential provider. Currently, this cannot be used directly and can only
    7      7   
//! be used via the ECS credential provider.
    8      8   
//!
    9      9   
//! Future work will stabilize this interface and enable it to be used directly.
   10     10   
   11     11   
use crate::json_credentials::{parse_json_credentials, JsonCredentials, RefreshableCredentials};
   12     12   
use crate::provider_config::ProviderConfig;
   13     13   
use aws_credential_types::attributes::AccountId;
          14  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
   14     15   
use aws_credential_types::provider::{self, error::CredentialsError};
   15     16   
use aws_credential_types::Credentials;
   16     17   
use aws_smithy_runtime::client::metrics::MetricsRuntimePlugin;
   17     18   
use aws_smithy_runtime::client::orchestrator::operation::Operation;
   18     19   
use aws_smithy_runtime::client::retries::classifiers::{
   19     20   
    HttpStatusCodeClassifier, TransientErrorClassifier,
   20     21   
};
   21     22   
use aws_smithy_runtime_api::client::http::HttpConnectorSettings;
   22     23   
use aws_smithy_runtime_api::client::interceptors::context::{Error, InterceptorContext};
   23     24   
use aws_smithy_runtime_api::client::orchestrator::{
   24     25   
    HttpResponse, Metadata, OrchestratorError, SensitiveOutput,
   25     26   
};
   26     27   
use aws_smithy_runtime_api::client::result::SdkError;
   27     28   
use aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry;
   28     29   
use aws_smithy_runtime_api::client::retries::classifiers::RetryAction;
   29     30   
use aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin;
   30     31   
use aws_smithy_types::body::SdkBody;
   31     32   
use aws_smithy_types::config_bag::Layer;
   32     33   
use aws_smithy_types::retry::RetryConfig;
   33     34   
use aws_smithy_types::timeout::TimeoutConfig;
   34     35   
use http::header::{ACCEPT, AUTHORIZATION};
   35     36   
use http::HeaderValue;
   36     37   
use std::time::Duration;
   37     38   
   38     39   
const DEFAULT_READ_TIMEOUT: Duration = Duration::from_secs(5);
   39     40   
const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(2);
   40     41   
   41     42   
#[derive(Debug)]
   42     43   
struct HttpProviderAuth {
   43     44   
    auth: Option<HeaderValue>,
   44     45   
}
   45     46   
   46     47   
#[derive(Debug)]
   47     48   
pub(crate) struct HttpCredentialProvider {
   48     49   
    operation: Operation<HttpProviderAuth, Credentials, CredentialsError>,
   49     50   
}
   50     51   
   51     52   
impl HttpCredentialProvider {
   52     53   
    pub(crate) fn builder() -> Builder {
   53     54   
        Builder::default()
   54     55   
    }
   55     56   
   56     57   
    pub(crate) async fn credentials(&self, auth: Option<HeaderValue>) -> provider::Result {
   57         -
        let credentials = self.operation.invoke(HttpProviderAuth { auth }).await;
          58  +
        let credentials =
          59  +
            self.operation
          60  +
                .invoke(HttpProviderAuth { auth })
          61  +
                .await
          62  +
                .map(|mut creds| {
          63  +
                    creds
          64  +
                        .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
          65  +
                        .push(AwsCredentialFeature::CredentialsHttp);
          66  +
                    creds
          67  +
                });
   58     68   
        match credentials {
   59     69   
            Ok(creds) => Ok(creds),
   60     70   
            Err(SdkError::ServiceError(context)) => Err(context.into_err()),
   61     71   
            Err(other) => Err(CredentialsError::unhandled(other)),
   62     72   
        }
   63     73   
    }
   64     74   
}
   65     75   
   66     76   
#[derive(Default)]
   67     77   
pub(crate) struct Builder {

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/imds/client.rs

@@ -614,614 +775,790 @@
  634    634   
        } else {
  635    635   
            // This is the default behavior.
  636    636   
            // Don't retry timeouts for IMDS, or else it will take ~30 seconds for the default
  637    637   
            // credentials provider chain to fail to provide credentials.
  638    638   
            // Also don't retry non-responses.
  639    639   
            RetryAction::NoActionIndicated
  640    640   
        }
  641    641   
    }
  642    642   
}
  643    643   
  644         -
#[cfg(test)]
  645         -
pub(crate) mod test {
  646         -
    use crate::imds::client::{Client, EndpointMode, ImdsResponseRetryClassifier};
         644  +
/// Utilities for testing IMDS clients
         645  +
#[cfg(feature = "test-util")]
         646  +
pub mod test_util {
  647    647   
    use crate::provider_config::ProviderConfig;
  648         -
    use aws_smithy_async::rt::sleep::TokioSleep;
  649         -
    use aws_smithy_async::test_util::{instant_time_and_sleep, InstantSleep};
  650         -
    use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
  651         -
    use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
  652         -
    use aws_smithy_runtime_api::client::interceptors::context::{
  653         -
        Input, InterceptorContext, Output,
  654         -
    };
  655         -
    use aws_smithy_runtime_api::client::orchestrator::{
  656         -
        HttpRequest, HttpResponse, OrchestratorError,
  657         -
    };
  658         -
    use aws_smithy_runtime_api::client::result::ConnectorError;
  659         -
    use aws_smithy_runtime_api::client::retries::classifiers::{
  660         -
        ClassifyRetry, RetryAction, SharedRetryClassifier,
  661         -
    };
         648  +
    use aws_smithy_async::test_util::InstantSleep;
         649  +
    use aws_smithy_http_client::test_util::StaticReplayClient;
         650  +
    use aws_smithy_runtime_api::client::orchestrator::{HttpRequest, HttpResponse};
  662    651   
    use aws_smithy_types::body::SdkBody;
  663         -
    use aws_smithy_types::error::display::DisplayErrorContext;
  664         -
    use aws_types::os_shim_internal::{Env, Fs};
  665         -
    use http::header::USER_AGENT;
  666    652   
    use http::Uri;
  667         -
    use serde::Deserialize;
  668         -
    use std::collections::HashMap;
  669         -
    use std::error::Error;
  670         -
    use std::io;
  671         -
    use std::time::SystemTime;
  672         -
    use std::time::{Duration, UNIX_EPOCH};
  673         -
    use tracing_test::traced_test;
  674         -
  675         -
    macro_rules! assert_full_error_contains {
  676         -
        ($err:expr, $contains:expr) => {
  677         -
            let err = $err;
  678         -
            let message = format!(
  679         -
                "{}",
  680         -
                aws_smithy_types::error::display::DisplayErrorContext(&err)
  681         -
            );
  682         -
            assert!(
  683         -
                message.contains($contains),
  684         -
                "Error message '{message}' didn't contain text '{}'",
  685         -
                $contains
  686         -
            );
  687         -
        };
  688         -
    }
  689    653   
  690         -
    const TOKEN_A: &str = "AQAEAFTNrA4eEGx0AQgJ1arIq_Cc-t4tWt3fB0Hd8RKhXlKc5ccvhg==";
  691         -
    const TOKEN_B: &str = "alternatetoken==";
  692         -
  693         -
    pub(crate) fn token_request(base: &str, ttl: u32) -> HttpRequest {
         654  +
    /// Create a simple token request
         655  +
    pub fn token_request(base: &str, ttl: u32) -> HttpRequest {
  694    656   
        http::Request::builder()
  695    657   
            .uri(format!("{}/latest/api/token", base))
  696    658   
            .header("x-aws-ec2-metadata-token-ttl-seconds", ttl)
  697    659   
            .method("PUT")
  698    660   
            .body(SdkBody::empty())
  699    661   
            .unwrap()
  700    662   
            .try_into()
  701    663   
            .unwrap()
  702    664   
    }
  703    665   
  704         -
    pub(crate) fn token_response(ttl: u32, token: &'static str) -> HttpResponse {
         666  +
    /// Create a simple token response
         667  +
    pub fn token_response(ttl: u32, token: &'static str) -> HttpResponse {
  705    668   
        HttpResponse::try_from(
  706    669   
            http::Response::builder()
  707    670   
                .status(200)
  708    671   
                .header("X-aws-ec2-metadata-token-ttl-seconds", ttl)
  709    672   
                .body(SdkBody::from(token))
  710    673   
                .unwrap(),
  711    674   
        )
  712    675   
        .unwrap()
  713    676   
    }
  714    677   
  715         -
    pub(crate) fn imds_request(path: &'static str, token: &str) -> HttpRequest {
         678  +
    /// Create a simple IMDS request
         679  +
    pub fn imds_request(path: &'static str, token: &str) -> HttpRequest {
  716    680   
        http::Request::builder()
  717    681   
            .uri(Uri::from_static(path))
  718    682   
            .method("GET")
  719    683   
            .header("x-aws-ec2-metadata-token", token)
  720    684   
            .body(SdkBody::empty())
  721    685   
            .unwrap()
  722    686   
            .try_into()
  723    687   
            .unwrap()
  724    688   
    }
  725    689   
  726         -
    pub(crate) fn imds_response(body: &'static str) -> HttpResponse {
         690  +
    /// Create a simple IMDS response
         691  +
    pub fn imds_response(body: &'static str) -> HttpResponse {
  727    692   
        HttpResponse::try_from(
  728    693   
            http::Response::builder()
  729    694   
                .status(200)
  730    695   
                .body(SdkBody::from(body))
  731    696   
                .unwrap(),
  732    697   
        )
  733    698   
        .unwrap()
  734    699   
    }
  735    700   
  736         -
    pub(crate) fn make_imds_client(http_client: &StaticReplayClient) -> super::Client {
         701  +
    /// Create an IMDS client with an underlying [StaticReplayClient]
         702  +
    pub fn make_imds_client(http_client: &StaticReplayClient) -> super::Client {
  737    703   
        tokio::time::pause();
  738    704   
        super::Client::builder()
  739    705   
            .configure(
  740    706   
                &ProviderConfig::no_configuration()
  741    707   
                    .with_sleep_impl(InstantSleep::unlogged())
  742    708   
                    .with_http_client(http_client.clone()),
  743    709   
            )
  744    710   
            .build()
  745    711   
    }
         712  +
}
         713  +
         714  +
#[cfg(all(test, feature = "test-util"))]
         715  +
pub(crate) mod test {
         716  +
    use crate::imds::client::{Client, EndpointMode, ImdsResponseRetryClassifier};
         717  +
    use crate::provider_config::ProviderConfig;
         718  +
    use aws_smithy_async::rt::sleep::TokioSleep;
         719  +
    use aws_smithy_async::test_util::{instant_time_and_sleep, InstantSleep};
         720  +
    use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
         721  +
    use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
         722  +
    use aws_smithy_runtime_api::client::interceptors::context::{
         723  +
        Input, InterceptorContext, Output,
         724  +
    };
         725  +
    use aws_smithy_runtime_api::client::orchestrator::OrchestratorError;
         726  +
    use aws_smithy_runtime_api::client::result::ConnectorError;
         727  +
    use aws_smithy_runtime_api::client::retries::classifiers::{
         728  +
        ClassifyRetry, RetryAction, SharedRetryClassifier,
         729  +
    };
         730  +
    use aws_smithy_types::body::SdkBody;
         731  +
    use aws_smithy_types::error::display::DisplayErrorContext;
         732  +
    use aws_types::os_shim_internal::{Env, Fs};
         733  +
    use http::header::USER_AGENT;
         734  +
         735  +
    use super::test_util::*;
         736  +
    use serde::Deserialize;
         737  +
    use std::collections::HashMap;
         738  +
    use std::error::Error;
         739  +
    use std::io;
         740  +
    use std::time::SystemTime;
         741  +
    use std::time::{Duration, UNIX_EPOCH};
         742  +
    use tracing_test::traced_test;
         743  +
         744  +
    macro_rules! assert_full_error_contains {
         745  +
        ($err:expr, $contains:expr) => {
         746  +
            let err = $err;
         747  +
            let message = format!(
         748  +
                "{}",
         749  +
                aws_smithy_types::error::display::DisplayErrorContext(&err)
         750  +
            );
         751  +
            assert!(
         752  +
                message.contains($contains),
         753  +
                "Error message '{message}' didn't contain text '{}'",
         754  +
                $contains
         755  +
            );
         756  +
        };
         757  +
    }
         758  +
         759  +
    const TOKEN_A: &str = "AQAEAFTNrA4eEGx0AQgJ1arIq_Cc-t4tWt3fB0Hd8RKhXlKc5ccvhg==";
         760  +
    const TOKEN_B: &str = "alternatetoken==";
  746    761   
  747    762   
    fn mock_imds_client(events: Vec<ReplayEvent>) -> (Client, StaticReplayClient) {
  748    763   
        let http_client = StaticReplayClient::new(events);
  749    764   
        let client = make_imds_client(&http_client);
  750    765   
        (client, http_client)
  751    766   
    }
  752    767   
  753    768   
    #[tokio::test]
  754    769   
    async fn client_caches_token() {
  755    770   
        let (client, http_client) = mock_imds_client(vec![

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/imds/credentials.rs

@@ -1,1 +44,45 @@
    5      5   
    6      6   
//! IMDSv2 Credentials Provider
    7      7   
//!
    8      8   
//! # Important
    9      9   
//! This credential provider will NOT fallback to IMDSv1. Ensure that IMDSv2 is enabled on your instances.
   10     10   
   11     11   
use super::client::error::ImdsError;
   12     12   
use crate::imds::{self, Client};
   13     13   
use crate::json_credentials::{parse_json_credentials, JsonCredentials, RefreshableCredentials};
   14     14   
use crate::provider_config::ProviderConfig;
          15  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
   15     16   
use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials};
   16     17   
use aws_credential_types::Credentials;
   17     18   
use aws_smithy_async::time::SharedTimeSource;
   18     19   
use aws_types::os_shim_internal::Env;
   19     20   
use std::borrow::Cow;
   20     21   
use std::error::Error as StdError;
   21     22   
use std::fmt;
   22     23   
use std::sync::{Arc, RwLock};
   23     24   
use std::time::{Duration, SystemTime};
   24     25   
@@ -242,243 +319,326 @@
  262    263   
            }
  263    264   
            Ok(JsonCredentials::Error { code, message }) => {
  264    265   
                Err(CredentialsError::provider_error(format!(
  265    266   
                    "Error retrieving credentials from IMDS: {} {}",
  266    267   
                    code, message
  267    268   
                )))
  268    269   
            }
  269    270   
            // got bad data from IMDS, should not occur during normal operation:
  270    271   
            Err(invalid) => Err(CredentialsError::unhandled(invalid)),
  271    272   
        }
         273  +
        .map(|mut creds| {
         274  +
            creds
         275  +
                .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
         276  +
                .push(AwsCredentialFeature::CredentialsImds);
         277  +
            creds
         278  +
        })
  272    279   
    }
  273    280   
  274    281   
    async fn credentials(&self) -> provider::Result {
  275    282   
        match self.retrieve_credentials().await {
  276    283   
            creds @ Ok(_) => creds,
  277    284   
            // Any failure while retrieving credentials MUST NOT impede use of existing credentials.
  278    285   
            err => match &*self.last_retrieved_credentials.read().unwrap() {
  279    286   
                Some(creds) => Ok(creds.clone()),
  280    287   
                _ => err,
  281    288   
            },
  282    289   
        }
  283    290   
    }
  284    291   
}
  285    292   
  286         -
#[cfg(test)]
         293  +
#[cfg(all(test, feature = "test-util"))]
  287    294   
mod test {
  288    295   
    use super::*;
  289         -
    use crate::imds::client::test::{
         296  +
    use crate::imds::client::test_util::{
  290    297   
        imds_request, imds_response, make_imds_client, token_request, token_response,
  291    298   
    };
  292    299   
    use crate::provider_config::ProviderConfig;
  293    300   
    use aws_credential_types::provider::ProvideCredentials;
  294    301   
    use aws_smithy_async::test_util::instant_time_and_sleep;
  295    302   
    use aws_smithy_http_client::test_util::{ReplayEvent, StaticReplayClient};
  296    303   
    use aws_smithy_types::body::SdkBody;
  297    304   
    use std::time::{Duration, UNIX_EPOCH};
  298    305   
    use tracing_test::traced_test;
  299    306   

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/imds/region.rs

@@ -87,87 +149,151 @@
  107    107   
        let client = self
  108    108   
            .imds_client_override
  109    109   
            .unwrap_or_else(|| imds::Client::builder().configure(&provider_config).build());
  110    110   
        ImdsRegionProvider {
  111    111   
            client,
  112    112   
            env: provider_config.env(),
  113    113   
        }
  114    114   
    }
  115    115   
}
  116    116   
  117         -
#[cfg(test)]
         117  +
#[cfg(all(test, feature = "test-util"))]
  118    118   
mod test {
  119         -
    use crate::imds::client::test::{imds_request, imds_response, token_request, token_response};
         119  +
    use crate::imds::client::test_util::{
         120  +
        imds_request, imds_response, token_request, token_response,
         121  +
    };
  120    122   
    use crate::imds::region::ImdsRegionProvider;
  121    123   
    use crate::provider_config::ProviderConfig;
  122    124   
    use aws_smithy_async::rt::sleep::TokioSleep;
  123    125   
    use aws_smithy_http_client::test_util::{ReplayEvent, StaticReplayClient};
  124    126   
    use aws_smithy_types::body::SdkBody;
  125    127   
    use aws_types::region::Region;
  126    128   
    use tracing_test::traced_test;
  127    129   
  128    130   
    #[tokio::test]
  129    131   
    async fn load_region() {

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/profile/credentials.rs

@@ -1,1 +60,61 @@
   21     21   
//!   build it from `~/.aws/credentials` and `~/.aws/config`.
   22     22   
//! - `exec` which contains a chain representation of providers to implement passing bootstrapped credentials
   23     23   
//!   through a series of providers.
   24     24   
   25     25   
use crate::profile::cell::ErrorTakingOnceCell;
   26     26   
#[allow(deprecated)]
   27     27   
use crate::profile::profile_file::ProfileFiles;
   28     28   
use crate::profile::Profile;
   29     29   
use crate::profile::ProfileFileLoadError;
   30     30   
use crate::provider_config::ProviderConfig;
          31  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
   31     32   
use aws_credential_types::{
   32     33   
    provider::{self, error::CredentialsError, future, ProvideCredentials},
   33     34   
    Credentials,
   34     35   
};
   35     36   
use aws_smithy_types::error::display::DisplayErrorContext;
   36     37   
use std::borrow::Cow;
   37     38   
use std::collections::HashMap;
   38     39   
use std::error::Error;
   39     40   
use std::fmt::{Display, Formatter};
   40     41   
use std::sync::Arc;
@@ -159,160 +219,225 @@
  179    180   
                                ))),
  180    181   
                            },
  181    182   
                        }
  182    183   
                    }
  183    184   
                },
  184    185   
                CredentialsError::unhandled(
  185    186   
                    "profile file credentials provider initialization error already taken",
  186    187   
                ),
  187    188   
            )
  188    189   
            .await?;
  189         -
        inner_provider.provide_credentials().await
         190  +
        inner_provider.provide_credentials().await.map(|mut creds| {
         191  +
            creds
         192  +
                .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
         193  +
                .push(AwsCredentialFeature::CredentialsProfile);
         194  +
            creds
         195  +
        })
  190    196   
    }
  191    197   
}
  192    198   
  193    199   
impl ProvideCredentials for ProfileFileCredentialsProvider {
  194    200   
    fn provide_credentials<'a>(&'a self) -> future::ProvideCredentials<'a>
  195    201   
    where
  196    202   
        Self: 'a,
  197    203   
    {
  198    204   
        future::ProvideCredentials::new(self.load_credentials())
  199    205   
    }

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

@@ -63,63 +123,123 @@
   83     83   
            use_fips: None,
   84     84   
            use_dual_stack: None,
   85     85   
            parsed_profile: Default::default(),
   86     86   
            #[allow(deprecated)]
   87     87   
            profile_files: ProfileFiles::default(),
   88     88   
            profile_name_override: None,
   89     89   
        }
   90     90   
    }
   91     91   
}
   92     92   
   93         -
#[cfg(test)]
          93  +
#[cfg(any(test, feature = "test-util"))]
   94     94   
impl ProviderConfig {
   95     95   
    /// ProviderConfig with all configuration removed
   96     96   
    ///
   97     97   
    /// Unlike [`ProviderConfig::empty`] where `env` and `fs` will use their non-mocked implementations,
   98     98   
    /// this method will use an empty mock environment and an empty mock file system.
   99     99   
    pub fn no_configuration() -> Self {
  100    100   
        use aws_smithy_async::time::StaticTimeSource;
  101    101   
        use std::collections::HashMap;
  102    102   
        use std::time::UNIX_EPOCH;
  103    103   
        let fs = Fs::from_raw_map(HashMap::new());
@@ -332,332 +407,429 @@
  352    352   
    /// Use the [default region chain](crate::default_provider::region) to set the
  353    353   
    /// region for this configuration
  354    354   
    ///
  355    355   
    /// Note: the `env` and `fs` already set on this provider will be used when loading the default region.
  356    356   
    pub async fn load_default_region(self) -> Self {
  357    357   
        use crate::default_provider::region::DefaultRegionChain;
  358    358   
        let provider_chain = DefaultRegionChain::builder().configure(&self).build();
  359    359   
        self.with_region(provider_chain.region().await)
  360    360   
    }
  361    361   
  362         -
    pub(crate) fn with_fs(self, fs: Fs) -> Self {
         362  +
    fn with_fs_internal(self, fs: Fs) -> Self {
  363    363   
        ProviderConfig {
  364    364   
            parsed_profile: Default::default(),
  365    365   
            fs,
  366    366   
            ..self
  367    367   
        }
  368    368   
    }
  369    369   
  370         -
    pub(crate) fn with_env(self, env: Env) -> Self {
         370  +
    #[cfg(not(feature = "test-util"))]
         371  +
    pub(crate) fn with_fs(self, fs: Fs) -> Self {
         372  +
        self.with_fs_internal(fs)
         373  +
    }
         374  +
         375  +
    /// Specify a [Fs] implementation for testing
         376  +
    #[cfg(feature = "test-util")]
         377  +
    pub fn with_fs(self, fs: Fs) -> Self {
         378  +
        self.with_fs_internal(fs)
         379  +
    }
         380  +
         381  +
    fn with_env_internal(self, env: Env) -> Self {
  371    382   
        ProviderConfig {
  372    383   
            parsed_profile: Default::default(),
  373    384   
            env,
  374    385   
            ..self
  375    386   
        }
  376    387   
    }
  377    388   
         389  +
    #[cfg(not(feature = "test-util"))]
         390  +
    pub(crate) fn with_env(self, env: Env) -> Self {
         391  +
        self.with_env_internal(env)
         392  +
    }
         393  +
         394  +
    /// Specify an [Env] implementation for testing
         395  +
    #[cfg(feature = "test-util")]
         396  +
    pub fn with_env(self, env: Env) -> Self {
         397  +
        self.with_env_internal(env)
         398  +
    }
         399  +
  378    400   
    /// Override the time source for this configuration
  379    401   
    pub fn with_time_source(self, time_source: impl TimeSource + 'static) -> Self {
  380    402   
        ProviderConfig {
  381    403   
            time_source: time_source.into_shared(),
  382    404   
            ..self
  383    405   
        }
  384    406   
    }
  385    407   
  386    408   
    /// Override the HTTP client for this configuration
  387    409   
    pub fn with_http_client(self, http_client: impl HttpClient + 'static) -> Self {

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/sso/credentials.rs

@@ -1,1 +46,47 @@
    7      7   
//!
    8      8   
//! This credentials provider enables loading credentials from `~/.aws/sso/cache`. For more information,
    9      9   
//! see [Using AWS SSO Credentials](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/sso-credentials.html)
   10     10   
//!
   11     11   
//! This provider is included automatically when profiles are loaded.
   12     12   
   13     13   
use super::cache::load_cached_token;
   14     14   
use crate::identity::IdentityCache;
   15     15   
use crate::provider_config::ProviderConfig;
   16     16   
use crate::sso::SsoTokenProvider;
          17  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
   17     18   
use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials};
   18     19   
use aws_credential_types::Credentials;
   19     20   
use aws_sdk_sso::types::RoleCredentials;
   20     21   
use aws_sdk_sso::Client as SsoClient;
   21     22   
use aws_smithy_async::time::SharedTimeSource;
   22     23   
use aws_smithy_types::DateTime;
   23     24   
use aws_types::os_shim_internal::{Env, Fs};
   24     25   
use aws_types::region::Region;
   25     26   
use aws_types::SdkConfig;
   26     27   
@@ -61,62 +120,127 @@
   81     82   
    async fn credentials(&self) -> provider::Result {
   82     83   
        load_sso_credentials(
   83     84   
            &self.sso_provider_config,
   84     85   
            &self.sdk_config,
   85     86   
            self.token_provider.as_ref(),
   86     87   
            &self.env,
   87     88   
            &self.fs,
   88     89   
            self.time_source.clone(),
   89     90   
        )
   90     91   
        .await
          92  +
        .map(|mut creds| {
          93  +
            creds
          94  +
                .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
          95  +
                .push(AwsCredentialFeature::CredentialsSso);
          96  +
            creds
          97  +
        })
   91     98   
    }
   92     99   
}
   93    100   
   94    101   
impl ProvideCredentials for SsoCredentialsProvider {
   95    102   
    fn provide_credentials<'a>(&'a self) -> future::ProvideCredentials<'a>
   96    103   
    where
   97    104   
        Self: 'a,
   98    105   
    {
   99    106   
        future::ProvideCredentials::new(self.credentials())
  100    107   
    }

tmp-codegen-diff/aws-sdk/sdk/aws-config/src/sts/assume_role.rs

@@ -1,1 +37,38 @@
    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   
//! Assume credentials for a role through the AWS Security Token Service (STS).
    7      7   
           8  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
    8      9   
use aws_credential_types::provider::{
    9     10   
    self, error::CredentialsError, future, ProvideCredentials, SharedCredentialsProvider,
   10     11   
};
   11     12   
use aws_sdk_sts::operation::assume_role::builders::AssumeRoleFluentBuilder;
   12     13   
use aws_sdk_sts::operation::assume_role::AssumeRoleError;
   13     14   
use aws_sdk_sts::types::PolicyDescriptorType;
   14     15   
use aws_sdk_sts::Client as StsClient;
   15     16   
use aws_smithy_runtime::client::identity::IdentityCache;
   16     17   
use aws_smithy_runtime_api::client::result::SdkError;
   17     18   
use aws_smithy_types::error::display::DisplayErrorContext;
@@ -258,259 +346,354 @@
  278    279   
        self.sdk_config = Some(conf);
  279    280   
        self.build().await
  280    281   
    }
  281    282   
}
  282    283   
  283    284   
impl Inner {
  284    285   
    async fn credentials(&self) -> provider::Result {
  285    286   
        tracing::debug!("retrieving assumed credentials");
  286    287   
  287    288   
        let assumed = self.fluent_builder.clone().send().in_current_span().await;
  288         -
        match assumed {
         289  +
        let assumed = match assumed {
  289    290   
            Ok(assumed) => {
  290    291   
                tracing::debug!(
  291    292   
                    access_key_id = ?assumed.credentials.as_ref().map(|c| &c.access_key_id),
  292    293   
                    "obtained assumed credentials"
  293    294   
                );
  294    295   
                super::util::into_credentials(
  295    296   
                    assumed.credentials,
  296    297   
                    assumed.assumed_role_user,
  297    298   
                    "AssumeRoleProvider",
  298    299   
                )
  299    300   
            }
  300    301   
            Err(SdkError::ServiceError(ref context))
  301    302   
                if matches!(
  302    303   
                    context.err(),
  303    304   
                    AssumeRoleError::RegionDisabledException(_)
  304    305   
                        | AssumeRoleError::MalformedPolicyDocumentException(_)
  305    306   
                ) =>
  306    307   
            {
  307    308   
                Err(CredentialsError::invalid_configuration(
  308    309   
                    assumed.err().unwrap(),
  309    310   
                ))
  310    311   
            }
  311    312   
            Err(SdkError::ServiceError(ref context)) => {
  312    313   
                tracing::warn!(error = %DisplayErrorContext(context.err()), "STS refused to grant assume role");
  313    314   
                Err(CredentialsError::provider_error(assumed.err().unwrap()))
  314    315   
            }
  315    316   
            Err(err) => Err(CredentialsError::provider_error(err)),
  316         -
        }
         317  +
        };
         318  +
         319  +
        assumed.map(|mut creds| {
         320  +
            creds
         321  +
                .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
         322  +
                .push(AwsCredentialFeature::CredentialsStsAssumeRole);
         323  +
            creds
         324  +
        })
  317    325   
    }
  318    326   
}
  319    327   
  320    328   
impl ProvideCredentials for AssumeRoleProvider {
  321    329   
    fn provide_credentials<'a>(&'a self) -> future::ProvideCredentials<'a>
  322    330   
    where
  323    331   
        Self: 'a,
  324    332   
    {
  325    333   
        future::ProvideCredentials::new(
  326    334   
            self.inner

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

@@ -36,36 +95,96 @@
   56     56   
//! use aws_config::web_identity_token::WebIdentityTokenCredentialsProvider;
   57     57   
//! use aws_config::provider_config::ProviderConfig;
   58     58   
//! let provider = WebIdentityTokenCredentialsProvider::builder()
   59     59   
//!     .configure(&ProviderConfig::with_default_region().await)
   60     60   
//!     .build();
   61     61   
//! # }
   62     62   
//! ```
   63     63   
   64     64   
use crate::provider_config::ProviderConfig;
   65     65   
use crate::sts;
          66  +
use aws_credential_types::credential_feature::AwsCredentialFeature;
   66     67   
use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials};
   67     68   
use aws_sdk_sts::{types::PolicyDescriptorType, Client as StsClient};
   68     69   
use aws_smithy_async::time::SharedTimeSource;
   69     70   
use aws_smithy_types::error::display::DisplayErrorContext;
   70     71   
use aws_types::os_shim_internal::{Env, Fs};
   71     72   
   72     73   
use std::borrow::Cow;
   73     74   
use std::path::{Path, PathBuf};
   74     75   
   75     76   
const ENV_VAR_TOKEN_FILE: &str = "AWS_WEB_IDENTITY_TOKEN_FILE";
@@ -133,134 +192,199 @@
  153    154   
        load_credentials(
  154    155   
            &self.fs,
  155    156   
            &self.sts_client,
  156    157   
            self.policy.clone(),
  157    158   
            self.policy_arns.clone(),
  158    159   
            &conf.web_identity_token_file,
  159    160   
            &conf.role_arn,
  160    161   
            &conf.session_name,
  161    162   
        )
  162    163   
        .await
         164  +
        .map(|mut creds| {
         165  +
            creds
         166  +
                .get_property_mut_or_default::<Vec<AwsCredentialFeature>>()
         167  +
                .push(AwsCredentialFeature::CredentialsProfileStsWebIdToken);
         168  +
            creds
         169  +
        })
  163    170   
    }
  164    171   
}
  165    172   
  166    173   
/// Builder for [`WebIdentityTokenCredentialsProvider`].
  167    174   
#[derive(Debug, Default)]
  168    175   
pub struct Builder {
  169    176   
    source: Option<Source>,
  170    177   
    config: Option<ProviderConfig>,
  171    178   
    policy: Option<String>,
  172    179   
    policy_arns: Option<Vec<PolicyDescriptorType>>,

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

@@ -7,7 +49,49 @@
   27     27   
path = "../aws-smithy-async"
   28     28   
version = "1.2.5"
   29     29   
   30     30   
[dependencies.aws-smithy-types]
   31     31   
path = "../aws-smithy-types"
   32     32   
version = "1.3.2"
   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.8.5"
          37  +
version = "1.8.6"
   38     38   
   39     39   
[dev-dependencies]
   40     40   
async-trait = "0.1.74"
   41     41   
   42     42   
[dev-dependencies.aws-smithy-runtime-api]
   43     43   
path = "../aws-smithy-runtime-api"
   44     44   
features = ["test-util"]
   45         -
version = "1.8.5"
          45  +
version = "1.8.6"
   46     46   
   47     47   
[dev-dependencies.tokio]
   48     48   
version = "1.23.1"
   49     49   
features = ["full", "test-util", "rt"]