AWS SDK

AWS SDK

rev. 5673a7a38b4a4a6973351c005d572863803729fe

Files changed:

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_document_page_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 page-level location within a document, providing positioning information for cited content using page numbers.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct DocumentPageLocation {
           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 page number of the cited content within the document.</p>
          10  +
    pub start: ::std::option::Option<i32>,
          11  +
    /// <p>The ending page number of the cited content within the document.</p>
          12  +
    pub end: ::std::option::Option<i32>,
          13  +
}
          14  +
impl DocumentPageLocation {
          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 page number 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 page number of the cited content within the document.</p>
          24  +
    pub fn end(&self) -> ::std::option::Option<i32> {
          25  +
        self.end
          26  +
    }
          27  +
}
          28  +
impl DocumentPageLocation {
          29  +
    /// Creates a new builder-style object to manufacture [`DocumentPageLocation`](crate::types::DocumentPageLocation).
          30  +
    pub fn builder() -> crate::types::builders::DocumentPageLocationBuilder {
          31  +
        crate::types::builders::DocumentPageLocationBuilder::default()
          32  +
    }
          33  +
}
          34  +
          35  +
/// A builder for [`DocumentPageLocation`](crate::types::DocumentPageLocation).
          36  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          37  +
#[non_exhaustive]
          38  +
pub struct DocumentPageLocationBuilder {
          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 DocumentPageLocationBuilder {
          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 page number 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 page number 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 page number 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 page number 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 page number 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 page number 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 [`DocumentPageLocation`](crate::types::DocumentPageLocation).
          87  +
    pub fn build(self) -> crate::types::DocumentPageLocation {
          88  +
        crate::types::DocumentPageLocation {
          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_source.rs

@@ -0,1 +0,82 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>Contains the content of a document.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub enum DocumentSource {
           7  +
    /// <p>The raw bytes for the document. If you use an Amazon Web Services SDK, you don't need to encode the bytes in base64.</p>
           8  +
    Bytes(::aws_smithy_types::Blob),
           9  +
    /// <p>The structured content of the document source, which may include various content blocks such as text, images, or other document elements.</p>
          10  +
    Content(::std::vec::Vec<crate::types::DocumentContentBlock>),
          11  +
    /// <p>The location of a document object in an Amazon S3 bucket. To see which models support S3 uploads, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html">Supported models and features for Converse</a>.</p>
          12  +
    S3Location(crate::types::S3Location),
          13  +
    /// <p>The text content of the document source.</p>
          14  +
    Text(::std::string::String),
          15  +
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          16  +
    /// An unknown enum variant
          17  +
    ///
          18  +
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          19  +
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          20  +
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          21  +
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          22  +
    #[non_exhaustive]
          23  +
    Unknown,
          24  +
}
          25  +
impl DocumentSource {
          26  +
    /// Tries to convert the enum instance into [`Bytes`](crate::types::DocumentSource::Bytes), extracting the inner [`Blob`](::aws_smithy_types::Blob).
          27  +
    /// Returns `Err(&Self)` if it can't be converted.
          28  +
    pub fn as_bytes(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
          29  +
        if let DocumentSource::Bytes(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 [`Bytes`](crate::types::DocumentSource::Bytes).
          36  +
    pub fn is_bytes(&self) -> bool {
          37  +
        self.as_bytes().is_ok()
          38  +
    }
          39  +
    /// Tries to convert the enum instance into [`Content`](crate::types::DocumentSource::Content), extracting the inner [`Vec`](::std::vec::Vec).
          40  +
    /// Returns `Err(&Self)` if it can't be converted.
          41  +
    pub fn as_content(&self) -> ::std::result::Result<&::std::vec::Vec<crate::types::DocumentContentBlock>, &Self> {
          42  +
        if let DocumentSource::Content(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 [`Content`](crate::types::DocumentSource::Content).
          49  +
    pub fn is_content(&self) -> bool {
          50  +
        self.as_content().is_ok()
          51  +
    }
          52  +
    /// Tries to convert the enum instance into [`S3Location`](crate::types::DocumentSource::S3Location), extracting the inner [`S3Location`](crate::types::S3Location).
          53  +
    /// Returns `Err(&Self)` if it can't be converted.
          54  +
    pub fn as_s3_location(&self) -> ::std::result::Result<&crate::types::S3Location, &Self> {
          55  +
        if let DocumentSource::S3Location(val) = &self {
          56  +
            ::std::result::Result::Ok(val)
          57  +
        } else {
          58  +
            ::std::result::Result::Err(self)
          59  +
        }
          60  +
    }
          61  +
    /// Returns true if this is a [`S3Location`](crate::types::DocumentSource::S3Location).
          62  +
    pub fn is_s3_location(&self) -> bool {
          63  +
        self.as_s3_location().is_ok()
          64  +
    }
          65  +
    /// Tries to convert the enum instance into [`Text`](crate::types::DocumentSource::Text), extracting the inner [`String`](::std::string::String).
          66  +
    /// Returns `Err(&Self)` if it can't be converted.
          67  +
    pub fn as_text(&self) -> ::std::result::Result<&::std::string::String, &Self> {
          68  +
        if let DocumentSource::Text(val) = &self {
          69  +
            ::std::result::Result::Ok(val)
          70  +
        } else {
          71  +
            ::std::result::Result::Err(self)
          72  +
        }
          73  +
    }
          74  +
    /// Returns true if this is a [`Text`](crate::types::DocumentSource::Text).
          75  +
    pub fn is_text(&self) -> bool {
          76  +
        self.as_text().is_ok()
          77  +
    }
          78  +
    /// Returns true if the enum instance is the `Unknown` variant.
          79  +
    pub fn is_unknown(&self) -> bool {
          80  +
        matches!(self, Self::Unknown)
          81  +
    }
          82  +
}

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

@@ -0,1 +0,108 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// When writing a match expression against `GuardrailAction`, 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 guardrailaction = unimplemented!();
          14  +
/// match guardrailaction {
          15  +
///     GuardrailAction::GuardrailIntervened => { /* ... */ },
          16  +
///     GuardrailAction::None => { /* ... */ },
          17  +
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          18  +
///     _ => { /* ... */ },
          19  +
/// }
          20  +
/// ```
          21  +
/// The above code demonstrates that when `guardrailaction` represents
          22  +
/// `NewFeature`, the execution path will lead to the second last match arm,
          23  +
/// even though the enum does not contain a variant `GuardrailAction::NewFeature`
          24  +
/// in the current version of SDK. The reason is that the variable `other`,
          25  +
/// created by the `@` operator, is bound to
          26  +
/// `GuardrailAction::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
          27  +
/// and calling `as_str` on it yields `"NewFeature"`.
          28  +
/// This match expression is forward-compatible when executed with a newer
          29  +
/// version of SDK where the variant `GuardrailAction::NewFeature` is defined.
          30  +
/// Specifically, when `guardrailaction` represents `NewFeature`,
          31  +
/// the execution path will hit the second last match arm as before by virtue of
          32  +
/// calling `as_str` on `GuardrailAction::NewFeature` also yielding `"NewFeature"`.
          33  +
///
          34  +
/// Explicitly matching on the `Unknown` variant should
          35  +
/// be avoided for two reasons:
          36  +
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
          37  +
/// - It might inadvertently shadow other intended match arms.
          38  +
///
          39  +
#[allow(missing_docs)] // documentation missing in model
          40  +
#[non_exhaustive]
          41  +
#[derive(
          42  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
          43  +
)]
          44  +
pub enum GuardrailAction {
          45  +
    #[allow(missing_docs)] // documentation missing in model
          46  +
    GuardrailIntervened,
          47  +
    #[allow(missing_docs)] // documentation missing in model
          48  +
    None,
          49  +
    /// `Unknown` contains new variants that have been added since this code was generated.
          50  +
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
          51  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          52  +
}
          53  +
impl ::std::convert::From<&str> for GuardrailAction {
          54  +
    fn from(s: &str) -> Self {
          55  +
        match s {
          56  +
            "GUARDRAIL_INTERVENED" => GuardrailAction::GuardrailIntervened,
          57  +
            "NONE" => GuardrailAction::None,
          58  +
            other => GuardrailAction::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
          59  +
        }
          60  +
    }
          61  +
}
          62  +
impl ::std::str::FromStr for GuardrailAction {
          63  +
    type Err = ::std::convert::Infallible;
          64  +
          65  +
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
          66  +
        ::std::result::Result::Ok(GuardrailAction::from(s))
          67  +
    }
          68  +
}
          69  +
impl GuardrailAction {
          70  +
    /// Returns the `&str` value of the enum member.
          71  +
    pub fn as_str(&self) -> &str {
          72  +
        match self {
          73  +
            GuardrailAction::GuardrailIntervened => "GUARDRAIL_INTERVENED",
          74  +
            GuardrailAction::None => "NONE",
          75  +
            GuardrailAction::Unknown(value) => value.as_str(),
          76  +
        }
          77  +
    }
          78  +
    /// Returns all the `&str` representations of the enum members.
          79  +
    pub const fn values() -> &'static [&'static str] {
          80  +
        &["GUARDRAIL_INTERVENED", "NONE"]
          81  +
    }
          82  +
}
          83  +
impl ::std::convert::AsRef<str> for GuardrailAction {
          84  +
    fn as_ref(&self) -> &str {
          85  +
        self.as_str()
          86  +
    }
          87  +
}
          88  +
impl GuardrailAction {
          89  +
    /// Parses the enum value while disallowing unknown variants.
          90  +
    ///
          91  +
    /// Unknown variants will result in an error.
          92  +
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
          93  +
        match Self::from(value) {
          94  +
            #[allow(deprecated)]
          95  +
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
          96  +
            known => Ok(known),
          97  +
        }
          98  +
    }
          99  +
}
         100  +
impl ::std::fmt::Display for GuardrailAction {
         101  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
         102  +
        match self {
         103  +
            GuardrailAction::GuardrailIntervened => write!(f, "GUARDRAIL_INTERVENED"),
         104  +
            GuardrailAction::None => write!(f, "NONE"),
         105  +
            GuardrailAction::Unknown(value) => write!(f, "{}", value),
         106  +
        }
         107  +
    }
         108  +
}

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

@@ -0,1 +0,166 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>A behavior assessment of the guardrail policies used in a call to the Converse API.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct GuardrailAssessment {
           7  +
    /// <p>The topic policy.</p>
           8  +
    pub topic_policy: ::std::option::Option<crate::types::GuardrailTopicPolicyAssessment>,
           9  +
    /// <p>The content policy.</p>
          10  +
    pub content_policy: ::std::option::Option<crate::types::GuardrailContentPolicyAssessment>,
          11  +
    /// <p>The word policy.</p>
          12  +
    pub word_policy: ::std::option::Option<crate::types::GuardrailWordPolicyAssessment>,
          13  +
    /// <p>The sensitive information policy.</p>
          14  +
    pub sensitive_information_policy: ::std::option::Option<crate::types::GuardrailSensitiveInformationPolicyAssessment>,
          15  +
    /// <p>The contextual grounding policy used for the guardrail assessment.</p>
          16  +
    pub contextual_grounding_policy: ::std::option::Option<crate::types::GuardrailContextualGroundingPolicyAssessment>,
          17  +
    /// <p>The invocation metrics for the guardrail assessment.</p>
          18  +
    pub invocation_metrics: ::std::option::Option<crate::types::GuardrailInvocationMetrics>,
          19  +
}
          20  +
impl GuardrailAssessment {
          21  +
    /// <p>The topic policy.</p>
          22  +
    pub fn topic_policy(&self) -> ::std::option::Option<&crate::types::GuardrailTopicPolicyAssessment> {
          23  +
        self.topic_policy.as_ref()
          24  +
    }
          25  +
    /// <p>The content policy.</p>
          26  +
    pub fn content_policy(&self) -> ::std::option::Option<&crate::types::GuardrailContentPolicyAssessment> {
          27  +
        self.content_policy.as_ref()
          28  +
    }
          29  +
    /// <p>The word policy.</p>
          30  +
    pub fn word_policy(&self) -> ::std::option::Option<&crate::types::GuardrailWordPolicyAssessment> {
          31  +
        self.word_policy.as_ref()
          32  +
    }
          33  +
    /// <p>The sensitive information policy.</p>
          34  +
    pub fn sensitive_information_policy(&self) -> ::std::option::Option<&crate::types::GuardrailSensitiveInformationPolicyAssessment> {
          35  +
        self.sensitive_information_policy.as_ref()
          36  +
    }
          37  +
    /// <p>The contextual grounding policy used for the guardrail assessment.</p>
          38  +
    pub fn contextual_grounding_policy(&self) -> ::std::option::Option<&crate::types::GuardrailContextualGroundingPolicyAssessment> {
          39  +
        self.contextual_grounding_policy.as_ref()
          40  +
    }
          41  +
    /// <p>The invocation metrics for the guardrail assessment.</p>
          42  +
    pub fn invocation_metrics(&self) -> ::std::option::Option<&crate::types::GuardrailInvocationMetrics> {
          43  +
        self.invocation_metrics.as_ref()
          44  +
    }
          45  +
}
          46  +
impl GuardrailAssessment {
          47  +
    /// Creates a new builder-style object to manufacture [`GuardrailAssessment`](crate::types::GuardrailAssessment).
          48  +
    pub fn builder() -> crate::types::builders::GuardrailAssessmentBuilder {
          49  +
        crate::types::builders::GuardrailAssessmentBuilder::default()
          50  +
    }
          51  +
}
          52  +
          53  +
/// A builder for [`GuardrailAssessment`](crate::types::GuardrailAssessment).
          54  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          55  +
#[non_exhaustive]
          56  +
pub struct GuardrailAssessmentBuilder {
          57  +
    pub(crate) topic_policy: ::std::option::Option<crate::types::GuardrailTopicPolicyAssessment>,
          58  +
    pub(crate) content_policy: ::std::option::Option<crate::types::GuardrailContentPolicyAssessment>,
          59  +
    pub(crate) word_policy: ::std::option::Option<crate::types::GuardrailWordPolicyAssessment>,
          60  +
    pub(crate) sensitive_information_policy: ::std::option::Option<crate::types::GuardrailSensitiveInformationPolicyAssessment>,
          61  +
    pub(crate) contextual_grounding_policy: ::std::option::Option<crate::types::GuardrailContextualGroundingPolicyAssessment>,
          62  +
    pub(crate) invocation_metrics: ::std::option::Option<crate::types::GuardrailInvocationMetrics>,
          63  +
}
          64  +
impl GuardrailAssessmentBuilder {
          65  +
    /// <p>The topic policy.</p>
          66  +
    pub fn topic_policy(mut self, input: crate::types::GuardrailTopicPolicyAssessment) -> Self {
          67  +
        self.topic_policy = ::std::option::Option::Some(input);
          68  +
        self
          69  +
    }
          70  +
    /// <p>The topic policy.</p>
          71  +
    pub fn set_topic_policy(mut self, input: ::std::option::Option<crate::types::GuardrailTopicPolicyAssessment>) -> Self {
          72  +
        self.topic_policy = input;
          73  +
        self
          74  +
    }
          75  +
    /// <p>The topic policy.</p>
          76  +
    pub fn get_topic_policy(&self) -> &::std::option::Option<crate::types::GuardrailTopicPolicyAssessment> {
          77  +
        &self.topic_policy
          78  +
    }
          79  +
    /// <p>The content policy.</p>
          80  +
    pub fn content_policy(mut self, input: crate::types::GuardrailContentPolicyAssessment) -> Self {
          81  +
        self.content_policy = ::std::option::Option::Some(input);
          82  +
        self
          83  +
    }
          84  +
    /// <p>The content policy.</p>
          85  +
    pub fn set_content_policy(mut self, input: ::std::option::Option<crate::types::GuardrailContentPolicyAssessment>) -> Self {
          86  +
        self.content_policy = input;
          87  +
        self
          88  +
    }
          89  +
    /// <p>The content policy.</p>
          90  +
    pub fn get_content_policy(&self) -> &::std::option::Option<crate::types::GuardrailContentPolicyAssessment> {
          91  +
        &self.content_policy
          92  +
    }
          93  +
    /// <p>The word policy.</p>
          94  +
    pub fn word_policy(mut self, input: crate::types::GuardrailWordPolicyAssessment) -> Self {
          95  +
        self.word_policy = ::std::option::Option::Some(input);
          96  +
        self
          97  +
    }
          98  +
    /// <p>The word policy.</p>
          99  +
    pub fn set_word_policy(mut self, input: ::std::option::Option<crate::types::GuardrailWordPolicyAssessment>) -> Self {
         100  +
        self.word_policy = input;
         101  +
        self
         102  +
    }
         103  +
    /// <p>The word policy.</p>
         104  +
    pub fn get_word_policy(&self) -> &::std::option::Option<crate::types::GuardrailWordPolicyAssessment> {
         105  +
        &self.word_policy
         106  +
    }
         107  +
    /// <p>The sensitive information policy.</p>
         108  +
    pub fn sensitive_information_policy(mut self, input: crate::types::GuardrailSensitiveInformationPolicyAssessment) -> Self {
         109  +
        self.sensitive_information_policy = ::std::option::Option::Some(input);
         110  +
        self
         111  +
    }
         112  +
    /// <p>The sensitive information policy.</p>
         113  +
    pub fn set_sensitive_information_policy(
         114  +
        mut self,
         115  +
        input: ::std::option::Option<crate::types::GuardrailSensitiveInformationPolicyAssessment>,
         116  +
    ) -> Self {
         117  +
        self.sensitive_information_policy = input;
         118  +
        self
         119  +
    }
         120  +
    /// <p>The sensitive information policy.</p>
         121  +
    pub fn get_sensitive_information_policy(&self) -> &::std::option::Option<crate::types::GuardrailSensitiveInformationPolicyAssessment> {
         122  +
        &self.sensitive_information_policy
         123  +
    }
         124  +
    /// <p>The contextual grounding policy used for the guardrail assessment.</p>
         125  +
    pub fn contextual_grounding_policy(mut self, input: crate::types::GuardrailContextualGroundingPolicyAssessment) -> Self {
         126  +
        self.contextual_grounding_policy = ::std::option::Option::Some(input);
         127  +
        self
         128  +
    }
         129  +
    /// <p>The contextual grounding policy used for the guardrail assessment.</p>
         130  +
    pub fn set_contextual_grounding_policy(
         131  +
        mut self,
         132  +
        input: ::std::option::Option<crate::types::GuardrailContextualGroundingPolicyAssessment>,
         133  +
    ) -> Self {
         134  +
        self.contextual_grounding_policy = input;
         135  +
        self
         136  +
    }
         137  +
    /// <p>The contextual grounding policy used for the guardrail assessment.</p>
         138  +
    pub fn get_contextual_grounding_policy(&self) -> &::std::option::Option<crate::types::GuardrailContextualGroundingPolicyAssessment> {
         139  +
        &self.contextual_grounding_policy
         140  +
    }
         141  +
    /// <p>The invocation metrics for the guardrail assessment.</p>
         142  +
    pub fn invocation_metrics(mut self, input: crate::types::GuardrailInvocationMetrics) -> Self {
         143  +
        self.invocation_metrics = ::std::option::Option::Some(input);
         144  +
        self
         145  +
    }
         146  +
    /// <p>The invocation metrics for the guardrail assessment.</p>
         147  +
    pub fn set_invocation_metrics(mut self, input: ::std::option::Option<crate::types::GuardrailInvocationMetrics>) -> Self {
         148  +
        self.invocation_metrics = input;
         149  +
        self
         150  +
    }
         151  +
    /// <p>The invocation metrics for the guardrail assessment.</p>
         152  +
    pub fn get_invocation_metrics(&self) -> &::std::option::Option<crate::types::GuardrailInvocationMetrics> {
         153  +
        &self.invocation_metrics
         154  +
    }
         155  +
    /// Consumes the builder and constructs a [`GuardrailAssessment`](crate::types::GuardrailAssessment).
         156  +
    pub fn build(self) -> crate::types::GuardrailAssessment {
         157  +
        crate::types::GuardrailAssessment {
         158  +
            topic_policy: self.topic_policy,
         159  +
            content_policy: self.content_policy,
         160  +
            word_policy: self.word_policy,
         161  +
            sensitive_information_policy: self.sensitive_information_policy,
         162  +
            contextual_grounding_policy: self.contextual_grounding_policy,
         163  +
            invocation_metrics: self.invocation_metrics,
         164  +
        }
         165  +
    }
         166  +
}

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

@@ -0,1 +0,115 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>Configuration information for a guardrail that you use with the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> operation.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct GuardrailConfiguration {
           7  +
    /// <p>The identifier for the guardrail.</p>
           8  +
    pub guardrail_identifier: ::std::string::String,
           9  +
    /// <p>The version of the guardrail.</p>
          10  +
    pub guardrail_version: ::std::string::String,
          11  +
    /// <p>The trace behavior for the guardrail.</p>
          12  +
    pub trace: crate::types::GuardrailTrace,
          13  +
}
          14  +
impl GuardrailConfiguration {
          15  +
    /// <p>The identifier for the guardrail.</p>
          16  +
    pub fn guardrail_identifier(&self) -> &str {
          17  +
        use std::ops::Deref;
          18  +
        self.guardrail_identifier.deref()
          19  +
    }
          20  +
    /// <p>The version of the guardrail.</p>
          21  +
    pub fn guardrail_version(&self) -> &str {
          22  +
        use std::ops::Deref;
          23  +
        self.guardrail_version.deref()
          24  +
    }
          25  +
    /// <p>The trace behavior for the guardrail.</p>
          26  +
    pub fn trace(&self) -> &crate::types::GuardrailTrace {
          27  +
        &self.trace
          28  +
    }
          29  +
}
          30  +
impl GuardrailConfiguration {
          31  +
    /// Creates a new builder-style object to manufacture [`GuardrailConfiguration`](crate::types::GuardrailConfiguration).
          32  +
    pub fn builder() -> crate::types::builders::GuardrailConfigurationBuilder {
          33  +
        crate::types::builders::GuardrailConfigurationBuilder::default()
          34  +
    }
          35  +
}
          36  +
          37  +
/// A builder for [`GuardrailConfiguration`](crate::types::GuardrailConfiguration).
          38  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          39  +
#[non_exhaustive]
          40  +
pub struct GuardrailConfigurationBuilder {
          41  +
    pub(crate) guardrail_identifier: ::std::option::Option<::std::string::String>,
          42  +
    pub(crate) guardrail_version: ::std::option::Option<::std::string::String>,
          43  +
    pub(crate) trace: ::std::option::Option<crate::types::GuardrailTrace>,
          44  +
}
          45  +
impl GuardrailConfigurationBuilder {
          46  +
    /// <p>The identifier for the guardrail.</p>
          47  +
    /// This field is required.
          48  +
    pub fn guardrail_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          49  +
        self.guardrail_identifier = ::std::option::Option::Some(input.into());
          50  +
        self
          51  +
    }
          52  +
    /// <p>The identifier for the guardrail.</p>
          53  +
    pub fn set_guardrail_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          54  +
        self.guardrail_identifier = input;
          55  +
        self
          56  +
    }
          57  +
    /// <p>The identifier for the guardrail.</p>
          58  +
    pub fn get_guardrail_identifier(&self) -> &::std::option::Option<::std::string::String> {
          59  +
        &self.guardrail_identifier
          60  +
    }
          61  +
    /// <p>The version of the guardrail.</p>
          62  +
    /// This field is required.
          63  +
    pub fn guardrail_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          64  +
        self.guardrail_version = ::std::option::Option::Some(input.into());
          65  +
        self
          66  +
    }
          67  +
    /// <p>The version of the guardrail.</p>
          68  +
    pub fn set_guardrail_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          69  +
        self.guardrail_version = input;
          70  +
        self
          71  +
    }
          72  +
    /// <p>The version of the guardrail.</p>
          73  +
    pub fn get_guardrail_version(&self) -> &::std::option::Option<::std::string::String> {
          74  +
        &self.guardrail_version
          75  +
    }
          76  +
    /// <p>The trace behavior for the guardrail.</p>
          77  +
    pub fn trace(mut self, input: crate::types::GuardrailTrace) -> Self {
          78  +
        self.trace = ::std::option::Option::Some(input);
          79  +
        self
          80  +
    }
          81  +
    /// <p>The trace behavior for the guardrail.</p>
          82  +
    pub fn set_trace(mut self, input: ::std::option::Option<crate::types::GuardrailTrace>) -> Self {
          83  +
        self.trace = input;
          84  +
        self
          85  +
    }
          86  +
    /// <p>The trace behavior for the guardrail.</p>
          87  +
    pub fn get_trace(&self) -> &::std::option::Option<crate::types::GuardrailTrace> {
          88  +
        &self.trace
          89  +
    }
          90  +
    /// Consumes the builder and constructs a [`GuardrailConfiguration`](crate::types::GuardrailConfiguration).
          91  +
    /// This method will fail if any of the following fields are not set:
          92  +
    /// - [`guardrail_identifier`](crate::types::builders::GuardrailConfigurationBuilder::guardrail_identifier)
          93  +
    /// - [`guardrail_version`](crate::types::builders::GuardrailConfigurationBuilder::guardrail_version)
          94  +
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailConfiguration, ::aws_smithy_types::error::operation::BuildError> {
          95  +
        ::std::result::Result::Ok(crate::types::GuardrailConfiguration {
          96  +
            guardrail_identifier: self.guardrail_identifier.ok_or_else(|| {
          97  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
          98  +
                    "guardrail_identifier",
          99  +
                    "guardrail_identifier was not specified but it is required when building GuardrailConfiguration",
         100  +
                )
         101  +
            })?,
         102  +
            guardrail_version: self.guardrail_version.ok_or_else(|| {
         103  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
         104  +
                    "guardrail_version",
         105  +
                    "guardrail_version was not specified but it is required when building GuardrailConfiguration",
         106  +
                )
         107  +
            })?,
         108  +
            trace: self.trace.unwrap_or(
         109  +
                "disabled"
         110  +
                    .parse::<crate::types::GuardrailTrace>()
         111  +
                    .expect("static value validated to member"),
         112  +
            ),
         113  +
        })
         114  +
    }
         115  +
}

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

@@ -0,1 +0,61 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>The content block to be evaluated by the guardrail.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
           6  +
pub enum GuardrailContentBlock {
           7  +
    /// <p>Image within guardrail content block to be evaluated by the guardrail.</p>
           8  +
    Image(crate::types::GuardrailImageBlock),
           9  +
    /// <p>Text within content block to be evaluated by the guardrail.</p>
          10  +
    Text(crate::types::GuardrailTextBlock),
          11  +
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          12  +
    /// An unknown enum variant
          13  +
    ///
          14  +
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          15  +
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          16  +
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          17  +
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          18  +
    #[non_exhaustive]
          19  +
    Unknown,
          20  +
}
          21  +
impl GuardrailContentBlock {
          22  +
    /// Tries to convert the enum instance into [`Image`](crate::types::GuardrailContentBlock::Image), extracting the inner [`GuardrailImageBlock`](crate::types::GuardrailImageBlock).
          23  +
    /// Returns `Err(&Self)` if it can't be converted.
          24  +
    pub fn as_image(&self) -> ::std::result::Result<&crate::types::GuardrailImageBlock, &Self> {
          25  +
        if let GuardrailContentBlock::Image(val) = &self {
          26  +
            ::std::result::Result::Ok(val)
          27  +
        } else {
          28  +
            ::std::result::Result::Err(self)
          29  +
        }
          30  +
    }
          31  +
    /// Returns true if this is a [`Image`](crate::types::GuardrailContentBlock::Image).
          32  +
    pub fn is_image(&self) -> bool {
          33  +
        self.as_image().is_ok()
          34  +
    }
          35  +
    /// Tries to convert the enum instance into [`Text`](crate::types::GuardrailContentBlock::Text), extracting the inner [`GuardrailTextBlock`](crate::types::GuardrailTextBlock).
          36  +
    /// Returns `Err(&Self)` if it can't be converted.
          37  +
    pub fn as_text(&self) -> ::std::result::Result<&crate::types::GuardrailTextBlock, &Self> {
          38  +
        if let GuardrailContentBlock::Text(val) = &self {
          39  +
            ::std::result::Result::Ok(val)
          40  +
        } else {
          41  +
            ::std::result::Result::Err(self)
          42  +
        }
          43  +
    }
          44  +
    /// Returns true if this is a [`Text`](crate::types::GuardrailContentBlock::Text).
          45  +
    pub fn is_text(&self) -> bool {
          46  +
        self.as_text().is_ok()
          47  +
    }
          48  +
    /// Returns true if the enum instance is the `Unknown` variant.
          49  +
    pub fn is_unknown(&self) -> bool {
          50  +
        matches!(self, Self::Unknown)
          51  +
    }
          52  +
}
          53  +
impl ::std::fmt::Debug for GuardrailContentBlock {
          54  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
          55  +
        match self {
          56  +
            GuardrailContentBlock::Image(_) => f.debug_tuple("*** Sensitive Data Redacted ***").finish(),
          57  +
            GuardrailContentBlock::Text(val) => f.debug_tuple("Text").field(&val).finish(),
          58  +
            GuardrailContentBlock::Unknown => f.debug_tuple("Unknown").finish(),
          59  +
        }
          60  +
    }
          61  +
}

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

@@ -0,1 +0,160 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// <p>The content filter for a guardrail.</p>
           4  +
#[non_exhaustive]
           5  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           6  +
pub struct GuardrailContentFilter {
           7  +
    /// <p>The guardrail type.</p>
           8  +
    pub r#type: crate::types::GuardrailContentFilterType,
           9  +
    /// <p>The guardrail confidence.</p>
          10  +
    pub confidence: crate::types::GuardrailContentFilterConfidence,
          11  +
    /// <p>The filter strength setting for the guardrail content filter.</p>
          12  +
    pub filter_strength: ::std::option::Option<crate::types::GuardrailContentFilterStrength>,
          13  +
    /// <p>The guardrail action.</p>
          14  +
    pub action: crate::types::GuardrailContentPolicyAction,
          15  +
    /// <p>Indicates whether content that breaches the guardrail configuration is detected.</p>
          16  +
    pub detected: ::std::option::Option<bool>,
          17  +
}
          18  +
impl GuardrailContentFilter {
          19  +
    /// <p>The guardrail type.</p>
          20  +
    pub fn r#type(&self) -> &crate::types::GuardrailContentFilterType {
          21  +
        &self.r#type
          22  +
    }
          23  +
    /// <p>The guardrail confidence.</p>
          24  +
    pub fn confidence(&self) -> &crate::types::GuardrailContentFilterConfidence {
          25  +
        &self.confidence
          26  +
    }
          27  +
    /// <p>The filter strength setting for the guardrail content filter.</p>
          28  +
    pub fn filter_strength(&self) -> ::std::option::Option<&crate::types::GuardrailContentFilterStrength> {
          29  +
        self.filter_strength.as_ref()
          30  +
    }
          31  +
    /// <p>The guardrail action.</p>
          32  +
    pub fn action(&self) -> &crate::types::GuardrailContentPolicyAction {
          33  +
        &self.action
          34  +
    }
          35  +
    /// <p>Indicates whether content that breaches the guardrail configuration is detected.</p>
          36  +
    pub fn detected(&self) -> ::std::option::Option<bool> {
          37  +
        self.detected
          38  +
    }
          39  +
}
          40  +
impl GuardrailContentFilter {
          41  +
    /// Creates a new builder-style object to manufacture [`GuardrailContentFilter`](crate::types::GuardrailContentFilter).
          42  +
    pub fn builder() -> crate::types::builders::GuardrailContentFilterBuilder {
          43  +
        crate::types::builders::GuardrailContentFilterBuilder::default()
          44  +
    }
          45  +
}
          46  +
          47  +
/// A builder for [`GuardrailContentFilter`](crate::types::GuardrailContentFilter).
          48  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          49  +
#[non_exhaustive]
          50  +
pub struct GuardrailContentFilterBuilder {
          51  +
    pub(crate) r#type: ::std::option::Option<crate::types::GuardrailContentFilterType>,
          52  +
    pub(crate) confidence: ::std::option::Option<crate::types::GuardrailContentFilterConfidence>,
          53  +
    pub(crate) filter_strength: ::std::option::Option<crate::types::GuardrailContentFilterStrength>,
          54  +
    pub(crate) action: ::std::option::Option<crate::types::GuardrailContentPolicyAction>,
          55  +
    pub(crate) detected: ::std::option::Option<bool>,
          56  +
}
          57  +
impl GuardrailContentFilterBuilder {
          58  +
    /// <p>The guardrail type.</p>
          59  +
    /// This field is required.
          60  +
    pub fn r#type(mut self, input: crate::types::GuardrailContentFilterType) -> Self {
          61  +
        self.r#type = ::std::option::Option::Some(input);
          62  +
        self
          63  +
    }
          64  +
    /// <p>The guardrail type.</p>
          65  +
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::GuardrailContentFilterType>) -> Self {
          66  +
        self.r#type = input;
          67  +
        self
          68  +
    }
          69  +
    /// <p>The guardrail type.</p>
          70  +
    pub fn get_type(&self) -> &::std::option::Option<crate::types::GuardrailContentFilterType> {
          71  +
        &self.r#type
          72  +
    }
          73  +
    /// <p>The guardrail confidence.</p>
          74  +
    /// This field is required.
          75  +
    pub fn confidence(mut self, input: crate::types::GuardrailContentFilterConfidence) -> Self {
          76  +
        self.confidence = ::std::option::Option::Some(input);
          77  +
        self
          78  +
    }
          79  +
    /// <p>The guardrail confidence.</p>
          80  +
    pub fn set_confidence(mut self, input: ::std::option::Option<crate::types::GuardrailContentFilterConfidence>) -> Self {
          81  +
        self.confidence = input;
          82  +
        self
          83  +
    }
          84  +
    /// <p>The guardrail confidence.</p>
          85  +
    pub fn get_confidence(&self) -> &::std::option::Option<crate::types::GuardrailContentFilterConfidence> {
          86  +
        &self.confidence
          87  +
    }
          88  +
    /// <p>The filter strength setting for the guardrail content filter.</p>
          89  +
    pub fn filter_strength(mut self, input: crate::types::GuardrailContentFilterStrength) -> Self {
          90  +
        self.filter_strength = ::std::option::Option::Some(input);
          91  +
        self
          92  +
    }
          93  +
    /// <p>The filter strength setting for the guardrail content filter.</p>
          94  +
    pub fn set_filter_strength(mut self, input: ::std::option::Option<crate::types::GuardrailContentFilterStrength>) -> Self {
          95  +
        self.filter_strength = input;
          96  +
        self
          97  +
    }
          98  +
    /// <p>The filter strength setting for the guardrail content filter.</p>
          99  +
    pub fn get_filter_strength(&self) -> &::std::option::Option<crate::types::GuardrailContentFilterStrength> {
         100  +
        &self.filter_strength
         101  +
    }
         102  +
    /// <p>The guardrail action.</p>
         103  +
    /// This field is required.
         104  +
    pub fn action(mut self, input: crate::types::GuardrailContentPolicyAction) -> Self {
         105  +
        self.action = ::std::option::Option::Some(input);
         106  +
        self
         107  +
    }
         108  +
    /// <p>The guardrail action.</p>
         109  +
    pub fn set_action(mut self, input: ::std::option::Option<crate::types::GuardrailContentPolicyAction>) -> Self {
         110  +
        self.action = input;
         111  +
        self
         112  +
    }
         113  +
    /// <p>The guardrail action.</p>
         114  +
    pub fn get_action(&self) -> &::std::option::Option<crate::types::GuardrailContentPolicyAction> {
         115  +
        &self.action
         116  +
    }
         117  +
    /// <p>Indicates whether content that breaches the guardrail configuration is detected.</p>
         118  +
    pub fn detected(mut self, input: bool) -> Self {
         119  +
        self.detected = ::std::option::Option::Some(input);
         120  +
        self
         121  +
    }
         122  +
    /// <p>Indicates whether content that breaches the guardrail configuration is detected.</p>
         123  +
    pub fn set_detected(mut self, input: ::std::option::Option<bool>) -> Self {
         124  +
        self.detected = input;
         125  +
        self
         126  +
    }
         127  +
    /// <p>Indicates whether content that breaches the guardrail configuration is detected.</p>
         128  +
    pub fn get_detected(&self) -> &::std::option::Option<bool> {
         129  +
        &self.detected
         130  +
    }
         131  +
    /// Consumes the builder and constructs a [`GuardrailContentFilter`](crate::types::GuardrailContentFilter).
         132  +
    /// This method will fail if any of the following fields are not set:
         133  +
    /// - [`r#type`](crate::types::builders::GuardrailContentFilterBuilder::type)
         134  +
    /// - [`confidence`](crate::types::builders::GuardrailContentFilterBuilder::confidence)
         135  +
    /// - [`action`](crate::types::builders::GuardrailContentFilterBuilder::action)
         136  +
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailContentFilter, ::aws_smithy_types::error::operation::BuildError> {
         137  +
        ::std::result::Result::Ok(crate::types::GuardrailContentFilter {
         138  +
            r#type: self.r#type.ok_or_else(|| {
         139  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
         140  +
                    "r#type",
         141  +
                    "r#type was not specified but it is required when building GuardrailContentFilter",
         142  +
                )
         143  +
            })?,
         144  +
            confidence: self.confidence.ok_or_else(|| {
         145  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
         146  +
                    "confidence",
         147  +
                    "confidence was not specified but it is required when building GuardrailContentFilter",
         148  +
                )
         149  +
            })?,
         150  +
            filter_strength: self.filter_strength,
         151  +
            action: self.action.ok_or_else(|| {
         152  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
         153  +
                    "action",
         154  +
                    "action was not specified but it is required when building GuardrailContentFilter",
         155  +
                )
         156  +
            })?,
         157  +
            detected: self.detected,
         158  +
        })
         159  +
    }
         160  +
}

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

@@ -0,1 +0,120 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// When writing a match expression against `GuardrailContentFilterConfidence`, 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 guardrailcontentfilterconfidence = unimplemented!();
          14  +
/// match guardrailcontentfilterconfidence {
          15  +
///     GuardrailContentFilterConfidence::High => { /* ... */ },
          16  +
///     GuardrailContentFilterConfidence::Low => { /* ... */ },
          17  +
///     GuardrailContentFilterConfidence::Medium => { /* ... */ },
          18  +
///     GuardrailContentFilterConfidence::None => { /* ... */ },
          19  +
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          20  +
///     _ => { /* ... */ },
          21  +
/// }
          22  +
/// ```
          23  +
/// The above code demonstrates that when `guardrailcontentfilterconfidence` represents
          24  +
/// `NewFeature`, the execution path will lead to the second last match arm,
          25  +
/// even though the enum does not contain a variant `GuardrailContentFilterConfidence::NewFeature`
          26  +
/// in the current version of SDK. The reason is that the variable `other`,
          27  +
/// created by the `@` operator, is bound to
          28  +
/// `GuardrailContentFilterConfidence::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
          29  +
/// and calling `as_str` on it yields `"NewFeature"`.
          30  +
/// This match expression is forward-compatible when executed with a newer
          31  +
/// version of SDK where the variant `GuardrailContentFilterConfidence::NewFeature` is defined.
          32  +
/// Specifically, when `guardrailcontentfilterconfidence` represents `NewFeature`,
          33  +
/// the execution path will hit the second last match arm as before by virtue of
          34  +
/// calling `as_str` on `GuardrailContentFilterConfidence::NewFeature` also yielding `"NewFeature"`.
          35  +
///
          36  +
/// Explicitly matching on the `Unknown` variant should
          37  +
/// be avoided for two reasons:
          38  +
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
          39  +
/// - It might inadvertently shadow other intended match arms.
          40  +
///
          41  +
#[allow(missing_docs)] // documentation missing in model
          42  +
#[non_exhaustive]
          43  +
#[derive(
          44  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
          45  +
)]
          46  +
pub enum GuardrailContentFilterConfidence {
          47  +
    #[allow(missing_docs)] // documentation missing in model
          48  +
    High,
          49  +
    #[allow(missing_docs)] // documentation missing in model
          50  +
    Low,
          51  +
    #[allow(missing_docs)] // documentation missing in model
          52  +
    Medium,
          53  +
    #[allow(missing_docs)] // documentation missing in model
          54  +
    None,
          55  +
    /// `Unknown` contains new variants that have been added since this code was generated.
          56  +
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
          57  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          58  +
}
          59  +
impl ::std::convert::From<&str> for GuardrailContentFilterConfidence {
          60  +
    fn from(s: &str) -> Self {
          61  +
        match s {
          62  +
            "HIGH" => GuardrailContentFilterConfidence::High,
          63  +
            "LOW" => GuardrailContentFilterConfidence::Low,
          64  +
            "MEDIUM" => GuardrailContentFilterConfidence::Medium,
          65  +
            "NONE" => GuardrailContentFilterConfidence::None,
          66  +
            other => GuardrailContentFilterConfidence::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
          67  +
        }
          68  +
    }
          69  +
}
          70  +
impl ::std::str::FromStr for GuardrailContentFilterConfidence {
          71  +
    type Err = ::std::convert::Infallible;
          72  +
          73  +
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
          74  +
        ::std::result::Result::Ok(GuardrailContentFilterConfidence::from(s))
          75  +
    }
          76  +
}
          77  +
impl GuardrailContentFilterConfidence {
          78  +
    /// Returns the `&str` value of the enum member.
          79  +
    pub fn as_str(&self) -> &str {
          80  +
        match self {
          81  +
            GuardrailContentFilterConfidence::High => "HIGH",
          82  +
            GuardrailContentFilterConfidence::Low => "LOW",
          83  +
            GuardrailContentFilterConfidence::Medium => "MEDIUM",
          84  +
            GuardrailContentFilterConfidence::None => "NONE",
          85  +
            GuardrailContentFilterConfidence::Unknown(value) => value.as_str(),
          86  +
        }
          87  +
    }
          88  +
    /// Returns all the `&str` representations of the enum members.
          89  +
    pub const fn values() -> &'static [&'static str] {
          90  +
        &["HIGH", "LOW", "MEDIUM", "NONE"]
          91  +
    }
          92  +
}
          93  +
impl ::std::convert::AsRef<str> for GuardrailContentFilterConfidence {
          94  +
    fn as_ref(&self) -> &str {
          95  +
        self.as_str()
          96  +
    }
          97  +
}
          98  +
impl GuardrailContentFilterConfidence {
          99  +
    /// Parses the enum value while disallowing unknown variants.
         100  +
    ///
         101  +
    /// Unknown variants will result in an error.
         102  +
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
         103  +
        match Self::from(value) {
         104  +
            #[allow(deprecated)]
         105  +
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
         106  +
            known => Ok(known),
         107  +
        }
         108  +
    }
         109  +
}
         110  +
impl ::std::fmt::Display for GuardrailContentFilterConfidence {
         111  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
         112  +
        match self {
         113  +
            GuardrailContentFilterConfidence::High => write!(f, "HIGH"),
         114  +
            GuardrailContentFilterConfidence::Low => write!(f, "LOW"),
         115  +
            GuardrailContentFilterConfidence::Medium => write!(f, "MEDIUM"),
         116  +
            GuardrailContentFilterConfidence::None => write!(f, "NONE"),
         117  +
            GuardrailContentFilterConfidence::Unknown(value) => write!(f, "{}", value),
         118  +
        }
         119  +
    }
         120  +
}

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

@@ -0,1 +0,120 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// When writing a match expression against `GuardrailContentFilterStrength`, 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 guardrailcontentfilterstrength = unimplemented!();
          14  +
/// match guardrailcontentfilterstrength {
          15  +
///     GuardrailContentFilterStrength::High => { /* ... */ },
          16  +
///     GuardrailContentFilterStrength::Low => { /* ... */ },
          17  +
///     GuardrailContentFilterStrength::Medium => { /* ... */ },
          18  +
///     GuardrailContentFilterStrength::None => { /* ... */ },
          19  +
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          20  +
///     _ => { /* ... */ },
          21  +
/// }
          22  +
/// ```
          23  +
/// The above code demonstrates that when `guardrailcontentfilterstrength` represents
          24  +
/// `NewFeature`, the execution path will lead to the second last match arm,
          25  +
/// even though the enum does not contain a variant `GuardrailContentFilterStrength::NewFeature`
          26  +
/// in the current version of SDK. The reason is that the variable `other`,
          27  +
/// created by the `@` operator, is bound to
          28  +
/// `GuardrailContentFilterStrength::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
          29  +
/// and calling `as_str` on it yields `"NewFeature"`.
          30  +
/// This match expression is forward-compatible when executed with a newer
          31  +
/// version of SDK where the variant `GuardrailContentFilterStrength::NewFeature` is defined.
          32  +
/// Specifically, when `guardrailcontentfilterstrength` represents `NewFeature`,
          33  +
/// the execution path will hit the second last match arm as before by virtue of
          34  +
/// calling `as_str` on `GuardrailContentFilterStrength::NewFeature` also yielding `"NewFeature"`.
          35  +
///
          36  +
/// Explicitly matching on the `Unknown` variant should
          37  +
/// be avoided for two reasons:
          38  +
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
          39  +
/// - It might inadvertently shadow other intended match arms.
          40  +
///
          41  +
#[allow(missing_docs)] // documentation missing in model
          42  +
#[non_exhaustive]
          43  +
#[derive(
          44  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
          45  +
)]
          46  +
pub enum GuardrailContentFilterStrength {
          47  +
    #[allow(missing_docs)] // documentation missing in model
          48  +
    High,
          49  +
    #[allow(missing_docs)] // documentation missing in model
          50  +
    Low,
          51  +
    #[allow(missing_docs)] // documentation missing in model
          52  +
    Medium,
          53  +
    #[allow(missing_docs)] // documentation missing in model
          54  +
    None,
          55  +
    /// `Unknown` contains new variants that have been added since this code was generated.
          56  +
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
          57  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          58  +
}
          59  +
impl ::std::convert::From<&str> for GuardrailContentFilterStrength {
          60  +
    fn from(s: &str) -> Self {
          61  +
        match s {
          62  +
            "HIGH" => GuardrailContentFilterStrength::High,
          63  +
            "LOW" => GuardrailContentFilterStrength::Low,
          64  +
            "MEDIUM" => GuardrailContentFilterStrength::Medium,
          65  +
            "NONE" => GuardrailContentFilterStrength::None,
          66  +
            other => GuardrailContentFilterStrength::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
          67  +
        }
          68  +
    }
          69  +
}
          70  +
impl ::std::str::FromStr for GuardrailContentFilterStrength {
          71  +
    type Err = ::std::convert::Infallible;
          72  +
          73  +
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
          74  +
        ::std::result::Result::Ok(GuardrailContentFilterStrength::from(s))
          75  +
    }
          76  +
}
          77  +
impl GuardrailContentFilterStrength {
          78  +
    /// Returns the `&str` value of the enum member.
          79  +
    pub fn as_str(&self) -> &str {
          80  +
        match self {
          81  +
            GuardrailContentFilterStrength::High => "HIGH",
          82  +
            GuardrailContentFilterStrength::Low => "LOW",
          83  +
            GuardrailContentFilterStrength::Medium => "MEDIUM",
          84  +
            GuardrailContentFilterStrength::None => "NONE",
          85  +
            GuardrailContentFilterStrength::Unknown(value) => value.as_str(),
          86  +
        }
          87  +
    }
          88  +
    /// Returns all the `&str` representations of the enum members.
          89  +
    pub const fn values() -> &'static [&'static str] {
          90  +
        &["HIGH", "LOW", "MEDIUM", "NONE"]
          91  +
    }
          92  +
}
          93  +
impl ::std::convert::AsRef<str> for GuardrailContentFilterStrength {
          94  +
    fn as_ref(&self) -> &str {
          95  +
        self.as_str()
          96  +
    }
          97  +
}
          98  +
impl GuardrailContentFilterStrength {
          99  +
    /// Parses the enum value while disallowing unknown variants.
         100  +
    ///
         101  +
    /// Unknown variants will result in an error.
         102  +
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
         103  +
        match Self::from(value) {
         104  +
            #[allow(deprecated)]
         105  +
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
         106  +
            known => Ok(known),
         107  +
        }
         108  +
    }
         109  +
}
         110  +
impl ::std::fmt::Display for GuardrailContentFilterStrength {
         111  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
         112  +
        match self {
         113  +
            GuardrailContentFilterStrength::High => write!(f, "HIGH"),
         114  +
            GuardrailContentFilterStrength::Low => write!(f, "LOW"),
         115  +
            GuardrailContentFilterStrength::Medium => write!(f, "MEDIUM"),
         116  +
            GuardrailContentFilterStrength::None => write!(f, "NONE"),
         117  +
            GuardrailContentFilterStrength::Unknown(value) => write!(f, "{}", value),
         118  +
        }
         119  +
    }
         120  +
}