AWS SDK

AWS SDK

rev. ba98f30b52e51c6e715b0ae469e7a2e988c27d9a

Files changed:

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

@@ -1,1 +24,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
impl super::Client {
    3      3   
    /// Constructs a fluent builder for the [`InvokeModelWithResponseStream`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder) operation.
    4      4   
    ///
    5      5   
    /// - The fluent builder is configurable:
    6         -
    ///   - [`body(Blob)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::body) / [`set_body(Option<Blob>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_body):<br>required: **false**<br><p>The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p><br>
    7         -
    ///   - [`content_type(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::content_type) / [`set_content_type(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_content_type):<br>required: **false**<br><p>The MIME type of the input data in the request. You must specify <code>application/json</code>.</p><br>
           6  +
    ///   - [`body(Blob)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::body) / [`set_body(Option<Blob>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_body):<br>required: **true**<br><p>The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p><br>
           7  +
    ///   - [`content_type(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::content_type) / [`set_content_type(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_content_type):<br>required: **false**<br><p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p><br>
    8      8   
    ///   - [`accept(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::accept) / [`set_accept(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_accept):<br>required: **false**<br><p>The desired MIME type of the inference body in the response. The default value is <code>application/json</code>.</p><br>
    9         -
    ///   - [`model_id(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::model_id) / [`set_model_id(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_model_id):<br>required: **true**<br><p>The unique identifier of the model to invoke to run inference.</p> <p>The <code>modelId</code> to provide depends on the type of model or throughput that you use:</p> <ul>  <li>   <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>  <li>   <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>  <li>   <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>  <li>   <p>If you use a custom model, specify the ARN of the custom model deployment (for on-demand inference) or the ARN of your provisioned model (for Provisioned Throughput). For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>  <li>   <p>If you use an <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported model</a>, specify the ARN of the imported model. You can get the model ARN from a successful call to <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateModelImportJob.html">CreateModelImportJob</a> or from the Imported models page in the Amazon Bedrock console.</p></li> </ul><br>
           9  +
    ///   - [`model_id(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::model_id) / [`set_model_id(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_model_id):<br>required: **true**<br><p>The unique identifier of the model to invoke to run inference.</p> <p>The <code>modelId</code> to provide depends on the type of model that you use:</p> <ul>  <li>   <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>  <li>   <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>  <li>   <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li> </ul><br>
   10     10   
    ///   - [`trace(Trace)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::trace) / [`set_trace(Option<Trace>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_trace):<br>required: **false**<br><p>Specifies whether to enable or disable the Bedrock trace. If enabled, you can see the full Bedrock trace.</p><br>
   11     11   
    ///   - [`guardrail_identifier(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::guardrail_identifier) / [`set_guardrail_identifier(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_guardrail_identifier):<br>required: **false**<br><p>The unique identifier of the guardrail that you want to use. If you don't provide a value, no guardrail is applied to the invocation.</p> <p>An error is thrown in the following situations.</p> <ul>  <li>   <p>You don't provide a guardrail identifier but you specify the <code>amazon-bedrock-guardrailConfig</code> field in the request body.</p></li>  <li>   <p>You enable the guardrail but the <code>contentType</code> isn't <code>application/json</code>.</p></li>  <li>   <p>You provide a guardrail identifier, but <code>guardrailVersion</code> isn't specified.</p></li> </ul><br>
   12     12   
    ///   - [`guardrail_version(impl Into<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::guardrail_version) / [`set_guardrail_version(Option<String>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_guardrail_version):<br>required: **false**<br><p>The version number for the guardrail. The value can also be <code>DRAFT</code>.</p><br>
   13         -
    ///   - [`performance_config_latency(PerformanceConfigLatency)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::performance_config_latency) / [`set_performance_config_latency(Option<PerformanceConfigLatency>)`](crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::set_performance_config_latency):<br>required: **false**<br><p>Model performance settings for the request.</p><br>
   14     13   
    /// - On success, responds with [`InvokeModelWithResponseStreamOutput`](crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamOutput) with field(s):
   15     14   
    ///   - [`body(EventReceiver<ResponseStream, ResponseStreamError>)`](crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamOutput::body): <p>Inference response from the model in the format specified by the <code>contentType</code> header. To see the format and content of this field for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.</p>
   16     15   
    ///   - [`content_type(String)`](crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamOutput::content_type): <p>The MIME type of the inference result.</p>
   17         -
    ///   - [`performance_config_latency(Option<PerformanceConfigLatency>)`](crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamOutput::performance_config_latency): <p>Model performance settings for the request.</p>
   18     16   
    /// - On failure, responds with [`SdkError<InvokeModelWithResponseStreamError>`](crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError)
   19     17   
    pub fn invoke_model_with_response_stream(
   20     18   
        &self,
   21     19   
    ) -> crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder {
   22     20   
        crate::operation::invoke_model_with_response_stream::builders::InvokeModelWithResponseStreamFluentBuilder::new(self.handle.clone())
   23     21   
    }
   24     22   
}

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

@@ -1,0 +21,0 @@
    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

@@ -1,0 +17,0 @@
    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

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

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

@@ -28,28 +97,91 @@
   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![
   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         -
            ],
          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")],
   68     62   
            operation_overrides: ::std::collections::HashMap::new(),
   69     63   
        }
   70     64   
    }
   71     65   
}
   72     66   
   73     67   
impl crate::config::auth::ResolveAuthScheme for DefaultAuthSchemeResolver {
   74     68   
    fn resolve_auth_scheme<'a>(
   75     69   
        &'a self,
   76     70   
        params: &'a crate::config::auth::Params,
   77     71   
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,

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

@@ -1,1 +571,318 @@
    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 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>
           6  +
    /// <p>The request is denied because of missing access permissions.</p>
    7      7   
    AccessDeniedException(crate::types::error::AccessDeniedException),
    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>
           8  +
    /// <p>An internal server error occurred. Retry your request.</p>
   11      9   
    InternalServerException(crate::types::error::InternalServerException),
   12     10   
    /// <p>The request failed due to an error while processing the model.</p>
   13     11   
    ModelErrorException(crate::types::error::ModelErrorException),
   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>
          12  +
    /// <p>The model specified in the request is not ready to serve inference requests.</p>
   15     13   
    ModelNotReadyException(crate::types::error::ModelNotReadyException),
   16     14   
    /// <p>An error occurred while streaming the response. Retry your request.</p>
   17     15   
    ModelStreamErrorException(crate::types::error::ModelStreamErrorException),
   18     16   
    /// <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
   19     17   
    ModelTimeoutException(crate::types::error::ModelTimeoutException),
   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>
          18  +
    /// <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
   21     19   
    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
   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>
          20  +
    /// <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
   23     21   
    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
   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>
          22  +
    /// <p>The number of requests exceeds the limit. Resubmit your request later.</p>
   27     23   
    ThrottlingException(crate::types::error::ThrottlingException),
   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>
          24  +
    /// <p>Input validation failed. Check your request parameters and retry the request.</p>
   29     25   
    ValidationException(crate::types::error::ValidationException),
   30     26   
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
   31     27   
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
   32     28   
    variable wildcard pattern and check `.code()`:
   33     29   
     \
   34     30   
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
   35     31   
     \
   36     32   
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
   37     33   
    Unhandled(crate::error::sealed_unhandled::Unhandled),
   38     34   
}
   39     35   
impl ::std::fmt::Display for Error {
   40     36   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   41     37   
        match self {
   42     38   
            Error::AccessDeniedException(inner) => inner.fmt(f),
   43         -
            Error::ConflictException(inner) => inner.fmt(f),
   44     39   
            Error::InternalServerException(inner) => inner.fmt(f),
   45     40   
            Error::ModelErrorException(inner) => inner.fmt(f),
   46     41   
            Error::ModelNotReadyException(inner) => inner.fmt(f),
   47     42   
            Error::ModelStreamErrorException(inner) => inner.fmt(f),
   48     43   
            Error::ModelTimeoutException(inner) => inner.fmt(f),
   49     44   
            Error::ResourceNotFoundException(inner) => inner.fmt(f),
   50     45   
            Error::ServiceQuotaExceededException(inner) => inner.fmt(f),
   51         -
            Error::ServiceUnavailableException(inner) => inner.fmt(f),
   52     46   
            Error::ThrottlingException(inner) => inner.fmt(f),
   53     47   
            Error::ValidationException(inner) => inner.fmt(f),
   54     48   
            Error::Unhandled(_) => {
   55     49   
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
   56     50   
                    write!(f, "unhandled error ({code})")
   57     51   
                } else {
   58     52   
                    f.write_str("unhandled error")
   59     53   
                }
   60     54   
            }
   61     55   
        }
   62     56   
    }
   63     57   
}
   64     58   
impl From<::aws_smithy_types::error::operation::BuildError> for Error {
   65     59   
    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
   66     60   
        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
   67     61   
            source: value.into(),
   68     62   
            meta: ::std::default::Default::default(),
   69     63   
        })
   70     64   
    }
   71     65   
}
   72     66   
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
   73     67   
    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
   74     68   
        match self {
   75     69   
            Self::AccessDeniedException(inner) => inner.meta(),
   76         -
            Self::ConflictException(inner) => inner.meta(),
   77     70   
            Self::InternalServerException(inner) => inner.meta(),
   78     71   
            Self::ModelErrorException(inner) => inner.meta(),
   79     72   
            Self::ModelNotReadyException(inner) => inner.meta(),
   80     73   
            Self::ModelStreamErrorException(inner) => inner.meta(),
   81     74   
            Self::ModelTimeoutException(inner) => inner.meta(),
   82     75   
            Self::ResourceNotFoundException(inner) => inner.meta(),
   83     76   
            Self::ServiceQuotaExceededException(inner) => inner.meta(),
   84         -
            Self::ServiceUnavailableException(inner) => inner.meta(),
   85     77   
            Self::ThrottlingException(inner) => inner.meta(),
   86     78   
            Self::ValidationException(inner) => inner.meta(),
   87     79   
            Self::Unhandled(inner) => &inner.meta,
   88     80   
        }
   89     81   
    }
   90     82   
}
   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         -
}
  120     83   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, R>> for Error
  121     84   
where
  122     85   
    R: Send + Sync + std::fmt::Debug + 'static,
  123     86   
{
  124     87   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse::ConverseError, R>) -> Self {
  125     88   
        match err {
  126     89   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  127     90   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  128     91   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  129     92   
                source: err.into(),
  130     93   
            }),
  131     94   
        }
  132     95   
    }
  133     96   
}
  134     97   
impl From<crate::operation::converse::ConverseError> for Error {
  135     98   
    fn from(err: crate::operation::converse::ConverseError) -> Self {
  136     99   
        match err {
  137    100   
            crate::operation::converse::ConverseError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
  138    101   
            crate::operation::converse::ConverseError::InternalServerException(inner) => Error::InternalServerException(inner),
  139    102   
            crate::operation::converse::ConverseError::ModelErrorException(inner) => Error::ModelErrorException(inner),
  140    103   
            crate::operation::converse::ConverseError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
  141    104   
            crate::operation::converse::ConverseError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  142    105   
            crate::operation::converse::ConverseError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
  143         -
            crate::operation::converse::ConverseError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  144    106   
            crate::operation::converse::ConverseError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  145    107   
            crate::operation::converse::ConverseError::ValidationException(inner) => Error::ValidationException(inner),
  146    108   
            crate::operation::converse::ConverseError::Unhandled(inner) => Error::Unhandled(inner),
  147    109   
        }
  148    110   
    }
  149    111   
}
  150    112   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>> for Error
  151    113   
where
  152    114   
    R: Send + Sync + std::fmt::Debug + 'static,
  153    115   
{
  154    116   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::converse_stream::ConverseStreamError, R>) -> Self {
  155    117   
        match err {
  156    118   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  157    119   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  158    120   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  159    121   
                source: err.into(),
  160    122   
            }),
  161    123   
        }
  162    124   
    }
  163    125   
}
  164    126   
impl From<crate::operation::converse_stream::ConverseStreamError> for Error {
  165    127   
    fn from(err: crate::operation::converse_stream::ConverseStreamError) -> Self {
  166    128   
        match err {
  167    129   
            crate::operation::converse_stream::ConverseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  168    130   
            crate::operation::converse_stream::ConverseStreamError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
  169    131   
            crate::operation::converse_stream::ConverseStreamError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
  170    132   
            crate::operation::converse_stream::ConverseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  171         -
            crate::operation::converse_stream::ConverseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  172    133   
            crate::operation::converse_stream::ConverseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
  173    134   
            crate::operation::converse_stream::ConverseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
  174    135   
            crate::operation::converse_stream::ConverseStreamError::ValidationException(inner) => Error::ValidationException(inner),
  175    136   
            crate::operation::converse_stream::ConverseStreamError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
  176    137   
            crate::operation::converse_stream::ConverseStreamError::ModelErrorException(inner) => Error::ModelErrorException(inner),
  177    138   
            crate::operation::converse_stream::ConverseStreamError::Unhandled(inner) => Error::Unhandled(inner),
  178    139   
        }
  179    140   
    }
  180    141   
}
  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         -
}
  206    142   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>> for Error
  207    143   
where
  208    144   
    R: Send + Sync + std::fmt::Debug + 'static,
  209    145   
{
  210    146   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::invoke_model::InvokeModelError, R>) -> Self {
  211    147   
        match err {
  212    148   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  213    149   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  214    150   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  215    151   
                source: err.into(),
  216    152   
            }),
  217    153   
        }
  218    154   
    }
  219    155   
}
  220    156   
impl From<crate::operation::invoke_model::InvokeModelError> for Error {
  221    157   
    fn from(err: crate::operation::invoke_model::InvokeModelError) -> Self {
  222    158   
        match err {
  223    159   
            crate::operation::invoke_model::InvokeModelError::AccessDeniedException(inner) => Error::AccessDeniedException(inner),
  224    160   
            crate::operation::invoke_model::InvokeModelError::InternalServerException(inner) => Error::InternalServerException(inner),
  225    161   
            crate::operation::invoke_model::InvokeModelError::ModelErrorException(inner) => Error::ModelErrorException(inner),
  226    162   
            crate::operation::invoke_model::InvokeModelError::ModelNotReadyException(inner) => Error::ModelNotReadyException(inner),
  227    163   
            crate::operation::invoke_model::InvokeModelError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  228    164   
            crate::operation::invoke_model::InvokeModelError::ResourceNotFoundException(inner) => Error::ResourceNotFoundException(inner),
  229    165   
            crate::operation::invoke_model::InvokeModelError::ServiceQuotaExceededException(inner) => Error::ServiceQuotaExceededException(inner),
  230         -
            crate::operation::invoke_model::InvokeModelError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  231    166   
            crate::operation::invoke_model::InvokeModelError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  232    167   
            crate::operation::invoke_model::InvokeModelError::ValidationException(inner) => Error::ValidationException(inner),
  233    168   
            crate::operation::invoke_model::InvokeModelError::Unhandled(inner) => Error::Unhandled(inner),
  234    169   
        }
  235    170   
    }
  236    171   
}
  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         -
}
  304    172   
impl<R>
  305    173   
    From<
  306    174   
        ::aws_smithy_runtime_api::client::result::SdkError<
  307    175   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
  308    176   
            R,
  309    177   
        >,
  310    178   
    > for Error
  311    179   
where
  312    180   
    R: Send + Sync + std::fmt::Debug + 'static,
  313    181   
{
  314    182   
    fn from(
  315    183   
        err: ::aws_smithy_runtime_api::client::result::SdkError<
  316    184   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
  317    185   
            R,
  318    186   
        >,
  319    187   
    ) -> Self {
  320    188   
        match err {
  321    189   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  322    190   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  323    191   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  324    192   
                source: err.into(),
  325    193   
            }),
  326    194   
        }
  327    195   
    }
  328    196   
}
  329    197   
impl From<crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError> for Error {
  330    198   
    fn from(err: crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError) -> Self {
  331    199   
        match err {
  332    200   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelTimeoutException(inner) => {
  333    201   
                Error::ModelTimeoutException(inner)
  334    202   
            }
  335    203   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::AccessDeniedException(inner) => {
  336    204   
                Error::AccessDeniedException(inner)
  337    205   
            }
  338    206   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ResourceNotFoundException(inner) => {
  339    207   
                Error::ResourceNotFoundException(inner)
  340    208   
            }
  341    209   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ThrottlingException(inner) => {
  342    210   
                Error::ThrottlingException(inner)
  343    211   
            }
  344         -
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceUnavailableException(inner) => {
  345         -
                Error::ServiceUnavailableException(inner)
  346         -
            }
  347    212   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::InternalServerException(inner) => {
  348    213   
                Error::InternalServerException(inner)
  349    214   
            }
  350    215   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelStreamErrorException(inner) => {
  351    216   
                Error::ModelStreamErrorException(inner)
  352    217   
            }
  353    218   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ValidationException(inner) => {
  354    219   
                Error::ValidationException(inner)
  355    220   
            }
  356    221   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelNotReadyException(inner) => {
  357    222   
                Error::ModelNotReadyException(inner)
  358    223   
            }
  359    224   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ModelErrorException(inner) => {
  360    225   
                Error::ModelErrorException(inner)
  361    226   
            }
  362    227   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::ServiceQuotaExceededException(inner) => {
  363    228   
                Error::ServiceQuotaExceededException(inner)
  364    229   
            }
  365    230   
            crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
  366    231   
        }
  367    232   
    }
  368    233   
}
  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         -
}
  427    234   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>> for Error
  428    235   
where
  429    236   
    R: Send + Sync + std::fmt::Debug + 'static,
  430    237   
{
  431    238   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ConverseStreamOutputError, R>) -> Self {
  432    239   
        match err {
  433    240   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  434    241   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  435    242   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  436    243   
                source: err.into(),
  437    244   
            }),
  438    245   
        }
  439    246   
    }
  440    247   
}
  441    248   
impl From<crate::types::error::ConverseStreamOutputError> for Error {
  442    249   
    fn from(err: crate::types::error::ConverseStreamOutputError) -> Self {
  443    250   
        match err {
  444    251   
            crate::types::error::ConverseStreamOutputError::InternalServerException(inner) => Error::InternalServerException(inner),
  445    252   
            crate::types::error::ConverseStreamOutputError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
  446    253   
            crate::types::error::ConverseStreamOutputError::ValidationException(inner) => Error::ValidationException(inner),
  447    254   
            crate::types::error::ConverseStreamOutputError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  448         -
            crate::types::error::ConverseStreamOutputError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  449    255   
            crate::types::error::ConverseStreamOutputError::Unhandled(inner) => Error::Unhandled(inner),
  450    256   
        }
  451    257   
    }
  452    258   
}
  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         -
}
  507    259   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>> for Error
  508    260   
where
  509    261   
    R: Send + Sync + std::fmt::Debug + 'static,
  510    262   
{
  511    263   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::types::error::ResponseStreamError, R>) -> Self {
  512    264   
        match err {
  513    265   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
  514    266   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
  515    267   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
  516    268   
                source: err.into(),
  517    269   
            }),
  518    270   
        }
  519    271   
    }
  520    272   
}
  521    273   
impl From<crate::types::error::ResponseStreamError> for Error {
  522    274   
    fn from(err: crate::types::error::ResponseStreamError) -> Self {
  523    275   
        match err {
  524    276   
            crate::types::error::ResponseStreamError::InternalServerException(inner) => Error::InternalServerException(inner),
  525    277   
            crate::types::error::ResponseStreamError::ModelStreamErrorException(inner) => Error::ModelStreamErrorException(inner),
  526    278   
            crate::types::error::ResponseStreamError::ValidationException(inner) => Error::ValidationException(inner),
  527    279   
            crate::types::error::ResponseStreamError::ThrottlingException(inner) => Error::ThrottlingException(inner),
  528    280   
            crate::types::error::ResponseStreamError::ModelTimeoutException(inner) => Error::ModelTimeoutException(inner),
  529         -
            crate::types::error::ResponseStreamError::ServiceUnavailableException(inner) => Error::ServiceUnavailableException(inner),
  530    281   
            crate::types::error::ResponseStreamError::Unhandled(inner) => Error::Unhandled(inner),
  531    282   
        }
  532    283   
    }
  533    284   
}
  534    285   
impl ::std::error::Error for Error {
  535    286   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
  536    287   
        match self {
  537    288   
            Error::AccessDeniedException(inner) => inner.source(),
  538         -
            Error::ConflictException(inner) => inner.source(),
  539    289   
            Error::InternalServerException(inner) => inner.source(),
  540    290   
            Error::ModelErrorException(inner) => inner.source(),
  541    291   
            Error::ModelNotReadyException(inner) => inner.source(),
  542    292   
            Error::ModelStreamErrorException(inner) => inner.source(),
  543    293   
            Error::ModelTimeoutException(inner) => inner.source(),
  544    294   
            Error::ResourceNotFoundException(inner) => inner.source(),
  545    295   
            Error::ServiceQuotaExceededException(inner) => inner.source(),
  546         -
            Error::ServiceUnavailableException(inner) => inner.source(),
  547    296   
            Error::ThrottlingException(inner) => inner.source(),
  548    297   
            Error::ValidationException(inner) => inner.source(),
  549    298   
            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
  550    299   
        }
  551    300   
    }
  552    301   
}
  553    302   
impl ::aws_types::request_id::RequestId for Error {
  554    303   
    fn request_id(&self) -> Option<&str> {
  555    304   
        match self {
  556    305   
            Self::AccessDeniedException(e) => e.request_id(),
  557         -
            Self::ConflictException(e) => e.request_id(),
  558    306   
            Self::InternalServerException(e) => e.request_id(),
  559    307   
            Self::ModelErrorException(e) => e.request_id(),
  560    308   
            Self::ModelNotReadyException(e) => e.request_id(),
  561    309   
            Self::ModelStreamErrorException(e) => e.request_id(),
  562    310   
            Self::ModelTimeoutException(e) => e.request_id(),
  563    311   
            Self::ResourceNotFoundException(e) => e.request_id(),
  564    312   
            Self::ServiceQuotaExceededException(e) => e.request_id(),
  565         -
            Self::ServiceUnavailableException(e) => e.request_id(),
  566    313   
            Self::ThrottlingException(e) => e.request_id(),
  567    314   
            Self::ValidationException(e) => e.request_id(),
  568    315   
            Self::Unhandled(e) => e.meta.request_id(),
  569    316   
        }
  570    317   
    }
  571    318   
}

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

@@ -1,1 +89,31 @@
    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         -
   60      2   
#[non_exhaustive]
   61      3   
#[derive(Debug)]
   62      4   
pub struct ConverseStreamOutputUnmarshaller;
   63      5   
   64      6   
impl ConverseStreamOutputUnmarshaller {
   65      7   
    pub fn new() -> Self {
   66      8   
        ConverseStreamOutputUnmarshaller
   67      9   
    }
   68     10   
}
   69     11   
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for ConverseStreamOutputUnmarshaller {
@@ -174,116 +414,191 @@
  194    136   
                                    ::aws_smithy_eventstream::error::Error::unmarshalling(format!(
  195    137   
                                        "failed to unmarshall throttlingException: {}",
  196    138   
                                        err
  197    139   
                                    ))
  198    140   
                                })?;
  199    141   
                        builder.set_meta(Some(generic));
  200    142   
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  201    143   
                            crate::types::error::ConverseStreamOutputError::ThrottlingException(builder.build()),
  202    144   
                        ));
  203    145   
                    }
  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         -
                    }
  221    146   
                    _ => {}
  222    147   
                }
  223    148   
                Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  224    149   
                    crate::types::error::ConverseStreamOutputError::generic(generic),
  225    150   
                ))
  226    151   
            }
  227    152   
            value => {
  228    153   
                return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
  229    154   
                    "unrecognized :message-type: {}",
  230    155   
                    value
  231    156   
                )));
  232    157   
            }
  233    158   
        }
  234    159   
    }
  235    160   
}
  236    161   
  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         -
  385    162   
#[non_exhaustive]
  386    163   
#[derive(Debug)]
  387    164   
pub struct ResponseStreamUnmarshaller;
  388    165   
  389    166   
impl ResponseStreamUnmarshaller {
  390    167   
    pub fn new() -> Self {
  391    168   
        ResponseStreamUnmarshaller
  392    169   
    }
  393    170   
}
  394    171   
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for ResponseStreamUnmarshaller {
@@ -468,245 +529,289 @@
  488    265   
                            builder,
  489    266   
                        )
  490    267   
                        .map_err(|err| {
  491    268   
                            ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall modelTimeoutException: {}", err))
  492    269   
                        })?;
  493    270   
                        builder.set_meta(Some(generic));
  494    271   
                        return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  495    272   
                            crate::types::error::ResponseStreamError::ModelTimeoutException(builder.build()),
  496    273   
                        ));
  497    274   
                    }
  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         -
                    }
  515    275   
                    _ => {}
  516    276   
                }
  517    277   
                Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
  518    278   
                    crate::types::error::ResponseStreamError::generic(generic),
  519    279   
                ))
  520    280   
            }
  521    281   
            value => {
  522    282   
                return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
  523    283   
                    "unrecognized :message-type: {}",
  524    284   
                    value

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

@@ -1,0 +102,0 @@
    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

@@ -1,0 +17,0 @@
    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 +212,206 @@
  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 [`ApplyGuardrail`](crate::operation::apply_guardrail) operation has
  153         -
/// a [`Client::apply_guardrail`], function which returns a builder for that operation.
         152  +
/// For example, the [`Converse`](crate::operation::converse) operation has
         153  +
/// a [`Client::converse`], 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.apply_guardrail()
  159         -
///     .guardrail_identifier("example")
         158  +
/// let result = client.converse()
         159  +
///     .model_id("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         -
  191    189   
mod event_receiver;
  192    190   
  193         -
mod event_stream_serde;
  194         -
  195         -
mod idempotency_token;
  196         -
  197    191   
pub(crate) mod protocol_serde;
  198    192   
  199    193   
mod sdk_feature_tracker;
  200    194   
  201    195   
mod serialization_settings;
  202    196   
  203    197   
mod endpoint_lib;
  204    198   
  205         -
mod lens;
  206         -
  207    199   
mod serde_util;
  208    200   
         201  +
mod event_stream_serde;
         202  +
  209    203   
mod json_errors;
  210    204   
  211    205   
#[doc(inline)]
  212    206   
pub use client::Client;

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

@@ -1,1 +29,0 @@
    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         -
    7      4   
/// Types for the `Converse` operation.
    8      5   
pub mod converse;
    9      6   
   10      7   
/// Types for the `ConverseStream` operation.
   11      8   
pub mod converse_stream;
   12      9   
   13         -
/// Types for the `GetAsyncInvoke` operation.
   14         -
pub mod get_async_invoke;
   15         -
   16     10   
/// Types for the `InvokeModel` operation.
   17     11   
pub mod invoke_model;
   18     12   
   19         -
/// Types for the `InvokeModelWithBidirectionalStream` operation.
   20         -
pub mod invoke_model_with_bidirectional_stream;
   21         -
   22     13   
/// Types for the `InvokeModelWithResponseStream` operation.
   23     14   
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

@@ -1,0 +443,0 @@
    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;