AWS SDK

AWS SDK

rev. 2d483a0880c30683858329fc8411e9f9282de633 (ignoring whitespace)

Files changed:

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

@@ -18,18 +139,169 @@
   38     38   
        }
   39     39   
    }
   40     40   
}
   41     41   
   42     42   
/// The default auth scheme resolver
   43     43   
#[derive(Debug)]
   44     44   
#[allow(dead_code)]
   45     45   
pub struct DefaultAuthSchemeResolver {
   46     46   
    service_defaults: Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>,
   47     47   
    operation_overrides: ::std::collections::HashMap<&'static str, Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>>,
          48  +
    preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
   48     49   
}
   49     50   
   50     51   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     52   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     53   
// of the `Default` trait may appear as if it could be derived automatically.
   53     54   
// However, that is not the case in production.
   54     55   
#[allow(clippy::derivable_impls)]
   55     56   
impl Default for DefaultAuthSchemeResolver {
   56     57   
    fn default() -> Self {
   57     58   
        Self {
   58     59   
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59     60   
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60     61   
                .build()
   61     62   
                .expect("required fields set")],
   62     63   
            operation_overrides: [
   63     64   
                (
   64     65   
                    "GetRoleCredentials",
   65     66   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   66     67   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   67     68   
                    )],
   68     69   
                ),
   69     70   
                (
   70     71   
                    "ListAccountRoles",
   71     72   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   72     73   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   73     74   
                    )],
   74     75   
                ),
   75     76   
                (
   76     77   
                    "ListAccounts",
   77     78   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   78     79   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   79     80   
                    )],
   80     81   
                ),
   81     82   
                (
   82     83   
                    "Logout",
   83     84   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   84     85   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   85     86   
                    )],
   86     87   
                ),
   87     88   
            ]
   88     89   
            .into(),
          90  +
            preference: ::std::option::Option::None,
   89     91   
        }
   90     92   
    }
   91     93   
}
   92     94   
   93     95   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   94     96   
    fn resolve_auth_scheme<'a>(
   95     97   
        &'a self,
   96     98   
        params: &'a crate::config::auth::Params,
   97     99   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
   98    100   
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
   99    101   
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  100    102   
        let operation_name = params.operation_name();
  101    103   
  102    104   
        let modeled_auth_options = match self.operation_overrides.get(operation_name) {
  103    105   
            Some(overrides) => overrides,
  104    106   
            None => &self.service_defaults,
  105    107   
        };
  106    108   
  107    109   
        let _fut = ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(Ok(modeled_auth_options.clone()));
  108    110   
  109         -
        _fut
         111  +
        match &self.preference {
         112  +
            ::std::option::Option::Some(preference) => {
         113  +
                _fut.map_ok({
         114  +
                    // maps auth scheme ID to the index in the preference list
         115  +
                    let preference_map: ::std::collections::HashMap<_, _> = preference.clone().into_iter().enumerate().map(|(i, s)| (s, i)).collect();
         116  +
                    move |auth_scheme_options| {
         117  +
                        let (mut preferred, non_preferred): (::std::vec::Vec<_>, ::std::vec::Vec<_>) = auth_scheme_options
         118  +
                            .into_iter()
         119  +
                            .partition(|auth_scheme_option| preference_map.contains_key(auth_scheme_option.scheme_id()));
         120  +
         121  +
                        preferred.sort_by_key(|opt| preference_map.get(opt.scheme_id()).expect("guaranteed by `partition`"));
         122  +
                        preferred.extend(non_preferred);
         123  +
                        preferred
         124  +
                    }
         125  +
                })
         126  +
            }
         127  +
            ::std::option::Option::None => _fut,
         128  +
        }
         129  +
    }
         130  +
}
         131  +
         132  +
impl DefaultAuthSchemeResolver {
         133  +
    /// Set auth scheme preference to the default auth scheme resolver
         134  +
    pub fn with_auth_scheme_preference(
         135  +
        mut self,
         136  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         137  +
    ) -> Self {
         138  +
        self.preference = ::std::option::Option::Some(preference.into());
         139  +
        self
  110    140   
    }
  111    141   
}
  112    142   
  113    143   
/// Configuration parameters for resolving the correct auth scheme
  114    144   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  115    145   
pub struct Params {
  116    146   
    operation_name: ::std::borrow::Cow<'static, str>,
  117    147   
}
  118    148   
impl Params {
  119    149   
    /// Create a builder for [`Params`]

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

@@ -1,1 +83,83 @@
   17     17   
[dependencies.aws-credential-types]
   18     18   
path = "../aws-credential-types"
   19     19   
version = "1.2.3"
   20     20   
   21     21   
[dependencies.aws-runtime]
   22     22   
path = "../aws-runtime"
   23     23   
version = "1.5.9"
   24     24   
   25     25   
[dependencies.aws-smithy-async]
   26     26   
path = "../aws-smithy-async"
   27         -
version = "1.2.5"
          27  +
version = "1.3.0"
   28     28   
   29     29   
[dependencies.aws-smithy-http]
   30     30   
path = "../aws-smithy-http"
   31     31   
version = "0.62.1"
   32     32   
   33     33   
[dependencies.aws-smithy-json]
   34     34   
path = "../aws-smithy-json"
   35     35   
version = "0.61.4"
   36     36   
   37     37   
[dependencies.aws-smithy-runtime]
   38     38   
path = "../aws-smithy-runtime"
   39     39   
features = ["client"]
   40         -
version = "1.8.4"
          40  +
version = "1.8.5"
   41     41   
   42     42   
[dependencies.aws-smithy-runtime-api]
   43     43   
path = "../aws-smithy-runtime-api"
   44     44   
features = ["client", "http-02x"]
   45         -
version = "1.8.3"
          45  +
version = "1.8.4"
   46     46   
   47     47   
[dependencies.aws-smithy-types]
   48     48   
path = "../aws-smithy-types"
   49     49   
version = "1.3.2"
   50     50   
   51     51   
[dependencies.aws-types]
   52     52   
path = "../aws-types"
   53         -
version = "1.3.7"
          53  +
version = "1.3.8"
   54     54   
   55     55   
[dependencies.bytes]
   56     56   
version = "1.4.0"
   57     57   
   58     58   
[dependencies.fastrand]
   59     59   
version = "2.0.0"
   60     60   
   61     61   
[dependencies.http]
   62     62   
version = "0.2.9"
   63     63   

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

@@ -36,36 +95,99 @@
   56     56   
    }
   57     57   
    /// Return the auth schemes configured on this service config
   58     58   
    pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
   59     59   
        self.runtime_components.auth_schemes()
   60     60   
    }
   61     61   
   62     62   
    /// Return the auth scheme resolver configured on this service config
   63     63   
    pub fn auth_scheme_resolver(&self) -> ::std::option::Option<::aws_smithy_runtime_api::client::auth::SharedAuthSchemeOptionResolver> {
   64     64   
        self.runtime_components.auth_scheme_option_resolver()
   65     65   
    }
          66  +
    /// Returns the configured auth scheme preference
          67  +
    pub fn auth_scheme_preference(&self) -> ::std::option::Option<&::aws_smithy_runtime_api::client::auth::AuthSchemePreference> {
          68  +
        self.config.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
          69  +
    }
   66     70   
    /// Returns the endpoint resolver.
   67     71   
    pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver {
   68     72   
        self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set")
   69     73   
    }
   70     74   
    /// Return a reference to the retry configuration contained in this config, if any.
   71     75   
    pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> {
   72     76   
        self.config.load::<::aws_smithy_types::retry::RetryConfig>()
   73     77   
    }
   74     78   
   75     79   
    /// Return a cloned shared async sleep implementation from this config, if any.
@@ -149,153 +208,213 @@
  169    173   
    ///
  170    174   
    pub fn new() -> Self {
  171    175   
        Self::default()
  172    176   
    }
  173    177   
    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
  174    178   
    /// but not those in runtime components.
  175    179   
    #[allow(unused)]
  176    180   
    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
  177    181   
        let mut builder = Self::new();
  178    182   
        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
         183  +
        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
  179    184   
        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
  180    185   
        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
  181    186   
        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
  182    187   
        builder.set_app_name(config_bag.load::<::aws_types::app_name::AppName>().cloned());
  183    188   
        builder.set_endpoint_url(config_bag.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()));
  184    189   
        builder.set_use_dual_stack(config_bag.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0));
  185    190   
        builder.set_use_fips(config_bag.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0));
  186    191   
        builder.set_region(config_bag.load::<crate::config::Region>().cloned());
  187    192   
        builder
  188    193   
    }
@@ -398,403 +457,519 @@
  418    423   
  419    424   
    /// Set the auth scheme resolver for the builder
  420    425   
    ///
  421    426   
    /// # Examples
  422    427   
    /// See an example for [`Self::auth_scheme_resolver`].
  423    428   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  424    429   
        self.runtime_components
  425    430   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  426    431   
        self
  427    432   
    }
         433  +
    /// Set the auth scheme preference for an auth scheme resolver
         434  +
    /// (typically the default auth scheme resolver).
         435  +
    ///
         436  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         437  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         438  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         439  +
    ///
         440  +
    /// The preference list is intended as a hint rather than a strict override.
         441  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         442  +
    ///
         443  +
    /// # Examples
         444  +
    ///
         445  +
    /// ```no_run
         446  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         447  +
    /// let config = aws_sdk_ssooidc::Config::builder()
         448  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         449  +
    ///     // ...
         450  +
    ///     .build();
         451  +
    /// let client = aws_sdk_ssooidc::Client::from_conf(config);
         452  +
    /// ```
         453  +
         454  +
    pub fn auth_scheme_preference(
         455  +
        mut self,
         456  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         457  +
    ) -> Self {
         458  +
        self.set_auth_scheme_preference(::std::option::Option::Some(preference.into()));
         459  +
        self
         460  +
    }
         461  +
         462  +
    /// Set the auth scheme preference for an auth scheme resolver
         463  +
    /// (typically the default auth scheme resolver).
         464  +
    ///
         465  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         466  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         467  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         468  +
    ///
         469  +
    /// The preference list is intended as a hint rather than a strict override.
         470  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         471  +
    ///
         472  +
    /// # Examples
         473  +
    ///
         474  +
    /// ```no_run
         475  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         476  +
    /// let config = aws_sdk_ssooidc::Config::builder()
         477  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         478  +
    ///     // ...
         479  +
    ///     .build();
         480  +
    /// let client = aws_sdk_ssooidc::Client::from_conf(config);
         481  +
    /// ```
         482  +
         483  +
    pub fn set_auth_scheme_preference(
         484  +
        &mut self,
         485  +
        preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         486  +
    ) -> &mut Self {
         487  +
        self.config.store_or_unset(preference);
         488  +
        self
         489  +
    }
  428    490   
    /// Sets the endpoint resolver to use when making requests.
  429    491   
    ///
  430    492   
    ///
  431    493   
    /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
  432    494   
    /// rules for `aws_sdk_ssooidc`.
  433    495   
    ///
  434    496   
    ///
  435    497   
    /// Note: setting an endpoint resolver will replace any endpoint URL that has been set.
  436    498   
    /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to
  437    499   
    /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`].
@@ -1263,1325 +1323,1395 @@
 1283   1345   
impl ServiceRuntimePlugin {
 1284   1346   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1285   1347   
        let config = {
 1286   1348   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("AWSSSOOIDCService");
 1287   1349   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1288   1350   
            ::std::option::Option::Some(cfg.freeze())
 1289   1351   
        };
 1290   1352   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
 1291   1353   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1292   1354   
            use crate::config::auth::ResolveAuthScheme;
        1355  +
            if let Some(preference) = _service_config
        1356  +
                .config
        1357  +
                .load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
        1358  +
                .cloned()
        1359  +
            {
        1360  +
                crate::config::auth::DefaultAuthSchemeResolver::default()
        1361  +
                    .with_auth_scheme_preference(preference)
        1362  +
                    .into_shared_resolver()
        1363  +
            } else {
 1293   1364   
                crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
        1365  +
            }
 1294   1366   
        }));
 1295   1367   
        runtime_components.set_endpoint_resolver(::std::option::Option::Some({
 1296   1368   
            use crate::config::endpoint::ResolveEndpoint;
 1297   1369   
            crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
 1298   1370   
        }));
 1299   1371   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1300   1372   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
 1301   1373   
        runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new());
 1302   1374   
        runtime_components.push_interceptor(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new());
 1303   1375   
        runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
@@ -1389,1461 +1448,1521 @@
 1409   1481   
            );
 1410   1482   
        }
 1411   1483   
        // resiliency
 1412   1484   
        builder.set_retry_config(input.retry_config().cloned());
 1413   1485   
        builder.set_timeout_config(input.timeout_config().cloned());
 1414   1486   
        builder.set_sleep_impl(input.sleep_impl());
 1415   1487   
 1416   1488   
        builder.set_http_client(input.http_client());
 1417   1489   
        builder.set_time_source(input.time_source());
 1418   1490   
        builder.set_behavior_version(input.behavior_version());
        1491  +
        builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
 1419   1492   
        // setting `None` here removes the default
 1420   1493   
        if let Some(config) = input.stalled_stream_protection() {
 1421   1494   
            builder.set_stalled_stream_protection(Some(config));
 1422   1495   
        }
 1423   1496   
 1424   1497   
        if let Some(cache) = input.identity_cache() {
 1425   1498   
            builder.set_identity_cache(cache);
 1426   1499   
        }
 1427   1500   
        builder.set_app_name(input.app_name().cloned());
 1428   1501   

tmp-codegen-diff/aws-sdk/sdk/ssooidc/src/config/auth.rs

@@ -18,18 +133,163 @@
   38     38   
        }
   39     39   
    }
   40     40   
}
   41     41   
   42     42   
/// The default auth scheme resolver
   43     43   
#[derive(Debug)]
   44     44   
#[allow(dead_code)]
   45     45   
pub struct DefaultAuthSchemeResolver {
   46     46   
    service_defaults: Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>,
   47     47   
    operation_overrides: ::std::collections::HashMap<&'static str, Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>>,
          48  +
    preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
   48     49   
}
   49     50   
   50     51   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     52   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     53   
// of the `Default` trait may appear as if it could be derived automatically.
   53     54   
// However, that is not the case in production.
   54     55   
#[allow(clippy::derivable_impls)]
   55     56   
impl Default for DefaultAuthSchemeResolver {
   56     57   
    fn default() -> Self {
   57     58   
        Self {
   58     59   
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59     60   
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60     61   
                .build()
   61     62   
                .expect("required fields set")],
   62     63   
            operation_overrides: [
   63     64   
                (
   64     65   
                    "CreateToken",
   65     66   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   66     67   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   67     68   
                    )],
   68     69   
                ),
   69     70   
                (
   70     71   
                    "RegisterClient",
   71     72   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   72     73   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   73     74   
                    )],
   74     75   
                ),
   75     76   
                (
   76     77   
                    "StartDeviceAuthorization",
   77     78   
                    vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   78     79   
                        ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   79     80   
                    )],
   80     81   
                ),
   81     82   
            ]
   82     83   
            .into(),
          84  +
            preference: ::std::option::Option::None,
   83     85   
        }
   84     86   
    }
   85     87   
}
   86     88   
   87     89   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   88     90   
    fn resolve_auth_scheme<'a>(
   89     91   
        &'a self,
   90     92   
        params: &'a crate::config::auth::Params,
   91     93   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
   92     94   
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
   93     95   
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
   94     96   
        let operation_name = params.operation_name();
   95     97   
   96     98   
        let modeled_auth_options = match self.operation_overrides.get(operation_name) {
   97     99   
            Some(overrides) => overrides,
   98    100   
            None => &self.service_defaults,
   99    101   
        };
  100    102   
  101    103   
        let _fut = ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(Ok(modeled_auth_options.clone()));
  102    104   
  103         -
        _fut
         105  +
        match &self.preference {
         106  +
            ::std::option::Option::Some(preference) => {
         107  +
                _fut.map_ok({
         108  +
                    // maps auth scheme ID to the index in the preference list
         109  +
                    let preference_map: ::std::collections::HashMap<_, _> = preference.clone().into_iter().enumerate().map(|(i, s)| (s, i)).collect();
         110  +
                    move |auth_scheme_options| {
         111  +
                        let (mut preferred, non_preferred): (::std::vec::Vec<_>, ::std::vec::Vec<_>) = auth_scheme_options
         112  +
                            .into_iter()
         113  +
                            .partition(|auth_scheme_option| preference_map.contains_key(auth_scheme_option.scheme_id()));
         114  +
         115  +
                        preferred.sort_by_key(|opt| preference_map.get(opt.scheme_id()).expect("guaranteed by `partition`"));
         116  +
                        preferred.extend(non_preferred);
         117  +
                        preferred
         118  +
                    }
         119  +
                })
         120  +
            }
         121  +
            ::std::option::Option::None => _fut,
         122  +
        }
         123  +
    }
         124  +
}
         125  +
         126  +
impl DefaultAuthSchemeResolver {
         127  +
    /// Set auth scheme preference to the default auth scheme resolver
         128  +
    pub fn with_auth_scheme_preference(
         129  +
        mut self,
         130  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         131  +
    ) -> Self {
         132  +
        self.preference = ::std::option::Option::Some(preference.into());
         133  +
        self
  104    134   
    }
  105    135   
}
  106    136   
  107    137   
/// Configuration parameters for resolving the correct auth scheme
  108    138   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  109    139   
pub struct Params {
  110    140   
    operation_name: ::std::borrow::Cow<'static, str>,
  111    141   
}
  112    142   
impl Params {
  113    143   
    /// Create a builder for [`Params`]

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

@@ -1,1 +136,136 @@
   17     17   
[dependencies.aws-credential-types]
   18     18   
path = "../aws-credential-types"
   19     19   
version = "1.2.3"
   20     20   
   21     21   
[dependencies.aws-runtime]
   22     22   
path = "../aws-runtime"
   23     23   
version = "1.5.9"
   24     24   
   25     25   
[dependencies.aws-smithy-async]
   26     26   
path = "../aws-smithy-async"
   27         -
version = "1.2.5"
          27  +
version = "1.3.0"
   28     28   
   29     29   
[dependencies.aws-smithy-http]
   30     30   
path = "../aws-smithy-http"
   31     31   
version = "0.62.1"
   32     32   
   33     33   
[dependencies.aws-smithy-json]
   34     34   
path = "../aws-smithy-json"
   35     35   
version = "0.61.4"
   36     36   
   37     37   
[dependencies.aws-smithy-query]
   38     38   
path = "../aws-smithy-query"
   39     39   
version = "0.60.7"
   40     40   
   41     41   
[dependencies.aws-smithy-runtime]
   42     42   
path = "../aws-smithy-runtime"
   43     43   
features = ["client"]
   44         -
version = "1.8.4"
          44  +
version = "1.8.5"
   45     45   
   46     46   
[dependencies.aws-smithy-runtime-api]
   47     47   
path = "../aws-smithy-runtime-api"
   48     48   
features = ["client", "http-02x"]
   49         -
version = "1.8.3"
          49  +
version = "1.8.4"
   50     50   
   51     51   
[dependencies.aws-smithy-types]
   52     52   
path = "../aws-smithy-types"
   53     53   
version = "1.3.2"
   54     54   
   55     55   
[dependencies.aws-smithy-xml]
   56     56   
path = "../aws-smithy-xml"
   57     57   
version = "0.60.10"
   58     58   
   59     59   
[dependencies.aws-types]
   60     60   
path = "../aws-types"
   61         -
version = "1.3.7"
          61  +
version = "1.3.8"
   62     62   
   63     63   
[dependencies.fastrand]
   64     64   
version = "2.0.0"
   65     65   
   66     66   
[dependencies.http]
   67     67   
version = "0.2.9"
   68     68   
   69     69   
[dependencies.regex-lite]
   70     70   
version = "0.1.5"
   71     71   
   72     72   
[dependencies.tracing]
   73     73   
version = "0.1"
   74     74   
[dev-dependencies.aws-credential-types]
   75     75   
path = "../aws-credential-types"
   76     76   
features = ["test-util"]
   77     77   
version = "1.2.3"
   78     78   
   79     79   
[dev-dependencies.aws-runtime]
   80     80   
path = "../aws-runtime"
   81     81   
features = ["test-util"]
   82     82   
version = "1.5.9"
   83     83   
   84     84   
[dev-dependencies.aws-smithy-async]
   85     85   
path = "../aws-smithy-async"
   86     86   
features = ["test-util"]
   87         -
version = "1.2.5"
          87  +
version = "1.3.0"
   88     88   
   89     89   
[dev-dependencies.aws-smithy-http-client]
   90     90   
path = "../aws-smithy-http-client"
   91     91   
features = ["test-util", "wire-mock"]
   92     92   
version = "1.0.6"
   93     93   
   94     94   
[dev-dependencies.aws-smithy-protocol-test]
   95     95   
path = "../aws-smithy-protocol-test"
   96     96   
version = "0.63.4"
   97     97   
   98     98   
[dev-dependencies.aws-smithy-runtime]
   99     99   
path = "../aws-smithy-runtime"
  100    100   
features = ["test-util"]
  101         -
version = "1.8.4"
         101  +
version = "1.8.5"
  102    102   
  103    103   
[dev-dependencies.aws-smithy-runtime-api]
  104    104   
path = "../aws-smithy-runtime-api"
  105    105   
features = ["test-util"]
  106         -
version = "1.8.3"
         106  +
version = "1.8.4"
  107    107   
  108    108   
[dev-dependencies.aws-smithy-types]
  109    109   
path = "../aws-smithy-types"
  110    110   
features = ["test-util"]
  111    111   
version = "1.3.2"
  112    112   
  113    113   
[dev-dependencies.futures-util]
  114    114   
version = "0.3.25"
  115    115   
features = ["alloc"]
  116    116   
default-features = false

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

@@ -36,36 +95,99 @@
   56     56   
    }
   57     57   
    /// Return the auth schemes configured on this service config
   58     58   
    pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
   59     59   
        self.runtime_components.auth_schemes()
   60     60   
    }
   61     61   
   62     62   
    /// Return the auth scheme resolver configured on this service config
   63     63   
    pub fn auth_scheme_resolver(&self) -> ::std::option::Option<::aws_smithy_runtime_api::client::auth::SharedAuthSchemeOptionResolver> {
   64     64   
        self.runtime_components.auth_scheme_option_resolver()
   65     65   
    }
          66  +
    /// Returns the configured auth scheme preference
          67  +
    pub fn auth_scheme_preference(&self) -> ::std::option::Option<&::aws_smithy_runtime_api::client::auth::AuthSchemePreference> {
          68  +
        self.config.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
          69  +
    }
   66     70   
    /// Returns the endpoint resolver.
   67     71   
    pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver {
   68     72   
        self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set")
   69     73   
    }
   70     74   
    /// Return a reference to the retry configuration contained in this config, if any.
   71     75   
    pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> {
   72     76   
        self.config.load::<::aws_smithy_types::retry::RetryConfig>()
   73     77   
    }
   74     78   
   75     79   
    /// Return a cloned shared async sleep implementation from this config, if any.
@@ -149,153 +208,213 @@
  169    173   
    ///
  170    174   
    pub fn new() -> Self {
  171    175   
        Self::default()
  172    176   
    }
  173    177   
    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
  174    178   
    /// but not those in runtime components.
  175    179   
    #[allow(unused)]
  176    180   
    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
  177    181   
        let mut builder = Self::new();
  178    182   
        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
         183  +
        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
  179    184   
        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
  180    185   
        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
  181    186   
        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
  182    187   
        builder.set_app_name(config_bag.load::<::aws_types::app_name::AppName>().cloned());
  183    188   
        builder.set_endpoint_url(config_bag.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()));
  184    189   
        builder.set_use_dual_stack(config_bag.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0));
  185    190   
        builder.set_use_fips(config_bag.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0));
  186    191   
        builder.set_region(config_bag.load::<crate::config::Region>().cloned());
  187    192   
        builder
  188    193   
    }
@@ -398,403 +457,519 @@
  418    423   
  419    424   
    /// Set the auth scheme resolver for the builder
  420    425   
    ///
  421    426   
    /// # Examples
  422    427   
    /// See an example for [`Self::auth_scheme_resolver`].
  423    428   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  424    429   
        self.runtime_components
  425    430   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  426    431   
        self
  427    432   
    }
         433  +
    /// Set the auth scheme preference for an auth scheme resolver
         434  +
    /// (typically the default auth scheme resolver).
         435  +
    ///
         436  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         437  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         438  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         439  +
    ///
         440  +
    /// The preference list is intended as a hint rather than a strict override.
         441  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         442  +
    ///
         443  +
    /// # Examples
         444  +
    ///
         445  +
    /// ```no_run
         446  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         447  +
    /// let config = aws_sdk_sts::Config::builder()
         448  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         449  +
    ///     // ...
         450  +
    ///     .build();
         451  +
    /// let client = aws_sdk_sts::Client::from_conf(config);
         452  +
    /// ```
         453  +
         454  +
    pub fn auth_scheme_preference(
         455  +
        mut self,
         456  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         457  +
    ) -> Self {
         458  +
        self.set_auth_scheme_preference(::std::option::Option::Some(preference.into()));
         459  +
        self
         460  +
    }
         461  +
         462  +
    /// Set the auth scheme preference for an auth scheme resolver
         463  +
    /// (typically the default auth scheme resolver).
         464  +
    ///
         465  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         466  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         467  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         468  +
    ///
         469  +
    /// The preference list is intended as a hint rather than a strict override.
         470  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         471  +
    ///
         472  +
    /// # Examples
         473  +
    ///
         474  +
    /// ```no_run
         475  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         476  +
    /// let config = aws_sdk_sts::Config::builder()
         477  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         478  +
    ///     // ...
         479  +
    ///     .build();
         480  +
    /// let client = aws_sdk_sts::Client::from_conf(config);
         481  +
    /// ```
         482  +
         483  +
    pub fn set_auth_scheme_preference(
         484  +
        &mut self,
         485  +
        preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         486  +
    ) -> &mut Self {
         487  +
        self.config.store_or_unset(preference);
         488  +
        self
         489  +
    }
  428    490   
    /// Sets the endpoint resolver to use when making requests.
  429    491   
    ///
  430    492   
    ///
  431    493   
    /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
  432    494   
    /// rules for `aws_sdk_sts`.
  433    495   
    ///
  434    496   
    ///
  435    497   
    /// Note: setting an endpoint resolver will replace any endpoint URL that has been set.
  436    498   
    /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to
  437    499   
    /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`].
@@ -1263,1325 +1323,1395 @@
 1283   1345   
impl ServiceRuntimePlugin {
 1284   1346   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1285   1347   
        let config = {
 1286   1348   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("AWSSecurityTokenServiceV20110615");
 1287   1349   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1288   1350   
            ::std::option::Option::Some(cfg.freeze())
 1289   1351   
        };
 1290   1352   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
 1291   1353   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1292   1354   
            use crate::config::auth::ResolveAuthScheme;
        1355  +
            if let Some(preference) = _service_config
        1356  +
                .config
        1357  +
                .load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
        1358  +
                .cloned()
        1359  +
            {
        1360  +
                crate::config::auth::DefaultAuthSchemeResolver::default()
        1361  +
                    .with_auth_scheme_preference(preference)
        1362  +
                    .into_shared_resolver()
        1363  +
            } else {
 1293   1364   
                crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
        1365  +
            }
 1294   1366   
        }));
 1295   1367   
        runtime_components.set_endpoint_resolver(::std::option::Option::Some({
 1296   1368   
            use crate::config::endpoint::ResolveEndpoint;
 1297   1369   
            crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
 1298   1370   
        }));
 1299   1371   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1300   1372   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
 1301   1373   
        runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new());
 1302   1374   
        runtime_components.push_interceptor(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new());
 1303   1375   
        runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
@@ -1389,1461 +1448,1521 @@
 1409   1481   
            );
 1410   1482   
        }
 1411   1483   
        // resiliency
 1412   1484   
        builder.set_retry_config(input.retry_config().cloned());
 1413   1485   
        builder.set_timeout_config(input.timeout_config().cloned());
 1414   1486   
        builder.set_sleep_impl(input.sleep_impl());
 1415   1487   
 1416   1488   
        builder.set_http_client(input.http_client());
 1417   1489   
        builder.set_time_source(input.time_source());
 1418   1490   
        builder.set_behavior_version(input.behavior_version());
        1491  +
        builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
 1419   1492   
        // setting `None` here removes the default
 1420   1493   
        if let Some(config) = input.stalled_stream_protection() {
 1421   1494   
            builder.set_stalled_stream_protection(Some(config));
 1422   1495   
        }
 1423   1496   
 1424   1497   
        if let Some(cache) = input.identity_cache() {
 1425   1498   
            builder.set_identity_cache(cache);
 1426   1499   
        }
 1427   1500   
        builder.set_app_name(input.app_name().cloned());
 1428   1501   

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

@@ -18,18 +139,169 @@
   38     38   
        }
   39     39   
    }
   40     40   
}
   41     41   
   42     42   
/// The default auth scheme resolver
   43     43   
#[derive(Debug)]
   44     44   
#[allow(dead_code)]
   45     45   
pub struct DefaultAuthSchemeResolver {
   46     46   
    service_defaults: Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>,
   47     47   
    operation_overrides: ::std::collections::HashMap<&'static str, Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>>,
          48  +
    preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
   48     49   
}
   49     50   
   50     51   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     52   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     53   
// of the `Default` trait may appear as if it could be derived automatically.
   53     54   
// However, that is not the case in production.
   54     55   
#[allow(clippy::derivable_impls)]
   55     56   
impl Default for DefaultAuthSchemeResolver {
   56     57   
    fn default() -> Self {
   57     58   
        Self {
   58     59   
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59     60   
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60     61   
                .build()
   61     62   
                .expect("required fields set")],
   62     63   
            operation_overrides: [
   63     64   
                (
   64     65   
                    "AssumeRoleWithSAML",
   65     66   
                    vec![
   66     67   
                        ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   67     68   
                            .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   68     69   
                            .build()
   69     70   
                            .expect("required fields set"),
   70     71   
                        ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   71     72   
                            ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   72     73   
                        ),
   73     74   
                    ],
   74     75   
                ),
   75     76   
                (
   76     77   
                    "AssumeRoleWithWebIdentity",
   77     78   
                    vec![
   78     79   
                        ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   79     80   
                            .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   80     81   
                            .build()
   81     82   
                            .expect("required fields set"),
   82     83   
                        ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(
   83     84   
                            ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
   84     85   
                        ),
   85     86   
                    ],
   86     87   
                ),
   87     88   
            ]
   88     89   
            .into(),
          90  +
            preference: ::std::option::Option::None,
   89     91   
        }
   90     92   
    }
   91     93   
}
   92     94   
   93     95   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   94     96   
    fn resolve_auth_scheme<'a>(
   95     97   
        &'a self,
   96     98   
        params: &'a crate::config::auth::Params,
   97     99   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
   98    100   
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
   99    101   
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  100    102   
        let operation_name = params.operation_name();
  101    103   
  102    104   
        let modeled_auth_options = match self.operation_overrides.get(operation_name) {
  103    105   
            Some(overrides) => overrides,
  104    106   
            None => &self.service_defaults,
  105    107   
        };
  106    108   
  107    109   
        let _fut = ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(Ok(modeled_auth_options.clone()));
  108    110   
  109         -
        _fut
         111  +
        match &self.preference {
         112  +
            ::std::option::Option::Some(preference) => {
         113  +
                _fut.map_ok({
         114  +
                    // maps auth scheme ID to the index in the preference list
         115  +
                    let preference_map: ::std::collections::HashMap<_, _> = preference.clone().into_iter().enumerate().map(|(i, s)| (s, i)).collect();
         116  +
                    move |auth_scheme_options| {
         117  +
                        let (mut preferred, non_preferred): (::std::vec::Vec<_>, ::std::vec::Vec<_>) = auth_scheme_options
         118  +
                            .into_iter()
         119  +
                            .partition(|auth_scheme_option| preference_map.contains_key(auth_scheme_option.scheme_id()));
         120  +
         121  +
                        preferred.sort_by_key(|opt| preference_map.get(opt.scheme_id()).expect("guaranteed by `partition`"));
         122  +
                        preferred.extend(non_preferred);
         123  +
                        preferred
         124  +
                    }
         125  +
                })
         126  +
            }
         127  +
            ::std::option::Option::None => _fut,
         128  +
        }
         129  +
    }
         130  +
}
         131  +
         132  +
impl DefaultAuthSchemeResolver {
         133  +
    /// Set auth scheme preference to the default auth scheme resolver
         134  +
    pub fn with_auth_scheme_preference(
         135  +
        mut self,
         136  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         137  +
    ) -> Self {
         138  +
        self.preference = ::std::option::Option::Some(preference.into());
         139  +
        self
  110    140   
    }
  111    141   
}
  112    142   
  113    143   
/// Configuration parameters for resolving the correct auth scheme
  114    144   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  115    145   
pub struct Params {
  116    146   
    operation_name: ::std::borrow::Cow<'static, str>,
  117    147   
}
  118    148   
impl Params {
  119    149   
    /// Create a builder for [`Params`]

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

@@ -1,1 +139,139 @@
   17     17   
[dependencies.aws-credential-types]
   18     18   
path = "../aws-credential-types"
   19     19   
version = "1.2.3"
   20     20   
   21     21   
[dependencies.aws-runtime]
   22     22   
path = "../aws-runtime"
   23     23   
version = "1.5.9"
   24     24   
   25     25   
[dependencies.aws-smithy-async]
   26     26   
path = "../aws-smithy-async"
   27         -
version = "1.2.5"
          27  +
version = "1.3.0"
   28     28   
   29     29   
[dependencies.aws-smithy-http]
   30     30   
path = "../aws-smithy-http"
   31     31   
version = "0.62.1"
   32     32   
   33     33   
[dependencies.aws-smithy-json]
   34     34   
path = "../aws-smithy-json"
   35     35   
version = "0.61.4"
   36     36   
   37     37   
[dependencies.aws-smithy-runtime]
   38     38   
path = "../aws-smithy-runtime"
   39     39   
features = ["client"]
   40         -
version = "1.8.4"
          40  +
version = "1.8.5"
   41     41   
   42     42   
[dependencies.aws-smithy-runtime-api]
   43     43   
path = "../aws-smithy-runtime-api"
   44     44   
features = ["client", "http-02x"]
   45         -
version = "1.8.3"
          45  +
version = "1.8.4"
   46     46   
   47     47   
[dependencies.aws-smithy-types]
   48     48   
path = "../aws-smithy-types"
   49     49   
version = "1.3.2"
   50     50   
   51     51   
[dependencies.aws-types]
   52     52   
path = "../aws-types"
   53         -
version = "1.3.7"
          53  +
version = "1.3.8"
   54     54   
   55     55   
[dependencies.bytes]
   56     56   
version = "1.4.0"
   57     57   
   58     58   
[dependencies.fastrand]
   59     59   
version = "2.0.0"
   60     60   
   61     61   
[dependencies.http]
   62     62   
version = "0.2.9"
   63     63   
   64     64   
[dependencies.regex-lite]
   65     65   
version = "0.1.5"
   66     66   
   67     67   
[dependencies.tokio]
   68     68   
version = "1.23.1"
   69     69   
features = ["sync"]
   70     70   
   71     71   
[dependencies.tracing]
   72     72   
version = "0.1"
   73     73   
[dev-dependencies.aws-config]
   74     74   
path = "../aws-config"
   75         -
version = "1.8.2"
          75  +
version = "1.8.3"
   76     76   
   77     77   
[dev-dependencies.aws-credential-types]
   78     78   
path = "../aws-credential-types"
   79     79   
features = ["test-util"]
   80     80   
version = "1.2.3"
   81     81   
   82     82   
[dev-dependencies.aws-runtime]
   83     83   
path = "../aws-runtime"
   84     84   
features = ["test-util"]
   85     85   
version = "1.5.9"
   86     86   
   87     87   
[dev-dependencies.aws-smithy-async]
   88     88   
path = "../aws-smithy-async"
   89     89   
features = ["test-util"]
   90         -
version = "1.2.5"
          90  +
version = "1.3.0"
   91     91   
   92     92   
[dev-dependencies.aws-smithy-http-client]
   93     93   
path = "../aws-smithy-http-client"
   94     94   
features = ["test-util", "wire-mock"]
   95     95   
version = "1.0.6"
   96     96   
   97     97   
[dev-dependencies.aws-smithy-protocol-test]
   98     98   
path = "../aws-smithy-protocol-test"
   99     99   
version = "0.63.4"
  100    100   
  101    101   
[dev-dependencies.aws-smithy-runtime]
  102    102   
path = "../aws-smithy-runtime"
  103    103   
features = ["test-util"]
  104         -
version = "1.8.4"
         104  +
version = "1.8.5"
  105    105   
  106    106   
[dev-dependencies.aws-smithy-runtime-api]
  107    107   
path = "../aws-smithy-runtime-api"
  108    108   
features = ["test-util"]
  109         -
version = "1.8.3"
         109  +
version = "1.8.4"
  110    110   
  111    111   
[dev-dependencies.aws-smithy-types]
  112    112   
path = "../aws-smithy-types"
  113    113   
features = ["test-util"]
  114    114   
version = "1.3.2"
  115    115   
  116    116   
[dev-dependencies.futures-util]
  117    117   
version = "0.3.25"
  118    118   
features = ["alloc"]
  119    119   
default-features = false

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

@@ -36,36 +95,99 @@
   56     56   
    }
   57     57   
    /// Return the auth schemes configured on this service config
   58     58   
    pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
   59     59   
        self.runtime_components.auth_schemes()
   60     60   
    }
   61     61   
   62     62   
    /// Return the auth scheme resolver configured on this service config
   63     63   
    pub fn auth_scheme_resolver(&self) -> ::std::option::Option<::aws_smithy_runtime_api::client::auth::SharedAuthSchemeOptionResolver> {
   64     64   
        self.runtime_components.auth_scheme_option_resolver()
   65     65   
    }
          66  +
    /// Returns the configured auth scheme preference
          67  +
    pub fn auth_scheme_preference(&self) -> ::std::option::Option<&::aws_smithy_runtime_api::client::auth::AuthSchemePreference> {
          68  +
        self.config.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
          69  +
    }
   66     70   
    /// Returns the endpoint resolver.
   67     71   
    pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver {
   68     72   
        self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set")
   69     73   
    }
   70     74   
    /// Return a reference to the retry configuration contained in this config, if any.
   71     75   
    pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> {
   72     76   
        self.config.load::<::aws_smithy_types::retry::RetryConfig>()
   73     77   
    }
   74     78   
   75     79   
    /// Return a cloned shared async sleep implementation from this config, if any.
@@ -149,153 +208,213 @@
  169    173   
    ///
  170    174   
    pub fn new() -> Self {
  171    175   
        Self::default()
  172    176   
    }
  173    177   
    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
  174    178   
    /// but not those in runtime components.
  175    179   
    #[allow(unused)]
  176    180   
    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
  177    181   
        let mut builder = Self::new();
  178    182   
        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
         183  +
        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
  179    184   
        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
  180    185   
        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
  181    186   
        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
  182    187   
        builder.set_app_name(config_bag.load::<::aws_types::app_name::AppName>().cloned());
  183    188   
        builder.set_endpoint_url(config_bag.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()));
  184    189   
        builder.set_use_dual_stack(config_bag.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0));
  185    190   
        builder.set_use_fips(config_bag.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0));
  186    191   
        builder.set_region(config_bag.load::<crate::config::Region>().cloned());
  187    192   
        builder
  188    193   
    }
@@ -414,419 +473,535 @@
  434    439   
  435    440   
    /// Set the auth scheme resolver for the builder
  436    441   
    ///
  437    442   
    /// # Examples
  438    443   
    /// See an example for [`Self::auth_scheme_resolver`].
  439    444   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  440    445   
        self.runtime_components
  441    446   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  442    447   
        self
  443    448   
    }
         449  +
    /// Set the auth scheme preference for an auth scheme resolver
         450  +
    /// (typically the default auth scheme resolver).
         451  +
    ///
         452  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         453  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         454  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         455  +
    ///
         456  +
    /// The preference list is intended as a hint rather than a strict override.
         457  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         458  +
    ///
         459  +
    /// # Examples
         460  +
    ///
         461  +
    /// ```no_run
         462  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         463  +
    /// let config = aws_sdk_timestreamquery::Config::builder()
         464  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         465  +
    ///     // ...
         466  +
    ///     .build();
         467  +
    /// let client = aws_sdk_timestreamquery::Client::from_conf(config);
         468  +
    /// ```
         469  +
         470  +
    pub fn auth_scheme_preference(
         471  +
        mut self,
         472  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         473  +
    ) -> Self {
         474  +
        self.set_auth_scheme_preference(::std::option::Option::Some(preference.into()));
         475  +
        self
         476  +
    }
         477  +
         478  +
    /// Set the auth scheme preference for an auth scheme resolver
         479  +
    /// (typically the default auth scheme resolver).
         480  +
    ///
         481  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         482  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         483  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         484  +
    ///
         485  +
    /// The preference list is intended as a hint rather than a strict override.
         486  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         487  +
    ///
         488  +
    /// # Examples
         489  +
    ///
         490  +
    /// ```no_run
         491  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         492  +
    /// let config = aws_sdk_timestreamquery::Config::builder()
         493  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         494  +
    ///     // ...
         495  +
    ///     .build();
         496  +
    /// let client = aws_sdk_timestreamquery::Client::from_conf(config);
         497  +
    /// ```
         498  +
         499  +
    pub fn set_auth_scheme_preference(
         500  +
        &mut self,
         501  +
        preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         502  +
    ) -> &mut Self {
         503  +
        self.config.store_or_unset(preference);
         504  +
        self
         505  +
    }
  444    506   
    /// Sets the endpoint resolver to use when making requests.
  445    507   
    ///
  446    508   
    ///
  447    509   
    /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
  448    510   
    /// rules for `aws_sdk_timestreamquery`.
  449    511   
    ///
  450    512   
    ///
  451    513   
    /// Note: setting an endpoint resolver will replace any endpoint URL that has been set.
  452    514   
    /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to
  453    515   
    /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`].
@@ -1281,1343 +1341,1413 @@
 1301   1363   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1302   1364   
        let config = {
 1303   1365   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Timestream_20181101");
 1304   1366   
            cfg.store_put(crate::idempotency_token::default_provider());
 1305   1367   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1306   1368   
            ::std::option::Option::Some(cfg.freeze())
 1307   1369   
        };
 1308   1370   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
 1309   1371   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1310   1372   
            use crate::config::auth::ResolveAuthScheme;
        1373  +
            if let Some(preference) = _service_config
        1374  +
                .config
        1375  +
                .load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
        1376  +
                .cloned()
        1377  +
            {
        1378  +
                crate::config::auth::DefaultAuthSchemeResolver::default()
        1379  +
                    .with_auth_scheme_preference(preference)
        1380  +
                    .into_shared_resolver()
        1381  +
            } else {
 1311   1382   
                crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
        1383  +
            }
 1312   1384   
        }));
 1313   1385   
        runtime_components.set_endpoint_resolver(::std::option::Option::Some({
 1314   1386   
            use crate::config::endpoint::ResolveEndpoint;
 1315   1387   
            crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
 1316   1388   
        }));
 1317   1389   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1318   1390   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
 1319   1391   
        runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new());
 1320   1392   
        runtime_components.push_interceptor(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new());
 1321   1393   
        runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
@@ -1407,1479 +1466,1539 @@
 1427   1499   
            );
 1428   1500   
        }
 1429   1501   
        // resiliency
 1430   1502   
        builder.set_retry_config(input.retry_config().cloned());
 1431   1503   
        builder.set_timeout_config(input.timeout_config().cloned());
 1432   1504   
        builder.set_sleep_impl(input.sleep_impl());
 1433   1505   
 1434   1506   
        builder.set_http_client(input.http_client());
 1435   1507   
        builder.set_time_source(input.time_source());
 1436   1508   
        builder.set_behavior_version(input.behavior_version());
        1509  +
        builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
 1437   1510   
        // setting `None` here removes the default
 1438   1511   
        if let Some(config) = input.stalled_stream_protection() {
 1439   1512   
            builder.set_stalled_stream_protection(Some(config));
 1440   1513   
        }
 1441   1514   
 1442   1515   
        if let Some(cache) = input.identity_cache() {
 1443   1516   
            builder.set_identity_cache(cache);
 1444   1517   
        }
 1445   1518   
        builder.set_app_name(input.app_name().cloned());
 1446   1519   

tmp-codegen-diff/aws-sdk/sdk/timestreamquery/src/config/auth.rs

@@ -18,18 +113,143 @@
   38     38   
        }
   39     39   
    }
   40     40   
}
   41     41   
   42     42   
/// The default auth scheme resolver
   43     43   
#[derive(Debug)]
   44     44   
#[allow(dead_code)]
   45     45   
pub struct DefaultAuthSchemeResolver {
   46     46   
    service_defaults: Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>,
   47     47   
    operation_overrides: ::std::collections::HashMap<&'static str, Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>>,
          48  +
    preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
   48     49   
}
   49     50   
   50     51   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     52   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     53   
// of the `Default` trait may appear as if it could be derived automatically.
   53     54   
// However, that is not the case in production.
   54     55   
#[allow(clippy::derivable_impls)]
   55     56   
impl Default for DefaultAuthSchemeResolver {
   56     57   
    fn default() -> Self {
   57     58   
        Self {
   58     59   
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59     60   
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60     61   
                .build()
   61     62   
                .expect("required fields set")],
   62     63   
            operation_overrides: ::std::collections::HashMap::new(),
          64  +
            preference: ::std::option::Option::None,
   63     65   
        }
   64     66   
    }
   65     67   
}
   66     68   
   67     69   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   68     70   
    fn resolve_auth_scheme<'a>(
   69     71   
        &'a self,
   70     72   
        params: &'a crate::config::auth::Params,
   71     73   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
   72     74   
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
   73     75   
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
   74     76   
        let operation_name = params.operation_name();
   75     77   
   76     78   
        let modeled_auth_options = match self.operation_overrides.get(operation_name) {
   77     79   
            Some(overrides) => overrides,
   78     80   
            None => &self.service_defaults,
   79     81   
        };
   80     82   
   81     83   
        let _fut = ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(Ok(modeled_auth_options.clone()));
   82     84   
   83         -
        _fut
          85  +
        match &self.preference {
          86  +
            ::std::option::Option::Some(preference) => {
          87  +
                _fut.map_ok({
          88  +
                    // maps auth scheme ID to the index in the preference list
          89  +
                    let preference_map: ::std::collections::HashMap<_, _> = preference.clone().into_iter().enumerate().map(|(i, s)| (s, i)).collect();
          90  +
                    move |auth_scheme_options| {
          91  +
                        let (mut preferred, non_preferred): (::std::vec::Vec<_>, ::std::vec::Vec<_>) = auth_scheme_options
          92  +
                            .into_iter()
          93  +
                            .partition(|auth_scheme_option| preference_map.contains_key(auth_scheme_option.scheme_id()));
          94  +
          95  +
                        preferred.sort_by_key(|opt| preference_map.get(opt.scheme_id()).expect("guaranteed by `partition`"));
          96  +
                        preferred.extend(non_preferred);
          97  +
                        preferred
          98  +
                    }
          99  +
                })
         100  +
            }
         101  +
            ::std::option::Option::None => _fut,
         102  +
        }
         103  +
    }
         104  +
}
         105  +
         106  +
impl DefaultAuthSchemeResolver {
         107  +
    /// Set auth scheme preference to the default auth scheme resolver
         108  +
    pub fn with_auth_scheme_preference(
         109  +
        mut self,
         110  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         111  +
    ) -> Self {
         112  +
        self.preference = ::std::option::Option::Some(preference.into());
         113  +
        self
   84    114   
    }
   85    115   
}
   86    116   
   87    117   
/// Configuration parameters for resolving the correct auth scheme
   88    118   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
   89    119   
pub struct Params {
   90    120   
    operation_name: ::std::borrow::Cow<'static, str>,
   91    121   
}
   92    122   
impl Params {
   93    123   
    /// Create a builder for [`Params`]

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

@@ -1,1 +98,98 @@
   17     17   
[dependencies.aws-credential-types]
   18     18   
path = "../aws-credential-types"
   19     19   
version = "1.2.3"
   20     20   
   21     21   
[dependencies.aws-runtime]
   22     22   
path = "../aws-runtime"
   23     23   
version = "1.5.9"
   24     24   
   25     25   
[dependencies.aws-smithy-async]
   26     26   
path = "../aws-smithy-async"
   27         -
version = "1.2.5"
          27  +
version = "1.3.0"
   28     28   
   29     29   
[dependencies.aws-smithy-http]
   30     30   
path = "../aws-smithy-http"
   31     31   
version = "0.62.1"
   32     32   
   33     33   
[dependencies.aws-smithy-json]
   34     34   
path = "../aws-smithy-json"
   35     35   
version = "0.61.4"
   36     36   
   37     37   
[dependencies.aws-smithy-runtime]
   38     38   
path = "../aws-smithy-runtime"
   39     39   
features = ["client"]
   40         -
version = "1.8.4"
          40  +
version = "1.8.5"
   41     41   
   42     42   
[dependencies.aws-smithy-runtime-api]
   43     43   
path = "../aws-smithy-runtime-api"
   44     44   
features = ["client", "http-02x"]
   45         -
version = "1.8.3"
          45  +
version = "1.8.4"
   46     46   
   47     47   
[dependencies.aws-smithy-types]
   48     48   
path = "../aws-smithy-types"
   49     49   
version = "1.3.2"
   50     50   
   51     51   
[dependencies.aws-types]
   52     52   
path = "../aws-types"
   53         -
version = "1.3.7"
          53  +
version = "1.3.8"
   54     54   
   55     55   
[dependencies.bytes]
   56     56   
version = "1.4.0"
   57     57   
   58     58   
[dependencies.fastrand]
   59     59   
version = "2.0.0"
   60     60   
   61     61   
[dependencies.http]
   62     62   
version = "0.2.9"
   63     63   
   64     64   
[dependencies.regex-lite]
   65     65   
version = "0.1.5"
   66     66   
   67     67   
[dependencies.tokio]
   68     68   
version = "1.23.1"
   69     69   
features = ["sync"]
   70     70   
   71     71   
[dependencies.tracing]
   72     72   
version = "0.1"
   73     73   
[dev-dependencies.aws-config]
   74     74   
path = "../aws-config"
   75         -
version = "1.8.2"
          75  +
version = "1.8.3"
   76     76   
   77     77   
[dev-dependencies.aws-credential-types]
   78     78   
path = "../aws-credential-types"
   79     79   
features = ["test-util"]
   80     80   
version = "1.2.3"
   81     81   
   82     82   
[dev-dependencies.aws-smithy-async]
   83     83   
path = "../aws-smithy-async"
   84     84   
features = ["test-util"]
   85         -
version = "1.2.5"
          85  +
version = "1.3.0"
   86     86   
   87     87   
[dev-dependencies.tokio]
   88     88   
version = "1.23.1"
   89     89   
features = ["macros", "test-util", "rt-multi-thread"]
   90     90   
   91     91   
[features]
   92     92   
behavior-version-latest = []
   93     93   
rustls = ["aws-smithy-runtime/tls-rustls"]
   94     94   
default-https-client = ["aws-smithy-runtime/default-https-client"]
   95     95   
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]

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

@@ -36,36 +95,99 @@
   56     56   
    }
   57     57   
    /// Return the auth schemes configured on this service config
   58     58   
    pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
   59     59   
        self.runtime_components.auth_schemes()
   60     60   
    }
   61     61   
   62     62   
    /// Return the auth scheme resolver configured on this service config
   63     63   
    pub fn auth_scheme_resolver(&self) -> ::std::option::Option<::aws_smithy_runtime_api::client::auth::SharedAuthSchemeOptionResolver> {
   64     64   
        self.runtime_components.auth_scheme_option_resolver()
   65     65   
    }
          66  +
    /// Returns the configured auth scheme preference
          67  +
    pub fn auth_scheme_preference(&self) -> ::std::option::Option<&::aws_smithy_runtime_api::client::auth::AuthSchemePreference> {
          68  +
        self.config.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
          69  +
    }
   66     70   
    /// Returns the endpoint resolver.
   67     71   
    pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver {
   68     72   
        self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set")
   69     73   
    }
   70     74   
    /// Return a reference to the retry configuration contained in this config, if any.
   71     75   
    pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> {
   72     76   
        self.config.load::<::aws_smithy_types::retry::RetryConfig>()
   73     77   
    }
   74     78   
   75     79   
    /// Return a cloned shared async sleep implementation from this config, if any.
@@ -149,153 +208,213 @@
  169    173   
    ///
  170    174   
    pub fn new() -> Self {
  171    175   
        Self::default()
  172    176   
    }
  173    177   
    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
  174    178   
    /// but not those in runtime components.
  175    179   
    #[allow(unused)]
  176    180   
    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
  177    181   
        let mut builder = Self::new();
  178    182   
        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
         183  +
        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
  179    184   
        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
  180    185   
        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
  181    186   
        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
  182    187   
        builder.set_app_name(config_bag.load::<::aws_types::app_name::AppName>().cloned());
  183    188   
        builder.set_endpoint_url(config_bag.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()));
  184    189   
        builder.set_use_dual_stack(config_bag.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0));
  185    190   
        builder.set_use_fips(config_bag.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0));
  186    191   
        builder.set_region(config_bag.load::<crate::config::Region>().cloned());
  187    192   
        builder
  188    193   
    }
@@ -414,419 +473,535 @@
  434    439   
  435    440   
    /// Set the auth scheme resolver for the builder
  436    441   
    ///
  437    442   
    /// # Examples
  438    443   
    /// See an example for [`Self::auth_scheme_resolver`].
  439    444   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  440    445   
        self.runtime_components
  441    446   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  442    447   
        self
  443    448   
    }
         449  +
    /// Set the auth scheme preference for an auth scheme resolver
         450  +
    /// (typically the default auth scheme resolver).
         451  +
    ///
         452  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         453  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         454  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         455  +
    ///
         456  +
    /// The preference list is intended as a hint rather than a strict override.
         457  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         458  +
    ///
         459  +
    /// # Examples
         460  +
    ///
         461  +
    /// ```no_run
         462  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         463  +
    /// let config = aws_sdk_timestreamwrite::Config::builder()
         464  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         465  +
    ///     // ...
         466  +
    ///     .build();
         467  +
    /// let client = aws_sdk_timestreamwrite::Client::from_conf(config);
         468  +
    /// ```
         469  +
         470  +
    pub fn auth_scheme_preference(
         471  +
        mut self,
         472  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         473  +
    ) -> Self {
         474  +
        self.set_auth_scheme_preference(::std::option::Option::Some(preference.into()));
         475  +
        self
         476  +
    }
         477  +
         478  +
    /// Set the auth scheme preference for an auth scheme resolver
         479  +
    /// (typically the default auth scheme resolver).
         480  +
    ///
         481  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         482  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         483  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         484  +
    ///
         485  +
    /// The preference list is intended as a hint rather than a strict override.
         486  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         487  +
    ///
         488  +
    /// # Examples
         489  +
    ///
         490  +
    /// ```no_run
         491  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         492  +
    /// let config = aws_sdk_timestreamwrite::Config::builder()
         493  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         494  +
    ///     // ...
         495  +
    ///     .build();
         496  +
    /// let client = aws_sdk_timestreamwrite::Client::from_conf(config);
         497  +
    /// ```
         498  +
         499  +
    pub fn set_auth_scheme_preference(
         500  +
        &mut self,
         501  +
        preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         502  +
    ) -> &mut Self {
         503  +
        self.config.store_or_unset(preference);
         504  +
        self
         505  +
    }
  444    506   
    /// Sets the endpoint resolver to use when making requests.
  445    507   
    ///
  446    508   
    ///
  447    509   
    /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
  448    510   
    /// rules for `aws_sdk_timestreamwrite`.
  449    511   
    ///
  450    512   
    ///
  451    513   
    /// Note: setting an endpoint resolver will replace any endpoint URL that has been set.
  452    514   
    /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to
  453    515   
    /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`].
@@ -1281,1343 +1341,1413 @@
 1301   1363   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1302   1364   
        let config = {
 1303   1365   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Timestream_20181101");
 1304   1366   
            cfg.store_put(crate::idempotency_token::default_provider());
 1305   1367   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1306   1368   
            ::std::option::Option::Some(cfg.freeze())
 1307   1369   
        };
 1308   1370   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
 1309   1371   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1310   1372   
            use crate::config::auth::ResolveAuthScheme;
        1373  +
            if let Some(preference) = _service_config
        1374  +
                .config
        1375  +
                .load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
        1376  +
                .cloned()
        1377  +
            {
        1378  +
                crate::config::auth::DefaultAuthSchemeResolver::default()
        1379  +
                    .with_auth_scheme_preference(preference)
        1380  +
                    .into_shared_resolver()
        1381  +
            } else {
 1311   1382   
                crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
        1383  +
            }
 1312   1384   
        }));
 1313   1385   
        runtime_components.set_endpoint_resolver(::std::option::Option::Some({
 1314   1386   
            use crate::config::endpoint::ResolveEndpoint;
 1315   1387   
            crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
 1316   1388   
        }));
 1317   1389   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1318   1390   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
 1319   1391   
        runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new());
 1320   1392   
        runtime_components.push_interceptor(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new());
 1321   1393   
        runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
@@ -1407,1479 +1466,1539 @@
 1427   1499   
            );
 1428   1500   
        }
 1429   1501   
        // resiliency
 1430   1502   
        builder.set_retry_config(input.retry_config().cloned());
 1431   1503   
        builder.set_timeout_config(input.timeout_config().cloned());
 1432   1504   
        builder.set_sleep_impl(input.sleep_impl());
 1433   1505   
 1434   1506   
        builder.set_http_client(input.http_client());
 1435   1507   
        builder.set_time_source(input.time_source());
 1436   1508   
        builder.set_behavior_version(input.behavior_version());
        1509  +
        builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
 1437   1510   
        // setting `None` here removes the default
 1438   1511   
        if let Some(config) = input.stalled_stream_protection() {
 1439   1512   
            builder.set_stalled_stream_protection(Some(config));
 1440   1513   
        }
 1441   1514   
 1442   1515   
        if let Some(cache) = input.identity_cache() {
 1443   1516   
            builder.set_identity_cache(cache);
 1444   1517   
        }
 1445   1518   
        builder.set_app_name(input.app_name().cloned());
 1446   1519   

tmp-codegen-diff/aws-sdk/sdk/timestreamwrite/src/config/auth.rs

@@ -18,18 +113,143 @@
   38     38   
        }
   39     39   
    }
   40     40   
}
   41     41   
   42     42   
/// The default auth scheme resolver
   43     43   
#[derive(Debug)]
   44     44   
#[allow(dead_code)]
   45     45   
pub struct DefaultAuthSchemeResolver {
   46     46   
    service_defaults: Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>,
   47     47   
    operation_overrides: ::std::collections::HashMap<&'static str, Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>>,
          48  +
    preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
   48     49   
}
   49     50   
   50     51   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     52   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     53   
// of the `Default` trait may appear as if it could be derived automatically.
   53     54   
// However, that is not the case in production.
   54     55   
#[allow(clippy::derivable_impls)]
   55     56   
impl Default for DefaultAuthSchemeResolver {
   56     57   
    fn default() -> Self {
   57     58   
        Self {
   58     59   
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59     60   
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60     61   
                .build()
   61     62   
                .expect("required fields set")],
   62     63   
            operation_overrides: ::std::collections::HashMap::new(),
          64  +
            preference: ::std::option::Option::None,
   63     65   
        }
   64     66   
    }
   65     67   
}
   66     68   
   67     69   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   68     70   
    fn resolve_auth_scheme<'a>(
   69     71   
        &'a self,
   70     72   
        params: &'a crate::config::auth::Params,
   71     73   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
   72     74   
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
   73     75   
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
   74     76   
        let operation_name = params.operation_name();
   75     77   
   76     78   
        let modeled_auth_options = match self.operation_overrides.get(operation_name) {
   77     79   
            Some(overrides) => overrides,
   78     80   
            None => &self.service_defaults,
   79     81   
        };
   80     82   
   81     83   
        let _fut = ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(Ok(modeled_auth_options.clone()));
   82     84   
   83         -
        _fut
          85  +
        match &self.preference {
          86  +
            ::std::option::Option::Some(preference) => {
          87  +
                _fut.map_ok({
          88  +
                    // maps auth scheme ID to the index in the preference list
          89  +
                    let preference_map: ::std::collections::HashMap<_, _> = preference.clone().into_iter().enumerate().map(|(i, s)| (s, i)).collect();
          90  +
                    move |auth_scheme_options| {
          91  +
                        let (mut preferred, non_preferred): (::std::vec::Vec<_>, ::std::vec::Vec<_>) = auth_scheme_options
          92  +
                            .into_iter()
          93  +
                            .partition(|auth_scheme_option| preference_map.contains_key(auth_scheme_option.scheme_id()));
          94  +
          95  +
                        preferred.sort_by_key(|opt| preference_map.get(opt.scheme_id()).expect("guaranteed by `partition`"));
          96  +
                        preferred.extend(non_preferred);
          97  +
                        preferred
          98  +
                    }
          99  +
                })
         100  +
            }
         101  +
            ::std::option::Option::None => _fut,
         102  +
        }
         103  +
    }
         104  +
}
         105  +
         106  +
impl DefaultAuthSchemeResolver {
         107  +
    /// Set auth scheme preference to the default auth scheme resolver
         108  +
    pub fn with_auth_scheme_preference(
         109  +
        mut self,
         110  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         111  +
    ) -> Self {
         112  +
        self.preference = ::std::option::Option::Some(preference.into());
         113  +
        self
   84    114   
    }
   85    115   
}
   86    116   
   87    117   
/// Configuration parameters for resolving the correct auth scheme
   88    118   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
   89    119   
pub struct Params {
   90    120   
    operation_name: ::std::borrow::Cow<'static, str>,
   91    121   
}
   92    122   
impl Params {
   93    123   
    /// Create a builder for [`Params`]

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

@@ -2,2 +158,158 @@
   22     22   
path = "../aws-runtime"
   23     23   
features = ["event-stream"]
   24     24   
version = "1.5.9"
   25     25   
   26     26   
[dependencies.aws-sigv4]
   27     27   
path = "../aws-sigv4"
   28     28   
version = "1.3.3"
   29     29   
   30     30   
[dependencies.aws-smithy-async]
   31     31   
path = "../aws-smithy-async"
   32         -
version = "1.2.5"
          32  +
version = "1.3.0"
   33     33   
   34     34   
[dependencies.aws-smithy-eventstream]
   35     35   
path = "../aws-smithy-eventstream"
   36     36   
version = "0.60.9"
   37     37   
   38     38   
[dependencies.aws-smithy-http]
   39     39   
path = "../aws-smithy-http"
   40     40   
features = ["event-stream"]
   41     41   
version = "0.62.1"
   42     42   
   43     43   
[dependencies.aws-smithy-json]
   44     44   
path = "../aws-smithy-json"
   45     45   
version = "0.61.4"
   46     46   
   47     47   
[dependencies.aws-smithy-runtime]
   48     48   
path = "../aws-smithy-runtime"
   49     49   
features = ["client"]
   50         -
version = "1.8.4"
          50  +
version = "1.8.5"
   51     51   
   52     52   
[dependencies.aws-smithy-runtime-api]
   53     53   
path = "../aws-smithy-runtime-api"
   54     54   
features = ["client", "http-02x"]
   55         -
version = "1.8.3"
          55  +
version = "1.8.4"
   56     56   
   57     57   
[dependencies.aws-smithy-types]
   58     58   
path = "../aws-smithy-types"
   59     59   
features = ["http-body-0-4-x"]
   60     60   
version = "1.3.2"
   61     61   
   62     62   
[dependencies.aws-types]
   63     63   
path = "../aws-types"
   64         -
version = "1.3.7"
          64  +
version = "1.3.8"
   65     65   
   66     66   
[dependencies.bytes]
   67     67   
version = "1.4.0"
   68     68   
   69     69   
[dependencies.fastrand]
   70     70   
version = "2.0.0"
   71     71   
   72     72   
[dependencies.http]
   73     73   
version = "0.2.9"
   74     74   
   75     75   
[dependencies.hyper]
   76     76   
version = "0.14.26"
   77     77   
features = ["stream"]
   78     78   
   79     79   
[dependencies.regex-lite]
   80     80   
version = "0.1.5"
   81     81   
   82     82   
[dependencies.tracing]
   83     83   
version = "0.1"
   84     84   
[dev-dependencies.async-stream]
   85     85   
version = "0.3.0"
   86     86   
   87     87   
[dev-dependencies.aws-config]
   88     88   
path = "../aws-config"
   89         -
version = "1.8.2"
          89  +
version = "1.8.3"
   90     90   
   91     91   
[dev-dependencies.aws-credential-types]
   92     92   
path = "../aws-credential-types"
   93     93   
features = ["test-util"]
   94     94   
version = "1.2.3"
   95     95   
   96     96   
[dev-dependencies.aws-runtime]
   97     97   
path = "../aws-runtime"
   98     98   
features = ["test-util"]
   99     99   
version = "1.5.9"
  100    100   
  101    101   
[dev-dependencies.aws-smithy-async]
  102    102   
path = "../aws-smithy-async"
  103    103   
features = ["test-util"]
  104         -
version = "1.2.5"
         104  +
version = "1.3.0"
  105    105   
  106    106   
[dev-dependencies.aws-smithy-eventstream]
  107    107   
path = "../aws-smithy-eventstream"
  108    108   
features = ["test-util"]
  109    109   
version = "0.60.9"
  110    110   
  111    111   
[dev-dependencies.aws-smithy-http-client]
  112    112   
path = "../aws-smithy-http-client"
  113    113   
features = ["test-util", "wire-mock"]
  114    114   
version = "1.0.6"
  115    115   
  116    116   
[dev-dependencies.aws-smithy-protocol-test]
  117    117   
path = "../aws-smithy-protocol-test"
  118    118   
version = "0.63.4"
  119    119   
  120    120   
[dev-dependencies.aws-smithy-runtime]
  121    121   
path = "../aws-smithy-runtime"
  122    122   
features = ["test-util"]
  123         -
version = "1.8.4"
         123  +
version = "1.8.5"
  124    124   
  125    125   
[dev-dependencies.aws-smithy-runtime-api]
  126    126   
path = "../aws-smithy-runtime-api"
  127    127   
features = ["test-util"]
  128         -
version = "1.8.3"
         128  +
version = "1.8.4"
  129    129   
  130    130   
[dev-dependencies.aws-smithy-types]
  131    131   
path = "../aws-smithy-types"
  132    132   
features = ["test-util"]
  133    133   
version = "1.3.2"
  134    134   
  135    135   
[dev-dependencies.futures-core]
  136    136   
version = "0.3.25"
  137    137   
  138    138   
[dev-dependencies.futures-util]

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

@@ -36,36 +95,99 @@
   56     56   
    }
   57     57   
    /// Return the auth schemes configured on this service config
   58     58   
    pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
   59     59   
        self.runtime_components.auth_schemes()
   60     60   
    }
   61     61   
   62     62   
    /// Return the auth scheme resolver configured on this service config
   63     63   
    pub fn auth_scheme_resolver(&self) -> ::std::option::Option<::aws_smithy_runtime_api::client::auth::SharedAuthSchemeOptionResolver> {
   64     64   
        self.runtime_components.auth_scheme_option_resolver()
   65     65   
    }
          66  +
    /// Returns the configured auth scheme preference
          67  +
    pub fn auth_scheme_preference(&self) -> ::std::option::Option<&::aws_smithy_runtime_api::client::auth::AuthSchemePreference> {
          68  +
        self.config.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
          69  +
    }
   66     70   
    /// Returns the endpoint resolver.
   67     71   
    pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver {
   68     72   
        self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set")
   69     73   
    }
   70     74   
    /// Return a reference to the retry configuration contained in this config, if any.
   71     75   
    pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> {
   72     76   
        self.config.load::<::aws_smithy_types::retry::RetryConfig>()
   73     77   
    }
   74     78   
   75     79   
    /// Return a cloned shared async sleep implementation from this config, if any.
@@ -149,153 +208,213 @@
  169    173   
    ///
  170    174   
    pub fn new() -> Self {
  171    175   
        Self::default()
  172    176   
    }
  173    177   
    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
  174    178   
    /// but not those in runtime components.
  175    179   
    #[allow(unused)]
  176    180   
    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
  177    181   
        let mut builder = Self::new();
  178    182   
        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
         183  +
        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
  179    184   
        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
  180    185   
        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
  181    186   
        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
  182    187   
        builder.set_app_name(config_bag.load::<::aws_types::app_name::AppName>().cloned());
  183    188   
        builder.set_endpoint_url(config_bag.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()));
  184    189   
        builder.set_use_dual_stack(config_bag.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0));
  185    190   
        builder.set_use_fips(config_bag.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0));
  186    191   
        builder.set_region(config_bag.load::<crate::config::Region>().cloned());
  187    192   
        builder
  188    193   
    }
@@ -398,403 +457,519 @@
  418    423   
  419    424   
    /// Set the auth scheme resolver for the builder
  420    425   
    ///
  421    426   
    /// # Examples
  422    427   
    /// See an example for [`Self::auth_scheme_resolver`].
  423    428   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  424    429   
        self.runtime_components
  425    430   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  426    431   
        self
  427    432   
    }
         433  +
    /// Set the auth scheme preference for an auth scheme resolver
         434  +
    /// (typically the default auth scheme resolver).
         435  +
    ///
         436  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         437  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         438  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         439  +
    ///
         440  +
    /// The preference list is intended as a hint rather than a strict override.
         441  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         442  +
    ///
         443  +
    /// # Examples
         444  +
    ///
         445  +
    /// ```no_run
         446  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         447  +
    /// let config = aws_sdk_transcribestreaming::Config::builder()
         448  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         449  +
    ///     // ...
         450  +
    ///     .build();
         451  +
    /// let client = aws_sdk_transcribestreaming::Client::from_conf(config);
         452  +
    /// ```
         453  +
         454  +
    pub fn auth_scheme_preference(
         455  +
        mut self,
         456  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         457  +
    ) -> Self {
         458  +
        self.set_auth_scheme_preference(::std::option::Option::Some(preference.into()));
         459  +
        self
         460  +
    }
         461  +
         462  +
    /// Set the auth scheme preference for an auth scheme resolver
         463  +
    /// (typically the default auth scheme resolver).
         464  +
    ///
         465  +
    /// Each operation has a predefined order of auth schemes, as determined by the service,
         466  +
    /// for auth scheme resolution. By using the auth scheme preference, customers
         467  +
    /// can reorder the schemes resolved by the auth scheme resolver.
         468  +
    ///
         469  +
    /// The preference list is intended as a hint rather than a strict override.
         470  +
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
         471  +
    ///
         472  +
    /// # Examples
         473  +
    ///
         474  +
    /// ```no_run
         475  +
    /// # use aws_smithy_runtime_api::client::auth::AuthSchemeId;
         476  +
    /// let config = aws_sdk_transcribestreaming::Config::builder()
         477  +
    ///     .auth_scheme_preference([AuthSchemeId::from("scheme1"), AuthSchemeId::from("scheme2")])
         478  +
    ///     // ...
         479  +
    ///     .build();
         480  +
    /// let client = aws_sdk_transcribestreaming::Client::from_conf(config);
         481  +
    /// ```
         482  +
         483  +
    pub fn set_auth_scheme_preference(
         484  +
        &mut self,
         485  +
        preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         486  +
    ) -> &mut Self {
         487  +
        self.config.store_or_unset(preference);
         488  +
        self
         489  +
    }
  428    490   
    /// Sets the endpoint resolver to use when making requests.
  429    491   
    ///
  430    492   
    ///
  431    493   
    /// When unset, the client will used a generated endpoint resolver based on the endpoint resolution
  432    494   
    /// rules for `aws_sdk_transcribestreaming`.
  433    495   
    ///
  434    496   
    ///
  435    497   
    /// Note: setting an endpoint resolver will replace any endpoint URL that has been set.
  436    498   
    /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to
  437    499   
    /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`].
@@ -1263,1325 +1323,1395 @@
 1283   1345   
impl ServiceRuntimePlugin {
 1284   1346   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1285   1347   
        let config = {
 1286   1348   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Transcribe");
 1287   1349   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1288   1350   
            ::std::option::Option::Some(cfg.freeze())
 1289   1351   
        };
 1290   1352   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
 1291   1353   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1292   1354   
            use crate::config::auth::ResolveAuthScheme;
        1355  +
            if let Some(preference) = _service_config
        1356  +
                .config
        1357  +
                .load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>()
        1358  +
                .cloned()
        1359  +
            {
        1360  +
                crate::config::auth::DefaultAuthSchemeResolver::default()
        1361  +
                    .with_auth_scheme_preference(preference)
        1362  +
                    .into_shared_resolver()
        1363  +
            } else {
 1293   1364   
                crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
        1365  +
            }
 1294   1366   
        }));
 1295   1367   
        runtime_components.set_endpoint_resolver(::std::option::Option::Some({
 1296   1368   
            use crate::config::endpoint::ResolveEndpoint;
 1297   1369   
            crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
 1298   1370   
        }));
 1299   1371   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1300   1372   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
 1301   1373   
        runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new());
 1302   1374   
        runtime_components.push_interceptor(::aws_runtime::service_clock_skew::ServiceClockSkewInterceptor::new());
 1303   1375   
        runtime_components.push_interceptor(::aws_runtime::request_info::RequestInfoInterceptor::new());
@@ -1389,1461 +1448,1521 @@
 1409   1481   
            );
 1410   1482   
        }
 1411   1483   
        // resiliency
 1412   1484   
        builder.set_retry_config(input.retry_config().cloned());
 1413   1485   
        builder.set_timeout_config(input.timeout_config().cloned());
 1414   1486   
        builder.set_sleep_impl(input.sleep_impl());
 1415   1487   
 1416   1488   
        builder.set_http_client(input.http_client());
 1417   1489   
        builder.set_time_source(input.time_source());
 1418   1490   
        builder.set_behavior_version(input.behavior_version());
        1491  +
        builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
 1419   1492   
        // setting `None` here removes the default
 1420   1493   
        if let Some(config) = input.stalled_stream_protection() {
 1421   1494   
            builder.set_stalled_stream_protection(Some(config));
 1422   1495   
        }
 1423   1496   
 1424   1497   
        if let Some(cache) = input.identity_cache() {
 1425   1498   
            builder.set_identity_cache(cache);
 1426   1499   
        }
 1427   1500   
        builder.set_app_name(input.app_name().cloned());
 1428   1501   

tmp-codegen-diff/aws-sdk/sdk/transcribestreaming/src/config/auth.rs

@@ -18,18 +113,143 @@
   38     38   
        }
   39     39   
    }
   40     40   
}
   41     41   
   42     42   
/// The default auth scheme resolver
   43     43   
#[derive(Debug)]
   44     44   
#[allow(dead_code)]
   45     45   
pub struct DefaultAuthSchemeResolver {
   46     46   
    service_defaults: Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>,
   47     47   
    operation_overrides: ::std::collections::HashMap<&'static str, Vec<::aws_smithy_runtime_api::client::auth::AuthSchemeOption>>,
          48  +
    preference: ::std::option::Option<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
   48     49   
}
   49     50   
   50     51   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     52   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     53   
// of the `Default` trait may appear as if it could be derived automatically.
   53     54   
// However, that is not the case in production.
   54     55   
#[allow(clippy::derivable_impls)]
   55     56   
impl Default for DefaultAuthSchemeResolver {
   56     57   
    fn default() -> Self {
   57     58   
        Self {
   58     59   
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59     60   
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60     61   
                .build()
   61     62   
                .expect("required fields set")],
   62     63   
            operation_overrides: ::std::collections::HashMap::new(),
          64  +
            preference: ::std::option::Option::None,
   63     65   
        }
   64     66   
    }
   65     67   
}
   66     68   
   67     69   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   68     70   
    fn resolve_auth_scheme<'a>(
   69     71   
        &'a self,
   70     72   
        params: &'a crate::config::auth::Params,
   71     73   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
   72     74   
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
   73     75   
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
   74     76   
        let operation_name = params.operation_name();
   75     77   
   76     78   
        let modeled_auth_options = match self.operation_overrides.get(operation_name) {
   77     79   
            Some(overrides) => overrides,
   78     80   
            None => &self.service_defaults,
   79     81   
        };
   80     82   
   81     83   
        let _fut = ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(Ok(modeled_auth_options.clone()));
   82     84   
   83         -
        _fut
          85  +
        match &self.preference {
          86  +
            ::std::option::Option::Some(preference) => {
          87  +
                _fut.map_ok({
          88  +
                    // maps auth scheme ID to the index in the preference list
          89  +
                    let preference_map: ::std::collections::HashMap<_, _> = preference.clone().into_iter().enumerate().map(|(i, s)| (s, i)).collect();
          90  +
                    move |auth_scheme_options| {
          91  +
                        let (mut preferred, non_preferred): (::std::vec::Vec<_>, ::std::vec::Vec<_>) = auth_scheme_options
          92  +
                            .into_iter()
          93  +
                            .partition(|auth_scheme_option| preference_map.contains_key(auth_scheme_option.scheme_id()));
          94  +
          95  +
                        preferred.sort_by_key(|opt| preference_map.get(opt.scheme_id()).expect("guaranteed by `partition`"));
          96  +
                        preferred.extend(non_preferred);
          97  +
                        preferred
          98  +
                    }
          99  +
                })
         100  +
            }
         101  +
            ::std::option::Option::None => _fut,
         102  +
        }
         103  +
    }
         104  +
}
         105  +
         106  +
impl DefaultAuthSchemeResolver {
         107  +
    /// Set auth scheme preference to the default auth scheme resolver
         108  +
    pub fn with_auth_scheme_preference(
         109  +
        mut self,
         110  +
        preference: impl ::std::convert::Into<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>,
         111  +
    ) -> Self {
         112  +
        self.preference = ::std::option::Option::Some(preference.into());
         113  +
        self
   84    114   
    }
   85    115   
}
   86    116   
   87    117   
/// Configuration parameters for resolving the correct auth scheme
   88    118   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
   89    119   
pub struct Params {
   90    120   
    operation_name: ::std::borrow::Cow<'static, str>,
   91    121   
}
   92    122   
impl Params {
   93    123   
    /// Create a builder for [`Params`]