AWS SDK

AWS SDK

rev. ba98f30b52e51c6e715b0ae469e7a2e988c27d9a (ignoring whitespace)

Files changed:

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

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

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

@@ -1,0 +108,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `GuardrailContentPolicyAction`, 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 guardrailcontentpolicyaction = unimplemented!();
   14         -
/// match guardrailcontentpolicyaction {
   15         -
///     GuardrailContentPolicyAction::Blocked => { /* ... */ },
   16         -
///     GuardrailContentPolicyAction::None => { /* ... */ },
   17         -
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
   18         -
///     _ => { /* ... */ },
   19         -
/// }
   20         -
/// ```
   21         -
/// The above code demonstrates that when `guardrailcontentpolicyaction` represents
   22         -
/// `NewFeature`, the execution path will lead to the second last match arm,
   23         -
/// even though the enum does not contain a variant `GuardrailContentPolicyAction::NewFeature`
   24         -
/// in the current version of SDK. The reason is that the variable `other`,
   25         -
/// created by the `@` operator, is bound to
   26         -
/// `GuardrailContentPolicyAction::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 `GuardrailContentPolicyAction::NewFeature` is defined.
   30         -
/// Specifically, when `guardrailcontentpolicyaction` represents `NewFeature`,
   31         -
/// the execution path will hit the second last match arm as before by virtue of
   32         -
/// calling `as_str` on `GuardrailContentPolicyAction::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 GuardrailContentPolicyAction {
   45         -
    #[allow(missing_docs)] // documentation missing in model
   46         -
    Blocked,
   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 GuardrailContentPolicyAction {
   54         -
    fn from(s: &str) -> Self {
   55         -
        match s {
   56         -
            "BLOCKED" => GuardrailContentPolicyAction::Blocked,
   57         -
            "NONE" => GuardrailContentPolicyAction::None,
   58         -
            other => GuardrailContentPolicyAction::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   59         -
        }
   60         -
    }
   61         -
}
   62         -
impl ::std::str::FromStr for GuardrailContentPolicyAction {
   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(GuardrailContentPolicyAction::from(s))
   67         -
    }
   68         -
}
   69         -
impl GuardrailContentPolicyAction {
   70         -
    /// Returns the `&str` value of the enum member.
   71         -
    pub fn as_str(&self) -> &str {
   72         -
        match self {
   73         -
            GuardrailContentPolicyAction::Blocked => "BLOCKED",
   74         -
            GuardrailContentPolicyAction::None => "NONE",
   75         -
            GuardrailContentPolicyAction::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         -
        &["BLOCKED", "NONE"]
   81         -
    }
   82         -
}
   83         -
impl ::std::convert::AsRef<str> for GuardrailContentPolicyAction {
   84         -
    fn as_ref(&self) -> &str {
   85         -
        self.as_str()
   86         -
    }
   87         -
}
   88         -
impl GuardrailContentPolicyAction {
   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 GuardrailContentPolicyAction {
  101         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  102         -
        match self {
  103         -
            GuardrailContentPolicyAction::Blocked => write!(f, "BLOCKED"),
  104         -
            GuardrailContentPolicyAction::None => write!(f, "NONE"),
  105         -
            GuardrailContentPolicyAction::Unknown(value) => write!(f, "{}", value),
  106         -
        }
  107         -
    }
  108         -
}

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

@@ -1,0 +64,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>An assessment of a content policy for a guardrail.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailContentPolicyAssessment {
    7         -
    /// <p>The content policy filters.</p>
    8         -
    pub filters: ::std::vec::Vec<crate::types::GuardrailContentFilter>,
    9         -
}
   10         -
impl GuardrailContentPolicyAssessment {
   11         -
    /// <p>The content policy filters.</p>
   12         -
    pub fn filters(&self) -> &[crate::types::GuardrailContentFilter] {
   13         -
        use std::ops::Deref;
   14         -
        self.filters.deref()
   15         -
    }
   16         -
}
   17         -
impl GuardrailContentPolicyAssessment {
   18         -
    /// Creates a new builder-style object to manufacture [`GuardrailContentPolicyAssessment`](crate::types::GuardrailContentPolicyAssessment).
   19         -
    pub fn builder() -> crate::types::builders::GuardrailContentPolicyAssessmentBuilder {
   20         -
        crate::types::builders::GuardrailContentPolicyAssessmentBuilder::default()
   21         -
    }
   22         -
}
   23         -
   24         -
/// A builder for [`GuardrailContentPolicyAssessment`](crate::types::GuardrailContentPolicyAssessment).
   25         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   26         -
#[non_exhaustive]
   27         -
pub struct GuardrailContentPolicyAssessmentBuilder {
   28         -
    pub(crate) filters: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentFilter>>,
   29         -
}
   30         -
impl GuardrailContentPolicyAssessmentBuilder {
   31         -
    /// Appends an item to `filters`.
   32         -
    ///
   33         -
    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
   34         -
    ///
   35         -
    /// <p>The content policy filters.</p>
   36         -
    pub fn filters(mut self, input: crate::types::GuardrailContentFilter) -> Self {
   37         -
        let mut v = self.filters.unwrap_or_default();
   38         -
        v.push(input);
   39         -
        self.filters = ::std::option::Option::Some(v);
   40         -
        self
   41         -
    }
   42         -
    /// <p>The content policy filters.</p>
   43         -
    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentFilter>>) -> Self {
   44         -
        self.filters = input;
   45         -
        self
   46         -
    }
   47         -
    /// <p>The content policy filters.</p>
   48         -
    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentFilter>> {
   49         -
        &self.filters
   50         -
    }
   51         -
    /// Consumes the builder and constructs a [`GuardrailContentPolicyAssessment`](crate::types::GuardrailContentPolicyAssessment).
   52         -
    /// This method will fail if any of the following fields are not set:
   53         -
    /// - [`filters`](crate::types::builders::GuardrailContentPolicyAssessmentBuilder::filters)
   54         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailContentPolicyAssessment, ::aws_smithy_types::error::operation::BuildError> {
   55         -
        ::std::result::Result::Ok(crate::types::GuardrailContentPolicyAssessment {
   56         -
            filters: self.filters.ok_or_else(|| {
   57         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   58         -
                    "filters",
   59         -
                    "filters was not specified but it is required when building GuardrailContentPolicyAssessment",
   60         -
                )
   61         -
            })?,
   62         -
        })
   63         -
    }
   64         -
}

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

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

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

@@ -1,0 +108,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `GuardrailContentSource`, 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 guardrailcontentsource = unimplemented!();
   14         -
/// match guardrailcontentsource {
   15         -
///     GuardrailContentSource::Input => { /* ... */ },
   16         -
///     GuardrailContentSource::Output => { /* ... */ },
   17         -
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
   18         -
///     _ => { /* ... */ },
   19         -
/// }
   20         -
/// ```
   21         -
/// The above code demonstrates that when `guardrailcontentsource` represents
   22         -
/// `NewFeature`, the execution path will lead to the second last match arm,
   23         -
/// even though the enum does not contain a variant `GuardrailContentSource::NewFeature`
   24         -
/// in the current version of SDK. The reason is that the variable `other`,
   25         -
/// created by the `@` operator, is bound to
   26         -
/// `GuardrailContentSource::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 `GuardrailContentSource::NewFeature` is defined.
   30         -
/// Specifically, when `guardrailcontentsource` represents `NewFeature`,
   31         -
/// the execution path will hit the second last match arm as before by virtue of
   32         -
/// calling `as_str` on `GuardrailContentSource::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 GuardrailContentSource {
   45         -
    #[allow(missing_docs)] // documentation missing in model
   46         -
    Input,
   47         -
    #[allow(missing_docs)] // documentation missing in model
   48         -
    Output,
   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 GuardrailContentSource {
   54         -
    fn from(s: &str) -> Self {
   55         -
        match s {
   56         -
            "INPUT" => GuardrailContentSource::Input,
   57         -
            "OUTPUT" => GuardrailContentSource::Output,
   58         -
            other => GuardrailContentSource::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   59         -
        }
   60         -
    }
   61         -
}
   62         -
impl ::std::str::FromStr for GuardrailContentSource {
   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(GuardrailContentSource::from(s))
   67         -
    }
   68         -
}
   69         -
impl GuardrailContentSource {
   70         -
    /// Returns the `&str` value of the enum member.
   71         -
    pub fn as_str(&self) -> &str {
   72         -
        match self {
   73         -
            GuardrailContentSource::Input => "INPUT",
   74         -
            GuardrailContentSource::Output => "OUTPUT",
   75         -
            GuardrailContentSource::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         -
        &["INPUT", "OUTPUT"]
   81         -
    }
   82         -
}
   83         -
impl ::std::convert::AsRef<str> for GuardrailContentSource {
   84         -
    fn as_ref(&self) -> &str {
   85         -
        self.as_str()
   86         -
    }
   87         -
}
   88         -
impl GuardrailContentSource {
   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 GuardrailContentSource {
  101         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  102         -
        match self {
  103         -
            GuardrailContentSource::Input => write!(f, "INPUT"),
  104         -
            GuardrailContentSource::Output => write!(f, "OUTPUT"),
  105         -
            GuardrailContentSource::Unknown(value) => write!(f, "{}", value),
  106         -
        }
  107         -
    }
  108         -
}

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

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

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

@@ -1,0 +108,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `GuardrailContextualGroundingFilterType`, 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 guardrailcontextualgroundingfiltertype = unimplemented!();
   14         -
/// match guardrailcontextualgroundingfiltertype {
   15         -
///     GuardrailContextualGroundingFilterType::Grounding => { /* ... */ },
   16         -
///     GuardrailContextualGroundingFilterType::Relevance => { /* ... */ },
   17         -
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
   18         -
///     _ => { /* ... */ },
   19         -
/// }
   20         -
/// ```
   21         -
/// The above code demonstrates that when `guardrailcontextualgroundingfiltertype` represents
   22         -
/// `NewFeature`, the execution path will lead to the second last match arm,
   23         -
/// even though the enum does not contain a variant `GuardrailContextualGroundingFilterType::NewFeature`
   24         -
/// in the current version of SDK. The reason is that the variable `other`,
   25         -
/// created by the `@` operator, is bound to
   26         -
/// `GuardrailContextualGroundingFilterType::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 `GuardrailContextualGroundingFilterType::NewFeature` is defined.
   30         -
/// Specifically, when `guardrailcontextualgroundingfiltertype` represents `NewFeature`,
   31         -
/// the execution path will hit the second last match arm as before by virtue of
   32         -
/// calling `as_str` on `GuardrailContextualGroundingFilterType::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 GuardrailContextualGroundingFilterType {
   45         -
    #[allow(missing_docs)] // documentation missing in model
   46         -
    Grounding,
   47         -
    #[allow(missing_docs)] // documentation missing in model
   48         -
    Relevance,
   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 GuardrailContextualGroundingFilterType {
   54         -
    fn from(s: &str) -> Self {
   55         -
        match s {
   56         -
            "GROUNDING" => GuardrailContextualGroundingFilterType::Grounding,
   57         -
            "RELEVANCE" => GuardrailContextualGroundingFilterType::Relevance,
   58         -
            other => GuardrailContextualGroundingFilterType::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   59         -
        }
   60         -
    }
   61         -
}
   62         -
impl ::std::str::FromStr for GuardrailContextualGroundingFilterType {
   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(GuardrailContextualGroundingFilterType::from(s))
   67         -
    }
   68         -
}
   69         -
impl GuardrailContextualGroundingFilterType {
   70         -
    /// Returns the `&str` value of the enum member.
   71         -
    pub fn as_str(&self) -> &str {
   72         -
        match self {
   73         -
            GuardrailContextualGroundingFilterType::Grounding => "GROUNDING",
   74         -
            GuardrailContextualGroundingFilterType::Relevance => "RELEVANCE",
   75         -
            GuardrailContextualGroundingFilterType::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         -
        &["GROUNDING", "RELEVANCE"]
   81         -
    }
   82         -
}
   83         -
impl ::std::convert::AsRef<str> for GuardrailContextualGroundingFilterType {
   84         -
    fn as_ref(&self) -> &str {
   85         -
        self.as_str()
   86         -
    }
   87         -
}
   88         -
impl GuardrailContextualGroundingFilterType {
   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 GuardrailContextualGroundingFilterType {
  101         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  102         -
        match self {
  103         -
            GuardrailContextualGroundingFilterType::Grounding => write!(f, "GROUNDING"),
  104         -
            GuardrailContextualGroundingFilterType::Relevance => write!(f, "RELEVANCE"),
  105         -
            GuardrailContextualGroundingFilterType::Unknown(value) => write!(f, "{}", value),
  106         -
        }
  107         -
    }
  108         -
}

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

@@ -1,0 +108,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `GuardrailContextualGroundingPolicyAction`, 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 guardrailcontextualgroundingpolicyaction = unimplemented!();
   14         -
/// match guardrailcontextualgroundingpolicyaction {
   15         -
///     GuardrailContextualGroundingPolicyAction::Blocked => { /* ... */ },
   16         -
///     GuardrailContextualGroundingPolicyAction::None => { /* ... */ },
   17         -
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
   18         -
///     _ => { /* ... */ },
   19         -
/// }
   20         -
/// ```
   21         -
/// The above code demonstrates that when `guardrailcontextualgroundingpolicyaction` represents
   22         -
/// `NewFeature`, the execution path will lead to the second last match arm,
   23         -
/// even though the enum does not contain a variant `GuardrailContextualGroundingPolicyAction::NewFeature`
   24         -
/// in the current version of SDK. The reason is that the variable `other`,
   25         -
/// created by the `@` operator, is bound to
   26         -
/// `GuardrailContextualGroundingPolicyAction::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 `GuardrailContextualGroundingPolicyAction::NewFeature` is defined.
   30         -
/// Specifically, when `guardrailcontextualgroundingpolicyaction` represents `NewFeature`,
   31         -
/// the execution path will hit the second last match arm as before by virtue of
   32         -
/// calling `as_str` on `GuardrailContextualGroundingPolicyAction::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 GuardrailContextualGroundingPolicyAction {
   45         -
    #[allow(missing_docs)] // documentation missing in model
   46         -
    Blocked,
   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 GuardrailContextualGroundingPolicyAction {
   54         -
    fn from(s: &str) -> Self {
   55         -
        match s {
   56         -
            "BLOCKED" => GuardrailContextualGroundingPolicyAction::Blocked,
   57         -
            "NONE" => GuardrailContextualGroundingPolicyAction::None,
   58         -
            other => GuardrailContextualGroundingPolicyAction::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   59         -
        }
   60         -
    }
   61         -
}
   62         -
impl ::std::str::FromStr for GuardrailContextualGroundingPolicyAction {
   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(GuardrailContextualGroundingPolicyAction::from(s))
   67         -
    }
   68         -
}
   69         -
impl GuardrailContextualGroundingPolicyAction {
   70         -
    /// Returns the `&str` value of the enum member.
   71         -
    pub fn as_str(&self) -> &str {
   72         -
        match self {
   73         -
            GuardrailContextualGroundingPolicyAction::Blocked => "BLOCKED",
   74         -
            GuardrailContextualGroundingPolicyAction::None => "NONE",
   75         -
            GuardrailContextualGroundingPolicyAction::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         -
        &["BLOCKED", "NONE"]
   81         -
    }
   82         -
}
   83         -
impl ::std::convert::AsRef<str> for GuardrailContextualGroundingPolicyAction {
   84         -
    fn as_ref(&self) -> &str {
   85         -
        self.as_str()
   86         -
    }
   87         -
}
   88         -
impl GuardrailContextualGroundingPolicyAction {
   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 GuardrailContextualGroundingPolicyAction {
  101         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  102         -
        match self {
  103         -
            GuardrailContextualGroundingPolicyAction::Blocked => write!(f, "BLOCKED"),
  104         -
            GuardrailContextualGroundingPolicyAction::None => write!(f, "NONE"),
  105         -
            GuardrailContextualGroundingPolicyAction::Unknown(value) => write!(f, "{}", value),
  106         -
        }
  107         -
    }
  108         -
}

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

@@ -1,0 +56,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The policy assessment details for the guardrails contextual grounding filter.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailContextualGroundingPolicyAssessment {
    7         -
    /// <p>The filter details for the guardrails contextual grounding filter.</p>
    8         -
    pub filters: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContextualGroundingFilter>>,
    9         -
}
   10         -
impl GuardrailContextualGroundingPolicyAssessment {
   11         -
    /// <p>The filter details for the guardrails contextual grounding filter.</p>
   12         -
    ///
   13         -
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.filters.is_none()`.
   14         -
    pub fn filters(&self) -> &[crate::types::GuardrailContextualGroundingFilter] {
   15         -
        self.filters.as_deref().unwrap_or_default()
   16         -
    }
   17         -
}
   18         -
impl GuardrailContextualGroundingPolicyAssessment {
   19         -
    /// Creates a new builder-style object to manufacture [`GuardrailContextualGroundingPolicyAssessment`](crate::types::GuardrailContextualGroundingPolicyAssessment).
   20         -
    pub fn builder() -> crate::types::builders::GuardrailContextualGroundingPolicyAssessmentBuilder {
   21         -
        crate::types::builders::GuardrailContextualGroundingPolicyAssessmentBuilder::default()
   22         -
    }
   23         -
}
   24         -
   25         -
/// A builder for [`GuardrailContextualGroundingPolicyAssessment`](crate::types::GuardrailContextualGroundingPolicyAssessment).
   26         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   27         -
#[non_exhaustive]
   28         -
pub struct GuardrailContextualGroundingPolicyAssessmentBuilder {
   29         -
    pub(crate) filters: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContextualGroundingFilter>>,
   30         -
}
   31         -
impl GuardrailContextualGroundingPolicyAssessmentBuilder {
   32         -
    /// Appends an item to `filters`.
   33         -
    ///
   34         -
    /// To override the contents of this collection use [`set_filters`](Self::set_filters).
   35         -
    ///
   36         -
    /// <p>The filter details for the guardrails contextual grounding filter.</p>
   37         -
    pub fn filters(mut self, input: crate::types::GuardrailContextualGroundingFilter) -> Self {
   38         -
        let mut v = self.filters.unwrap_or_default();
   39         -
        v.push(input);
   40         -
        self.filters = ::std::option::Option::Some(v);
   41         -
        self
   42         -
    }
   43         -
    /// <p>The filter details for the guardrails contextual grounding filter.</p>
   44         -
    pub fn set_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContextualGroundingFilter>>) -> Self {
   45         -
        self.filters = input;
   46         -
        self
   47         -
    }
   48         -
    /// <p>The filter details for the guardrails contextual grounding filter.</p>
   49         -
    pub fn get_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailContextualGroundingFilter>> {
   50         -
        &self.filters
   51         -
    }
   52         -
    /// Consumes the builder and constructs a [`GuardrailContextualGroundingPolicyAssessment`](crate::types::GuardrailContextualGroundingPolicyAssessment).
   53         -
    pub fn build(self) -> crate::types::GuardrailContextualGroundingPolicyAssessment {
   54         -
        crate::types::GuardrailContextualGroundingPolicyAssessment { filters: self.filters }
   55         -
    }
   56         -
}

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

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