AWS SDK

AWS SDK

rev. ba98f30b52e51c6e715b0ae469e7a2e988c27d9a (ignoring whitespace)

Files changed:

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/types/_guardrail_converse_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 `GuardrailConverseContentQualifier`, 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 guardrailconversecontentqualifier = unimplemented!();
   14         -
/// match guardrailconversecontentqualifier {
   15         -
///     GuardrailConverseContentQualifier::GroundingSource => { /* ... */ },
   16         -
///     GuardrailConverseContentQualifier::GuardContent => { /* ... */ },
   17         -
///     GuardrailConverseContentQualifier::Query => { /* ... */ },
   18         -
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
   19         -
///     _ => { /* ... */ },
   20         -
/// }
   21         -
/// ```
   22         -
/// The above code demonstrates that when `guardrailconversecontentqualifier` represents
   23         -
/// `NewFeature`, the execution path will lead to the second last match arm,
   24         -
/// even though the enum does not contain a variant `GuardrailConverseContentQualifier::NewFeature`
   25         -
/// in the current version of SDK. The reason is that the variable `other`,
   26         -
/// created by the `@` operator, is bound to
   27         -
/// `GuardrailConverseContentQualifier::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 `GuardrailConverseContentQualifier::NewFeature` is defined.
   31         -
/// Specifically, when `guardrailconversecontentqualifier` represents `NewFeature`,
   32         -
/// the execution path will hit the second last match arm as before by virtue of
   33         -
/// calling `as_str` on `GuardrailConverseContentQualifier::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 GuardrailConverseContentQualifier {
   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 GuardrailConverseContentQualifier {
   57         -
    fn from(s: &str) -> Self {
   58         -
        match s {
   59         -
            "grounding_source" => GuardrailConverseContentQualifier::GroundingSource,
   60         -
            "guard_content" => GuardrailConverseContentQualifier::GuardContent,
   61         -
            "query" => GuardrailConverseContentQualifier::Query,
   62         -
            other => GuardrailConverseContentQualifier::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   63         -
        }
   64         -
    }
   65         -
}
   66         -
impl ::std::str::FromStr for GuardrailConverseContentQualifier {
   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(GuardrailConverseContentQualifier::from(s))
   71         -
    }
   72         -
}
   73         -
impl GuardrailConverseContentQualifier {
   74         -
    /// Returns the `&str` value of the enum member.
   75         -
    pub fn as_str(&self) -> &str {
   76         -
        match self {
   77         -
            GuardrailConverseContentQualifier::GroundingSource => "grounding_source",
   78         -
            GuardrailConverseContentQualifier::GuardContent => "guard_content",
   79         -
            GuardrailConverseContentQualifier::Query => "query",
   80         -
            GuardrailConverseContentQualifier::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 GuardrailConverseContentQualifier {
   89         -
    fn as_ref(&self) -> &str {
   90         -
        self.as_str()
   91         -
    }
   92         -
}
   93         -
impl GuardrailConverseContentQualifier {
   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 GuardrailConverseContentQualifier {
  106         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  107         -
        match self {
  108         -
            GuardrailConverseContentQualifier::GroundingSource => write!(f, "grounding_source"),
  109         -
            GuardrailConverseContentQualifier::GuardContent => write!(f, "guard_content"),
  110         -
            GuardrailConverseContentQualifier::Query => write!(f, "query"),
  111         -
            GuardrailConverseContentQualifier::Unknown(value) => write!(f, "{}", value),
  112         -
        }
  113         -
    }
  114         -
}

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

@@ -1,0 +97,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>An image block that contains images that you want to assess with a guardrail.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
    6         -
pub struct GuardrailConverseImageBlock {
    7         -
    /// <p>The format details for the image type of the guardrail converse image block.</p>
    8         -
    pub format: crate::types::GuardrailConverseImageFormat,
    9         -
    /// <p>The image source (image bytes) of the guardrail converse image block.</p>
   10         -
    pub source: ::std::option::Option<crate::types::GuardrailConverseImageSource>,
   11         -
}
   12         -
impl GuardrailConverseImageBlock {
   13         -
    /// <p>The format details for the image type of the guardrail converse image block.</p>
   14         -
    pub fn format(&self) -> &crate::types::GuardrailConverseImageFormat {
   15         -
        &self.format
   16         -
    }
   17         -
    /// <p>The image source (image bytes) of the guardrail converse image block.</p>
   18         -
    pub fn source(&self) -> ::std::option::Option<&crate::types::GuardrailConverseImageSource> {
   19         -
        self.source.as_ref()
   20         -
    }
   21         -
}
   22         -
impl ::std::fmt::Debug for GuardrailConverseImageBlock {
   23         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
   24         -
        let mut formatter = f.debug_struct("GuardrailConverseImageBlock");
   25         -
        formatter.field("format", &"*** Sensitive Data Redacted ***");
   26         -
        formatter.field("source", &"*** Sensitive Data Redacted ***");
   27         -
        formatter.finish()
   28         -
    }
   29         -
}
   30         -
impl GuardrailConverseImageBlock {
   31         -
    /// Creates a new builder-style object to manufacture [`GuardrailConverseImageBlock`](crate::types::GuardrailConverseImageBlock).
   32         -
    pub fn builder() -> crate::types::builders::GuardrailConverseImageBlockBuilder {
   33         -
        crate::types::builders::GuardrailConverseImageBlockBuilder::default()
   34         -
    }
   35         -
}
   36         -
   37         -
/// A builder for [`GuardrailConverseImageBlock`](crate::types::GuardrailConverseImageBlock).
   38         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
   39         -
#[non_exhaustive]
   40         -
pub struct GuardrailConverseImageBlockBuilder {
   41         -
    pub(crate) format: ::std::option::Option<crate::types::GuardrailConverseImageFormat>,
   42         -
    pub(crate) source: ::std::option::Option<crate::types::GuardrailConverseImageSource>,
   43         -
}
   44         -
impl GuardrailConverseImageBlockBuilder {
   45         -
    /// <p>The format details for the image type of the guardrail converse image block.</p>
   46         -
    /// This field is required.
   47         -
    pub fn format(mut self, input: crate::types::GuardrailConverseImageFormat) -> Self {
   48         -
        self.format = ::std::option::Option::Some(input);
   49         -
        self
   50         -
    }
   51         -
    /// <p>The format details for the image type of the guardrail converse image block.</p>
   52         -
    pub fn set_format(mut self, input: ::std::option::Option<crate::types::GuardrailConverseImageFormat>) -> Self {
   53         -
        self.format = input;
   54         -
        self
   55         -
    }
   56         -
    /// <p>The format details for the image type of the guardrail converse image block.</p>
   57         -
    pub fn get_format(&self) -> &::std::option::Option<crate::types::GuardrailConverseImageFormat> {
   58         -
        &self.format
   59         -
    }
   60         -
    /// <p>The image source (image bytes) of the guardrail converse image block.</p>
   61         -
    /// This field is required.
   62         -
    pub fn source(mut self, input: crate::types::GuardrailConverseImageSource) -> Self {
   63         -
        self.source = ::std::option::Option::Some(input);
   64         -
        self
   65         -
    }
   66         -
    /// <p>The image source (image bytes) of the guardrail converse image block.</p>
   67         -
    pub fn set_source(mut self, input: ::std::option::Option<crate::types::GuardrailConverseImageSource>) -> Self {
   68         -
        self.source = input;
   69         -
        self
   70         -
    }
   71         -
    /// <p>The image source (image bytes) of the guardrail converse image block.</p>
   72         -
    pub fn get_source(&self) -> &::std::option::Option<crate::types::GuardrailConverseImageSource> {
   73         -
        &self.source
   74         -
    }
   75         -
    /// Consumes the builder and constructs a [`GuardrailConverseImageBlock`](crate::types::GuardrailConverseImageBlock).
   76         -
    /// This method will fail if any of the following fields are not set:
   77         -
    /// - [`format`](crate::types::builders::GuardrailConverseImageBlockBuilder::format)
   78         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailConverseImageBlock, ::aws_smithy_types::error::operation::BuildError> {
   79         -
        ::std::result::Result::Ok(crate::types::GuardrailConverseImageBlock {
   80         -
            format: self.format.ok_or_else(|| {
   81         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   82         -
                    "format",
   83         -
                    "format was not specified but it is required when building GuardrailConverseImageBlock",
   84         -
                )
   85         -
            })?,
   86         -
            source: self.source,
   87         -
        })
   88         -
    }
   89         -
}
   90         -
impl ::std::fmt::Debug for GuardrailConverseImageBlockBuilder {
   91         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
   92         -
        let mut formatter = f.debug_struct("GuardrailConverseImageBlockBuilder");
   93         -
        formatter.field("format", &"*** Sensitive Data Redacted ***");
   94         -
        formatter.field("source", &"*** Sensitive Data Redacted ***");
   95         -
        formatter.finish()
   96         -
    }
   97         -
}

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

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

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

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

@@ -1,0 +89,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>A text block that contains text that you want to assess with a guardrail. For more information, see <code>GuardrailConverseContentBlock</code>.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailConverseTextBlock {
    7         -
    /// <p>The text that you want to guard.</p>
    8         -
    pub text: ::std::string::String,
    9         -
    /// <p>The qualifier details for the guardrails contextual grounding filter.</p>
   10         -
    pub qualifiers: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailConverseContentQualifier>>,
   11         -
}
   12         -
impl GuardrailConverseTextBlock {
   13         -
    /// <p>The text that you want to guard.</p>
   14         -
    pub fn text(&self) -> &str {
   15         -
        use std::ops::Deref;
   16         -
        self.text.deref()
   17         -
    }
   18         -
    /// <p>The qualifier details for the guardrails contextual grounding filter.</p>
   19         -
    ///
   20         -
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.qualifiers.is_none()`.
   21         -
    pub fn qualifiers(&self) -> &[crate::types::GuardrailConverseContentQualifier] {
   22         -
        self.qualifiers.as_deref().unwrap_or_default()
   23         -
    }
   24         -
}
   25         -
impl GuardrailConverseTextBlock {
   26         -
    /// Creates a new builder-style object to manufacture [`GuardrailConverseTextBlock`](crate::types::GuardrailConverseTextBlock).
   27         -
    pub fn builder() -> crate::types::builders::GuardrailConverseTextBlockBuilder {
   28         -
        crate::types::builders::GuardrailConverseTextBlockBuilder::default()
   29         -
    }
   30         -
}
   31         -
   32         -
/// A builder for [`GuardrailConverseTextBlock`](crate::types::GuardrailConverseTextBlock).
   33         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   34         -
#[non_exhaustive]
   35         -
pub struct GuardrailConverseTextBlockBuilder {
   36         -
    pub(crate) text: ::std::option::Option<::std::string::String>,
   37         -
    pub(crate) qualifiers: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailConverseContentQualifier>>,
   38         -
}
   39         -
impl GuardrailConverseTextBlockBuilder {
   40         -
    /// <p>The text that you want to guard.</p>
   41         -
    /// This field is required.
   42         -
    pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
   43         -
        self.text = ::std::option::Option::Some(input.into());
   44         -
        self
   45         -
    }
   46         -
    /// <p>The text that you want to guard.</p>
   47         -
    pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
   48         -
        self.text = input;
   49         -
        self
   50         -
    }
   51         -
    /// <p>The text that you want to guard.</p>
   52         -
    pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
   53         -
        &self.text
   54         -
    }
   55         -
    /// Appends an item to `qualifiers`.
   56         -
    ///
   57         -
    /// To override the contents of this collection use [`set_qualifiers`](Self::set_qualifiers).
   58         -
    ///
   59         -
    /// <p>The qualifier details for the guardrails contextual grounding filter.</p>
   60         -
    pub fn qualifiers(mut self, input: crate::types::GuardrailConverseContentQualifier) -> Self {
   61         -
        let mut v = self.qualifiers.unwrap_or_default();
   62         -
        v.push(input);
   63         -
        self.qualifiers = ::std::option::Option::Some(v);
   64         -
        self
   65         -
    }
   66         -
    /// <p>The qualifier details for the guardrails contextual grounding filter.</p>
   67         -
    pub fn set_qualifiers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailConverseContentQualifier>>) -> Self {
   68         -
        self.qualifiers = input;
   69         -
        self
   70         -
    }
   71         -
    /// <p>The qualifier details for the guardrails contextual grounding filter.</p>
   72         -
    pub fn get_qualifiers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailConverseContentQualifier>> {
   73         -
        &self.qualifiers
   74         -
    }
   75         -
    /// Consumes the builder and constructs a [`GuardrailConverseTextBlock`](crate::types::GuardrailConverseTextBlock).
   76         -
    /// This method will fail if any of the following fields are not set:
   77         -
    /// - [`text`](crate::types::builders::GuardrailConverseTextBlockBuilder::text)
   78         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailConverseTextBlock, ::aws_smithy_types::error::operation::BuildError> {
   79         -
        ::std::result::Result::Ok(crate::types::GuardrailConverseTextBlock {
   80         -
            text: self.text.ok_or_else(|| {
   81         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   82         -
                    "text",
   83         -
                    "text was not specified but it is required when building GuardrailConverseTextBlock",
   84         -
                )
   85         -
            })?,
   86         -
            qualifiers: self.qualifiers,
   87         -
        })
   88         -
    }
   89         -
}

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

@@ -1,0 +72,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The action of the guardrail coverage details.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailCoverage {
    7         -
    /// <p>The text characters of the guardrail coverage details.</p>
    8         -
    pub text_characters: ::std::option::Option<crate::types::GuardrailTextCharactersCoverage>,
    9         -
    /// <p>The guardrail coverage for images (the number of images that guardrails guarded).</p>
   10         -
    pub images: ::std::option::Option<crate::types::GuardrailImageCoverage>,
   11         -
}
   12         -
impl GuardrailCoverage {
   13         -
    /// <p>The text characters of the guardrail coverage details.</p>
   14         -
    pub fn text_characters(&self) -> ::std::option::Option<&crate::types::GuardrailTextCharactersCoverage> {
   15         -
        self.text_characters.as_ref()
   16         -
    }
   17         -
    /// <p>The guardrail coverage for images (the number of images that guardrails guarded).</p>
   18         -
    pub fn images(&self) -> ::std::option::Option<&crate::types::GuardrailImageCoverage> {
   19         -
        self.images.as_ref()
   20         -
    }
   21         -
}
   22         -
impl GuardrailCoverage {
   23         -
    /// Creates a new builder-style object to manufacture [`GuardrailCoverage`](crate::types::GuardrailCoverage).
   24         -
    pub fn builder() -> crate::types::builders::GuardrailCoverageBuilder {
   25         -
        crate::types::builders::GuardrailCoverageBuilder::default()
   26         -
    }
   27         -
}
   28         -
   29         -
/// A builder for [`GuardrailCoverage`](crate::types::GuardrailCoverage).
   30         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   31         -
#[non_exhaustive]
   32         -
pub struct GuardrailCoverageBuilder {
   33         -
    pub(crate) text_characters: ::std::option::Option<crate::types::GuardrailTextCharactersCoverage>,
   34         -
    pub(crate) images: ::std::option::Option<crate::types::GuardrailImageCoverage>,
   35         -
}
   36         -
impl GuardrailCoverageBuilder {
   37         -
    /// <p>The text characters of the guardrail coverage details.</p>
   38         -
    pub fn text_characters(mut self, input: crate::types::GuardrailTextCharactersCoverage) -> Self {
   39         -
        self.text_characters = ::std::option::Option::Some(input);
   40         -
        self
   41         -
    }
   42         -
    /// <p>The text characters of the guardrail coverage details.</p>
   43         -
    pub fn set_text_characters(mut self, input: ::std::option::Option<crate::types::GuardrailTextCharactersCoverage>) -> Self {
   44         -
        self.text_characters = input;
   45         -
        self
   46         -
    }
   47         -
    /// <p>The text characters of the guardrail coverage details.</p>
   48         -
    pub fn get_text_characters(&self) -> &::std::option::Option<crate::types::GuardrailTextCharactersCoverage> {
   49         -
        &self.text_characters
   50         -
    }
   51         -
    /// <p>The guardrail coverage for images (the number of images that guardrails guarded).</p>
   52         -
    pub fn images(mut self, input: crate::types::GuardrailImageCoverage) -> Self {
   53         -
        self.images = ::std::option::Option::Some(input);
   54         -
        self
   55         -
    }
   56         -
    /// <p>The guardrail coverage for images (the number of images that guardrails guarded).</p>
   57         -
    pub fn set_images(mut self, input: ::std::option::Option<crate::types::GuardrailImageCoverage>) -> Self {
   58         -
        self.images = input;
   59         -
        self
   60         -
    }
   61         -
    /// <p>The guardrail coverage for images (the number of images that guardrails guarded).</p>
   62         -
    pub fn get_images(&self) -> &::std::option::Option<crate::types::GuardrailImageCoverage> {
   63         -
        &self.images
   64         -
    }
   65         -
    /// Consumes the builder and constructs a [`GuardrailCoverage`](crate::types::GuardrailCoverage).
   66         -
    pub fn build(self) -> crate::types::GuardrailCoverage {
   67         -
        crate::types::GuardrailCoverage {
   68         -
            text_characters: self.text_characters,
   69         -
            images: self.images,
   70         -
        }
   71         -
    }
   72         -
}

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

@@ -1,0 +110,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>A custom word configured in a guardrail.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailCustomWord {
    7         -
    /// <p>The match for the custom word.</p>
    8         -
    pub r#match: ::std::string::String,
    9         -
    /// <p>The action for the custom word.</p>
   10         -
    pub action: crate::types::GuardrailWordPolicyAction,
   11         -
    /// <p>Indicates whether custom word content that breaches the guardrail configuration is detected.</p>
   12         -
    pub detected: ::std::option::Option<bool>,
   13         -
}
   14         -
impl GuardrailCustomWord {
   15         -
    /// <p>The match for the custom word.</p>
   16         -
    pub fn r#match(&self) -> &str {
   17         -
        use std::ops::Deref;
   18         -
        self.r#match.deref()
   19         -
    }
   20         -
    /// <p>The action for the custom word.</p>
   21         -
    pub fn action(&self) -> &crate::types::GuardrailWordPolicyAction {
   22         -
        &self.action
   23         -
    }
   24         -
    /// <p>Indicates whether custom word content that breaches the guardrail configuration is detected.</p>
   25         -
    pub fn detected(&self) -> ::std::option::Option<bool> {
   26         -
        self.detected
   27         -
    }
   28         -
}
   29         -
impl GuardrailCustomWord {
   30         -
    /// Creates a new builder-style object to manufacture [`GuardrailCustomWord`](crate::types::GuardrailCustomWord).
   31         -
    pub fn builder() -> crate::types::builders::GuardrailCustomWordBuilder {
   32         -
        crate::types::builders::GuardrailCustomWordBuilder::default()
   33         -
    }
   34         -
}
   35         -
   36         -
/// A builder for [`GuardrailCustomWord`](crate::types::GuardrailCustomWord).
   37         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   38         -
#[non_exhaustive]
   39         -
pub struct GuardrailCustomWordBuilder {
   40         -
    pub(crate) r#match: ::std::option::Option<::std::string::String>,
   41         -
    pub(crate) action: ::std::option::Option<crate::types::GuardrailWordPolicyAction>,
   42         -
    pub(crate) detected: ::std::option::Option<bool>,
   43         -
}
   44         -
impl GuardrailCustomWordBuilder {
   45         -
    /// <p>The match for the custom word.</p>
   46         -
    /// This field is required.
   47         -
    pub fn r#match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
   48         -
        self.r#match = ::std::option::Option::Some(input.into());
   49         -
        self
   50         -
    }
   51         -
    /// <p>The match for the custom word.</p>
   52         -
    pub fn set_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
   53         -
        self.r#match = input;
   54         -
        self
   55         -
    }
   56         -
    /// <p>The match for the custom word.</p>
   57         -
    pub fn get_match(&self) -> &::std::option::Option<::std::string::String> {
   58         -
        &self.r#match
   59         -
    }
   60         -
    /// <p>The action for the custom word.</p>
   61         -
    /// This field is required.
   62         -
    pub fn action(mut self, input: crate::types::GuardrailWordPolicyAction) -> Self {
   63         -
        self.action = ::std::option::Option::Some(input);
   64         -
        self
   65         -
    }
   66         -
    /// <p>The action for the custom word.</p>
   67         -
    pub fn set_action(mut self, input: ::std::option::Option<crate::types::GuardrailWordPolicyAction>) -> Self {
   68         -
        self.action = input;
   69         -
        self
   70         -
    }
   71         -
    /// <p>The action for the custom word.</p>
   72         -
    pub fn get_action(&self) -> &::std::option::Option<crate::types::GuardrailWordPolicyAction> {
   73         -
        &self.action
   74         -
    }
   75         -
    /// <p>Indicates whether custom word content that breaches the guardrail configuration is detected.</p>
   76         -
    pub fn detected(mut self, input: bool) -> Self {
   77         -
        self.detected = ::std::option::Option::Some(input);
   78         -
        self
   79         -
    }
   80         -
    /// <p>Indicates whether custom word content that breaches the guardrail configuration is detected.</p>
   81         -
    pub fn set_detected(mut self, input: ::std::option::Option<bool>) -> Self {
   82         -
        self.detected = input;
   83         -
        self
   84         -
    }
   85         -
    /// <p>Indicates whether custom word content that breaches the guardrail configuration is detected.</p>
   86         -
    pub fn get_detected(&self) -> &::std::option::Option<bool> {
   87         -
        &self.detected
   88         -
    }
   89         -
    /// Consumes the builder and constructs a [`GuardrailCustomWord`](crate::types::GuardrailCustomWord).
   90         -
    /// This method will fail if any of the following fields are not set:
   91         -
    /// - [`r#match`](crate::types::builders::GuardrailCustomWordBuilder::match)
   92         -
    /// - [`action`](crate::types::builders::GuardrailCustomWordBuilder::action)
   93         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailCustomWord, ::aws_smithy_types::error::operation::BuildError> {
   94         -
        ::std::result::Result::Ok(crate::types::GuardrailCustomWord {
   95         -
            r#match: self.r#match.ok_or_else(|| {
   96         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   97         -
                    "r#match",
   98         -
                    "r#match was not specified but it is required when building GuardrailCustomWord",
   99         -
                )
  100         -
            })?,
  101         -
            action: self.action.ok_or_else(|| {
  102         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
  103         -
                    "action",
  104         -
                    "action was not specified but it is required when building GuardrailCustomWord",
  105         -
                )
  106         -
            })?,
  107         -
            detected: self.detected,
  108         -
        })
  109         -
    }
  110         -
}

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

@@ -1,0 +97,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>Contain an image which user wants guarded. This block is accepted by the guardrails independent API.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
    6         -
pub struct GuardrailImageBlock {
    7         -
    /// <p>The format details for the file type of the image blocked by the guardrail.</p>
    8         -
    pub format: crate::types::GuardrailImageFormat,
    9         -
    /// <p>The image source (image bytes) details of the image blocked by the guardrail.</p>
   10         -
    pub source: ::std::option::Option<crate::types::GuardrailImageSource>,
   11         -
}
   12         -
impl GuardrailImageBlock {
   13         -
    /// <p>The format details for the file type of the image blocked by the guardrail.</p>
   14         -
    pub fn format(&self) -> &crate::types::GuardrailImageFormat {
   15         -
        &self.format
   16         -
    }
   17         -
    /// <p>The image source (image bytes) details of the image blocked by the guardrail.</p>
   18         -
    pub fn source(&self) -> ::std::option::Option<&crate::types::GuardrailImageSource> {
   19         -
        self.source.as_ref()
   20         -
    }
   21         -
}
   22         -
impl ::std::fmt::Debug for GuardrailImageBlock {
   23         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
   24         -
        let mut formatter = f.debug_struct("GuardrailImageBlock");
   25         -
        formatter.field("format", &"*** Sensitive Data Redacted ***");
   26         -
        formatter.field("source", &"*** Sensitive Data Redacted ***");
   27         -
        formatter.finish()
   28         -
    }
   29         -
}
   30         -
impl GuardrailImageBlock {
   31         -
    /// Creates a new builder-style object to manufacture [`GuardrailImageBlock`](crate::types::GuardrailImageBlock).
   32         -
    pub fn builder() -> crate::types::builders::GuardrailImageBlockBuilder {
   33         -
        crate::types::builders::GuardrailImageBlockBuilder::default()
   34         -
    }
   35         -
}
   36         -
   37         -
/// A builder for [`GuardrailImageBlock`](crate::types::GuardrailImageBlock).
   38         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
   39         -
#[non_exhaustive]
   40         -
pub struct GuardrailImageBlockBuilder {
   41         -
    pub(crate) format: ::std::option::Option<crate::types::GuardrailImageFormat>,
   42         -
    pub(crate) source: ::std::option::Option<crate::types::GuardrailImageSource>,
   43         -
}
   44         -
impl GuardrailImageBlockBuilder {
   45         -
    /// <p>The format details for the file type of the image blocked by the guardrail.</p>
   46         -
    /// This field is required.
   47         -
    pub fn format(mut self, input: crate::types::GuardrailImageFormat) -> Self {
   48         -
        self.format = ::std::option::Option::Some(input);
   49         -
        self
   50         -
    }
   51         -
    /// <p>The format details for the file type of the image blocked by the guardrail.</p>
   52         -
    pub fn set_format(mut self, input: ::std::option::Option<crate::types::GuardrailImageFormat>) -> Self {
   53         -
        self.format = input;
   54         -
        self
   55         -
    }
   56         -
    /// <p>The format details for the file type of the image blocked by the guardrail.</p>
   57         -
    pub fn get_format(&self) -> &::std::option::Option<crate::types::GuardrailImageFormat> {
   58         -
        &self.format
   59         -
    }
   60         -
    /// <p>The image source (image bytes) details of the image blocked by the guardrail.</p>
   61         -
    /// This field is required.
   62         -
    pub fn source(mut self, input: crate::types::GuardrailImageSource) -> Self {
   63         -
        self.source = ::std::option::Option::Some(input);
   64         -
        self
   65         -
    }
   66         -
    /// <p>The image source (image bytes) details of the image blocked by the guardrail.</p>
   67         -
    pub fn set_source(mut self, input: ::std::option::Option<crate::types::GuardrailImageSource>) -> Self {
   68         -
        self.source = input;
   69         -
        self
   70         -
    }
   71         -
    /// <p>The image source (image bytes) details of the image blocked by the guardrail.</p>
   72         -
    pub fn get_source(&self) -> &::std::option::Option<crate::types::GuardrailImageSource> {
   73         -
        &self.source
   74         -
    }
   75         -
    /// Consumes the builder and constructs a [`GuardrailImageBlock`](crate::types::GuardrailImageBlock).
   76         -
    /// This method will fail if any of the following fields are not set:
   77         -
    /// - [`format`](crate::types::builders::GuardrailImageBlockBuilder::format)
   78         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailImageBlock, ::aws_smithy_types::error::operation::BuildError> {
   79         -
        ::std::result::Result::Ok(crate::types::GuardrailImageBlock {
   80         -
            format: self.format.ok_or_else(|| {
   81         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   82         -
                    "format",
   83         -
                    "format was not specified but it is required when building GuardrailImageBlock",
   84         -
                )
   85         -
            })?,
   86         -
            source: self.source,
   87         -
        })
   88         -
    }
   89         -
}
   90         -
impl ::std::fmt::Debug for GuardrailImageBlockBuilder {
   91         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
   92         -
        let mut formatter = f.debug_struct("GuardrailImageBlockBuilder");
   93         -
        formatter.field("format", &"*** Sensitive Data Redacted ***");
   94         -
        formatter.field("source", &"*** Sensitive Data Redacted ***");
   95         -
        formatter.finish()
   96         -
    }
   97         -
}

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

@@ -1,0 +72,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The details of the guardrail image coverage.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailImageCoverage {
    7         -
    /// <p>The count (integer) of images guardrails guarded.</p>
    8         -
    pub guarded: ::std::option::Option<i32>,
    9         -
    /// <p>Represents the total number of images (integer) that were in the request (guarded and unguarded).</p>
   10         -
    pub total: ::std::option::Option<i32>,
   11         -
}
   12         -
impl GuardrailImageCoverage {
   13         -
    /// <p>The count (integer) of images guardrails guarded.</p>
   14         -
    pub fn guarded(&self) -> ::std::option::Option<i32> {
   15         -
        self.guarded
   16         -
    }
   17         -
    /// <p>Represents the total number of images (integer) that were in the request (guarded and unguarded).</p>
   18         -
    pub fn total(&self) -> ::std::option::Option<i32> {
   19         -
        self.total
   20         -
    }
   21         -
}
   22         -
impl GuardrailImageCoverage {
   23         -
    /// Creates a new builder-style object to manufacture [`GuardrailImageCoverage`](crate::types::GuardrailImageCoverage).
   24         -
    pub fn builder() -> crate::types::builders::GuardrailImageCoverageBuilder {
   25         -
        crate::types::builders::GuardrailImageCoverageBuilder::default()
   26         -
    }
   27         -
}
   28         -
   29         -
/// A builder for [`GuardrailImageCoverage`](crate::types::GuardrailImageCoverage).
   30         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   31         -
#[non_exhaustive]
   32         -
pub struct GuardrailImageCoverageBuilder {
   33         -
    pub(crate) guarded: ::std::option::Option<i32>,
   34         -
    pub(crate) total: ::std::option::Option<i32>,
   35         -
}
   36         -
impl GuardrailImageCoverageBuilder {
   37         -
    /// <p>The count (integer) of images guardrails guarded.</p>
   38         -
    pub fn guarded(mut self, input: i32) -> Self {
   39         -
        self.guarded = ::std::option::Option::Some(input);
   40         -
        self
   41         -
    }
   42         -
    /// <p>The count (integer) of images guardrails guarded.</p>
   43         -
    pub fn set_guarded(mut self, input: ::std::option::Option<i32>) -> Self {
   44         -
        self.guarded = input;
   45         -
        self
   46         -
    }
   47         -
    /// <p>The count (integer) of images guardrails guarded.</p>
   48         -
    pub fn get_guarded(&self) -> &::std::option::Option<i32> {
   49         -
        &self.guarded
   50         -
    }
   51         -
    /// <p>Represents the total number of images (integer) that were in the request (guarded and unguarded).</p>
   52         -
    pub fn total(mut self, input: i32) -> Self {
   53         -
        self.total = ::std::option::Option::Some(input);
   54         -
        self
   55         -
    }
   56         -
    /// <p>Represents the total number of images (integer) that were in the request (guarded and unguarded).</p>
   57         -
    pub fn set_total(mut self, input: ::std::option::Option<i32>) -> Self {
   58         -
        self.total = input;
   59         -
        self
   60         -
    }
   61         -
    /// <p>Represents the total number of images (integer) that were in the request (guarded and unguarded).</p>
   62         -
    pub fn get_total(&self) -> &::std::option::Option<i32> {
   63         -
        &self.total
   64         -
    }
   65         -
    /// Consumes the builder and constructs a [`GuardrailImageCoverage`](crate::types::GuardrailImageCoverage).
   66         -
    pub fn build(self) -> crate::types::GuardrailImageCoverage {
   67         -
        crate::types::GuardrailImageCoverage {
   68         -
            guarded: self.guarded,
   69         -
            total: self.total,
   70         -
        }
   71         -
    }
   72         -
}

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

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

@@ -1,0 +43,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The image source (image bytes) of the guardrail image source. Object used in independent api.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
    6         -
pub enum GuardrailImageSource {
    7         -
    /// <p>The bytes details of the guardrail image source. Object used in independent api.</p>
    8         -
    Bytes(::aws_smithy_types::Blob),
    9         -
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
   10         -
    /// An unknown enum variant
   11         -
    ///
   12         -
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
   13         -
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
   14         -
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
   15         -
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
   16         -
    #[non_exhaustive]
   17         -
    Unknown,
   18         -
}
   19         -
impl GuardrailImageSource {
   20         -
    #[allow(irrefutable_let_patterns)]
   21         -
    /// Tries to convert the enum instance into [`Bytes`](crate::types::GuardrailImageSource::Bytes), extracting the inner [`Blob`](::aws_smithy_types::Blob).
   22         -
    /// Returns `Err(&Self)` if it can't be converted.
   23         -
    pub fn as_bytes(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
   24         -
        if let GuardrailImageSource::Bytes(val) = &self {
   25         -
            ::std::result::Result::Ok(val)
   26         -
        } else {
   27         -
            ::std::result::Result::Err(self)
   28         -
        }
   29         -
    }
   30         -
    /// Returns true if this is a [`Bytes`](crate::types::GuardrailImageSource::Bytes).
   31         -
    pub fn is_bytes(&self) -> bool {
   32         -
        self.as_bytes().is_ok()
   33         -
    }
   34         -
    /// Returns true if the enum instance is the `Unknown` variant.
   35         -
    pub fn is_unknown(&self) -> bool {
   36         -
        matches!(self, Self::Unknown)
   37         -
    }
   38         -
}
   39         -
impl ::std::fmt::Debug for GuardrailImageSource {
   40         -
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
   41         -
        ::std::write!(f, "*** Sensitive Data Redacted ***")
   42         -
    }
   43         -
}

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

@@ -1,0 +94,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The invocation metrics for the guardrail.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailInvocationMetrics {
    7         -
    /// <p>The processing latency details for the guardrail invocation metrics.</p>
    8         -
    pub guardrail_processing_latency: ::std::option::Option<i64>,
    9         -
    /// <p>The usage details for the guardrail invocation metrics.</p>
   10         -
    pub usage: ::std::option::Option<crate::types::GuardrailUsage>,
   11         -
    /// <p>The coverage details for the guardrail invocation metrics.</p>
   12         -
    pub guardrail_coverage: ::std::option::Option<crate::types::GuardrailCoverage>,
   13         -
}
   14         -
impl GuardrailInvocationMetrics {
   15         -
    /// <p>The processing latency details for the guardrail invocation metrics.</p>
   16         -
    pub fn guardrail_processing_latency(&self) -> ::std::option::Option<i64> {
   17         -
        self.guardrail_processing_latency
   18         -
    }
   19         -
    /// <p>The usage details for the guardrail invocation metrics.</p>
   20         -
    pub fn usage(&self) -> ::std::option::Option<&crate::types::GuardrailUsage> {
   21         -
        self.usage.as_ref()
   22         -
    }
   23         -
    /// <p>The coverage details for the guardrail invocation metrics.</p>
   24         -
    pub fn guardrail_coverage(&self) -> ::std::option::Option<&crate::types::GuardrailCoverage> {
   25         -
        self.guardrail_coverage.as_ref()
   26         -
    }
   27         -
}
   28         -
impl GuardrailInvocationMetrics {
   29         -
    /// Creates a new builder-style object to manufacture [`GuardrailInvocationMetrics`](crate::types::GuardrailInvocationMetrics).
   30         -
    pub fn builder() -> crate::types::builders::GuardrailInvocationMetricsBuilder {
   31         -
        crate::types::builders::GuardrailInvocationMetricsBuilder::default()
   32         -
    }
   33         -
}
   34         -
   35         -
/// A builder for [`GuardrailInvocationMetrics`](crate::types::GuardrailInvocationMetrics).
   36         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   37         -
#[non_exhaustive]
   38         -
pub struct GuardrailInvocationMetricsBuilder {
   39         -
    pub(crate) guardrail_processing_latency: ::std::option::Option<i64>,
   40         -
    pub(crate) usage: ::std::option::Option<crate::types::GuardrailUsage>,
   41         -
    pub(crate) guardrail_coverage: ::std::option::Option<crate::types::GuardrailCoverage>,
   42         -
}
   43         -
impl GuardrailInvocationMetricsBuilder {
   44         -
    /// <p>The processing latency details for the guardrail invocation metrics.</p>
   45         -
    pub fn guardrail_processing_latency(mut self, input: i64) -> Self {
   46         -
        self.guardrail_processing_latency = ::std::option::Option::Some(input);
   47         -
        self
   48         -
    }
   49         -
    /// <p>The processing latency details for the guardrail invocation metrics.</p>
   50         -
    pub fn set_guardrail_processing_latency(mut self, input: ::std::option::Option<i64>) -> Self {
   51         -
        self.guardrail_processing_latency = input;
   52         -
        self
   53         -
    }
   54         -
    /// <p>The processing latency details for the guardrail invocation metrics.</p>
   55         -
    pub fn get_guardrail_processing_latency(&self) -> &::std::option::Option<i64> {
   56         -
        &self.guardrail_processing_latency
   57         -
    }
   58         -
    /// <p>The usage details for the guardrail invocation metrics.</p>
   59         -
    pub fn usage(mut self, input: crate::types::GuardrailUsage) -> Self {
   60         -
        self.usage = ::std::option::Option::Some(input);
   61         -
        self
   62         -
    }
   63         -
    /// <p>The usage details for the guardrail invocation metrics.</p>
   64         -
    pub fn set_usage(mut self, input: ::std::option::Option<crate::types::GuardrailUsage>) -> Self {
   65         -
        self.usage = input;
   66         -
        self
   67         -
    }
   68         -
    /// <p>The usage details for the guardrail invocation metrics.</p>
   69         -
    pub fn get_usage(&self) -> &::std::option::Option<crate::types::GuardrailUsage> {
   70         -
        &self.usage
   71         -
    }
   72         -
    /// <p>The coverage details for the guardrail invocation metrics.</p>
   73         -
    pub fn guardrail_coverage(mut self, input: crate::types::GuardrailCoverage) -> Self {
   74         -
        self.guardrail_coverage = ::std::option::Option::Some(input);
   75         -
        self
   76         -
    }
   77         -
    /// <p>The coverage details for the guardrail invocation metrics.</p>
   78         -
    pub fn set_guardrail_coverage(mut self, input: ::std::option::Option<crate::types::GuardrailCoverage>) -> Self {
   79         -
        self.guardrail_coverage = input;
   80         -
        self
   81         -
    }
   82         -
    /// <p>The coverage details for the guardrail invocation metrics.</p>
   83         -
    pub fn get_guardrail_coverage(&self) -> &::std::option::Option<crate::types::GuardrailCoverage> {
   84         -
        &self.guardrail_coverage
   85         -
    }
   86         -
    /// Consumes the builder and constructs a [`GuardrailInvocationMetrics`](crate::types::GuardrailInvocationMetrics).
   87         -
    pub fn build(self) -> crate::types::GuardrailInvocationMetrics {
   88         -
        crate::types::GuardrailInvocationMetrics {
   89         -
            guardrail_processing_latency: self.guardrail_processing_latency,
   90         -
            usage: self.usage,
   91         -
            guardrail_coverage: self.guardrail_coverage,
   92         -
        }
   93         -
    }
   94         -
}