AWS SDK

AWS SDK

rev. db10d8b7d1ddffb641e5651cb5b4c7c7d63bda6a (ignoring whitespace)

Files changed:

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_citations_content_block.rs

@@ -0,1 +0,88 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>A content block that contains both generated text and associated citation information. This block type is returned when document citations are enabled, providing traceability between the generated content and the source documents that informed the response.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct CitationsContentBlock {
           7  +
    /// <p>The generated content that is supported by the associated citations.</p>
           8  +
    pub content: ::std::option::Option<::std::vec::Vec<crate::types::CitationGeneratedContent>>,
           9  +
    /// <p>An array of citations that reference the source documents used to generate the associated content.</p>
          10  +
    pub citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
          11  +
}
          12  +
impl CitationsContentBlock {
          13  +
    /// <p>The generated content that is supported by the associated citations.</p>
          14  +
    ///
          15  +
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.content.is_none()`.
          16  +
    pub fn content(&self) -> &[crate::types::CitationGeneratedContent] {
          17  +
        self.content.as_deref().unwrap_or_default()
          18  +
    }
          19  +
    /// <p>An array of citations that reference the source documents used to generate the associated content.</p>
          20  +
    ///
          21  +
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.citations.is_none()`.
          22  +
    pub fn citations(&self) -> &[crate::types::Citation] {
          23  +
        self.citations.as_deref().unwrap_or_default()
          24  +
    }
          25  +
}
          26  +
impl CitationsContentBlock {
          27  +
    /// Creates a new builder-style object to manufacture [`CitationsContentBlock`](crate::types::CitationsContentBlock).
          28  +
    pub fn builder() -> crate::types::builders::CitationsContentBlockBuilder {
          29  +
        crate::types::builders::CitationsContentBlockBuilder::default()
          30  +
    }
          31  +
}
          32  +
          33  +
/// A builder for [`CitationsContentBlock`](crate::types::CitationsContentBlock).
          34  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          35  +
#[non_exhaustive]
          36  +
pub struct CitationsContentBlockBuilder {
          37  +
    pub(crate) content: ::std::option::Option<::std::vec::Vec<crate::types::CitationGeneratedContent>>,
          38  +
    pub(crate) citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
          39  +
}
          40  +
impl CitationsContentBlockBuilder {
          41  +
    /// Appends an item to `content`.
          42  +
    ///
          43  +
    /// To override the contents of this collection use [`set_content`](Self::set_content).
          44  +
    ///
          45  +
    /// <p>The generated content that is supported by the associated citations.</p>
          46  +
    pub fn content(mut self, input: crate::types::CitationGeneratedContent) -> Self {
          47  +
        let mut v = self.content.unwrap_or_default();
          48  +
        v.push(input);
          49  +
        self.content = ::std::option::Option::Some(v);
          50  +
        self
          51  +
    }
          52  +
    /// <p>The generated content that is supported by the associated citations.</p>
          53  +
    pub fn set_content(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CitationGeneratedContent>>) -> Self {
          54  +
        self.content = input;
          55  +
        self
          56  +
    }
          57  +
    /// <p>The generated content that is supported by the associated citations.</p>
          58  +
    pub fn get_content(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CitationGeneratedContent>> {
          59  +
        &self.content
          60  +
    }
          61  +
    /// Appends an item to `citations`.
          62  +
    ///
          63  +
    /// To override the contents of this collection use [`set_citations`](Self::set_citations).
          64  +
    ///
          65  +
    /// <p>An array of citations that reference the source documents used to generate the associated content.</p>
          66  +
    pub fn citations(mut self, input: crate::types::Citation) -> Self {
          67  +
        let mut v = self.citations.unwrap_or_default();
          68  +
        v.push(input);
          69  +
        self.citations = ::std::option::Option::Some(v);
          70  +
        self
          71  +
    }
          72  +
    /// <p>An array of citations that reference the source documents used to generate the associated content.</p>
          73  +
    pub fn set_citations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>) -> Self {
          74  +
        self.citations = input;
          75  +
        self
          76  +
    }
          77  +
    /// <p>An array of citations that reference the source documents used to generate the associated content.</p>
          78  +
    pub fn get_citations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Citation>> {
          79  +
        &self.citations
          80  +
    }
          81  +
    /// Consumes the builder and constructs a [`CitationsContentBlock`](crate::types::CitationsContentBlock).
          82  +
    pub fn build(self) -> crate::types::CitationsContentBlock {
          83  +
        crate::types::CitationsContentBlock {
          84  +
            content: self.content,
          85  +
            citations: self.citations,
          86  +
        }
          87  +
    }
          88  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_citations_delta.rs

@@ -0,1 +0,102 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>Contains incremental updates to citation information during streaming responses. This allows clients to build up citation data progressively as the response is generated.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct CitationsDelta {
           7  +
    /// <p>The title or identifier of the source document being cited.</p>
           8  +
    pub title: ::std::option::Option<::std::string::String>,
           9  +
    /// <p>The specific content from the source document that was referenced or cited in the generated response.</p>
          10  +
    pub source_content: ::std::option::Option<::std::vec::Vec<crate::types::CitationSourceContentDelta>>,
          11  +
    /// <p>Specifies the precise location within a source document where cited content can be found. This can include character-level positions, page numbers, or document chunks depending on the document type and indexing method.</p>
          12  +
    pub location: ::std::option::Option<crate::types::CitationLocation>,
          13  +
}
          14  +
impl CitationsDelta {
          15  +
    /// <p>The title or identifier of the source document being cited.</p>
          16  +
    pub fn title(&self) -> ::std::option::Option<&str> {
          17  +
        self.title.as_deref()
          18  +
    }
          19  +
    /// <p>The specific content from the source document that was referenced or cited in the generated response.</p>
          20  +
    ///
          21  +
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.source_content.is_none()`.
          22  +
    pub fn source_content(&self) -> &[crate::types::CitationSourceContentDelta] {
          23  +
        self.source_content.as_deref().unwrap_or_default()
          24  +
    }
          25  +
    /// <p>Specifies the precise location within a source document where cited content can be found. This can include character-level positions, page numbers, or document chunks depending on the document type and indexing method.</p>
          26  +
    pub fn location(&self) -> ::std::option::Option<&crate::types::CitationLocation> {
          27  +
        self.location.as_ref()
          28  +
    }
          29  +
}
          30  +
impl CitationsDelta {
          31  +
    /// Creates a new builder-style object to manufacture [`CitationsDelta`](crate::types::CitationsDelta).
          32  +
    pub fn builder() -> crate::types::builders::CitationsDeltaBuilder {
          33  +
        crate::types::builders::CitationsDeltaBuilder::default()
          34  +
    }
          35  +
}
          36  +
          37  +
/// A builder for [`CitationsDelta`](crate::types::CitationsDelta).
          38  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          39  +
#[non_exhaustive]
          40  +
pub struct CitationsDeltaBuilder {
          41  +
    pub(crate) title: ::std::option::Option<::std::string::String>,
          42  +
    pub(crate) source_content: ::std::option::Option<::std::vec::Vec<crate::types::CitationSourceContentDelta>>,
          43  +
    pub(crate) location: ::std::option::Option<crate::types::CitationLocation>,
          44  +
}
          45  +
impl CitationsDeltaBuilder {
          46  +
    /// <p>The title or identifier of the source document being cited.</p>
          47  +
    pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          48  +
        self.title = ::std::option::Option::Some(input.into());
          49  +
        self
          50  +
    }
          51  +
    /// <p>The title or identifier of the source document being cited.</p>
          52  +
    pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          53  +
        self.title = input;
          54  +
        self
          55  +
    }
          56  +
    /// <p>The title or identifier of the source document being cited.</p>
          57  +
    pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
          58  +
        &self.title
          59  +
    }
          60  +
    /// Appends an item to `source_content`.
          61  +
    ///
          62  +
    /// To override the contents of this collection use [`set_source_content`](Self::set_source_content).
          63  +
    ///
          64  +
    /// <p>The specific content from the source document that was referenced or cited in the generated response.</p>
          65  +
    pub fn source_content(mut self, input: crate::types::CitationSourceContentDelta) -> Self {
          66  +
        let mut v = self.source_content.unwrap_or_default();
          67  +
        v.push(input);
          68  +
        self.source_content = ::std::option::Option::Some(v);
          69  +
        self
          70  +
    }
          71  +
    /// <p>The specific content from the source document that was referenced or cited in the generated response.</p>
          72  +
    pub fn set_source_content(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CitationSourceContentDelta>>) -> Self {
          73  +
        self.source_content = input;
          74  +
        self
          75  +
    }
          76  +
    /// <p>The specific content from the source document that was referenced or cited in the generated response.</p>
          77  +
    pub fn get_source_content(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CitationSourceContentDelta>> {
          78  +
        &self.source_content
          79  +
    }
          80  +
    /// <p>Specifies the precise location within a source document where cited content can be found. This can include character-level positions, page numbers, or document chunks depending on the document type and indexing method.</p>
          81  +
    pub fn location(mut self, input: crate::types::CitationLocation) -> Self {
          82  +
        self.location = ::std::option::Option::Some(input);
          83  +
        self
          84  +
    }
          85  +
    /// <p>Specifies the precise location within a source document where cited content can be found. This can include character-level positions, page numbers, or document chunks depending on the document type and indexing method.</p>
          86  +
    pub fn set_location(mut self, input: ::std::option::Option<crate::types::CitationLocation>) -> Self {
          87  +
        self.location = input;
          88  +
        self
          89  +
    }
          90  +
    /// <p>Specifies the precise location within a source document where cited content can be found. This can include character-level positions, page numbers, or document chunks depending on the document type and indexing method.</p>
          91  +
    pub fn get_location(&self) -> &::std::option::Option<crate::types::CitationLocation> {
          92  +
        &self.location
          93  +
    }
          94  +
    /// Consumes the builder and constructs a [`CitationsDelta`](crate::types::CitationsDelta).
          95  +
    pub fn build(self) -> crate::types::CitationsDelta {
          96  +
        crate::types::CitationsDelta {
          97  +
            title: self.title,
          98  +
            source_content: self.source_content,
          99  +
            location: self.location,
         100  +
        }
         101  +
    }
         102  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_content_block.rs

@@ -1,1 +0,192 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3         -
/// <p>A block of content for a message.</p>
           3  +
/// <p>A block of content for a message that you pass to, or receive from, a model with the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> or <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> API operations.</p>
    4      4   
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
    6      6   
pub enum ContentBlock {
           7  +
    /// <p>CachePoint to include in the message.</p>
           8  +
    CachePoint(crate::types::CachePointBlock),
           9  +
    /// <p>A content block that contains both generated text and associated citation information, providing traceability between the response and source documents.</p>
          10  +
    CitationsContent(crate::types::CitationsContentBlock),
          11  +
    /// <p>A document to include in the message.</p>
          12  +
    Document(crate::types::DocumentBlock),
          13  +
    /// <p>Contains the content to assess with the guardrail. If you don't specify <code>guardContent</code> in a call to the Converse API, the guardrail (if passed in the Converse API) assesses the entire message.</p>
          14  +
    /// <p>For more information, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>.</p>
          15  +
    GuardContent(crate::types::GuardrailConverseContentBlock),
    7     16   
    /// <p>Image to include in the message.</p><note>
    8     17   
    /// <p>This field is only supported by Anthropic Claude 3 models.</p>
    9     18   
    /// </note>
   10     19   
    Image(crate::types::ImageBlock),
          20  +
    /// <p>Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.</p>
          21  +
    ReasoningContent(crate::types::ReasoningContentBlock),
   11     22   
    /// <p>Text to include in the message.</p>
   12     23   
    Text(::std::string::String),
   13     24   
    /// <p>The result for a tool request that a model makes.</p>
   14     25   
    ToolResult(crate::types::ToolResultBlock),
   15     26   
    /// <p>Information about a tool use request from a model.</p>
   16     27   
    ToolUse(crate::types::ToolUseBlock),
          28  +
    /// <p>Video to include in the message.</p>
          29  +
    Video(crate::types::VideoBlock),
   17     30   
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
   18     31   
    /// An unknown enum variant
   19     32   
    ///
   20     33   
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
   21     34   
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
   22     35   
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
   23     36   
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
   24     37   
    #[non_exhaustive]
   25     38   
    Unknown,
   26     39   
}
   27     40   
impl ContentBlock {
          41  +
    /// Tries to convert the enum instance into [`CachePoint`](crate::types::ContentBlock::CachePoint), extracting the inner [`CachePointBlock`](crate::types::CachePointBlock).
          42  +
    /// Returns `Err(&Self)` if it can't be converted.
          43  +
    pub fn as_cache_point(&self) -> ::std::result::Result<&crate::types::CachePointBlock, &Self> {
          44  +
        if let ContentBlock::CachePoint(val) = &self {
          45  +
            ::std::result::Result::Ok(val)
          46  +
        } else {
          47  +
            ::std::result::Result::Err(self)
          48  +
        }
          49  +
    }
          50  +
    /// Returns true if this is a [`CachePoint`](crate::types::ContentBlock::CachePoint).
          51  +
    pub fn is_cache_point(&self) -> bool {
          52  +
        self.as_cache_point().is_ok()
          53  +
    }
          54  +
    /// Tries to convert the enum instance into [`CitationsContent`](crate::types::ContentBlock::CitationsContent), extracting the inner [`CitationsContentBlock`](crate::types::CitationsContentBlock).
          55  +
    /// Returns `Err(&Self)` if it can't be converted.
          56  +
    pub fn as_citations_content(&self) -> ::std::result::Result<&crate::types::CitationsContentBlock, &Self> {
          57  +
        if let ContentBlock::CitationsContent(val) = &self {
          58  +
            ::std::result::Result::Ok(val)
          59  +
        } else {
          60  +
            ::std::result::Result::Err(self)
          61  +
        }
          62  +
    }
          63  +
    /// Returns true if this is a [`CitationsContent`](crate::types::ContentBlock::CitationsContent).
          64  +
    pub fn is_citations_content(&self) -> bool {
          65  +
        self.as_citations_content().is_ok()
          66  +
    }
          67  +
    /// Tries to convert the enum instance into [`Document`](crate::types::ContentBlock::Document), extracting the inner [`DocumentBlock`](crate::types::DocumentBlock).
          68  +
    /// Returns `Err(&Self)` if it can't be converted.
          69  +
    pub fn as_document(&self) -> ::std::result::Result<&crate::types::DocumentBlock, &Self> {
          70  +
        if let ContentBlock::Document(val) = &self {
          71  +
            ::std::result::Result::Ok(val)
          72  +
        } else {
          73  +
            ::std::result::Result::Err(self)
          74  +
        }
          75  +
    }
          76  +
    /// Returns true if this is a [`Document`](crate::types::ContentBlock::Document).
          77  +
    pub fn is_document(&self) -> bool {
          78  +
        self.as_document().is_ok()
          79  +
    }
          80  +
    /// Tries to convert the enum instance into [`GuardContent`](crate::types::ContentBlock::GuardContent), extracting the inner [`GuardrailConverseContentBlock`](crate::types::GuardrailConverseContentBlock).
          81  +
    /// Returns `Err(&Self)` if it can't be converted.
          82  +
    pub fn as_guard_content(&self) -> ::std::result::Result<&crate::types::GuardrailConverseContentBlock, &Self> {
          83  +
        if let ContentBlock::GuardContent(val) = &self {
          84  +
            ::std::result::Result::Ok(val)
          85  +
        } else {
          86  +
            ::std::result::Result::Err(self)
          87  +
        }
          88  +
    }
          89  +
    /// Returns true if this is a [`GuardContent`](crate::types::ContentBlock::GuardContent).
          90  +
    pub fn is_guard_content(&self) -> bool {
          91  +
        self.as_guard_content().is_ok()
          92  +
    }
   28     93   
    /// Tries to convert the enum instance into [`Image`](crate::types::ContentBlock::Image), extracting the inner [`ImageBlock`](crate::types::ImageBlock).
   29     94   
    /// Returns `Err(&Self)` if it can't be converted.
   30     95   
    pub fn as_image(&self) -> ::std::result::Result<&crate::types::ImageBlock, &Self> {
   31     96   
        if let ContentBlock::Image(val) = &self {
   32     97   
            ::std::result::Result::Ok(val)
   33     98   
        } else {
   34     99   
            ::std::result::Result::Err(self)
   35    100   
        }
   36    101   
    }
   37    102   
    /// Returns true if this is a [`Image`](crate::types::ContentBlock::Image).
   38    103   
    pub fn is_image(&self) -> bool {
   39    104   
        self.as_image().is_ok()
   40    105   
    }
         106  +
    /// Tries to convert the enum instance into [`ReasoningContent`](crate::types::ContentBlock::ReasoningContent), extracting the inner [`ReasoningContentBlock`](crate::types::ReasoningContentBlock).
         107  +
    /// Returns `Err(&Self)` if it can't be converted.
         108  +
    pub fn as_reasoning_content(&self) -> ::std::result::Result<&crate::types::ReasoningContentBlock, &Self> {
         109  +
        if let ContentBlock::ReasoningContent(val) = &self {
         110  +
            ::std::result::Result::Ok(val)
         111  +
        } else {
         112  +
            ::std::result::Result::Err(self)
         113  +
        }
         114  +
    }
         115  +
    /// Returns true if this is a [`ReasoningContent`](crate::types::ContentBlock::ReasoningContent).
         116  +
    pub fn is_reasoning_content(&self) -> bool {
         117  +
        self.as_reasoning_content().is_ok()
         118  +
    }
   41    119   
    /// Tries to convert the enum instance into [`Text`](crate::types::ContentBlock::Text), extracting the inner [`String`](::std::string::String).
   42    120   
    /// Returns `Err(&Self)` if it can't be converted.
   43    121   
    pub fn as_text(&self) -> ::std::result::Result<&::std::string::String, &Self> {
   44    122   
        if let ContentBlock::Text(val) = &self {
   45    123   
            ::std::result::Result::Ok(val)
   46    124   
        } else {
   47    125   
            ::std::result::Result::Err(self)
   48    126   
        }
   49    127   
    }
   50    128   
    /// Returns true if this is a [`Text`](crate::types::ContentBlock::Text).
   51    129   
    pub fn is_text(&self) -> bool {
   52    130   
        self.as_text().is_ok()
   53    131   
    }
   54    132   
    /// Tries to convert the enum instance into [`ToolResult`](crate::types::ContentBlock::ToolResult), extracting the inner [`ToolResultBlock`](crate::types::ToolResultBlock).
   55    133   
    /// Returns `Err(&Self)` if it can't be converted.
   56    134   
    pub fn as_tool_result(&self) -> ::std::result::Result<&crate::types::ToolResultBlock, &Self> {
   57    135   
        if let ContentBlock::ToolResult(val) = &self {
   58    136   
            ::std::result::Result::Ok(val)
   59    137   
        } else {
   60    138   
            ::std::result::Result::Err(self)
   61    139   
        }
   62    140   
    }
   63    141   
    /// Returns true if this is a [`ToolResult`](crate::types::ContentBlock::ToolResult).
   64    142   
    pub fn is_tool_result(&self) -> bool {
   65    143   
        self.as_tool_result().is_ok()
   66    144   
    }
   67    145   
    /// Tries to convert the enum instance into [`ToolUse`](crate::types::ContentBlock::ToolUse), extracting the inner [`ToolUseBlock`](crate::types::ToolUseBlock).
   68    146   
    /// Returns `Err(&Self)` if it can't be converted.
   69    147   
    pub fn as_tool_use(&self) -> ::std::result::Result<&crate::types::ToolUseBlock, &Self> {
   70    148   
        if let ContentBlock::ToolUse(val) = &self {
   71    149   
            ::std::result::Result::Ok(val)
   72    150   
        } else {
   73    151   
            ::std::result::Result::Err(self)
   74    152   
        }
   75    153   
    }
   76    154   
    /// Returns true if this is a [`ToolUse`](crate::types::ContentBlock::ToolUse).
   77    155   
    pub fn is_tool_use(&self) -> bool {
   78    156   
        self.as_tool_use().is_ok()
   79    157   
    }
         158  +
    /// Tries to convert the enum instance into [`Video`](crate::types::ContentBlock::Video), extracting the inner [`VideoBlock`](crate::types::VideoBlock).
         159  +
    /// Returns `Err(&Self)` if it can't be converted.
         160  +
    pub fn as_video(&self) -> ::std::result::Result<&crate::types::VideoBlock, &Self> {
         161  +
        if let ContentBlock::Video(val) = &self {
         162  +
            ::std::result::Result::Ok(val)
         163  +
        } else {
         164  +
            ::std::result::Result::Err(self)
         165  +
        }
         166  +
    }
         167  +
    /// Returns true if this is a [`Video`](crate::types::ContentBlock::Video).
         168  +
    pub fn is_video(&self) -> bool {
         169  +
        self.as_video().is_ok()
         170  +
    }
   80    171   
    /// Returns true if the enum instance is the `Unknown` variant.
   81    172   
    pub fn is_unknown(&self) -> bool {
   82    173   
        matches!(self, Self::Unknown)
   83    174   
    }
   84    175   
}
         176  +
impl ::std::fmt::Debug for ContentBlock {
         177  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         178  +
        match self {
         179  +
            ContentBlock::CachePoint(val) => f.debug_tuple("CachePoint").field(&val).finish(),
         180  +
            ContentBlock::CitationsContent(val) => f.debug_tuple("CitationsContent").field(&val).finish(),
         181  +
            ContentBlock::Document(val) => f.debug_tuple("Document").field(&val).finish(),
         182  +
            ContentBlock::GuardContent(val) => f.debug_tuple("GuardContent").field(&val).finish(),
         183  +
            ContentBlock::Image(val) => f.debug_tuple("Image").field(&val).finish(),
         184  +
            ContentBlock::ReasoningContent(_) => f.debug_tuple("*** Sensitive Data Redacted ***").finish(),
         185  +
            ContentBlock::Text(val) => f.debug_tuple("Text").field(&val).finish(),
         186  +
            ContentBlock::ToolResult(val) => f.debug_tuple("ToolResult").field(&val).finish(),
         187  +
            ContentBlock::ToolUse(val) => f.debug_tuple("ToolUse").field(&val).finish(),
         188  +
            ContentBlock::Video(val) => f.debug_tuple("Video").field(&val).finish(),
         189  +
            ContentBlock::Unknown => f.debug_tuple("Unknown").finish(),
         190  +
        }
         191  +
    }
         192  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_content_block_delta.rs

@@ -1,1 +0,93 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3         -
/// <p>A bock of content in a streaming response.</p>
           3  +
/// <p>A block of content in a streaming response.</p>
    4      4   
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
    6      6   
pub enum ContentBlockDelta {
           7  +
    /// <p>Incremental citation information that is streamed as part of the response generation process.</p>
           8  +
    Citation(crate::types::CitationsDelta),
           9  +
    /// <p>Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.</p>
          10  +
    ReasoningContent(crate::types::ReasoningContentBlockDelta),
    7     11   
    /// <p>The content text.</p>
    8     12   
    Text(::std::string::String),
    9     13   
    /// <p>Information about a tool that the model is requesting to use.</p>
   10     14   
    ToolUse(crate::types::ToolUseBlockDelta),
   11     15   
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
   12     16   
    /// An unknown enum variant
   13     17   
    ///
   14     18   
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
   15     19   
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
   16     20   
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
   17     21   
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
   18     22   
    #[non_exhaustive]
   19     23   
    Unknown,
   20     24   
}
   21     25   
impl ContentBlockDelta {
          26  +
    /// Tries to convert the enum instance into [`Citation`](crate::types::ContentBlockDelta::Citation), extracting the inner [`CitationsDelta`](crate::types::CitationsDelta).
          27  +
    /// Returns `Err(&Self)` if it can't be converted.
          28  +
    pub fn as_citation(&self) -> ::std::result::Result<&crate::types::CitationsDelta, &Self> {
          29  +
        if let ContentBlockDelta::Citation(val) = &self {
          30  +
            ::std::result::Result::Ok(val)
          31  +
        } else {
          32  +
            ::std::result::Result::Err(self)
          33  +
        }
          34  +
    }
          35  +
    /// Returns true if this is a [`Citation`](crate::types::ContentBlockDelta::Citation).
          36  +
    pub fn is_citation(&self) -> bool {
          37  +
        self.as_citation().is_ok()
          38  +
    }
          39  +
    /// Tries to convert the enum instance into [`ReasoningContent`](crate::types::ContentBlockDelta::ReasoningContent), extracting the inner [`ReasoningContentBlockDelta`](crate::types::ReasoningContentBlockDelta).
          40  +
    /// Returns `Err(&Self)` if it can't be converted.
          41  +
    pub fn as_reasoning_content(&self) -> ::std::result::Result<&crate::types::ReasoningContentBlockDelta, &Self> {
          42  +
        if let ContentBlockDelta::ReasoningContent(val) = &self {
          43  +
            ::std::result::Result::Ok(val)
          44  +
        } else {
          45  +
            ::std::result::Result::Err(self)
          46  +
        }
          47  +
    }
          48  +
    /// Returns true if this is a [`ReasoningContent`](crate::types::ContentBlockDelta::ReasoningContent).
          49  +
    pub fn is_reasoning_content(&self) -> bool {
          50  +
        self.as_reasoning_content().is_ok()
          51  +
    }
   22     52   
    /// Tries to convert the enum instance into [`Text`](crate::types::ContentBlockDelta::Text), extracting the inner [`String`](::std::string::String).
   23     53   
    /// Returns `Err(&Self)` if it can't be converted.
   24     54   
    pub fn as_text(&self) -> ::std::result::Result<&::std::string::String, &Self> {
   25     55   
        if let ContentBlockDelta::Text(val) = &self {
   26     56   
            ::std::result::Result::Ok(val)
   27     57   
        } else {
   28     58   
            ::std::result::Result::Err(self)
   29     59   
        }
   30     60   
    }
   31     61   
    /// Returns true if this is a [`Text`](crate::types::ContentBlockDelta::Text).
   32     62   
    pub fn is_text(&self) -> bool {
   33     63   
        self.as_text().is_ok()
   34     64   
    }
   35     65   
    /// Tries to convert the enum instance into [`ToolUse`](crate::types::ContentBlockDelta::ToolUse), extracting the inner [`ToolUseBlockDelta`](crate::types::ToolUseBlockDelta).
   36     66   
    /// Returns `Err(&Self)` if it can't be converted.
   37     67   
    pub fn as_tool_use(&self) -> ::std::result::Result<&crate::types::ToolUseBlockDelta, &Self> {
   38     68   
        if let ContentBlockDelta::ToolUse(val) = &self {
   39     69   
            ::std::result::Result::Ok(val)
   40     70   
        } else {
   41     71   
            ::std::result::Result::Err(self)
   42     72   
        }
   43     73   
    }
   44     74   
    /// Returns true if this is a [`ToolUse`](crate::types::ContentBlockDelta::ToolUse).
   45     75   
    pub fn is_tool_use(&self) -> bool {
   46     76   
        self.as_tool_use().is_ok()
   47     77   
    }
   48     78   
    /// Returns true if the enum instance is the `Unknown` variant.
   49     79   
    pub fn is_unknown(&self) -> bool {
   50     80   
        matches!(self, Self::Unknown)
   51     81   
    }
   52     82   
}
          83  +
impl ::std::fmt::Debug for ContentBlockDelta {
          84  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
          85  +
        match self {
          86  +
            ContentBlockDelta::Citation(val) => f.debug_tuple("Citation").field(&val).finish(),
          87  +
            ContentBlockDelta::ReasoningContent(_) => f.debug_tuple("*** Sensitive Data Redacted ***").finish(),
          88  +
            ContentBlockDelta::Text(val) => f.debug_tuple("Text").field(&val).finish(),
          89  +
            ContentBlockDelta::ToolUse(val) => f.debug_tuple("ToolUse").field(&val).finish(),
          90  +
            ContentBlockDelta::Unknown => f.debug_tuple("Unknown").finish(),
          91  +
        }
          92  +
    }
          93  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_converse_stream_metadata_event.rs

@@ -1,1 +74,118 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
/// <p>A conversation stream metadata event.</p>
    4      4   
#[non_exhaustive]
    5      5   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6      6   
pub struct ConverseStreamMetadataEvent {
    7      7   
    /// <p>Usage information for the conversation stream event.</p>
    8      8   
    pub usage: ::std::option::Option<crate::types::TokenUsage>,
    9      9   
    /// <p>The metrics for the conversation stream metadata event.</p>
   10     10   
    pub metrics: ::std::option::Option<crate::types::ConverseStreamMetrics>,
          11  +
    /// <p>The trace object in the response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> that contains information about the guardrail behavior.</p>
          12  +
    pub trace: ::std::option::Option<crate::types::ConverseStreamTrace>,
          13  +
    /// <p>Model performance configuration metadata for the conversation stream event.</p>
          14  +
    pub performance_config: ::std::option::Option<crate::types::PerformanceConfiguration>,
   11     15   
}
   12     16   
impl ConverseStreamMetadataEvent {
   13     17   
    /// <p>Usage information for the conversation stream event.</p>
   14     18   
    pub fn usage(&self) -> ::std::option::Option<&crate::types::TokenUsage> {
   15     19   
        self.usage.as_ref()
   16     20   
    }
   17     21   
    /// <p>The metrics for the conversation stream metadata event.</p>
   18     22   
    pub fn metrics(&self) -> ::std::option::Option<&crate::types::ConverseStreamMetrics> {
   19     23   
        self.metrics.as_ref()
   20     24   
    }
          25  +
    /// <p>The trace object in the response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> that contains information about the guardrail behavior.</p>
          26  +
    pub fn trace(&self) -> ::std::option::Option<&crate::types::ConverseStreamTrace> {
          27  +
        self.trace.as_ref()
          28  +
    }
          29  +
    /// <p>Model performance configuration metadata for the conversation stream event.</p>
          30  +
    pub fn performance_config(&self) -> ::std::option::Option<&crate::types::PerformanceConfiguration> {
          31  +
        self.performance_config.as_ref()
          32  +
    }
   21     33   
}
   22     34   
impl ConverseStreamMetadataEvent {
   23     35   
    /// Creates a new builder-style object to manufacture [`ConverseStreamMetadataEvent`](crate::types::ConverseStreamMetadataEvent).
   24     36   
    pub fn builder() -> crate::types::builders::ConverseStreamMetadataEventBuilder {
   25     37   
        crate::types::builders::ConverseStreamMetadataEventBuilder::default()
   26     38   
    }
   27     39   
}
   28     40   
   29     41   
/// A builder for [`ConverseStreamMetadataEvent`](crate::types::ConverseStreamMetadataEvent).
   30     42   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   31     43   
#[non_exhaustive]
   32     44   
pub struct ConverseStreamMetadataEventBuilder {
   33     45   
    pub(crate) usage: ::std::option::Option<crate::types::TokenUsage>,
   34     46   
    pub(crate) metrics: ::std::option::Option<crate::types::ConverseStreamMetrics>,
          47  +
    pub(crate) trace: ::std::option::Option<crate::types::ConverseStreamTrace>,
          48  +
    pub(crate) performance_config: ::std::option::Option<crate::types::PerformanceConfiguration>,
   35     49   
}
   36     50   
impl ConverseStreamMetadataEventBuilder {
   37     51   
    /// <p>Usage information for the conversation stream event.</p>
   38     52   
    /// This field is required.
   39     53   
    pub fn usage(mut self, input: crate::types::TokenUsage) -> Self {
   40     54   
        self.usage = ::std::option::Option::Some(input);
   41     55   
        self
   42     56   
    }
   43     57   
    /// <p>Usage information for the conversation stream event.</p>
   44     58   
    pub fn set_usage(mut self, input: ::std::option::Option<crate::types::TokenUsage>) -> Self {
   45     59   
        self.usage = input;
   46     60   
        self
   47     61   
    }
   48     62   
    /// <p>Usage information for the conversation stream event.</p>
   49     63   
    pub fn get_usage(&self) -> &::std::option::Option<crate::types::TokenUsage> {
   50     64   
        &self.usage
   51     65   
    }
   52     66   
    /// <p>The metrics for the conversation stream metadata event.</p>
   53     67   
    /// This field is required.
   54     68   
    pub fn metrics(mut self, input: crate::types::ConverseStreamMetrics) -> Self {
   55     69   
        self.metrics = ::std::option::Option::Some(input);
   56     70   
        self
   57     71   
    }
   58     72   
    /// <p>The metrics for the conversation stream metadata event.</p>
   59     73   
    pub fn set_metrics(mut self, input: ::std::option::Option<crate::types::ConverseStreamMetrics>) -> Self {
   60     74   
        self.metrics = input;
   61     75   
        self
   62     76   
    }
   63     77   
    /// <p>The metrics for the conversation stream metadata event.</p>
   64     78   
    pub fn get_metrics(&self) -> &::std::option::Option<crate::types::ConverseStreamMetrics> {
   65     79   
        &self.metrics
   66     80   
    }
          81  +
    /// <p>The trace object in the response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> that contains information about the guardrail behavior.</p>
          82  +
    pub fn trace(mut self, input: crate::types::ConverseStreamTrace) -> Self {
          83  +
        self.trace = ::std::option::Option::Some(input);
          84  +
        self
          85  +
    }
          86  +
    /// <p>The trace object in the response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> that contains information about the guardrail behavior.</p>
          87  +
    pub fn set_trace(mut self, input: ::std::option::Option<crate::types::ConverseStreamTrace>) -> Self {
          88  +
        self.trace = input;
          89  +
        self
          90  +
    }
          91  +
    /// <p>The trace object in the response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> that contains information about the guardrail behavior.</p>
          92  +
    pub fn get_trace(&self) -> &::std::option::Option<crate::types::ConverseStreamTrace> {
          93  +
        &self.trace
          94  +
    }
          95  +
    /// <p>Model performance configuration metadata for the conversation stream event.</p>
          96  +
    pub fn performance_config(mut self, input: crate::types::PerformanceConfiguration) -> Self {
          97  +
        self.performance_config = ::std::option::Option::Some(input);
          98  +
        self
          99  +
    }
         100  +
    /// <p>Model performance configuration metadata for the conversation stream event.</p>
         101  +
    pub fn set_performance_config(mut self, input: ::std::option::Option<crate::types::PerformanceConfiguration>) -> Self {
         102  +
        self.performance_config = input;
         103  +
        self
         104  +
    }
         105  +
    /// <p>Model performance configuration metadata for the conversation stream event.</p>
         106  +
    pub fn get_performance_config(&self) -> &::std::option::Option<crate::types::PerformanceConfiguration> {
         107  +
        &self.performance_config
         108  +
    }
   67    109   
    /// Consumes the builder and constructs a [`ConverseStreamMetadataEvent`](crate::types::ConverseStreamMetadataEvent).
   68    110   
    pub fn build(self) -> crate::types::ConverseStreamMetadataEvent {
   69    111   
        crate::types::ConverseStreamMetadataEvent {
   70    112   
            usage: self.usage,
   71    113   
            metrics: self.metrics,
         114  +
            trace: self.trace,
         115  +
            performance_config: self.performance_config,
   72    116   
        }
   73    117   
    }
   74    118   
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_converse_stream_trace.rs

@@ -0,1 +0,72 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>The trace object in a response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>. Currently, you can only trace guardrails.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct ConverseStreamTrace {
           7  +
    /// <p>The guardrail trace object.</p>
           8  +
    pub guardrail: ::std::option::Option<crate::types::GuardrailTraceAssessment>,
           9  +
    /// <p>The request's prompt router.</p>
          10  +
    pub prompt_router: ::std::option::Option<crate::types::PromptRouterTrace>,
          11  +
}
          12  +
impl ConverseStreamTrace {
          13  +
    /// <p>The guardrail trace object.</p>
          14  +
    pub fn guardrail(&self) -> ::std::option::Option<&crate::types::GuardrailTraceAssessment> {
          15  +
        self.guardrail.as_ref()
          16  +
    }
          17  +
    /// <p>The request's prompt router.</p>
          18  +
    pub fn prompt_router(&self) -> ::std::option::Option<&crate::types::PromptRouterTrace> {
          19  +
        self.prompt_router.as_ref()
          20  +
    }
          21  +
}
          22  +
impl ConverseStreamTrace {
          23  +
    /// Creates a new builder-style object to manufacture [`ConverseStreamTrace`](crate::types::ConverseStreamTrace).
          24  +
    pub fn builder() -> crate::types::builders::ConverseStreamTraceBuilder {
          25  +
        crate::types::builders::ConverseStreamTraceBuilder::default()
          26  +
    }
          27  +
}
          28  +
          29  +
/// A builder for [`ConverseStreamTrace`](crate::types::ConverseStreamTrace).
          30  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          31  +
#[non_exhaustive]
          32  +
pub struct ConverseStreamTraceBuilder {
          33  +
    pub(crate) guardrail: ::std::option::Option<crate::types::GuardrailTraceAssessment>,
          34  +
    pub(crate) prompt_router: ::std::option::Option<crate::types::PromptRouterTrace>,
          35  +
}
          36  +
impl ConverseStreamTraceBuilder {
          37  +
    /// <p>The guardrail trace object.</p>
          38  +
    pub fn guardrail(mut self, input: crate::types::GuardrailTraceAssessment) -> Self {
          39  +
        self.guardrail = ::std::option::Option::Some(input);
          40  +
        self
          41  +
    }
          42  +
    /// <p>The guardrail trace object.</p>
          43  +
    pub fn set_guardrail(mut self, input: ::std::option::Option<crate::types::GuardrailTraceAssessment>) -> Self {
          44  +
        self.guardrail = input;
          45  +
        self
          46  +
    }
          47  +
    /// <p>The guardrail trace object.</p>
          48  +
    pub fn get_guardrail(&self) -> &::std::option::Option<crate::types::GuardrailTraceAssessment> {
          49  +
        &self.guardrail
          50  +
    }
          51  +
    /// <p>The request's prompt router.</p>
          52  +
    pub fn prompt_router(mut self, input: crate::types::PromptRouterTrace) -> Self {
          53  +
        self.prompt_router = ::std::option::Option::Some(input);
          54  +
        self
          55  +
    }
          56  +
    /// <p>The request's prompt router.</p>
          57  +
    pub fn set_prompt_router(mut self, input: ::std::option::Option<crate::types::PromptRouterTrace>) -> Self {
          58  +
        self.prompt_router = input;
          59  +
        self
          60  +
    }
          61  +
    /// <p>The request's prompt router.</p>
          62  +
    pub fn get_prompt_router(&self) -> &::std::option::Option<crate::types::PromptRouterTrace> {
          63  +
        &self.prompt_router
          64  +
    }
          65  +
    /// Consumes the builder and constructs a [`ConverseStreamTrace`](crate::types::ConverseStreamTrace).
          66  +
    pub fn build(self) -> crate::types::ConverseStreamTrace {
          67  +
        crate::types::ConverseStreamTrace {
          68  +
            guardrail: self.guardrail,
          69  +
            prompt_router: self.prompt_router,
          70  +
        }
          71  +
    }
          72  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_converse_trace.rs

@@ -0,1 +0,72 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>The trace object in a response from <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a>. Currently, you can only trace guardrails.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct ConverseTrace {
           7  +
    /// <p>The guardrail trace object.</p>
           8  +
    pub guardrail: ::std::option::Option<crate::types::GuardrailTraceAssessment>,
           9  +
    /// <p>The request's prompt router.</p>
          10  +
    pub prompt_router: ::std::option::Option<crate::types::PromptRouterTrace>,
          11  +
}
          12  +
impl ConverseTrace {
          13  +
    /// <p>The guardrail trace object.</p>
          14  +
    pub fn guardrail(&self) -> ::std::option::Option<&crate::types::GuardrailTraceAssessment> {
          15  +
        self.guardrail.as_ref()
          16  +
    }
          17  +
    /// <p>The request's prompt router.</p>
          18  +
    pub fn prompt_router(&self) -> ::std::option::Option<&crate::types::PromptRouterTrace> {
          19  +
        self.prompt_router.as_ref()
          20  +
    }
          21  +
}
          22  +
impl ConverseTrace {
          23  +
    /// Creates a new builder-style object to manufacture [`ConverseTrace`](crate::types::ConverseTrace).
          24  +
    pub fn builder() -> crate::types::builders::ConverseTraceBuilder {
          25  +
        crate::types::builders::ConverseTraceBuilder::default()
          26  +
    }
          27  +
}
          28  +
          29  +
/// A builder for [`ConverseTrace`](crate::types::ConverseTrace).
          30  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          31  +
#[non_exhaustive]
          32  +
pub struct ConverseTraceBuilder {
          33  +
    pub(crate) guardrail: ::std::option::Option<crate::types::GuardrailTraceAssessment>,
          34  +
    pub(crate) prompt_router: ::std::option::Option<crate::types::PromptRouterTrace>,
          35  +
}
          36  +
impl ConverseTraceBuilder {
          37  +
    /// <p>The guardrail trace object.</p>
          38  +
    pub fn guardrail(mut self, input: crate::types::GuardrailTraceAssessment) -> Self {
          39  +
        self.guardrail = ::std::option::Option::Some(input);
          40  +
        self
          41  +
    }
          42  +
    /// <p>The guardrail trace object.</p>
          43  +
    pub fn set_guardrail(mut self, input: ::std::option::Option<crate::types::GuardrailTraceAssessment>) -> Self {
          44  +
        self.guardrail = input;
          45  +
        self
          46  +
    }
          47  +
    /// <p>The guardrail trace object.</p>
          48  +
    pub fn get_guardrail(&self) -> &::std::option::Option<crate::types::GuardrailTraceAssessment> {
          49  +
        &self.guardrail
          50  +
    }
          51  +
    /// <p>The request's prompt router.</p>
          52  +
    pub fn prompt_router(mut self, input: crate::types::PromptRouterTrace) -> Self {
          53  +
        self.prompt_router = ::std::option::Option::Some(input);
          54  +
        self
          55  +
    }
          56  +
    /// <p>The request's prompt router.</p>
          57  +
    pub fn set_prompt_router(mut self, input: ::std::option::Option<crate::types::PromptRouterTrace>) -> Self {
          58  +
        self.prompt_router = input;
          59  +
        self
          60  +
    }
          61  +
    /// <p>The request's prompt router.</p>
          62  +
    pub fn get_prompt_router(&self) -> &::std::option::Option<crate::types::PromptRouterTrace> {
          63  +
        &self.prompt_router
          64  +
    }
          65  +
    /// Consumes the builder and constructs a [`ConverseTrace`](crate::types::ConverseTrace).
          66  +
    pub fn build(self) -> crate::types::ConverseTrace {
          67  +
        crate::types::ConverseTrace {
          68  +
            guardrail: self.guardrail,
          69  +
            prompt_router: self.prompt_router,
          70  +
        }
          71  +
    }
          72  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_document_block.rs

@@ -0,1 +0,220 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>A document to include in a message.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct DocumentBlock {
           7  +
    /// <p>The format of a document, or its extension.</p>
           8  +
    pub format: crate::types::DocumentFormat,
           9  +
    /// <p>A name for the document. The name can only contain the following characters:</p>
          10  +
    /// <ul>
          11  +
    /// <li>
          12  +
    /// <p>Alphanumeric characters</p></li>
          13  +
    /// <li>
          14  +
    /// <p>Whitespace characters (no more than one in a row)</p></li>
          15  +
    /// <li>
          16  +
    /// <p>Hyphens</p></li>
          17  +
    /// <li>
          18  +
    /// <p>Parentheses</p></li>
          19  +
    /// <li>
          20  +
    /// <p>Square brackets</p></li>
          21  +
    /// </ul><note>
          22  +
    /// <p>This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.</p>
          23  +
    /// </note>
          24  +
    pub name: ::std::string::String,
          25  +
    /// <p>Contains the content of the document.</p>
          26  +
    pub source: ::std::option::Option<crate::types::DocumentSource>,
          27  +
    /// <p>Contextual information about how the document should be processed or interpreted by the model when generating citations.</p>
          28  +
    pub context: ::std::option::Option<::std::string::String>,
          29  +
    /// <p>Configuration settings that control how citations should be generated for this specific document.</p>
          30  +
    pub citations: ::std::option::Option<crate::types::CitationsConfig>,
          31  +
}
          32  +
impl DocumentBlock {
          33  +
    /// <p>The format of a document, or its extension.</p>
          34  +
    pub fn format(&self) -> &crate::types::DocumentFormat {
          35  +
        &self.format
          36  +
    }
          37  +
    /// <p>A name for the document. The name can only contain the following characters:</p>
          38  +
    /// <ul>
          39  +
    /// <li>
          40  +
    /// <p>Alphanumeric characters</p></li>
          41  +
    /// <li>
          42  +
    /// <p>Whitespace characters (no more than one in a row)</p></li>
          43  +
    /// <li>
          44  +
    /// <p>Hyphens</p></li>
          45  +
    /// <li>
          46  +
    /// <p>Parentheses</p></li>
          47  +
    /// <li>
          48  +
    /// <p>Square brackets</p></li>
          49  +
    /// </ul><note>
          50  +
    /// <p>This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.</p>
          51  +
    /// </note>
          52  +
    pub fn name(&self) -> &str {
          53  +
        use std::ops::Deref;
          54  +
        self.name.deref()
          55  +
    }
          56  +
    /// <p>Contains the content of the document.</p>
          57  +
    pub fn source(&self) -> ::std::option::Option<&crate::types::DocumentSource> {
          58  +
        self.source.as_ref()
          59  +
    }
          60  +
    /// <p>Contextual information about how the document should be processed or interpreted by the model when generating citations.</p>
          61  +
    pub fn context(&self) -> ::std::option::Option<&str> {
          62  +
        self.context.as_deref()
          63  +
    }
          64  +
    /// <p>Configuration settings that control how citations should be generated for this specific document.</p>
          65  +
    pub fn citations(&self) -> ::std::option::Option<&crate::types::CitationsConfig> {
          66  +
        self.citations.as_ref()
          67  +
    }
          68  +
}
          69  +
impl DocumentBlock {
          70  +
    /// Creates a new builder-style object to manufacture [`DocumentBlock`](crate::types::DocumentBlock).
          71  +
    pub fn builder() -> crate::types::builders::DocumentBlockBuilder {
          72  +
        crate::types::builders::DocumentBlockBuilder::default()
          73  +
    }
          74  +
}
          75  +
          76  +
/// A builder for [`DocumentBlock`](crate::types::DocumentBlock).
          77  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          78  +
#[non_exhaustive]
          79  +
pub struct DocumentBlockBuilder {
          80  +
    pub(crate) format: ::std::option::Option<crate::types::DocumentFormat>,
          81  +
    pub(crate) name: ::std::option::Option<::std::string::String>,
          82  +
    pub(crate) source: ::std::option::Option<crate::types::DocumentSource>,
          83  +
    pub(crate) context: ::std::option::Option<::std::string::String>,
          84  +
    pub(crate) citations: ::std::option::Option<crate::types::CitationsConfig>,
          85  +
}
          86  +
impl DocumentBlockBuilder {
          87  +
    /// <p>The format of a document, or its extension.</p>
          88  +
    pub fn format(mut self, input: crate::types::DocumentFormat) -> Self {
          89  +
        self.format = ::std::option::Option::Some(input);
          90  +
        self
          91  +
    }
          92  +
    /// <p>The format of a document, or its extension.</p>
          93  +
    pub fn set_format(mut self, input: ::std::option::Option<crate::types::DocumentFormat>) -> Self {
          94  +
        self.format = input;
          95  +
        self
          96  +
    }
          97  +
    /// <p>The format of a document, or its extension.</p>
          98  +
    pub fn get_format(&self) -> &::std::option::Option<crate::types::DocumentFormat> {
          99  +
        &self.format
         100  +
    }
         101  +
    /// <p>A name for the document. The name can only contain the following characters:</p>
         102  +
    /// <ul>
         103  +
    /// <li>
         104  +
    /// <p>Alphanumeric characters</p></li>
         105  +
    /// <li>
         106  +
    /// <p>Whitespace characters (no more than one in a row)</p></li>
         107  +
    /// <li>
         108  +
    /// <p>Hyphens</p></li>
         109  +
    /// <li>
         110  +
    /// <p>Parentheses</p></li>
         111  +
    /// <li>
         112  +
    /// <p>Square brackets</p></li>
         113  +
    /// </ul><note>
         114  +
    /// <p>This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.</p>
         115  +
    /// </note>
         116  +
    /// This field is required.
         117  +
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
         118  +
        self.name = ::std::option::Option::Some(input.into());
         119  +
        self
         120  +
    }
         121  +
    /// <p>A name for the document. The name can only contain the following characters:</p>
         122  +
    /// <ul>
         123  +
    /// <li>
         124  +
    /// <p>Alphanumeric characters</p></li>
         125  +
    /// <li>
         126  +
    /// <p>Whitespace characters (no more than one in a row)</p></li>
         127  +
    /// <li>
         128  +
    /// <p>Hyphens</p></li>
         129  +
    /// <li>
         130  +
    /// <p>Parentheses</p></li>
         131  +
    /// <li>
         132  +
    /// <p>Square brackets</p></li>
         133  +
    /// </ul><note>
         134  +
    /// <p>This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.</p>
         135  +
    /// </note>
         136  +
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         137  +
        self.name = input;
         138  +
        self
         139  +
    }
         140  +
    /// <p>A name for the document. The name can only contain the following characters:</p>
         141  +
    /// <ul>
         142  +
    /// <li>
         143  +
    /// <p>Alphanumeric characters</p></li>
         144  +
    /// <li>
         145  +
    /// <p>Whitespace characters (no more than one in a row)</p></li>
         146  +
    /// <li>
         147  +
    /// <p>Hyphens</p></li>
         148  +
    /// <li>
         149  +
    /// <p>Parentheses</p></li>
         150  +
    /// <li>
         151  +
    /// <p>Square brackets</p></li>
         152  +
    /// </ul><note>
         153  +
    /// <p>This field is vulnerable to prompt injections, because the model might inadvertently interpret it as instructions. Therefore, we recommend that you specify a neutral name.</p>
         154  +
    /// </note>
         155  +
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
         156  +
        &self.name
         157  +
    }
         158  +
    /// <p>Contains the content of the document.</p>
         159  +
    /// This field is required.
         160  +
    pub fn source(mut self, input: crate::types::DocumentSource) -> Self {
         161  +
        self.source = ::std::option::Option::Some(input);
         162  +
        self
         163  +
    }
         164  +
    /// <p>Contains the content of the document.</p>
         165  +
    pub fn set_source(mut self, input: ::std::option::Option<crate::types::DocumentSource>) -> Self {
         166  +
        self.source = input;
         167  +
        self
         168  +
    }
         169  +
    /// <p>Contains the content of the document.</p>
         170  +
    pub fn get_source(&self) -> &::std::option::Option<crate::types::DocumentSource> {
         171  +
        &self.source
         172  +
    }
         173  +
    /// <p>Contextual information about how the document should be processed or interpreted by the model when generating citations.</p>
         174  +
    pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
         175  +
        self.context = ::std::option::Option::Some(input.into());
         176  +
        self
         177  +
    }
         178  +
    /// <p>Contextual information about how the document should be processed or interpreted by the model when generating citations.</p>
         179  +
    pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         180  +
        self.context = input;
         181  +
        self
         182  +
    }
         183  +
    /// <p>Contextual information about how the document should be processed or interpreted by the model when generating citations.</p>
         184  +
    pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
         185  +
        &self.context
         186  +
    }
         187  +
    /// <p>Configuration settings that control how citations should be generated for this specific document.</p>
         188  +
    pub fn citations(mut self, input: crate::types::CitationsConfig) -> Self {
         189  +
        self.citations = ::std::option::Option::Some(input);
         190  +
        self
         191  +
    }
         192  +
    /// <p>Configuration settings that control how citations should be generated for this specific document.</p>
         193  +
    pub fn set_citations(mut self, input: ::std::option::Option<crate::types::CitationsConfig>) -> Self {
         194  +
        self.citations = input;
         195  +
        self
         196  +
    }
         197  +
    /// <p>Configuration settings that control how citations should be generated for this specific document.</p>
         198  +
    pub fn get_citations(&self) -> &::std::option::Option<crate::types::CitationsConfig> {
         199  +
        &self.citations
         200  +
    }
         201  +
    /// Consumes the builder and constructs a [`DocumentBlock`](crate::types::DocumentBlock).
         202  +
    /// This method will fail if any of the following fields are not set:
         203  +
    /// - [`name`](crate::types::builders::DocumentBlockBuilder::name)
         204  +
    pub fn build(self) -> ::std::result::Result<crate::types::DocumentBlock, ::aws_smithy_types::error::operation::BuildError> {
         205  +
        ::std::result::Result::Ok(crate::types::DocumentBlock {
         206  +
            format: self
         207  +
                .format
         208  +
                .unwrap_or("txt".parse::<crate::types::DocumentFormat>().expect("static value validated to member")),
         209  +
            name: self.name.ok_or_else(|| {
         210  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
         211  +
                    "name",
         212  +
                    "name was not specified but it is required when building DocumentBlock",
         213  +
                )
         214  +
            })?,
         215  +
            source: self.source,
         216  +
            context: self.context,
         217  +
            citations: self.citations,
         218  +
        })
         219  +
    }
         220  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_document_char_location.rs

@@ -0,1 +0,94 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>Specifies a character-level location within a document, providing precise positioning information for cited content using start and end character indices.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct DocumentCharLocation {
           7  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
           8  +
    pub document_index: ::std::option::Option<i32>,
           9  +
    /// <p>The starting character position of the cited content within the document.</p>
          10  +
    pub start: ::std::option::Option<i32>,
          11  +
    /// <p>The ending character position of the cited content within the document.</p>
          12  +
    pub end: ::std::option::Option<i32>,
          13  +
}
          14  +
impl DocumentCharLocation {
          15  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          16  +
    pub fn document_index(&self) -> ::std::option::Option<i32> {
          17  +
        self.document_index
          18  +
    }
          19  +
    /// <p>The starting character position of the cited content within the document.</p>
          20  +
    pub fn start(&self) -> ::std::option::Option<i32> {
          21  +
        self.start
          22  +
    }
          23  +
    /// <p>The ending character position of the cited content within the document.</p>
          24  +
    pub fn end(&self) -> ::std::option::Option<i32> {
          25  +
        self.end
          26  +
    }
          27  +
}
          28  +
impl DocumentCharLocation {
          29  +
    /// Creates a new builder-style object to manufacture [`DocumentCharLocation`](crate::types::DocumentCharLocation).
          30  +
    pub fn builder() -> crate::types::builders::DocumentCharLocationBuilder {
          31  +
        crate::types::builders::DocumentCharLocationBuilder::default()
          32  +
    }
          33  +
}
          34  +
          35  +
/// A builder for [`DocumentCharLocation`](crate::types::DocumentCharLocation).
          36  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          37  +
#[non_exhaustive]
          38  +
pub struct DocumentCharLocationBuilder {
          39  +
    pub(crate) document_index: ::std::option::Option<i32>,
          40  +
    pub(crate) start: ::std::option::Option<i32>,
          41  +
    pub(crate) end: ::std::option::Option<i32>,
          42  +
}
          43  +
impl DocumentCharLocationBuilder {
          44  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          45  +
    pub fn document_index(mut self, input: i32) -> Self {
          46  +
        self.document_index = ::std::option::Option::Some(input);
          47  +
        self
          48  +
    }
          49  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          50  +
    pub fn set_document_index(mut self, input: ::std::option::Option<i32>) -> Self {
          51  +
        self.document_index = input;
          52  +
        self
          53  +
    }
          54  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          55  +
    pub fn get_document_index(&self) -> &::std::option::Option<i32> {
          56  +
        &self.document_index
          57  +
    }
          58  +
    /// <p>The starting character position of the cited content within the document.</p>
          59  +
    pub fn start(mut self, input: i32) -> Self {
          60  +
        self.start = ::std::option::Option::Some(input);
          61  +
        self
          62  +
    }
          63  +
    /// <p>The starting character position of the cited content within the document.</p>
          64  +
    pub fn set_start(mut self, input: ::std::option::Option<i32>) -> Self {
          65  +
        self.start = input;
          66  +
        self
          67  +
    }
          68  +
    /// <p>The starting character position of the cited content within the document.</p>
          69  +
    pub fn get_start(&self) -> &::std::option::Option<i32> {
          70  +
        &self.start
          71  +
    }
          72  +
    /// <p>The ending character position of the cited content within the document.</p>
          73  +
    pub fn end(mut self, input: i32) -> Self {
          74  +
        self.end = ::std::option::Option::Some(input);
          75  +
        self
          76  +
    }
          77  +
    /// <p>The ending character position of the cited content within the document.</p>
          78  +
    pub fn set_end(mut self, input: ::std::option::Option<i32>) -> Self {
          79  +
        self.end = input;
          80  +
        self
          81  +
    }
          82  +
    /// <p>The ending character position of the cited content within the document.</p>
          83  +
    pub fn get_end(&self) -> &::std::option::Option<i32> {
          84  +
        &self.end
          85  +
    }
          86  +
    /// Consumes the builder and constructs a [`DocumentCharLocation`](crate::types::DocumentCharLocation).
          87  +
    pub fn build(self) -> crate::types::DocumentCharLocation {
          88  +
        crate::types::DocumentCharLocation {
          89  +
            document_index: self.document_index,
          90  +
            start: self.start,
          91  +
            end: self.end,
          92  +
        }
          93  +
    }
          94  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_document_chunk_location.rs

@@ -0,1 +0,94 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>Specifies a chunk-level location within a document, providing positioning information for cited content using logical document segments or chunks.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct DocumentChunkLocation {
           7  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
           8  +
    pub document_index: ::std::option::Option<i32>,
           9  +
    /// <p>The starting chunk identifier or index of the cited content within the document.</p>
          10  +
    pub start: ::std::option::Option<i32>,
          11  +
    /// <p>The ending chunk identifier or index of the cited content within the document.</p>
          12  +
    pub end: ::std::option::Option<i32>,
          13  +
}
          14  +
impl DocumentChunkLocation {
          15  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          16  +
    pub fn document_index(&self) -> ::std::option::Option<i32> {
          17  +
        self.document_index
          18  +
    }
          19  +
    /// <p>The starting chunk identifier or index of the cited content within the document.</p>
          20  +
    pub fn start(&self) -> ::std::option::Option<i32> {
          21  +
        self.start
          22  +
    }
          23  +
    /// <p>The ending chunk identifier or index of the cited content within the document.</p>
          24  +
    pub fn end(&self) -> ::std::option::Option<i32> {
          25  +
        self.end
          26  +
    }
          27  +
}
          28  +
impl DocumentChunkLocation {
          29  +
    /// Creates a new builder-style object to manufacture [`DocumentChunkLocation`](crate::types::DocumentChunkLocation).
          30  +
    pub fn builder() -> crate::types::builders::DocumentChunkLocationBuilder {
          31  +
        crate::types::builders::DocumentChunkLocationBuilder::default()
          32  +
    }
          33  +
}
          34  +
          35  +
/// A builder for [`DocumentChunkLocation`](crate::types::DocumentChunkLocation).
          36  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          37  +
#[non_exhaustive]
          38  +
pub struct DocumentChunkLocationBuilder {
          39  +
    pub(crate) document_index: ::std::option::Option<i32>,
          40  +
    pub(crate) start: ::std::option::Option<i32>,
          41  +
    pub(crate) end: ::std::option::Option<i32>,
          42  +
}
          43  +
impl DocumentChunkLocationBuilder {
          44  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          45  +
    pub fn document_index(mut self, input: i32) -> Self {
          46  +
        self.document_index = ::std::option::Option::Some(input);
          47  +
        self
          48  +
    }
          49  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          50  +
    pub fn set_document_index(mut self, input: ::std::option::Option<i32>) -> Self {
          51  +
        self.document_index = input;
          52  +
        self
          53  +
    }
          54  +
    /// <p>The index of the document within the array of documents provided in the request.</p>
          55  +
    pub fn get_document_index(&self) -> &::std::option::Option<i32> {
          56  +
        &self.document_index
          57  +
    }
          58  +
    /// <p>The starting chunk identifier or index of the cited content within the document.</p>
          59  +
    pub fn start(mut self, input: i32) -> Self {
          60  +
        self.start = ::std::option::Option::Some(input);
          61  +
        self
          62  +
    }
          63  +
    /// <p>The starting chunk identifier or index of the cited content within the document.</p>
          64  +
    pub fn set_start(mut self, input: ::std::option::Option<i32>) -> Self {
          65  +
        self.start = input;
          66  +
        self
          67  +
    }
          68  +
    /// <p>The starting chunk identifier or index of the cited content within the document.</p>
          69  +
    pub fn get_start(&self) -> &::std::option::Option<i32> {
          70  +
        &self.start
          71  +
    }
          72  +
    /// <p>The ending chunk identifier or index of the cited content within the document.</p>
          73  +
    pub fn end(mut self, input: i32) -> Self {
          74  +
        self.end = ::std::option::Option::Some(input);
          75  +
        self
          76  +
    }
          77  +
    /// <p>The ending chunk identifier or index of the cited content within the document.</p>
          78  +
    pub fn set_end(mut self, input: ::std::option::Option<i32>) -> Self {
          79  +
        self.end = input;
          80  +
        self
          81  +
    }
          82  +
    /// <p>The ending chunk identifier or index of the cited content within the document.</p>
          83  +
    pub fn get_end(&self) -> &::std::option::Option<i32> {
          84  +
        &self.end
          85  +
    }
          86  +
    /// Consumes the builder and constructs a [`DocumentChunkLocation`](crate::types::DocumentChunkLocation).
          87  +
    pub fn build(self) -> crate::types::DocumentChunkLocation {
          88  +
        crate::types::DocumentChunkLocation {
          89  +
            document_index: self.document_index,
          90  +
            start: self.start,
          91  +
            end: self.end,
          92  +
        }
          93  +
    }
          94  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_document_content_block.rs

@@ -0,1 +0,38 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>Contains the actual content of a document that can be processed by the model and potentially cited in the response.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub enum DocumentContentBlock {
           7  +
    /// <p>The text content of the document.</p>
           8  +
    Text(::std::string::String),
           9  +
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          10  +
    /// An unknown enum variant
          11  +
    ///
          12  +
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          13  +
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          14  +
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          15  +
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          16  +
    #[non_exhaustive]
          17  +
    Unknown,
          18  +
}
          19  +
impl DocumentContentBlock {
          20  +
    #[allow(irrefutable_let_patterns)]
          21  +
    /// Tries to convert the enum instance into [`Text`](crate::types::DocumentContentBlock::Text), extracting the inner [`String`](::std::string::String).
          22  +
    /// Returns `Err(&Self)` if it can't be converted.
          23  +
    pub fn as_text(&self) -> ::std::result::Result<&::std::string::String, &Self> {
          24  +
        if let DocumentContentBlock::Text(val) = &self {
          25  +
            ::std::result::Result::Ok(val)
          26  +
        } else {
          27  +
            ::std::result::Result::Err(self)
          28  +
        }
          29  +
    }
          30  +
    /// Returns true if this is a [`Text`](crate::types::DocumentContentBlock::Text).
          31  +
    pub fn is_text(&self) -> bool {
          32  +
        self.as_text().is_ok()
          33  +
    }
          34  +
    /// Returns true if the enum instance is the `Unknown` variant.
          35  +
    pub fn is_unknown(&self) -> bool {
          36  +
        matches!(self, Self::Unknown)
          37  +
    }
          38  +
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_document_format.rs

@@ -0,1 +0,150 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// When writing a match expression against `DocumentFormat`, it is important to ensure
           4  +
/// your code is forward-compatible. That is, if a match arm handles a case for a
           5  +
/// feature that is supported by the service but has not been represented as an enum
           6  +
/// variant in a current version of SDK, your code should continue to work when you
           7  +
/// upgrade SDK to a future version in which the enum does include a variant for that
           8  +
/// feature.
           9  +
///
          10  +
/// Here is an example of how you can make a match expression forward-compatible:
          11  +
///
          12  +
/// ```text
          13  +
/// # let documentformat = unimplemented!();
          14  +
/// match documentformat {
          15  +
///     DocumentFormat::Csv => { /* ... */ },
          16  +
///     DocumentFormat::Doc => { /* ... */ },
          17  +
///     DocumentFormat::Docx => { /* ... */ },
          18  +
///     DocumentFormat::Html => { /* ... */ },
          19  +
///     DocumentFormat::Md => { /* ... */ },
          20  +
///     DocumentFormat::Pdf => { /* ... */ },
          21  +
///     DocumentFormat::Txt => { /* ... */ },
          22  +
///     DocumentFormat::Xls => { /* ... */ },
          23  +
///     DocumentFormat::Xlsx => { /* ... */ },
          24  +
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          25  +
///     _ => { /* ... */ },
          26  +
/// }
          27  +
/// ```
          28  +
/// The above code demonstrates that when `documentformat` represents
          29  +
/// `NewFeature`, the execution path will lead to the second last match arm,
          30  +
/// even though the enum does not contain a variant `DocumentFormat::NewFeature`
          31  +
/// in the current version of SDK. The reason is that the variable `other`,
          32  +
/// created by the `@` operator, is bound to
          33  +
/// `DocumentFormat::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
          34  +
/// and calling `as_str` on it yields `"NewFeature"`.
          35  +
/// This match expression is forward-compatible when executed with a newer
          36  +
/// version of SDK where the variant `DocumentFormat::NewFeature` is defined.
          37  +
/// Specifically, when `documentformat` represents `NewFeature`,
          38  +
/// the execution path will hit the second last match arm as before by virtue of
          39  +
/// calling `as_str` on `DocumentFormat::NewFeature` also yielding `"NewFeature"`.
          40  +
///
          41  +
/// Explicitly matching on the `Unknown` variant should
          42  +
/// be avoided for two reasons:
          43  +
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
          44  +
/// - It might inadvertently shadow other intended match arms.
          45  +
///
          46  +
#[allow(missing_docs)] // documentation missing in model
          47  +
#[non_exhaustive]
          48  +
#[derive(
          49  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
          50  +
)]
          51  +
pub enum DocumentFormat {
          52  +
    #[allow(missing_docs)] // documentation missing in model
          53  +
    Csv,
          54  +
    #[allow(missing_docs)] // documentation missing in model
          55  +
    Doc,
          56  +
    #[allow(missing_docs)] // documentation missing in model
          57  +
    Docx,
          58  +
    #[allow(missing_docs)] // documentation missing in model
          59  +
    Html,
          60  +
    #[allow(missing_docs)] // documentation missing in model
          61  +
    Md,
          62  +
    #[allow(missing_docs)] // documentation missing in model
          63  +
    Pdf,
          64  +
    #[allow(missing_docs)] // documentation missing in model
          65  +
    Txt,
          66  +
    #[allow(missing_docs)] // documentation missing in model
          67  +
    Xls,
          68  +
    #[allow(missing_docs)] // documentation missing in model
          69  +
    Xlsx,
          70  +
    /// `Unknown` contains new variants that have been added since this code was generated.
          71  +
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
          72  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          73  +
}
          74  +
impl ::std::convert::From<&str> for DocumentFormat {
          75  +
    fn from(s: &str) -> Self {
          76  +
        match s {
          77  +
            "csv" => DocumentFormat::Csv,
          78  +
            "doc" => DocumentFormat::Doc,
          79  +
            "docx" => DocumentFormat::Docx,
          80  +
            "html" => DocumentFormat::Html,
          81  +
            "md" => DocumentFormat::Md,
          82  +
            "pdf" => DocumentFormat::Pdf,
          83  +
            "txt" => DocumentFormat::Txt,
          84  +
            "xls" => DocumentFormat::Xls,
          85  +
            "xlsx" => DocumentFormat::Xlsx,
          86  +
            other => DocumentFormat::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
          87  +
        }
          88  +
    }
          89  +
}
          90  +
impl ::std::str::FromStr for DocumentFormat {
          91  +
    type Err = ::std::convert::Infallible;
          92  +
          93  +
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
          94  +
        ::std::result::Result::Ok(DocumentFormat::from(s))
          95  +
    }
          96  +
}
          97  +
impl DocumentFormat {
          98  +
    /// Returns the `&str` value of the enum member.
          99  +
    pub fn as_str(&self) -> &str {
         100  +
        match self {
         101  +
            DocumentFormat::Csv => "csv",
         102  +
            DocumentFormat::Doc => "doc",
         103  +
            DocumentFormat::Docx => "docx",
         104  +
            DocumentFormat::Html => "html",
         105  +
            DocumentFormat::Md => "md",
         106  +
            DocumentFormat::Pdf => "pdf",
         107  +
            DocumentFormat::Txt => "txt",
         108  +
            DocumentFormat::Xls => "xls",
         109  +
            DocumentFormat::Xlsx => "xlsx",
         110  +
            DocumentFormat::Unknown(value) => value.as_str(),
         111  +
        }
         112  +
    }
         113  +
    /// Returns all the `&str` representations of the enum members.
         114  +
    pub const fn values() -> &'static [&'static str] {
         115  +
        &["csv", "doc", "docx", "html", "md", "pdf", "txt", "xls", "xlsx"]
         116  +
    }
         117  +
}
         118  +
impl ::std::convert::AsRef<str> for DocumentFormat {
         119  +
    fn as_ref(&self) -> &str {
         120  +
        self.as_str()
         121  +
    }
         122  +
}
         123  +
impl DocumentFormat {
         124  +
    /// Parses the enum value while disallowing unknown variants.
         125  +
    ///
         126  +
    /// Unknown variants will result in an error.
         127  +
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
         128  +
        match Self::from(value) {
         129  +
            #[allow(deprecated)]
         130  +
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
         131  +
            known => Ok(known),
         132  +
        }
         133  +
    }
         134  +
}
         135  +
impl ::std::fmt::Display for DocumentFormat {
         136  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
         137  +
        match self {
         138  +
            DocumentFormat::Csv => write!(f, "csv"),
         139  +
            DocumentFormat::Doc => write!(f, "doc"),
         140  +
            DocumentFormat::Docx => write!(f, "docx"),
         141  +
            DocumentFormat::Html => write!(f, "html"),
         142  +
            DocumentFormat::Md => write!(f, "md"),
         143  +
            DocumentFormat::Pdf => write!(f, "pdf"),
         144  +
            DocumentFormat::Txt => write!(f, "txt"),
         145  +
            DocumentFormat::Xls => write!(f, "xls"),
         146  +
            DocumentFormat::Xlsx => write!(f, "xlsx"),
         147  +
            DocumentFormat::Unknown(value) => write!(f, "{}", value),
         148  +
        }
         149  +
    }
         150  +
}