AWS SDK

AWS SDK

rev. db10d8b7d1ddffb641e5651cb5b4c7c7d63bda6a

Files changed:

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/client/list_async_invokes.rs

@@ -0,1 +0,21 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
impl super::Client {
           3  +
    /// Constructs a fluent builder for the [`ListAsyncInvokes`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder) operation.
           4  +
    /// This operation supports pagination; See [`into_paginator()`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::into_paginator).
           5  +
    ///
           6  +
    /// - The fluent builder is configurable:
           7  +
    ///   - [`submit_time_after(DateTime)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::submit_time_after) / [`set_submit_time_after(Option<DateTime>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_submit_time_after):<br>required: **false**<br><p>Include invocations submitted after this time.</p><br>
           8  +
    ///   - [`submit_time_before(DateTime)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::submit_time_before) / [`set_submit_time_before(Option<DateTime>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_submit_time_before):<br>required: **false**<br><p>Include invocations submitted before this time.</p><br>
           9  +
    ///   - [`status_equals(AsyncInvokeStatus)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::status_equals) / [`set_status_equals(Option<AsyncInvokeStatus>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_status_equals):<br>required: **false**<br><p>Filter invocations by status.</p><br>
          10  +
    ///   - [`max_results(i32)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::max_results) / [`set_max_results(Option<i32>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_max_results):<br>required: **false**<br><p>The maximum number of invocations to return in one page of results.</p><br>
          11  +
    ///   - [`next_token(impl Into<String>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::next_token) / [`set_next_token(Option<String>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_next_token):<br>required: **false**<br><p>Specify the pagination token from a previous request to retrieve the next page of results.</p><br>
          12  +
    ///   - [`sort_by(SortAsyncInvocationBy)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::sort_by) / [`set_sort_by(Option<SortAsyncInvocationBy>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_sort_by):<br>required: **false**<br><p>How to sort the response.</p><br>
          13  +
    ///   - [`sort_order(SortOrder)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::sort_order) / [`set_sort_order(Option<SortOrder>)`](crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::set_sort_order):<br>required: **false**<br><p>The sorting order for the response.</p><br>
          14  +
    /// - On success, responds with [`ListAsyncInvokesOutput`](crate::operation::list_async_invokes::ListAsyncInvokesOutput) with field(s):
          15  +
    ///   - [`next_token(Option<String>)`](crate::operation::list_async_invokes::ListAsyncInvokesOutput::next_token): <p>Specify the pagination token from a previous request to retrieve the next page of results.</p>
          16  +
    ///   - [`async_invoke_summaries(Option<Vec::<AsyncInvokeSummary>>)`](crate::operation::list_async_invokes::ListAsyncInvokesOutput::async_invoke_summaries): <p>A list of invocation summaries.</p>
          17  +
    /// - On failure, responds with [`SdkError<ListAsyncInvokesError>`](crate::operation::list_async_invokes::ListAsyncInvokesError)
          18  +
    pub fn list_async_invokes(&self) -> crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder {
          19  +
        crate::operation::list_async_invokes::builders::ListAsyncInvokesFluentBuilder::new(self.handle.clone())
          20  +
    }
          21  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/client/start_async_invoke.rs

@@ -0,1 +0,17 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
impl super::Client {
           3  +
    /// Constructs a fluent builder for the [`StartAsyncInvoke`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder) operation.
           4  +
    ///
           5  +
    /// - The fluent builder is configurable:
           6  +
    ///   - [`client_request_token(impl Into<String>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::client_request_token) / [`set_client_request_token(Option<String>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::set_client_request_token):<br>required: **false**<br><p>Specify idempotency token to ensure that requests are not duplicated.</p><br>
           7  +
    ///   - [`model_id(impl Into<String>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::model_id) / [`set_model_id(Option<String>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::set_model_id):<br>required: **true**<br><p>The model to invoke.</p><br>
           8  +
    ///   - [`model_input(Document)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::model_input) / [`set_model_input(Option<Document>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::set_model_input):<br>required: **true**<br><p>Input to send to the model.</p><br>
           9  +
    ///   - [`output_data_config(AsyncInvokeOutputDataConfig)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::output_data_config) / [`set_output_data_config(Option<AsyncInvokeOutputDataConfig>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::set_output_data_config):<br>required: **true**<br><p>Where to store the output.</p><br>
          10  +
    ///   - [`tags(Tag)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::tags) / [`set_tags(Option<Vec::<Tag>>)`](crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::set_tags):<br>required: **false**<br><p>Tags to apply to the invocation.</p><br>
          11  +
    /// - On success, responds with [`StartAsyncInvokeOutput`](crate::operation::start_async_invoke::StartAsyncInvokeOutput) with field(s):
          12  +
    ///   - [`invocation_arn(String)`](crate::operation::start_async_invoke::StartAsyncInvokeOutput::invocation_arn): <p>The ARN of the invocation.</p>
          13  +
    /// - On failure, responds with [`SdkError<StartAsyncInvokeError>`](crate::operation::start_async_invoke::StartAsyncInvokeError)
          14  +
    pub fn start_async_invoke(&self) -> crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder {
          15  +
        crate::operation::start_async_invoke::builders::StartAsyncInvokeFluentBuilder::new(self.handle.clone())
          16  +
    }
          17  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/client_idempotency_token.rs

@@ -0,1 +0,73 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/*
           3  +
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
           4  +
 * SPDX-License-Identifier: Apache-2.0
           5  +
 */
           6  +
           7  +
use std::borrow::Cow;
           8  +
use std::fmt;
           9  +
          10  +
use aws_smithy_runtime_api::box_error::BoxError;
          11  +
use aws_smithy_runtime_api::client::interceptors::context::{BeforeSerializationInterceptorContextMut, Input};
          12  +
use aws_smithy_runtime_api::client::interceptors::{Intercept, SharedInterceptor};
          13  +
use aws_smithy_runtime_api::client::runtime_components::{RuntimeComponents, RuntimeComponentsBuilder};
          14  +
use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
          15  +
use aws_smithy_types::config_bag::ConfigBag;
          16  +
          17  +
use crate::idempotency_token::IdempotencyTokenProvider;
          18  +
          19  +
#[derive(Debug)]
          20  +
pub(crate) struct IdempotencyTokenRuntimePlugin {
          21  +
    runtime_components: RuntimeComponentsBuilder,
          22  +
}
          23  +
          24  +
impl IdempotencyTokenRuntimePlugin {
          25  +
    pub(crate) fn new<S>(set_token: S) -> Self
          26  +
    where
          27  +
        S: Fn(IdempotencyTokenProvider, &mut Input) + Send + Sync + 'static,
          28  +
    {
          29  +
        Self {
          30  +
            runtime_components: RuntimeComponentsBuilder::new("IdempotencyTokenRuntimePlugin")
          31  +
                .with_interceptor(SharedInterceptor::new(IdempotencyTokenInterceptor { set_token })),
          32  +
        }
          33  +
    }
          34  +
}
          35  +
          36  +
impl RuntimePlugin for IdempotencyTokenRuntimePlugin {
          37  +
    fn runtime_components(&self, _: &RuntimeComponentsBuilder) -> Cow<'_, RuntimeComponentsBuilder> {
          38  +
        Cow::Borrowed(&self.runtime_components)
          39  +
    }
          40  +
}
          41  +
          42  +
struct IdempotencyTokenInterceptor<S> {
          43  +
    set_token: S,
          44  +
}
          45  +
          46  +
impl<S> fmt::Debug for IdempotencyTokenInterceptor<S> {
          47  +
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
          48  +
        f.debug_struct("IdempotencyTokenInterceptor").finish()
          49  +
    }
          50  +
}
          51  +
          52  +
impl<S> Intercept for IdempotencyTokenInterceptor<S>
          53  +
where
          54  +
    S: Fn(IdempotencyTokenProvider, &mut Input) + Send + Sync,
          55  +
{
          56  +
    fn name(&self) -> &'static str {
          57  +
        "IdempotencyTokenInterceptor"
          58  +
    }
          59  +
          60  +
    fn modify_before_serialization(
          61  +
        &self,
          62  +
        context: &mut BeforeSerializationInterceptorContextMut<'_>,
          63  +
        _runtime_components: &RuntimeComponents,
          64  +
        cfg: &mut ConfigBag,
          65  +
    ) -> Result<(), BoxError> {
          66  +
        let token_provider = cfg
          67  +
            .load::<IdempotencyTokenProvider>()
          68  +
            .expect("the idempotency provider must be set")
          69  +
            .clone();
          70  +
        (self.set_token)(token_provider, context.input_mut());
          71  +
        Ok(())
          72  +
    }
          73  +
}

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

@@ -179,179 +238,254 @@
  199    199   
    }
  200    200   
    /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig)
  201    201   
    /// to configure protection for stalled streams.
  202    202   
    pub fn set_stalled_stream_protection(
  203    203   
        &mut self,
  204    204   
        stalled_stream_protection_config: ::std::option::Option<crate::config::StalledStreamProtectionConfig>,
  205    205   
    ) -> &mut Self {
  206    206   
        self.config.store_or_unset(stalled_stream_protection_config);
  207    207   
        self
  208    208   
    }
         209  +
    /// Sets the idempotency token provider to use for service calls that require tokens.
         210  +
    pub fn idempotency_token_provider(
         211  +
        mut self,
         212  +
        idempotency_token_provider: impl ::std::convert::Into<crate::idempotency_token::IdempotencyTokenProvider>,
         213  +
    ) -> Self {
         214  +
        self.set_idempotency_token_provider(::std::option::Option::Some(idempotency_token_provider.into()));
         215  +
        self
         216  +
    }
         217  +
    /// Sets the idempotency token provider to use for service calls that require tokens.
         218  +
    pub fn set_idempotency_token_provider(
         219  +
        &mut self,
         220  +
        idempotency_token_provider: ::std::option::Option<crate::idempotency_token::IdempotencyTokenProvider>,
         221  +
    ) -> &mut Self {
         222  +
        self.config.store_or_unset(idempotency_token_provider);
         223  +
        self
         224  +
    }
  209    225   
    /// Sets the HTTP client to use when making requests.
  210    226   
    ///
  211    227   
    /// # Examples
  212    228   
    /// ```no_run
  213    229   
    /// # #[cfg(test)]
  214    230   
    /// # mod tests {
  215    231   
    /// # #[test]
  216    232   
    /// # fn example() {
  217    233   
    /// use std::time::Duration;
  218    234   
    /// use aws_sdk_bedrockruntime::config::Config;
@@ -246,262 +305,336 @@
  266    282   
    /// let mut builder = aws_sdk_bedrockruntime::Config::builder();
  267    283   
    /// override_http_client(&mut builder);
  268    284   
    /// let config = builder.build();
  269    285   
    /// # }
  270    286   
    /// # }
  271    287   
    /// ```
  272    288   
    pub fn set_http_client(&mut self, http_client: Option<crate::config::SharedHttpClient>) -> &mut Self {
  273    289   
        self.runtime_components.set_http_client(http_client);
  274    290   
        self
  275    291   
    }
         292  +
    /// Sets the bearer token that will be used for HTTP bearer auth.
         293  +
    pub fn bearer_token(self, bearer_token: crate::config::Token) -> Self {
         294  +
        self.bearer_token_resolver(bearer_token)
         295  +
    }
         296  +
         297  +
    /// Sets a bearer token provider that will be used for HTTP bearer auth.
         298  +
    pub fn bearer_token_resolver(mut self, bearer_token_resolver: impl crate::config::ResolveIdentity + 'static) -> Self {
         299  +
        self.runtime_components.set_identity_resolver(
         300  +
            ::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID,
         301  +
            ::aws_smithy_runtime_api::shared::IntoShared::<::aws_smithy_runtime_api::client::identity::SharedIdentityResolver>::into_shared(
         302  +
                bearer_token_resolver,
         303  +
            ),
         304  +
        );
         305  +
        self
         306  +
    }
  276    307   
    /// Adds an auth scheme to the builder
  277    308   
    ///
  278    309   
    /// If `auth_scheme` has an existing [AuthSchemeId](aws_smithy_runtime_api::client::auth::AuthSchemeId) in the runtime, the current identity
  279    310   
    /// resolver and signer for that scheme will be replaced by those from `auth_scheme`.
  280    311   
    ///
  281    312   
    /// _Important:_ When introducing a custom auth scheme, ensure you override either
  282    313   
    /// [`Self::auth_scheme_resolver`] or [`Self::set_auth_scheme_resolver`]
  283    314   
    /// so that the custom auth scheme is included in the list of resolved auth scheme options.
  284    315   
    /// [The default auth scheme resolver](crate::config::auth::DefaultAuthSchemeResolver) will not recognize your custom auth scheme.
  285    316   
    ///
@@ -960,991 +1019,1080 @@
  980   1011   
        self
  981   1012   
    }
  982   1013   
    /// Sets the name of the app that is using the client.
  983   1014   
    ///
  984   1015   
    /// This _optional_ name is used to identify the application in the user agent that
  985   1016   
    /// gets sent along with requests.
  986   1017   
    pub fn set_app_name(&mut self, app_name: ::std::option::Option<::aws_types::app_name::AppName>) -> &mut Self {
  987   1018   
        self.config.store_or_unset(app_name);
  988   1019   
        self
  989   1020   
    }
        1021  +
    /// Sets the access token provider for this service
        1022  +
    ///
        1023  +
    /// Note: the [`Self::bearer_token`] and [`Self::bearer_token_resolver`] methods are
        1024  +
    /// equivalent to this method, but take the [`Token`] and [`ResolveIdentity`] types
        1025  +
    /// respectively.
        1026  +
    ///
        1027  +
    /// [`Token`]: crate::config::Token
        1028  +
    /// [`ResolveIdentity`]: crate::config::ResolveIdentity
        1029  +
    pub fn token_provider(mut self, token_provider: impl crate::config::ProvideToken + 'static) -> Self {
        1030  +
        self.set_token_provider(::std::option::Option::Some(::aws_smithy_runtime_api::shared::IntoShared::<
        1031  +
            crate::config::SharedTokenProvider,
        1032  +
        >::into_shared(token_provider)));
        1033  +
        self
        1034  +
    }
        1035  +
        1036  +
    /// Sets the access token provider for this service
        1037  +
    ///
        1038  +
    /// Note: the [`Self::bearer_token`] and [`Self::bearer_token_resolver`] methods are
        1039  +
    /// equivalent to this method, but take the [`Token`] and [`ResolveIdentity`] types
        1040  +
    /// respectively.
        1041  +
    ///
        1042  +
    /// [`Token`]: crate::config::Token
        1043  +
    /// [`ResolveIdentity`]: crate::config::ResolveIdentity
        1044  +
    pub fn set_token_provider(&mut self, token_provider: ::std::option::Option<crate::config::SharedTokenProvider>) -> &mut Self {
        1045  +
        if let Some(token_provider) = token_provider {
        1046  +
            self.runtime_components
        1047  +
                .set_identity_resolver(::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID, token_provider);
        1048  +
        }
        1049  +
        self
        1050  +
    }
  990   1051   
    /// Overrides the default invocation ID generator.
  991   1052   
    ///
  992   1053   
    /// The invocation ID generator generates ID values for the `amz-sdk-invocation-id` header. By default, this will be a random UUID. Overriding it may be useful in tests that examine the HTTP request and need to be deterministic.
  993   1054   
    pub fn invocation_id_generator(mut self, gen: impl ::aws_runtime::invocation_id::InvocationIdGenerator + 'static) -> Self {
  994   1055   
        self.set_invocation_id_generator(::std::option::Option::Some(
  995   1056   
            ::aws_runtime::invocation_id::SharedInvocationIdGenerator::new(gen),
  996   1057   
        ));
  997   1058   
        self
  998   1059   
    }
  999   1060   
    /// Overrides the default invocation ID generator.
@@ -1145,1206 +1260,1327 @@
 1165   1226   
    /// Adds a runtime plugin to the config.
 1166   1227   
    #[allow(unused)]
 1167   1228   
    pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
 1168   1229   
        self.runtime_plugins.push(plugin);
 1169   1230   
        self
 1170   1231   
    }
 1171   1232   
    #[cfg(any(feature = "test-util", test))]
 1172   1233   
    #[allow(unused_mut)]
 1173   1234   
    /// Apply test defaults to the builder
 1174   1235   
    pub fn apply_test_defaults(&mut self) -> &mut Self {
        1236  +
        self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
 1175   1237   
        self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
 1176   1238   
            ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
 1177   1239   
        )));
 1178   1240   
        self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
        1241  +
        self.set_token_provider(Some(crate::config::SharedTokenProvider::new(::aws_credential_types::Token::for_tests())));
 1179   1242   
        self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
 1180   1243   
            ::aws_credential_types::Credentials::for_tests(),
 1181   1244   
        )));
 1182   1245   
        self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
 1183   1246   
        self
 1184   1247   
    }
 1185   1248   
    #[cfg(any(feature = "test-util", test))]
 1186   1249   
    #[allow(unused_mut)]
 1187   1250   
    /// Apply test defaults to the builder
 1188   1251   
    pub fn with_test_defaults(mut self) -> Self {
 1189   1252   
        self.apply_test_defaults();
 1190   1253   
        self
 1191   1254   
    }
 1192   1255   
    /// Builds a [`Config`].
 1193   1256   
    #[allow(unused_mut)]
 1194   1257   
    pub fn build(mut self) -> Config {
 1195   1258   
        let mut layer = self.config;
 1196   1259   
        if self.runtime_components.time_source().is_none() {
 1197   1260   
            self.runtime_components
 1198   1261   
                .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
 1199   1262   
        }
 1200   1263   
        layer.store_put(crate::meta::API_METADATA.clone());
 1201   1264   
        layer.store_put(::aws_types::SigningName::from_static("bedrock"));
 1202   1265   
        layer
 1203   1266   
            .load::<::aws_types::region::Region>()
 1204   1267   
            .cloned()
 1205   1268   
            .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
 1206   1269   
        Config {
 1207   1270   
            config: crate::config::Layer::from(layer.clone())
 1208   1271   
                .with_name("aws_sdk_bedrockruntime::config::Config")
 1209   1272   
                .freeze(),
 1210   1273   
            cloneable: layer,
 1211   1274   
            runtime_components: self.runtime_components,
 1212   1275   
            runtime_plugins: self.runtime_plugins,
 1213   1276   
            behavior_version: self.behavior_version,
 1214   1277   
        }
 1215   1278   
    }
 1216   1279   
}
 1217   1280   
#[derive(::std::fmt::Debug)]
 1218   1281   
pub(crate) struct ServiceRuntimePlugin {
 1219   1282   
    config: ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer>,
 1220   1283   
    runtime_components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
 1221   1284   
}
 1222   1285   
 1223   1286   
impl ServiceRuntimePlugin {
 1224   1287   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1225   1288   
        let config = {
 1226   1289   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("AmazonBedrockFrontendService");
        1290  +
            cfg.store_put(crate::idempotency_token::default_provider());
 1227   1291   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1228   1292   
            ::std::option::Option::Some(cfg.freeze())
 1229   1293   
        };
 1230   1294   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
        1295  +
        runtime_components.push_auth_scheme(::aws_smithy_runtime_api::client::auth::SharedAuthScheme::new(
        1296  +
            ::aws_smithy_runtime::client::auth::http::BearerAuthScheme::new(),
        1297  +
        ));
 1231   1298   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1232   1299   
            use crate::config::auth::ResolveAuthScheme;
 1233   1300   
            crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
 1234   1301   
        }));
 1235   1302   
        runtime_components.set_endpoint_resolver(::std::option::Option::Some({
 1236   1303   
            use crate::config::endpoint::ResolveEndpoint;
 1237   1304   
            crate::config::endpoint::DefaultResolver::new().into_shared_resolver()
 1238   1305   
        }));
 1239   1306   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1240   1307   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());
@@ -1315,1382 +1415,1507 @@
 1335   1402   
        builder = builder.region(input.region().cloned());
 1336   1403   
        builder.set_use_fips(input.use_fips());
 1337   1404   
        builder.set_use_dual_stack(input.use_dual_stack());
 1338   1405   
        if input.get_origin("endpoint_url").is_client_config() {
 1339   1406   
            builder.set_endpoint_url(input.endpoint_url().map(|s| s.to_string()));
 1340   1407   
        } else {
 1341   1408   
            builder.set_endpoint_url(
 1342   1409   
                input
 1343   1410   
                    .service_config()
 1344   1411   
                    .and_then(|conf| {
 1345         -
                        conf.load_config(service_config_key("AWS_ENDPOINT_URL", "endpoint_url"))
        1412  +
                        conf.load_config(service_config_key("Bedrock Runtime", "AWS_ENDPOINT_URL", "endpoint_url"))
 1346   1413   
                            .map(|it| it.parse().unwrap())
 1347   1414   
                    })
 1348   1415   
                    .or_else(|| input.endpoint_url().map(|s| s.to_string())),
 1349   1416   
            );
 1350   1417   
        }
 1351   1418   
        // resiliency
 1352   1419   
        builder.set_retry_config(input.retry_config().cloned());
 1353   1420   
        builder.set_timeout_config(input.timeout_config().cloned());
 1354   1421   
        builder.set_sleep_impl(input.sleep_impl());
 1355   1422   
 1356   1423   
        builder.set_http_client(input.http_client());
 1357   1424   
        builder.set_time_source(input.time_source());
 1358   1425   
        builder.set_behavior_version(input.behavior_version());
 1359   1426   
        builder.set_auth_scheme_preference(input.auth_scheme_preference().cloned());
 1360   1427   
        // setting `None` here removes the default
 1361   1428   
        if let Some(config) = input.stalled_stream_protection() {
 1362   1429   
            builder.set_stalled_stream_protection(Some(config));
 1363   1430   
        }
 1364   1431   
 1365   1432   
        if let Some(cache) = input.identity_cache() {
 1366   1433   
            builder.set_identity_cache(cache);
 1367   1434   
        }
        1435  +
        builder.set_token_provider(input.token_provider());
        1436  +
        if let ::std::option::Option::Some(val) = input.service_config().and_then(|conf| {
        1437  +
            // Passing an empty string for the last argument of `service_config_key`,
        1438  +
            // since shared config/profile for environment token provider is not supported.
        1439  +
            ::aws_types::service_config::LoadServiceConfig::load_config(conf, service_config_key("bedrock", "AWS_BEARER_TOKEN", ""))
        1440  +
                .and_then(|it| it.parse::<::std::string::String>().ok())
        1441  +
        }) {
        1442  +
            if !input.get_origin("auth_scheme_preference").is_client_config() {
        1443  +
                builder.set_auth_scheme_preference(::std::option::Option::Some(
        1444  +
                    [::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID].into(),
        1445  +
                ));
        1446  +
            }
        1447  +
            if !input.get_origin("token_provider").is_client_config() {
        1448  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("AwsBearerTokenBedrock");
        1449  +
                layer.store_append(::aws_credential_types::credential_feature::AwsCredentialFeature::BearerServiceEnvVars);
        1450  +
                let identity = ::aws_smithy_runtime_api::client::identity::Identity::builder()
        1451  +
                    .data(crate::config::Token::new(val, ::std::option::Option::None))
        1452  +
                    .property(layer.freeze())
        1453  +
                    .build()
        1454  +
                    .expect("required fields set");
        1455  +
                builder
        1456  +
                    .runtime_components
        1457  +
                    .set_identity_resolver(::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID, identity);
        1458  +
            }
        1459  +
        }
 1368   1460   
        builder.set_app_name(input.app_name().cloned());
 1369   1461   
 1370   1462   
        builder
 1371   1463   
    }
 1372   1464   
}
 1373   1465   
 1374   1466   
impl From<&::aws_types::sdk_config::SdkConfig> for Config {
 1375   1467   
    fn from(sdk_config: &::aws_types::sdk_config::SdkConfig) -> Self {
 1376   1468   
        Builder::from(sdk_config).build()
 1377   1469   
    }
 1378   1470   
}
 1379   1471   
 1380   1472   
pub use ::aws_types::app_name::AppName;
 1381   1473   
 1382   1474   
#[allow(dead_code)]
 1383         -
fn service_config_key<'a>(env: &'a str, profile: &'a str) -> aws_types::service_config::ServiceConfigKey<'a> {
        1475  +
fn service_config_key<'a>(service_id: &'a str, env: &'a str, profile: &'a str) -> aws_types::service_config::ServiceConfigKey<'a> {
 1384   1476   
    ::aws_types::service_config::ServiceConfigKey::builder()
 1385         -
        .service_id("Bedrock Runtime")
        1477  +
        .service_id(service_id)
 1386   1478   
        .env(env)
 1387   1479   
        .profile(profile)
 1388   1480   
        .build()
 1389   1481   
        .expect("all field sets explicitly, can't fail")
 1390   1482   
}
 1391   1483   
 1392   1484   
pub use ::aws_smithy_async::rt::sleep::Sleep;
 1393   1485   
 1394   1486   
pub(crate) fn base_client_runtime_plugins(mut config: crate::Config) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
 1395   1487   
    let mut configured_plugins = ::std::vec::Vec::new();
@@ -1438,1530 +1496,1596 @@
 1458   1550   
pub use ::aws_smithy_runtime_api::client::interceptors::SharedInterceptor;
 1459   1551   
 1460   1552   
pub use ::aws_types::region::Region;
 1461   1553   
 1462   1554   
pub use ::aws_credential_types::provider::SharedCredentialsProvider;
 1463   1555   
 1464   1556   
pub use ::aws_smithy_runtime_api::client::http::HttpClient;
 1465   1557   
 1466   1558   
pub use ::aws_smithy_runtime_api::shared::IntoShared;
 1467   1559   
        1560  +
pub use ::aws_smithy_runtime_api::client::identity::http::Token;
        1561  +
        1562  +
pub use ::aws_smithy_runtime_api::client::identity::ResolveIdentity;
        1563  +
 1468   1564   
pub use ::aws_smithy_async::rt::sleep::AsyncSleep;
 1469   1565   
 1470   1566   
pub use ::aws_smithy_runtime_api::client::identity::ResolveCachedIdentity;
 1471   1567   
 1472   1568   
pub use ::aws_smithy_runtime_api::client::interceptors::Intercept;
 1473   1569   
        1570  +
pub use ::aws_credential_types::provider::token::ProvideToken;
        1571  +
        1572  +
pub use ::aws_credential_types::provider::token::SharedTokenProvider;
        1573  +
 1474   1574   
pub use ::aws_credential_types::provider::ProvideCredentials;
 1475   1575   
 1476   1576   
pub use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
 1477   1577   
 1478   1578   
pub use ::aws_smithy_types::config_bag::Layer;
 1479   1579   
 1480   1580   
/// Types needed to configure endpoint resolution.
 1481   1581   
pub mod endpoint;
 1482   1582   
 1483   1583   
/// HTTP request and response types.

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

@@ -28,28 +91,97 @@
   48     48   
}
   49     49   
   50     50   
// TODO(https://github.com/smithy-lang/smithy-rs/issues/4177): Remove `allow(...)` once the issue is addressed.
   51     51   
// When generating code for tests (e.g., `codegen-client-test`), this manual implementation
   52     52   
// of the `Default` trait may appear as if it could be derived automatically.
   53     53   
// However, that is not the case in production.
   54     54   
#[allow(clippy::derivable_impls)]
   55     55   
impl Default for DefaultAuthSchemeResolver {
   56     56   
    fn default() -> Self {
   57     57   
        Self {
   58         -
            service_defaults: vec![::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
   59         -
                .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
   60         -
                .build()
   61         -
                .expect("required fields set")],
          58  +
            service_defaults: vec![
          59  +
                ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
          60  +
                    .scheme_id(::aws_runtime::auth::sigv4::SCHEME_ID)
          61  +
                    .build()
          62  +
                    .expect("required fields set"),
          63  +
                ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::builder()
          64  +
                    .scheme_id(::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID)
          65  +
                    .build()
          66  +
                    .expect("required fields set"),
          67  +
            ],
   62     68   
            operation_overrides: ::std::collections::HashMap::new(),
   63     69   
        }
   64     70   
    }
   65     71   
}
   66     72   
   67     73   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   68     74   
    fn resolve_auth_scheme<'a>(
   69     75   
        &'a self,
   70     76   
        params: &'a crate::config::auth::Params,
   71     77   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/error_meta.rs

@@ -1,1 +318,571 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// All possible error types for this service.
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::fmt::Debug)]
    5      5   
pub enum Error {
    6         -
    /// <p>The request is denied because of missing access permissions.</p>
           6  +
    /// <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
    7      7   
    AccessDeniedException(crate::types::error::AccessDeniedException),
    8         -
    /// <p>An internal server error occurred. Retry your request.</p>
           8  +
    /// <p>Error occurred because of a conflict while performing an operation.</p>
           9  +
    ConflictException(crate::types::error::ConflictException),
          10  +
    /// <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
    9     11   
    InternalServerException(crate::types::error::InternalServerException),
   10     12   
    /// <p>The request failed due to an error while processing the model.</p>
   11     13   
    ModelErrorException(crate::types::error::ModelErrorException),
   12         -
    /// <p>The model specified in the request is not ready to serve inference requests.</p>
          14  +
    /// <p>The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.</p>
   13     15   
    ModelNotReadyException(crate::types::error::ModelNotReadyException),
   14     16   
    /// <p>An error occurred while streaming the response. Retry your request.</p>
   15     17   
    ModelStreamErrorException(crate::types::error::ModelStreamErrorException),
   16     18   
    /// <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
   17     19   
    ModelTimeoutException(crate::types::error::ModelTimeoutException),
   18         -
    /// <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
          20  +
    /// <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
   19     21   
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
   20         -
    /// <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
          22  +
    /// <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
   21     23   
    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
   22         -
    /// <p>The number of requests exceeds the limit. Resubmit your request later.</p>
          24  +
    /// <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
          25  +
    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
          26  +
    /// <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
   23     27   
    ThrottlingException(crate::types::error::ThrottlingException),
   24         -
    /// <p>Input validation failed. Check your request parameters and retry the request.</p>
          28  +
    /// <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
   25     29   
    ValidationException(crate::types::error::ValidationException),
   26     30   
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
   27     31   
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
   28     32   
    variable wildcard pattern and check `.code()`:
   29     33   
     \
   30     34   
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
   31     35   
     \
   32     36   
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
   33     37   
    Unhandled(crate::error::sealed_unhandled::Unhandled),
   34     38   
}
   35     39   
impl ::std::fmt::Display for Error {
   36     40   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   37     41   
        match self {
   38     42   
            Error::AccessDeniedException(inner) => inner.fmt(f),
          43  +
            Error::ConflictException(inner) => inner.fmt(f),
   39     44   
            Error::InternalServerException(inner) => inner.fmt(f),
   40     45   
            Error::ModelErrorException(inner) => inner.fmt(f),
   41     46   
            Error::ModelNotReadyException(inner) => inner.fmt(f),
   42     47   
            Error::ModelStreamErrorException(inner) => inner.fmt(f),
   43     48   
            Error::ModelTimeoutException(inner) => inner.fmt(f),
   44     49   
            Error::ResourceNotFoundException(inner) => inner.fmt(f),
   45     50   
            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
          51  +
            Error::ServiceUnavailableException(inner) => inner.fmt(f),
   46     52   
            Error::ThrottlingException(inner) => inner.fmt(f),
   47     53   
            Error::ValidationException(inner) => inner.fmt(f),
   48     54   
            Error::Unhandled(_) => {
   49     55   
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
   50     56   
                    write!(f, "unhandled error ({code})")
   51     57   
                } else {
   52     58   
                    f.write_str("unhandled error")
   53     59   
                }
   54     60   
            }
   55     61   
        }
   56     62   
    }
   57     63   
}
   58     64   
impl From<::aws_smithy_types::error::operation::BuildError> for Error {
   59     65   
    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
   60     66   
        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
   61     67   
            source: value.into(),
   62     68   
            meta: ::std::default::Default::default(),
   63     69   
        })
   64     70   
    }
   65     71   
}
   66     72   
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
   67     73   
    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
   68     74   
        match self {
   69     75   
            Self::AccessDeniedException(inner) => inner.meta(),
          76  +
            Self::ConflictException(inner) => inner.meta(),
   70     77   
            Self::InternalServerException(inner) => inner.meta(),
   71     78   
            Self::ModelErrorException(inner) => inner.meta(),
   72     79   
            Self::ModelNotReadyException(inner) => inner.meta(),
   73     80   
            Self::ModelStreamErrorException(inner) => inner.meta(),
   74     81   
            Self::ModelTimeoutException(inner) => inner.meta(),
   75     82   
            Self::ResourceNotFoundException(inner) => inner.meta(),
   76     83   
            Self::ServiceQuotaExceededException(inner) => inner.meta(),
          84  +
            Self::ServiceUnavailableException(inner) => inner.meta(),
   77     85   
            Self::ThrottlingException(inner) => inner.meta(),
   78     86   
            Self::ValidationException(inner) => inner.meta(),
   79     87   
            Self::Unhandled(inner) => &inner.meta,
   80     88   
        }
   81     89   
    }
   82     90   
}
          91  +
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::apply_guardrail::ApplyGuardrailError, R>> for Error
          92  +
where
          93  +
    R: Send + Sync + std::fmt::Debug + 'static,
          94  +
{
          95  +
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::apply_guardrail::ApplyGuardrailError, R>) -> Self {
          96  +
        match err {
          97  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
          98  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
          99  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         100  +
                source: err.into(),
         101  +
            }),
         102  +
        }
         103  +
    }
         104  +
}
         105  +
impl From<crate::operation::apply_guardrail::ApplyGuardrailError> for Error {
         106  +
    fn from(err: crate::operation::apply_guardrail::ApplyGuardrailError) -> Self {
         107  +
        match err {
         108  +
            crate::operation::apply_guardrail::ApplyGuardrailError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
         109  +
            crate::operation::apply_guardrail::ApplyGuardrailError::InternalServerException(inner) => Error::InternalServerException(inner),
         110  +
            crate::operation::apply_guardrail::ApplyGuardrailError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
         111  +
            crate::operation::apply_guardrail::ApplyGuardrailError::ServiceQuotaExceededException(inner) => {
         112  +
                Error::ServiceQuotaExceededException(inner)
         113  +
            }
         114  +
            crate::operation::apply_guardrail::ApplyGuardrailError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         115  +
            crate::operation::apply_guardrail::ApplyGuardrailError::ValidationException(inner) => Error::ValidationException(inner),
         116  +
            crate::operation::apply_guardrail::ApplyGuardrailError::Unhandled(inner) => Error::Unhandled(inner),
         117  +
        }
         118  +
    }
         119  +
}
   83    120   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, R>> for Error
   84    121   
where
   85    122   
    R: Send + Sync + std::fmt::Debug + 'static,
   86    123   
{
   87    124   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, R>) -> Self {
   88    125   
        match err {
   89    126   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
   90    127   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
   91    128   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
   92    129   
                source: err.into(),
   93    130   
            }),
   94    131   
        }
   95    132   
    }
   96    133   
}
   97    134   
impl From<crate::operation::converse::ConverseError> for Error {
   98    135   
    fn from(err: crate::operation::converse::ConverseError) -> Self {
   99    136   
        match err {
  100    137   
            crate::operation::converse::ConverseError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
  101    138   
            crate::operation::converse::ConverseError::InternalServerException(inner) => Error::InternalServerException(inner),
  102    139   
            crate::operation::converse::ConverseError::ModelErrorException(inner) => Error::ModelErrorException(inner),
  103    140   
            crate::operation::converse::ConverseError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
  104    141   
            crate::operation::converse::ConverseError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  105    142   
            crate::operation::converse::ConverseError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
         143  +
            crate::operation::converse::ConverseError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  106    144   
            crate::operation::converse::ConverseError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  107    145   
            crate::operation::converse::ConverseError::ValidationException(inner) => Error::ValidationException(inner),
  108    146   
            crate::operation::converse::ConverseError::Unhandled(inner) => Error::Unhandled(inner),
  109    147   
        }
  110    148   
    }
  111    149   
}
  112    150   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>> for Error
  113    151   
where
  114    152   
    R: Send + Sync + std::fmt::Debug + 'static,
  115    153   
{
  116    154   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>) -> Self {
  117    155   
        match err {
  118    156   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  119    157   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  120    158   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  121    159   
                source: err.into(),
  122    160   
            }),
  123    161   
        }
  124    162   
    }
  125    163   
}
  126    164   
impl From<crate::operation::converse_stream::ConverseStreamError> for Error {
  127    165   
    fn from(err: crate::operation::converse_stream::ConverseStreamError) -> Self {
  128    166   
        match err {
  129    167   
            crate::operation::converse_stream::ConverseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  130    168   
            crate::operation::converse_stream::ConverseStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
  131    169   
            crate::operation::converse_stream::ConverseStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
  132    170   
            crate::operation::converse_stream::ConverseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         171  +
            crate::operation::converse_stream::ConverseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  133    172   
            crate::operation::converse_stream::ConverseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
  134    173   
            crate::operation::converse_stream::ConverseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
  135    174   
            crate::operation::converse_stream::ConverseStreamError::ValidationException(inner) => Error::ValidationException(inner),
  136    175   
            crate::operation::converse_stream::ConverseStreamError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
  137    176   
            crate::operation::converse_stream::ConverseStreamError::ModelErrorException(inner) => Error::ModelErrorException(inner),
  138    177   
            crate::operation::converse_stream::ConverseStreamError::Unhandled(inner) => Error::Unhandled(inner),
  139    178   
        }
  140    179   
    }
  141    180   
}
         181  +
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_async_invoke::GetAsyncInvokeError, R>> for Error
         182  +
where
         183  +
    R: Send + Sync + std::fmt::Debug + 'static,
         184  +
{
         185  +
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_async_invoke::GetAsyncInvokeError, R>) -> Self {
         186  +
        match err {
         187  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
         188  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
         189  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         190  +
                source: err.into(),
         191  +
            }),
         192  +
        }
         193  +
    }
         194  +
}
         195  +
impl From<crate::operation::get_async_invoke::GetAsyncInvokeError> for Error {
         196  +
    fn from(err: crate::operation::get_async_invoke::GetAsyncInvokeError) -> Self {
         197  +
        match err {
         198  +
            crate::operation::get_async_invoke::GetAsyncInvokeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
         199  +
            crate::operation::get_async_invoke::GetAsyncInvokeError::InternalServerException(inner) => Error::InternalServerException(inner),
         200  +
            crate::operation::get_async_invoke::GetAsyncInvokeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         201  +
            crate::operation::get_async_invoke::GetAsyncInvokeError::ValidationException(inner) => Error::ValidationException(inner),
         202  +
            crate::operation::get_async_invoke::GetAsyncInvokeError::Unhandled(inner) => Error::Unhandled(inner),
         203  +
        }
         204  +
    }
         205  +
}
  142    206   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>> for Error
  143    207   
where
  144    208   
    R: Send + Sync + std::fmt::Debug + 'static,
  145    209   
{
  146    210   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>) -> Self {
  147    211   
        match err {
  148    212   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  149    213   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  150    214   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  151    215   
                source: err.into(),
  152    216   
            }),
  153    217   
        }
  154    218   
    }
  155    219   
}
  156    220   
impl From<crate::operation::invoke_model::InvokeModelError> for Error {
  157    221   
    fn from(err: crate::operation::invoke_model::InvokeModelError) -> Self {
  158    222   
        match err {
  159    223   
            crate::operation::invoke_model::InvokeModelError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
  160    224   
            crate::operation::invoke_model::InvokeModelError::InternalServerException(inner) => Error::InternalServerException(inner),
  161    225   
            crate::operation::invoke_model::InvokeModelError::ModelErrorException(inner) => Error::ModelErrorException(inner),
  162    226   
            crate::operation::invoke_model::InvokeModelError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
  163    227   
            crate::operation::invoke_model::InvokeModelError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  164    228   
            crate::operation::invoke_model::InvokeModelError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
  165    229   
            crate::operation::invoke_model::InvokeModelError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
         230  +
            crate::operation::invoke_model::InvokeModelError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  166    231   
            crate::operation::invoke_model::InvokeModelError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  167    232   
            crate::operation::invoke_model::InvokeModelError::ValidationException(inner) => Error::ValidationException(inner),
  168    233   
            crate::operation::invoke_model::InvokeModelError::Unhandled(inner) => Error::Unhandled(inner),
  169    234   
        }
  170    235   
    }
  171    236   
}
         237  +
impl<R>
         238  +
    From<
         239  +
        ::aws_smithy_runtime_api::client::result::SdkError<
         240  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
         241  +
            R,
         242  +
        >,
         243  +
    > for Error
         244  +
where
         245  +
    R: Send + Sync + std::fmt::Debug + 'static,
         246  +
{
         247  +
    fn from(
         248  +
        err: ::aws_smithy_runtime_api::client::result::SdkError<
         249  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
         250  +
            R,
         251  +
        >,
         252  +
    ) -> Self {
         253  +
        match err {
         254  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
         255  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
         256  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         257  +
                source: err.into(),
         258  +
            }),
         259  +
        }
         260  +
    }
         261  +
}
         262  +
impl From<crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError> for Error {
         263  +
    fn from(err: crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError) -> Self {
         264  +
        match err {
         265  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelTimeoutException(inner) => {
         266  +
                Error::ModelTimeoutException(inner)
         267  +
            }
         268  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::AccessDeniedException(inner) => {
         269  +
                Error::AccessDeniedException(inner)
         270  +
            }
         271  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ResourceNotFoundException(inner) => {
         272  +
                Error::ResourceNotFoundException(inner)
         273  +
            }
         274  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ThrottlingException(inner) => {
         275  +
                Error::ThrottlingException(inner)
         276  +
            }
         277  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ServiceUnavailableException(inner) => {
         278  +
                Error::ServiceUnavailableException(inner)
         279  +
            }
         280  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::InternalServerException(inner) => {
         281  +
                Error::InternalServerException(inner)
         282  +
            }
         283  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelStreamErrorException(inner) => {
         284  +
                Error::ModelStreamErrorException(inner)
         285  +
            }
         286  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ValidationException(inner) => {
         287  +
                Error::ValidationException(inner)
         288  +
            }
         289  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelNotReadyException(inner) => {
         290  +
                Error::ModelNotReadyException(inner)
         291  +
            }
         292  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ModelErrorException(inner) => {
         293  +
                Error::ModelErrorException(inner)
         294  +
            }
         295  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::ServiceQuotaExceededException(
         296  +
                inner,
         297  +
            ) => Error::ServiceQuotaExceededException(inner),
         298  +
            crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError::Unhandled(inner) => {
         299  +
                Error::Unhandled(inner)
         300  +
            }
         301  +
        }
         302  +
    }
         303  +
}
  172    304   
impl<R>
  173    305   
    From<
  174    306   
        ::aws_smithy_runtime_api::client::result::SdkError<
  175    307   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
  176    308   
            R,
  177    309   
        >,
  178    310   
    > for Error
  179    311   
where
  180    312   
    R: Send + Sync + std::fmt::Debug + 'static,
  181    313   
{
  182    314   
    fn from(
  183    315   
        err: ::aws_smithy_runtime_api::client::result::SdkError<
  184    316   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
  185    317   
            R,
  186    318   
        >,
  187    319   
    ) -> Self {
  188    320   
        match err {
  189    321   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  190    322   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  191    323   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  192    324   
                source: err.into(),
  193    325   
            }),
  194    326   
        }
  195    327   
    }
  196    328   
}
  197    329   
impl From<crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError> for Error {
  198    330   
    fn from(err: crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError) -> Self {
  199    331   
        match err {
  200    332   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelTimeoutException(inner) => {
  201    333   
                Error::ModelTimeoutException(inner)
  202    334   
            }
  203    335   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::AccessDeniedException(inner) => {
  204    336   
                Error::AccessDeniedException(inner)
  205    337   
            }
  206    338   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ResourceNotFoundException(inner) => {
  207    339   
                Error::ResourceNotFoundException(inner)
  208    340   
            }
  209    341   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ThrottlingException(inner) => {
  210    342   
                Error::ThrottlingException(inner)
  211    343   
            }
         344  +
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceUnavailableException(inner) => {
         345  +
                Error::ServiceUnavailableException(inner)
         346  +
            }
  212    347   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::InternalServerException(inner) => {
  213    348   
                Error::InternalServerException(inner)
  214    349   
            }
  215    350   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelStreamErrorException(inner) => {
  216    351   
                Error::ModelStreamErrorException(inner)
  217    352   
            }
  218    353   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ValidationException(inner) => {
  219    354   
                Error::ValidationException(inner)
  220    355   
            }
  221    356   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelNotReadyException(inner) => {
  222    357   
                Error::ModelNotReadyException(inner)
  223    358   
            }
  224    359   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelErrorException(inner) => {
  225    360   
                Error::ModelErrorException(inner)
  226    361   
            }
  227    362   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceQuotaExceededException(inner) => {
  228    363   
                Error::ServiceQuotaExceededException(inner)
  229    364   
            }
  230    365   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
  231    366   
        }
  232    367   
    }
  233    368   
}
         369  +
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_async_invokes::ListAsyncInvokesError, R>> for Error
         370  +
where
         371  +
    R: Send + Sync + std::fmt::Debug + 'static,
         372  +
{
         373  +
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::list_async_invokes::ListAsyncInvokesError, R>) -> Self {
         374  +
        match err {
         375  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
         376  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
         377  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         378  +
                source: err.into(),
         379  +
            }),
         380  +
        }
         381  +
    }
         382  +
}
         383  +
impl From<crate::operation::list_async_invokes::ListAsyncInvokesError> for Error {
         384  +
    fn from(err: crate::operation::list_async_invokes::ListAsyncInvokesError) -> Self {
         385  +
        match err {
         386  +
            crate::operation::list_async_invokes::ListAsyncInvokesError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
         387  +
            crate::operation::list_async_invokes::ListAsyncInvokesError::InternalServerException(inner) => Error::InternalServerException(inner),
         388  +
            crate::operation::list_async_invokes::ListAsyncInvokesError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         389  +
            crate::operation::list_async_invokes::ListAsyncInvokesError::ValidationException(inner) => Error::ValidationException(inner),
         390  +
            crate::operation::list_async_invokes::ListAsyncInvokesError::Unhandled(inner) => Error::Unhandled(inner),
         391  +
        }
         392  +
    }
         393  +
}
         394  +
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_async_invoke::StartAsyncInvokeError, R>> for Error
         395  +
where
         396  +
    R: Send + Sync + std::fmt::Debug + 'static,
         397  +
{
         398  +
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::start_async_invoke::StartAsyncInvokeError, R>) -> Self {
         399  +
        match err {
         400  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
         401  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
         402  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         403  +
                source: err.into(),
         404  +
            }),
         405  +
        }
         406  +
    }
         407  +
}
         408  +
impl From<crate::operation::start_async_invoke::StartAsyncInvokeError> for Error {
         409  +
    fn from(err: crate::operation::start_async_invoke::StartAsyncInvokeError) -> Self {
         410  +
        match err {
         411  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
         412  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::ConflictException(inner) => Error::ConflictException(inner),
         413  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::InternalServerException(inner) => Error::InternalServerException(inner),
         414  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
         415  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::ServiceQuotaExceededException(inner) => {
         416  +
                Error::ServiceQuotaExceededException(inner)
         417  +
            }
         418  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::ServiceUnavailableException(inner) => {
         419  +
                Error::ServiceUnavailableException(inner)
         420  +
            }
         421  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         422  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::ValidationException(inner) => Error::ValidationException(inner),
         423  +
            crate::operation::start_async_invoke::StartAsyncInvokeError::Unhandled(inner) => Error::Unhandled(inner),
         424  +
        }
         425  +
    }
         426  +
}
  234    427   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>> for Error
  235    428   
where
  236    429   
    R: Send + Sync + std::fmt::Debug + 'static,
  237    430   
{
  238    431   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>) -> Self {
  239    432   
        match err {
  240    433   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  241    434   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  242    435   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  243    436   
                source: err.into(),
  244    437   
            }),
  245    438   
        }
  246    439   
    }
  247    440   
}
  248    441   
impl From<crate::types::error::ConverseStreamOutputError> for Error {
  249    442   
    fn from(err: crate::types::error::ConverseStreamOutputError) -> Self {
  250    443   
        match err {
  251    444   
            crate::types::error::ConverseStreamOutputError::InternalServerException(inner) => Error::InternalServerException(inner),
  252    445   
            crate::types::error::ConverseStreamOutputError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
  253    446   
            crate::types::error::ConverseStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
  254    447   
            crate::types::error::ConverseStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         448  +
            crate::types::error::ConverseStreamOutputError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  255    449   
            crate::types::error::ConverseStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
  256    450   
        }
  257    451   
    }
  258    452   
}
         453  +
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamInputError, R>> for Error
         454  +
where
         455  +
    R: Send + Sync + std::fmt::Debug + 'static,
         456  +
{
         457  +
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamInputError, R>) -> Self {
         458  +
        match err {
         459  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
         460  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
         461  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         462  +
                source: err.into(),
         463  +
            }),
         464  +
        }
         465  +
    }
         466  +
}
         467  +
impl From<crate::types::error::InvokeModelWithBidirectionalStreamInputError> for Error {
         468  +
    fn from(err: crate::types::error::InvokeModelWithBidirectionalStreamInputError) -> Self {
         469  +
        match err {
         470  +
            crate::types::error::InvokeModelWithBidirectionalStreamInputError::Unhandled(inner) => Error::Unhandled(inner),
         471  +
        }
         472  +
    }
         473  +
}
         474  +
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamOutputError, R>> for Error
         475  +
where
         476  +
    R: Send + Sync + std::fmt::Debug + 'static,
         477  +
{
         478  +
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::InvokeModelWithBidirectionalStreamOutputError, R>) -> Self {
         479  +
        match err {
         480  +
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
         481  +
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
         482  +
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
         483  +
                source: err.into(),
         484  +
            }),
         485  +
        }
         486  +
    }
         487  +
}
         488  +
impl From<crate::types::error::InvokeModelWithBidirectionalStreamOutputError> for Error {
         489  +
    fn from(err: crate::types::error::InvokeModelWithBidirectionalStreamOutputError) -> Self {
         490  +
        match err {
         491  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::InternalServerException(inner) => {
         492  +
                Error::InternalServerException(inner)
         493  +
            }
         494  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelStreamErrorException(inner) => {
         495  +
                Error::ModelStreamErrorException(inner)
         496  +
            }
         497  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
         498  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
         499  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
         500  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ServiceUnavailableException(inner) => {
         501  +
                Error::ServiceUnavailableException(inner)
         502  +
            }
         503  +
            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
         504  +
        }
         505  +
    }
         506  +
}
  259    507   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>> for Error
  260    508   
where
  261    509   
    R: Send + Sync + std::fmt::Debug + 'static,
  262    510   
{
  263    511   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>) -> Self {
  264    512   
        match err {
  265    513   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  266    514   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  267    515   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  268    516   
                source: err.into(),
  269    517   
            }),
  270    518   
        }
  271    519   
    }
  272    520   
}
  273    521   
impl From<crate::types::error::ResponseStreamError> for Error {
  274    522   
    fn from(err: crate::types::error::ResponseStreamError) -> Self {
  275    523   
        match err {
  276    524   
            crate::types::error::ResponseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
  277    525   
            crate::types::error::ResponseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
  278    526   
            crate::types::error::ResponseStreamError::ValidationException(inner) => Error::ValidationException(inner),
  279    527   
            crate::types::error::ResponseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  280    528   
            crate::types::error::ResponseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
         529  +
            crate::types::error::ResponseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  281    530   
            crate::types::error::ResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
  282    531   
        }
  283    532   
    }
  284    533   
}
  285    534   
impl ::std::error::Error for Error {
  286    535   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
  287    536   
        match self {
  288    537   
            Error::AccessDeniedException(inner) => inner.source(),
         538  +
            Error::ConflictException(inner) => inner.source(),
  289    539   
            Error::InternalServerException(inner) => inner.source(),
  290    540   
            Error::ModelErrorException(inner) => inner.source(),
  291    541   
            Error::ModelNotReadyException(inner) => inner.source(),
  292    542   
            Error::ModelStreamErrorException(inner) => inner.source(),
  293    543   
            Error::ModelTimeoutException(inner) => inner.source(),
  294    544   
            Error::ResourceNotFoundException(inner) => inner.source(),
  295    545   
            Error::ServiceQuotaExceededException(inner) => inner.source(),
         546  +
            Error::ServiceUnavailableException(inner) => inner.source(),
  296    547   
            Error::ThrottlingException(inner) => inner.source(),
  297    548   
            Error::ValidationException(inner) => inner.source(),
  298    549   
            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
  299    550   
        }
  300    551   
    }
  301    552   
}
  302    553   
impl ::aws_types::request_id::RequestId for Error {
  303    554   
    fn request_id(&self) -> Option<&str> {
  304    555   
        match self {
  305    556   
            Self::AccessDeniedException(e) => e.request_id(),
         557  +
            Self::ConflictException(e) => e.request_id(),
  306    558   
            Self::InternalServerException(e) => e.request_id(),
  307    559   
            Self::ModelErrorException(e) => e.request_id(),
  308    560   
            Self::ModelNotReadyException(e) => e.request_id(),
  309    561   
            Self::ModelStreamErrorException(e) => e.request_id(),
  310    562   
            Self::ModelTimeoutException(e) => e.request_id(),
  311    563   
            Self::ResourceNotFoundException(e) => e.request_id(),
  312    564   
            Self::ServiceQuotaExceededException(e) => e.request_id(),
         565  +
            Self::ServiceUnavailableException(e) => e.request_id(),
  313    566   
            Self::ThrottlingException(e) => e.request_id(),
  314    567   
            Self::ValidationException(e) => e.request_id(),
  315    568   
            Self::Unhandled(e) => e.meta.request_id(),
  316    569   
        }
  317    570   
    }
  318    571   
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/event_stream_serde.rs

@@ -1,1 +31,89 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[non_exhaustive]
           3  +
#[derive(Debug)]
           4  +
pub struct InvokeModelWithBidirectionalStreamInputErrorMarshaller;
           5  +
           6  +
impl InvokeModelWithBidirectionalStreamInputErrorMarshaller {
           7  +
    pub fn new() -> Self {
           8  +
        InvokeModelWithBidirectionalStreamInputErrorMarshaller
           9  +
    }
          10  +
}
          11  +
impl ::aws_smithy_eventstream::frame::MarshallMessage for InvokeModelWithBidirectionalStreamInputErrorMarshaller {
          12  +
    type Input = crate::types::error::InvokeModelWithBidirectionalStreamInputError;
          13  +
    fn marshall(
          14  +
        &self,
          15  +
        _input: Self::Input,
          16  +
    ) -> std::result::Result<::aws_smithy_types::event_stream::Message, ::aws_smithy_eventstream::error::Error> {
          17  +
        let mut headers = Vec::new();
          18  +
        headers.push(::aws_smithy_types::event_stream::Header::new(
          19  +
            ":message-type",
          20  +
            ::aws_smithy_types::event_stream::HeaderValue::String("exception".into()),
          21  +
        ));
          22  +
        let payload = Vec::new();
          23  +
        Ok(::aws_smithy_types::event_stream::Message::new_from_parts(headers, payload))
          24  +
    }
          25  +
}
          26  +
          27  +
#[non_exhaustive]
          28  +
#[derive(Debug)]
          29  +
pub struct InvokeModelWithBidirectionalStreamInputMarshaller;
          30  +
          31  +
impl InvokeModelWithBidirectionalStreamInputMarshaller {
          32  +
    pub fn new() -> Self {
          33  +
        InvokeModelWithBidirectionalStreamInputMarshaller
          34  +
    }
          35  +
}
          36  +
impl ::aws_smithy_eventstream::frame::MarshallMessage for InvokeModelWithBidirectionalStreamInputMarshaller {
          37  +
    type Input = crate::types::InvokeModelWithBidirectionalStreamInput;
          38  +
    fn marshall(&self, input: Self::Input) -> std::result::Result<::aws_smithy_types::event_stream::Message, ::aws_smithy_eventstream::error::Error> {
          39  +
        let mut headers = Vec::new();
          40  +
        headers.push(::aws_smithy_types::event_stream::Header::new(
          41  +
            ":message-type",
          42  +
            ::aws_smithy_types::event_stream::HeaderValue::String("event".into()),
          43  +
        ));
          44  +
        let payload = match input {
          45  +
            Self::Input::Chunk(inner) =>  {
          46  +
                headers.push(::aws_smithy_types::event_stream::Header::new(":event-type", ::aws_smithy_types::event_stream::HeaderValue::String("chunk".into())));
          47  +
                headers.push(::aws_smithy_types::event_stream::Header::new(":content-type", ::aws_smithy_types::event_stream::HeaderValue::String("application/json".into())));
          48  +
                crate::protocol_serde::shape_invoke_model_with_bidirectional_stream_input::ser_chunk_payload(&inner)
          49  +
                                            .map_err(|err| ::aws_smithy_eventstream::error::Error::marshalling(format!("{}", err)))?
          50  +
            }
          51  +
            Self::Input::Unknown => return Err(
          52  +
                                            ::aws_smithy_eventstream::error::Error::marshalling("Cannot serialize `InvokeModelWithBidirectionalStreamInput::Unknown` for the request. The `Unknown` variant is intended for responses only. It occurs when an outdated client is used after a new enum variant was added on the server side.".to_owned())
          53  +
                                        )
          54  +
        }
          55  +
        ;
          56  +
        Ok(::aws_smithy_types::event_stream::Message::new_from_parts(headers, payload))
          57  +
    }
          58  +
}
          59  +
    2     60   
#[non_exhaustive]
    3     61   
#[derive(Debug)]
    4     62   
pub struct ConverseStreamOutputUnmarshaller;
    5     63   
    6     64   
impl ConverseStreamOutputUnmarshaller {
    7     65   
    pub fn new() -> Self {
    8     66   
        ConverseStreamOutputUnmarshaller
    9     67   
    }
   10     68   
}
   11     69   
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for ConverseStreamOutputUnmarshaller {
@@ -116,174 +191,414 @@
  136    194   
                                    ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
  137    195   
                                        "failed to unmarshall throttlingException: {}",
  138    196   
                                        err
  139    197   
                                    ))
  140    198   
                                })?;
  141    199   
                        builder.set_meta(Some(generic));
  142    200   
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  143    201   
                            crate::types::error::ConverseStreamOutputError::ThrottlingException(builder.build()),
  144    202   
                        ));
  145    203   
                    }
         204  +
                    "serviceUnavailableException" => {
         205  +
                        let mut builder = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
         206  +
                        builder = crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(
         207  +
                            &message.payload()[..],
         208  +
                            builder,
         209  +
                        )
         210  +
                        .map_err(|err| {
         211  +
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
         212  +
                                "failed to unmarshall serviceUnavailableException: {}",
         213  +
                                err
         214  +
                            ))
         215  +
                        })?;
         216  +
                        builder.set_meta(Some(generic));
         217  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         218  +
                            crate::types::error::ConverseStreamOutputError::ServiceUnavailableException(builder.build()),
         219  +
                        ));
         220  +
                    }
  146    221   
                    _ => {}
  147    222   
                }
  148    223   
                Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  149    224   
                    crate::types::error::ConverseStreamOutputError::generic(generic),
  150    225   
                ))
  151    226   
            }
  152    227   
            value => {
  153    228   
                return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
  154    229   
                    "unrecognized :message-type: {}",
  155    230   
                    value
  156    231   
                )));
  157    232   
            }
  158    233   
        }
  159    234   
    }
  160    235   
}
  161    236   
         237  +
#[non_exhaustive]
         238  +
#[derive(Debug)]
         239  +
pub struct InvokeModelWithBidirectionalStreamOutputUnmarshaller;
         240  +
         241  +
impl InvokeModelWithBidirectionalStreamOutputUnmarshaller {
         242  +
    pub fn new() -> Self {
         243  +
        InvokeModelWithBidirectionalStreamOutputUnmarshaller
         244  +
    }
         245  +
}
         246  +
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for InvokeModelWithBidirectionalStreamOutputUnmarshaller {
         247  +
    type Output = crate::types::InvokeModelWithBidirectionalStreamOutput;
         248  +
    type Error = crate::types::error::InvokeModelWithBidirectionalStreamOutputError;
         249  +
    fn unmarshall(
         250  +
        &self,
         251  +
        message: &::aws_smithy_types::event_stream::Message,
         252  +
    ) -> std::result::Result<::aws_smithy_eventstream::frame::UnmarshalledMessage<Self::Output, Self::Error>, ::aws_smithy_eventstream::error::Error>
         253  +
    {
         254  +
        let response_headers = ::aws_smithy_eventstream::smithy::parse_response_headers(message)?;
         255  +
        match response_headers.message_type.as_str() {
         256  +
            "event" => match response_headers.smithy_type.as_str() {
         257  +
                "chunk" => {
         258  +
                    let parsed = crate::protocol_serde::shape_bidirectional_output_payload_part::de_bidirectional_output_payload_part_payload(
         259  +
                        &message.payload()[..],
         260  +
                    )
         261  +
                    .map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall Chunk: {}", err)))?;
         262  +
                    Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
         263  +
                        crate::types::InvokeModelWithBidirectionalStreamOutput::Chunk(parsed),
         264  +
                    ))
         265  +
                }
         266  +
                _unknown_variant => Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
         267  +
                    crate::types::InvokeModelWithBidirectionalStreamOutput::Unknown,
         268  +
                )),
         269  +
            },
         270  +
            "exception" => {
         271  +
                let generic = match crate::protocol_serde::parse_event_stream_error_metadata(message.payload()) {
         272  +
                    Ok(builder) => builder.build(),
         273  +
                    Err(err) => {
         274  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         275  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::unhandled(err),
         276  +
                        ))
         277  +
                    }
         278  +
                };
         279  +
                match response_headers.smithy_type.as_str() {
         280  +
                    "internalServerException" => {
         281  +
                        let mut builder = crate::types::error::builders::InternalServerExceptionBuilder::default();
         282  +
                        builder = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(
         283  +
                            &message.payload()[..],
         284  +
                            builder,
         285  +
                        )
         286  +
                        .map_err(|err| {
         287  +
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall internalServerException: {}", err))
         288  +
                        })?;
         289  +
                        builder.set_meta(Some(generic));
         290  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         291  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::InternalServerException(builder.build()),
         292  +
                        ));
         293  +
                    }
         294  +
                    "modelStreamErrorException" => {
         295  +
                        let mut builder = crate::types::error::builders::ModelStreamErrorExceptionBuilder::default();
         296  +
                        builder = crate::protocol_serde::shape_model_stream_error_exception::de_model_stream_error_exception_json_err(
         297  +
                            &message.payload()[..],
         298  +
                            builder,
         299  +
                        )
         300  +
                        .map_err(|err| {
         301  +
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall modelStreamErrorException: {}", err))
         302  +
                        })?;
         303  +
                        builder.set_meta(Some(generic));
         304  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         305  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelStreamErrorException(builder.build()),
         306  +
                        ));
         307  +
                    }
         308  +
                    "validationException" => {
         309  +
                        let mut builder = crate::types::error::builders::ValidationExceptionBuilder::default();
         310  +
                        builder =
         311  +
                            crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(&message.payload()[..], builder)
         312  +
                                .map_err(|err| {
         313  +
                                    ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
         314  +
                                        "failed to unmarshall validationException: {}",
         315  +
                                        err
         316  +
                                    ))
         317  +
                                })?;
         318  +
                        builder.set_meta(Some(generic));
         319  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         320  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ValidationException(builder.build()),
         321  +
                        ));
         322  +
                    }
         323  +
                    "throttlingException" => {
         324  +
                        let mut builder = crate::types::error::builders::ThrottlingExceptionBuilder::default();
         325  +
                        builder =
         326  +
                            crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(&message.payload()[..], builder)
         327  +
                                .map_err(|err| {
         328  +
                                    ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
         329  +
                                        "failed to unmarshall throttlingException: {}",
         330  +
                                        err
         331  +
                                    ))
         332  +
                                })?;
         333  +
                        builder.set_meta(Some(generic));
         334  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         335  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ThrottlingException(builder.build()),
         336  +
                        ));
         337  +
                    }
         338  +
                    "modelTimeoutException" => {
         339  +
                        let mut builder = crate::types::error::builders::ModelTimeoutExceptionBuilder::default();
         340  +
                        builder = crate::protocol_serde::shape_model_timeout_exception::de_model_timeout_exception_json_err(
         341  +
                            &message.payload()[..],
         342  +
                            builder,
         343  +
                        )
         344  +
                        .map_err(|err| {
         345  +
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall modelTimeoutException: {}", err))
         346  +
                        })?;
         347  +
                        builder.set_meta(Some(generic));
         348  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         349  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ModelTimeoutException(builder.build()),
         350  +
                        ));
         351  +
                    }
         352  +
                    "serviceUnavailableException" => {
         353  +
                        let mut builder = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
         354  +
                        builder = crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(
         355  +
                            &message.payload()[..],
         356  +
                            builder,
         357  +
                        )
         358  +
                        .map_err(|err| {
         359  +
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
         360  +
                                "failed to unmarshall serviceUnavailableException: {}",
         361  +
                                err
         362  +
                            ))
         363  +
                        })?;
         364  +
                        builder.set_meta(Some(generic));
         365  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         366  +
                            crate::types::error::InvokeModelWithBidirectionalStreamOutputError::ServiceUnavailableException(builder.build()),
         367  +
                        ));
         368  +
                    }
         369  +
                    _ => {}
         370  +
                }
         371  +
                Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         372  +
                    crate::types::error::InvokeModelWithBidirectionalStreamOutputError::generic(generic),
         373  +
                ))
         374  +
            }
         375  +
            value => {
         376  +
                return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
         377  +
                    "unrecognized :message-type: {}",
         378  +
                    value
         379  +
                )));
         380  +
            }
         381  +
        }
         382  +
    }
         383  +
}
         384  +
  162    385   
#[non_exhaustive]
  163    386   
#[derive(Debug)]
  164    387   
pub struct ResponseStreamUnmarshaller;
  165    388   
  166    389   
impl ResponseStreamUnmarshaller {
  167    390   
    pub fn new() -> Self {
  168    391   
        ResponseStreamUnmarshaller
  169    392   
    }
  170    393   
}
  171    394   
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for ResponseStreamUnmarshaller {
@@ -245,468 +289,529 @@
  265    488   
                            builder,
  266    489   
                        )
  267    490   
                        .map_err(|err| {
  268    491   
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall modelTimeoutException: {}", err))
  269    492   
                        })?;
  270    493   
                        builder.set_meta(Some(generic));
  271    494   
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  272    495   
                            crate::types::error::ResponseStreamError::ModelTimeoutException(builder.build()),
  273    496   
                        ));
  274    497   
                    }
         498  +
                    "serviceUnavailableException" => {
         499  +
                        let mut builder = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
         500  +
                        builder = crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(
         501  +
                            &message.payload()[..],
         502  +
                            builder,
         503  +
                        )
         504  +
                        .map_err(|err| {
         505  +
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
         506  +
                                "failed to unmarshall serviceUnavailableException: {}",
         507  +
                                err
         508  +
                            ))
         509  +
                        })?;
         510  +
                        builder.set_meta(Some(generic));
         511  +
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         512  +
                            crate::types::error::ResponseStreamError::ServiceUnavailableException(builder.build()),
         513  +
                        ));
         514  +
                    }
  275    515   
                    _ => {}
  276    516   
                }
  277    517   
                Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  278    518   
                    crate::types::error::ResponseStreamError::generic(generic),
  279    519   
                ))
  280    520   
            }
  281    521   
            value => {
  282    522   
                return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
  283    523   
                    "unrecognized :message-type: {}",
  284    524   
                    value

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/idempotency_token.rs

@@ -0,1 +0,102 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/*
           3  +
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
           4  +
 * SPDX-License-Identifier: Apache-2.0
           5  +
 */
           6  +
           7  +
use aws_smithy_types::config_bag::{Storable, StoreReplace};
           8  +
use std::sync::Mutex;
           9  +
          10  +
pub(crate) fn uuid_v4(input: u128) -> String {
          11  +
    let mut out = String::with_capacity(36);
          12  +
    // u4-aligned index into [input]
          13  +
    let mut rnd_idx: u8 = 0;
          14  +
    const HEX_CHARS: &[u8; 16] = b"0123456789abcdef";
          15  +
          16  +
    for str_idx in 0..36 {
          17  +
        if str_idx == 8 || str_idx == 13 || str_idx == 18 || str_idx == 23 {
          18  +
            out.push('-');
          19  +
        // UUID version character
          20  +
        } else if str_idx == 14 {
          21  +
            out.push('4');
          22  +
        } else {
          23  +
            let mut dat: u8 = ((input >> (rnd_idx * 4)) & 0x0F) as u8;
          24  +
            // UUID variant bits
          25  +
            if str_idx == 19 {
          26  +
                dat |= 0b00001000;
          27  +
            }
          28  +
            rnd_idx += 1;
          29  +
            out.push(HEX_CHARS[dat as usize] as char);
          30  +
        }
          31  +
    }
          32  +
    out
          33  +
}
          34  +
          35  +
/// IdempotencyTokenProvider generates idempotency tokens for idempotent API requests
          36  +
///
          37  +
/// Generally, customers will not need to interact with this at all. A sensible default will be
          38  +
/// provided automatically during config construction. However, if you need deterministic behavior
          39  +
/// for testing, two options are available:
          40  +
/// 1. Utilize the From<&'static str>` implementation to hard code an idempotency token
          41  +
/// 2. Seed the token provider with [`IdempotencyTokenProvider::with_seed`](IdempotencyTokenProvider::with_seed)
          42  +
#[derive(Debug)]
          43  +
pub struct IdempotencyTokenProvider {
          44  +
    inner: Inner,
          45  +
}
          46  +
          47  +
#[derive(Debug)]
          48  +
enum Inner {
          49  +
    Static(&'static str),
          50  +
    Random(Mutex<fastrand::Rng>),
          51  +
}
          52  +
          53  +
pub fn default_provider() -> IdempotencyTokenProvider {
          54  +
    IdempotencyTokenProvider::random()
          55  +
}
          56  +
          57  +
impl From<&'static str> for IdempotencyTokenProvider {
          58  +
    fn from(token: &'static str) -> Self {
          59  +
        Self::fixed(token)
          60  +
    }
          61  +
}
          62  +
          63  +
impl Storable for IdempotencyTokenProvider {
          64  +
    type Storer = StoreReplace<IdempotencyTokenProvider>;
          65  +
}
          66  +
          67  +
impl IdempotencyTokenProvider {
          68  +
    pub fn make_idempotency_token(&self) -> String {
          69  +
        match &self.inner {
          70  +
            Inner::Static(token) => token.to_string(),
          71  +
            Inner::Random(rng) => {
          72  +
                let input: u128 = rng.lock().unwrap().u128(..);
          73  +
                uuid_v4(input)
          74  +
            }
          75  +
        }
          76  +
    }
          77  +
          78  +
    pub fn with_seed(seed: u64) -> Self {
          79  +
        Self {
          80  +
            inner: Inner::Random(Mutex::new(fastrand::Rng::with_seed(seed))),
          81  +
        }
          82  +
    }
          83  +
          84  +
    pub fn random() -> Self {
          85  +
        Self {
          86  +
            inner: Inner::Random(Mutex::new(fastrand::Rng::new())),
          87  +
        }
          88  +
    }
          89  +
          90  +
    pub fn fixed(token: &'static str) -> Self {
          91  +
        Self { inner: Inner::Static(token) }
          92  +
    }
          93  +
}
          94  +
          95  +
impl Clone for IdempotencyTokenProvider {
          96  +
    fn clone(&self) -> Self {
          97  +
        match &self.inner {
          98  +
            Inner::Static(token) => IdempotencyTokenProvider::fixed(token),
          99  +
            Inner::Random(_) => IdempotencyTokenProvider::random(),
         100  +
        }
         101  +
    }
         102  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/lens.rs

@@ -0,1 +0,17 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn reflens_list_async_invokes_output_output_next_token(
           3  +
    input: &crate::operation::list_async_invokes::ListAsyncInvokesOutput,
           4  +
) -> ::std::option::Option<&::std::string::String> {
           5  +
    let input = match &input.next_token {
           6  +
        ::std::option::Option::None => return ::std::option::Option::None,
           7  +
        ::std::option::Option::Some(t) => t,
           8  +
    };
           9  +
    ::std::option::Option::Some(input)
          10  +
}
          11  +
          12  +
pub(crate) fn lens_list_async_invokes_output_output_async_invoke_summaries(
          13  +
    input: crate::operation::list_async_invokes::ListAsyncInvokesOutput,
          14  +
) -> ::std::option::Option<::std::vec::Vec<crate::types::AsyncInvokeSummary>> {
          15  +
    let input = input.async_invoke_summaries?;
          16  +
    ::std::option::Option::Some(input)
          17  +
}

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

@@ -122,122 +206,212 @@
  142    142   
/// [`ConfigLoader`]: https://docs.rs/aws-config/*/aws_config/struct.ConfigLoader.html
  143    143   
/// [`SdkConfig`]: https://docs.rs/aws-config/*/aws_config/struct.SdkConfig.html
  144    144   
/// [`aws-config` docs]: https://docs.rs/aws-config/*
  145    145   
/// [`aws-config`]: https://crates.io/crates/aws-config
  146    146   
/// [`aws_config::from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.from_env.html
  147    147   
/// [`aws_config::load_from_env()`]: https://docs.rs/aws-config/*/aws_config/fn.load_from_env.html
  148    148   
/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#builders-enable-construction-of-complex-values-c-builder
  149    149   
/// # Using the `Client`
  150    150   
///
  151    151   
/// A client has a function for every operation that can be performed by the service.
  152         -
/// For example, the [`Converse`](crate::operation::converse) operation has
  153         -
/// a [`Client::converse`], function which returns a builder for that operation.
         152  +
/// For example, the [`ApplyGuardrail`](crate::operation::apply_guardrail) operation has
         153  +
/// a [`Client::apply_guardrail`], function which returns a builder for that operation.
  154    154   
/// The fluent builder ultimately has a `send()` function that returns an async future that
  155    155   
/// returns a result, as illustrated below:
  156    156   
///
  157    157   
/// ```rust,ignore
  158         -
/// let result = client.converse()
  159         -
///     .model_id("example")
         158  +
/// let result = client.apply_guardrail()
         159  +
///     .guardrail_identifier("example")
  160    160   
///     .send()
  161    161   
///     .await;
  162    162   
/// ```
  163    163   
///
  164    164   
/// The underlying HTTP requests that get made by this can be modified with the `customize_operation`
  165    165   
/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more
  166    166   
/// information.
  167    167   
pub mod client;
  168    168   
  169    169   
/// Configuration for Amazon Bedrock Runtime.
  170    170   
pub mod config;
  171    171   
  172    172   
/// Common errors and error handling utilities.
  173    173   
pub mod error;
  174    174   
  175    175   
mod error_meta;
  176    176   
  177    177   
/// Information about this crate.
  178    178   
pub mod meta;
  179    179   
  180    180   
/// All operations that this crate can perform.
  181    181   
pub mod operation;
  182    182   
  183    183   
/// Primitives such as `Blob` or `DateTime` used by other types.
  184    184   
pub mod primitives;
  185    185   
  186    186   
/// Data structures used by operation inputs/outputs.
  187    187   
pub mod types;
  188    188   
         189  +
pub(crate) mod client_idempotency_token;
         190  +
  189    191   
mod event_receiver;
  190    192   
         193  +
mod event_stream_serde;
         194  +
         195  +
mod idempotency_token;
         196  +
  191    197   
pub(crate) mod protocol_serde;
  192    198   
  193    199   
mod sdk_feature_tracker;
  194    200   
  195    201   
mod serialization_settings;
  196    202   
  197    203   
mod endpoint_lib;
  198    204   
  199         -
mod serde_util;
         205  +
mod lens;
  200    206   
  201         -
mod event_stream_serde;
         207  +
mod serde_util;
  202    208   
  203    209   
mod json_errors;
  204    210   
  205    211   
#[doc(inline)]
  206    212   
pub use client::Client;

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/operation.rs

@@ -1,1 +0,29 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub use ::aws_types::request_id::RequestId;
    3      3   
           4  +
/// Types for the `ApplyGuardrail` operation.
           5  +
pub mod apply_guardrail;
           6  +
    4      7   
/// Types for the `Converse` operation.
    5      8   
pub mod converse;
    6      9   
    7     10   
/// Types for the `ConverseStream` operation.
    8     11   
pub mod converse_stream;
    9     12   
          13  +
/// Types for the `GetAsyncInvoke` operation.
          14  +
pub mod get_async_invoke;
          15  +
   10     16   
/// Types for the `InvokeModel` operation.
   11     17   
pub mod invoke_model;
   12     18   
          19  +
/// Types for the `InvokeModelWithBidirectionalStream` operation.
          20  +
pub mod invoke_model_with_bidirectional_stream;
          21  +
   13     22   
/// Types for the `InvokeModelWithResponseStream` operation.
   14     23   
pub mod invoke_model_with_response_stream;
          24  +
          25  +
/// Types for the `ListAsyncInvokes` operation.
          26  +
pub mod list_async_invokes;
          27  +
          28  +
/// Types for the `StartAsyncInvoke` operation.
          29  +
pub mod start_async_invoke;

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/operation/apply_guardrail.rs

@@ -0,1 +0,443 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// Orchestration and serialization glue logic for `ApplyGuardrail`.
           3  +
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
           4  +
#[non_exhaustive]
           5  +
pub struct ApplyGuardrail;
           6  +
impl ApplyGuardrail {
           7  +
    /// Creates a new `ApplyGuardrail`
           8  +
    pub fn new() -> Self {
           9  +
        Self
          10  +
    }
          11  +
    pub(crate) async fn orchestrate(
          12  +
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
          13  +
        input: crate::operation::apply_guardrail::ApplyGuardrailInput,
          14  +
    ) -> ::std::result::Result<
          15  +
        crate::operation::apply_guardrail::ApplyGuardrailOutput,
          16  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          17  +
            crate::operation::apply_guardrail::ApplyGuardrailError,
          18  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          19  +
        >,
          20  +
    > {
          21  +
        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
          22  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
          23  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          24  +
        >| {
          25  +
            err.map_service_error(|err| {
          26  +
                err.downcast::<crate::operation::apply_guardrail::ApplyGuardrailError>()
          27  +
                    .expect("correct error type")
          28  +
            })
          29  +
        };
          30  +
        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
          31  +
            .await
          32  +
            .map_err(map_err)?;
          33  +
        let output = context.finalize().map_err(map_err)?;
          34  +
        ::std::result::Result::Ok(
          35  +
            output
          36  +
                .downcast::<crate::operation::apply_guardrail::ApplyGuardrailOutput>()
          37  +
                .expect("correct output type"),
          38  +
        )
          39  +
    }
          40  +
          41  +
    pub(crate) async fn orchestrate_with_stop_point(
          42  +
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
          43  +
        input: crate::operation::apply_guardrail::ApplyGuardrailInput,
          44  +
        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
          45  +
    ) -> ::std::result::Result<
          46  +
        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
          47  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          48  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
          49  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          50  +
        >,
          51  +
    > {
          52  +
        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
          53  +
        use ::tracing::Instrument;
          54  +
        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("Bedrock Runtime", "ApplyGuardrail", input, runtime_plugins, stop_point)
          55  +
            // Create a parent span for the entire operation. Includes a random, internal-only,
          56  +
            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
          57  +
            .instrument(::tracing::debug_span!(
          58  +
                "Bedrock Runtime.ApplyGuardrail",
          59  +
                "rpc.service" = "Bedrock Runtime",
          60  +
                "rpc.method" = "ApplyGuardrail",
          61  +
                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
          62  +
                "rpc.system" = "aws-api",
          63  +
            ))
          64  +
            .await
          65  +
    }
          66  +
          67  +
    pub(crate) fn operation_runtime_plugins(
          68  +
        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
          69  +
        client_config: &crate::config::Config,
          70  +
        config_override: ::std::option::Option<crate::config::Builder>,
          71  +
    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
          72  +
        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
          73  +
          74  +
        if let ::std::option::Option::Some(config_override) = config_override {
          75  +
            for plugin in config_override.runtime_plugins.iter().cloned() {
          76  +
                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
          77  +
            }
          78  +
            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
          79  +
                config_override,
          80  +
                client_config.config.clone(),
          81  +
                &client_config.runtime_components,
          82  +
            ));
          83  +
        }
          84  +
        runtime_plugins
          85  +
    }
          86  +
}
          87  +
impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ApplyGuardrail {
          88  +
    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
          89  +
        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ApplyGuardrail");
          90  +
          91  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
          92  +
            ApplyGuardrailRequestSerializer,
          93  +
        ));
          94  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
          95  +
            ApplyGuardrailResponseDeserializer,
          96  +
        ));
          97  +
          98  +
        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
          99  +
            crate::config::auth::Params::builder()
         100  +
                .operation_name("ApplyGuardrail")
         101  +
                .build()
         102  +
                .expect("required fields set"),
         103  +
        ));
         104  +
         105  +
        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
         106  +
            "ApplyGuardrail",
         107  +
            "Bedrock Runtime",
         108  +
        ));
         109  +
        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
         110  +
        signing_options.double_uri_encode = true;
         111  +
        signing_options.content_sha256_header = false;
         112  +
        signing_options.normalize_uri_path = true;
         113  +
        signing_options.payload_override = None;
         114  +
         115  +
        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
         116  +
            signing_options,
         117  +
            ..::std::default::Default::default()
         118  +
        });
         119  +
         120  +
        ::std::option::Option::Some(cfg.freeze())
         121  +
    }
         122  +
         123  +
    fn runtime_components(
         124  +
        &self,
         125  +
        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
         126  +
    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
         127  +
        #[allow(unused_mut)]
         128  +
        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ApplyGuardrail")
         129  +
            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
         130  +
            .with_interceptor(ApplyGuardrailEndpointParamsInterceptor)
         131  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
         132  +
                crate::operation::apply_guardrail::ApplyGuardrailError,
         133  +
            >::new())
         134  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
         135  +
                crate::operation::apply_guardrail::ApplyGuardrailError,
         136  +
            >::new())
         137  +
            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
         138  +
                crate::operation::apply_guardrail::ApplyGuardrailError,
         139  +
            >::new());
         140  +
         141  +
        ::std::borrow::Cow::Owned(rcb)
         142  +
    }
         143  +
}
         144  +
         145  +
#[derive(Debug)]
         146  +
struct ApplyGuardrailResponseDeserializer;
         147  +
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ApplyGuardrailResponseDeserializer {
         148  +
    fn deserialize_nonstreaming(
         149  +
        &self,
         150  +
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         151  +
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
         152  +
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         153  +
        let headers = response.headers();
         154  +
        let body = response.body().bytes().expect("body loaded");
         155  +
        #[allow(unused_mut)]
         156  +
        let mut force_error = false;
         157  +
        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
         158  +
        let parse_result = if !success && status != 200 || force_error {
         159  +
            crate::protocol_serde::shape_apply_guardrail::de_apply_guardrail_http_error(status, headers, body)
         160  +
        } else {
         161  +
            crate::protocol_serde::shape_apply_guardrail::de_apply_guardrail_http_response(status, headers, body)
         162  +
        };
         163  +
        crate::protocol_serde::type_erase_result(parse_result)
         164  +
    }
         165  +
}
         166  +
#[derive(Debug)]
         167  +
struct ApplyGuardrailRequestSerializer;
         168  +
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ApplyGuardrailRequestSerializer {
         169  +
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
         170  +
    fn serialize_input(
         171  +
        &self,
         172  +
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
         173  +
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         174  +
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
         175  +
        let input = input
         176  +
            .downcast::<crate::operation::apply_guardrail::ApplyGuardrailInput>()
         177  +
            .expect("correct type");
         178  +
        let _header_serialization_settings = _cfg
         179  +
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
         180  +
            .cloned()
         181  +
            .unwrap_or_default();
         182  +
        let mut request_builder = {
         183  +
            fn uri_base(
         184  +
                _input: &crate::operation::apply_guardrail::ApplyGuardrailInput,
         185  +
                output: &mut ::std::string::String,
         186  +
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
         187  +
                use ::std::fmt::Write as _;
         188  +
                let input_1 = &_input.guardrail_identifier;
         189  +
                let input_1 = input_1.as_ref().ok_or_else(|| {
         190  +
                    ::aws_smithy_types::error::operation::BuildError::missing_field("guardrail_identifier", "cannot be empty or unset")
         191  +
                })?;
         192  +
                let guardrail_identifier = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
         193  +
                if guardrail_identifier.is_empty() {
         194  +
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
         195  +
                        "guardrail_identifier",
         196  +
                        "cannot be empty or unset",
         197  +
                    ));
         198  +
                }
         199  +
                let input_2 = &_input.guardrail_version;
         200  +
                let input_2 = input_2.as_ref().ok_or_else(|| {
         201  +
                    ::aws_smithy_types::error::operation::BuildError::missing_field("guardrail_version", "cannot be empty or unset")
         202  +
                })?;
         203  +
                let guardrail_version = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
         204  +
                if guardrail_version.is_empty() {
         205  +
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
         206  +
                        "guardrail_version",
         207  +
                        "cannot be empty or unset",
         208  +
                    ));
         209  +
                }
         210  +
                ::std::write!(
         211  +
                    output,
         212  +
                    "/guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply",
         213  +
                    guardrailIdentifier = guardrail_identifier,
         214  +
                    guardrailVersion = guardrail_version
         215  +
                )
         216  +
                .expect("formatting should succeed");
         217  +
                ::std::result::Result::Ok(())
         218  +
            }
         219  +
            #[allow(clippy::unnecessary_wraps)]
         220  +
            fn update_http_builder(
         221  +
                input: &crate::operation::apply_guardrail::ApplyGuardrailInput,
         222  +
                builder: ::http::request::Builder,
         223  +
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         224  +
                let mut uri = ::std::string::String::new();
         225  +
                uri_base(input, &mut uri)?;
         226  +
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         227  +
            }
         228  +
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
         229  +
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json");
         230  +
            builder
         231  +
        };
         232  +
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_apply_guardrail::ser_apply_guardrail_input(&input)?);
         233  +
        if let Some(content_length) = body.content_length() {
         234  +
            let content_length = content_length.to_string();
         235  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
         236  +
        }
         237  +
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         238  +
    }
         239  +
}
         240  +
#[derive(Debug)]
         241  +
struct ApplyGuardrailEndpointParamsInterceptor;
         242  +
         243  +
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ApplyGuardrailEndpointParamsInterceptor {
         244  +
    fn name(&self) -> &'static str {
         245  +
        "ApplyGuardrailEndpointParamsInterceptor"
         246  +
    }
         247  +
         248  +
    fn read_before_execution(
         249  +
        &self,
         250  +
        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
         251  +
            '_,
         252  +
            ::aws_smithy_runtime_api::client::interceptors::context::Input,
         253  +
            ::aws_smithy_runtime_api::client::interceptors::context::Output,
         254  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
         255  +
        >,
         256  +
        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         257  +
    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
         258  +
        let _input = context
         259  +
            .input()
         260  +
            .downcast_ref::<ApplyGuardrailInput>()
         261  +
            .ok_or("failed to downcast to ApplyGuardrailInput")?;
         262  +
         263  +
        let params = crate::config::endpoint::Params::builder()
         264  +
            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
         265  +
            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
         266  +
            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
         267  +
            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
         268  +
            .build()
         269  +
            .map_err(|err| {
         270  +
                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
         271  +
            })?;
         272  +
        cfg.interceptor_state()
         273  +
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
         274  +
        ::std::result::Result::Ok(())
         275  +
    }
         276  +
}
         277  +
         278  +
// The get_* functions below are generated from JMESPath expressions in the
         279  +
// operationContextParams trait. They target the operation's input shape.
         280  +
         281  +
/// Error type for the `ApplyGuardrailError` operation.
         282  +
#[non_exhaustive]
         283  +
#[derive(::std::fmt::Debug)]
         284  +
pub enum ApplyGuardrailError {
         285  +
    /// <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
         286  +
    AccessDeniedException(crate::types::error::AccessDeniedException),
         287  +
    /// <p>An internal server error occurred. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
         288  +
    InternalServerException(crate::types::error::InternalServerException),
         289  +
    /// <p>The specified resource ARN was not found. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
         290  +
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
         291  +
    /// <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
         292  +
    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
         293  +
    /// <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
         294  +
    ThrottlingException(crate::types::error::ThrottlingException),
         295  +
    /// <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
         296  +
    ValidationException(crate::types::error::ValidationException),
         297  +
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
         298  +
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
         299  +
    variable wildcard pattern and check `.code()`:
         300  +
     \
         301  +
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
         302  +
     \
         303  +
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ApplyGuardrailError) for what information is available for the error.")]
         304  +
    Unhandled(crate::error::sealed_unhandled::Unhandled),
         305  +
}
         306  +
impl ApplyGuardrailError {
         307  +
    /// Creates the `ApplyGuardrailError::Unhandled` variant from any error type.
         308  +
    pub fn unhandled(
         309  +
        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
         310  +
    ) -> Self {
         311  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         312  +
            source: err.into(),
         313  +
            meta: ::std::default::Default::default(),
         314  +
        })
         315  +
    }
         316  +
         317  +
    /// Creates the `ApplyGuardrailError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
         318  +
    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
         319  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         320  +
            source: err.clone().into(),
         321  +
            meta: err,
         322  +
        })
         323  +
    }
         324  +
    ///
         325  +
    /// Returns error metadata, which includes the error code, message,
         326  +
    /// request ID, and potentially additional information.
         327  +
    ///
         328  +
    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         329  +
        match self {
         330  +
            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         331  +
            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         332  +
            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         333  +
            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         334  +
            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         335  +
            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         336  +
            Self::Unhandled(e) => &e.meta,
         337  +
        }
         338  +
    }
         339  +
    /// Returns `true` if the error kind is `ApplyGuardrailError::AccessDeniedException`.
         340  +
    pub fn is_access_denied_exception(&self) -> bool {
         341  +
        matches!(self, Self::AccessDeniedException(_))
         342  +
    }
         343  +
    /// Returns `true` if the error kind is `ApplyGuardrailError::InternalServerException`.
         344  +
    pub fn is_internal_server_exception(&self) -> bool {
         345  +
        matches!(self, Self::InternalServerException(_))
         346  +
    }
         347  +
    /// Returns `true` if the error kind is `ApplyGuardrailError::ResourceNotFoundException`.
         348  +
    pub fn is_resource_not_found_exception(&self) -> bool {
         349  +
        matches!(self, Self::ResourceNotFoundException(_))
         350  +
    }
         351  +
    /// Returns `true` if the error kind is `ApplyGuardrailError::ServiceQuotaExceededException`.
         352  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
         353  +
        matches!(self, Self::ServiceQuotaExceededException(_))
         354  +
    }
         355  +
    /// Returns `true` if the error kind is `ApplyGuardrailError::ThrottlingException`.
         356  +
    pub fn is_throttling_exception(&self) -> bool {
         357  +
        matches!(self, Self::ThrottlingException(_))
         358  +
    }
         359  +
    /// Returns `true` if the error kind is `ApplyGuardrailError::ValidationException`.
         360  +
    pub fn is_validation_exception(&self) -> bool {
         361  +
        matches!(self, Self::ValidationException(_))
         362  +
    }
         363  +
}
         364  +
impl ::std::error::Error for ApplyGuardrailError {
         365  +
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         366  +
        match self {
         367  +
            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
         368  +
            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
         369  +
            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
         370  +
            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
         371  +
            Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
         372  +
            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
         373  +
            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
         374  +
        }
         375  +
    }
         376  +
}
         377  +
impl ::std::fmt::Display for ApplyGuardrailError {
         378  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         379  +
        match self {
         380  +
            Self::AccessDeniedException(_inner) => _inner.fmt(f),
         381  +
            Self::InternalServerException(_inner) => _inner.fmt(f),
         382  +
            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
         383  +
            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
         384  +
            Self::ThrottlingException(_inner) => _inner.fmt(f),
         385  +
            Self::ValidationException(_inner) => _inner.fmt(f),
         386  +
            Self::Unhandled(_inner) => {
         387  +
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
         388  +
                    write!(f, "unhandled error ({code})")
         389  +
                } else {
         390  +
                    f.write_str("unhandled error")
         391  +
                }
         392  +
            }
         393  +
        }
         394  +
    }
         395  +
}
         396  +
impl ::aws_smithy_types::retry::ProvideErrorKind for ApplyGuardrailError {
         397  +
    fn code(&self) -> ::std::option::Option<&str> {
         398  +
        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
         399  +
    }
         400  +
    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
         401  +
        ::std::option::Option::None
         402  +
    }
         403  +
}
         404  +
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ApplyGuardrailError {
         405  +
    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         406  +
        match self {
         407  +
            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         408  +
            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         409  +
            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         410  +
            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         411  +
            Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         412  +
            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         413  +
            Self::Unhandled(_inner) => &_inner.meta,
         414  +
        }
         415  +
    }
         416  +
}
         417  +
impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ApplyGuardrailError {
         418  +
    fn create_unhandled_error(
         419  +
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
         420  +
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
         421  +
    ) -> Self {
         422  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         423  +
            source,
         424  +
            meta: meta.unwrap_or_default(),
         425  +
        })
         426  +
    }
         427  +
}
         428  +
impl ::aws_types::request_id::RequestId for crate::operation::apply_guardrail::ApplyGuardrailError {
         429  +
    fn request_id(&self) -> Option<&str> {
         430  +
        self.meta().request_id()
         431  +
    }
         432  +
}
         433  +
         434  +
pub use crate::operation::apply_guardrail::_apply_guardrail_output::ApplyGuardrailOutput;
         435  +
         436  +
pub use crate::operation::apply_guardrail::_apply_guardrail_input::ApplyGuardrailInput;
         437  +
         438  +
mod _apply_guardrail_input;
         439  +
         440  +
mod _apply_guardrail_output;
         441  +
         442  +
/// Builders
         443  +
pub mod builders;