AWS SDK

AWS SDK

rev. ba98f30b52e51c6e715b0ae469e7a2e988c27d9a (ignoring whitespace)

Files changed:

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

@@ -1,0 +101,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The assessment for aPersonally Identifiable Information (PII) policy.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailSensitiveInformationPolicyAssessment {
    7         -
    /// <p>The PII entities in the assessment.</p>
    8         -
    pub pii_entities: ::std::vec::Vec<crate::types::GuardrailPiiEntityFilter>,
    9         -
    /// <p>The regex queries in the assessment.</p>
   10         -
    pub regexes: ::std::vec::Vec<crate::types::GuardrailRegexFilter>,
   11         -
}
   12         -
impl GuardrailSensitiveInformationPolicyAssessment {
   13         -
    /// <p>The PII entities in the assessment.</p>
   14         -
    pub fn pii_entities(&self) -> &[crate::types::GuardrailPiiEntityFilter] {
   15         -
        use std::ops::Deref;
   16         -
        self.pii_entities.deref()
   17         -
    }
   18         -
    /// <p>The regex queries in the assessment.</p>
   19         -
    pub fn regexes(&self) -> &[crate::types::GuardrailRegexFilter] {
   20         -
        use std::ops::Deref;
   21         -
        self.regexes.deref()
   22         -
    }
   23         -
}
   24         -
impl GuardrailSensitiveInformationPolicyAssessment {
   25         -
    /// Creates a new builder-style object to manufacture [`GuardrailSensitiveInformationPolicyAssessment`](crate::types::GuardrailSensitiveInformationPolicyAssessment).
   26         -
    pub fn builder() -> crate::types::builders::GuardrailSensitiveInformationPolicyAssessmentBuilder {
   27         -
        crate::types::builders::GuardrailSensitiveInformationPolicyAssessmentBuilder::default()
   28         -
    }
   29         -
}
   30         -
   31         -
/// A builder for [`GuardrailSensitiveInformationPolicyAssessment`](crate::types::GuardrailSensitiveInformationPolicyAssessment).
   32         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   33         -
#[non_exhaustive]
   34         -
pub struct GuardrailSensitiveInformationPolicyAssessmentBuilder {
   35         -
    pub(crate) pii_entities: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailPiiEntityFilter>>,
   36         -
    pub(crate) regexes: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailRegexFilter>>,
   37         -
}
   38         -
impl GuardrailSensitiveInformationPolicyAssessmentBuilder {
   39         -
    /// Appends an item to `pii_entities`.
   40         -
    ///
   41         -
    /// To override the contents of this collection use [`set_pii_entities`](Self::set_pii_entities).
   42         -
    ///
   43         -
    /// <p>The PII entities in the assessment.</p>
   44         -
    pub fn pii_entities(mut self, input: crate::types::GuardrailPiiEntityFilter) -> Self {
   45         -
        let mut v = self.pii_entities.unwrap_or_default();
   46         -
        v.push(input);
   47         -
        self.pii_entities = ::std::option::Option::Some(v);
   48         -
        self
   49         -
    }
   50         -
    /// <p>The PII entities in the assessment.</p>
   51         -
    pub fn set_pii_entities(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailPiiEntityFilter>>) -> Self {
   52         -
        self.pii_entities = input;
   53         -
        self
   54         -
    }
   55         -
    /// <p>The PII entities in the assessment.</p>
   56         -
    pub fn get_pii_entities(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailPiiEntityFilter>> {
   57         -
        &self.pii_entities
   58         -
    }
   59         -
    /// Appends an item to `regexes`.
   60         -
    ///
   61         -
    /// To override the contents of this collection use [`set_regexes`](Self::set_regexes).
   62         -
    ///
   63         -
    /// <p>The regex queries in the assessment.</p>
   64         -
    pub fn regexes(mut self, input: crate::types::GuardrailRegexFilter) -> Self {
   65         -
        let mut v = self.regexes.unwrap_or_default();
   66         -
        v.push(input);
   67         -
        self.regexes = ::std::option::Option::Some(v);
   68         -
        self
   69         -
    }
   70         -
    /// <p>The regex queries in the assessment.</p>
   71         -
    pub fn set_regexes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailRegexFilter>>) -> Self {
   72         -
        self.regexes = input;
   73         -
        self
   74         -
    }
   75         -
    /// <p>The regex queries in the assessment.</p>
   76         -
    pub fn get_regexes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailRegexFilter>> {
   77         -
        &self.regexes
   78         -
    }
   79         -
    /// Consumes the builder and constructs a [`GuardrailSensitiveInformationPolicyAssessment`](crate::types::GuardrailSensitiveInformationPolicyAssessment).
   80         -
    /// This method will fail if any of the following fields are not set:
   81         -
    /// - [`pii_entities`](crate::types::builders::GuardrailSensitiveInformationPolicyAssessmentBuilder::pii_entities)
   82         -
    /// - [`regexes`](crate::types::builders::GuardrailSensitiveInformationPolicyAssessmentBuilder::regexes)
   83         -
    pub fn build(
   84         -
        self,
   85         -
    ) -> ::std::result::Result<crate::types::GuardrailSensitiveInformationPolicyAssessment, ::aws_smithy_types::error::operation::BuildError> {
   86         -
        ::std::result::Result::Ok(crate::types::GuardrailSensitiveInformationPolicyAssessment {
   87         -
            pii_entities: self.pii_entities.ok_or_else(|| {
   88         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   89         -
                    "pii_entities",
   90         -
                    "pii_entities was not specified but it is required when building GuardrailSensitiveInformationPolicyAssessment",
   91         -
                )
   92         -
            })?,
   93         -
            regexes: self.regexes.ok_or_else(|| {
   94         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
   95         -
                    "regexes",
   96         -
                    "regexes was not specified but it is required when building GuardrailSensitiveInformationPolicyAssessment",
   97         -
                )
   98         -
            })?,
   99         -
        })
  100         -
    }
  101         -
}

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

@@ -1,0 +146,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>Configuration information for a guardrail that you use with the <code>ConverseStream</code> action.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailStreamConfiguration {
    7         -
    /// <p>The identifier for the guardrail.</p>
    8         -
    pub guardrail_identifier: ::std::string::String,
    9         -
    /// <p>The version of the guardrail.</p>
   10         -
    pub guardrail_version: ::std::string::String,
   11         -
    /// <p>The trace behavior for the guardrail.</p>
   12         -
    pub trace: crate::types::GuardrailTrace,
   13         -
    /// <p>The processing mode.</p>
   14         -
    /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
   15         -
    pub stream_processing_mode: crate::types::GuardrailStreamProcessingMode,
   16         -
}
   17         -
impl GuardrailStreamConfiguration {
   18         -
    /// <p>The identifier for the guardrail.</p>
   19         -
    pub fn guardrail_identifier(&self) -> &str {
   20         -
        use std::ops::Deref;
   21         -
        self.guardrail_identifier.deref()
   22         -
    }
   23         -
    /// <p>The version of the guardrail.</p>
   24         -
    pub fn guardrail_version(&self) -> &str {
   25         -
        use std::ops::Deref;
   26         -
        self.guardrail_version.deref()
   27         -
    }
   28         -
    /// <p>The trace behavior for the guardrail.</p>
   29         -
    pub fn trace(&self) -> &crate::types::GuardrailTrace {
   30         -
        &self.trace
   31         -
    }
   32         -
    /// <p>The processing mode.</p>
   33         -
    /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
   34         -
    pub fn stream_processing_mode(&self) -> &crate::types::GuardrailStreamProcessingMode {
   35         -
        &self.stream_processing_mode
   36         -
    }
   37         -
}
   38         -
impl GuardrailStreamConfiguration {
   39         -
    /// Creates a new builder-style object to manufacture [`GuardrailStreamConfiguration`](crate::types::GuardrailStreamConfiguration).
   40         -
    pub fn builder() -> crate::types::builders::GuardrailStreamConfigurationBuilder {
   41         -
        crate::types::builders::GuardrailStreamConfigurationBuilder::default()
   42         -
    }
   43         -
}
   44         -
   45         -
/// A builder for [`GuardrailStreamConfiguration`](crate::types::GuardrailStreamConfiguration).
   46         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   47         -
#[non_exhaustive]
   48         -
pub struct GuardrailStreamConfigurationBuilder {
   49         -
    pub(crate) guardrail_identifier: ::std::option::Option<::std::string::String>,
   50         -
    pub(crate) guardrail_version: ::std::option::Option<::std::string::String>,
   51         -
    pub(crate) trace: ::std::option::Option<crate::types::GuardrailTrace>,
   52         -
    pub(crate) stream_processing_mode: ::std::option::Option<crate::types::GuardrailStreamProcessingMode>,
   53         -
}
   54         -
impl GuardrailStreamConfigurationBuilder {
   55         -
    /// <p>The identifier for the guardrail.</p>
   56         -
    /// This field is required.
   57         -
    pub fn guardrail_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
   58         -
        self.guardrail_identifier = ::std::option::Option::Some(input.into());
   59         -
        self
   60         -
    }
   61         -
    /// <p>The identifier for the guardrail.</p>
   62         -
    pub fn set_guardrail_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
   63         -
        self.guardrail_identifier = input;
   64         -
        self
   65         -
    }
   66         -
    /// <p>The identifier for the guardrail.</p>
   67         -
    pub fn get_guardrail_identifier(&self) -> &::std::option::Option<::std::string::String> {
   68         -
        &self.guardrail_identifier
   69         -
    }
   70         -
    /// <p>The version of the guardrail.</p>
   71         -
    /// This field is required.
   72         -
    pub fn guardrail_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
   73         -
        self.guardrail_version = ::std::option::Option::Some(input.into());
   74         -
        self
   75         -
    }
   76         -
    /// <p>The version of the guardrail.</p>
   77         -
    pub fn set_guardrail_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
   78         -
        self.guardrail_version = input;
   79         -
        self
   80         -
    }
   81         -
    /// <p>The version of the guardrail.</p>
   82         -
    pub fn get_guardrail_version(&self) -> &::std::option::Option<::std::string::String> {
   83         -
        &self.guardrail_version
   84         -
    }
   85         -
    /// <p>The trace behavior for the guardrail.</p>
   86         -
    pub fn trace(mut self, input: crate::types::GuardrailTrace) -> Self {
   87         -
        self.trace = ::std::option::Option::Some(input);
   88         -
        self
   89         -
    }
   90         -
    /// <p>The trace behavior for the guardrail.</p>
   91         -
    pub fn set_trace(mut self, input: ::std::option::Option<crate::types::GuardrailTrace>) -> Self {
   92         -
        self.trace = input;
   93         -
        self
   94         -
    }
   95         -
    /// <p>The trace behavior for the guardrail.</p>
   96         -
    pub fn get_trace(&self) -> &::std::option::Option<crate::types::GuardrailTrace> {
   97         -
        &self.trace
   98         -
    }
   99         -
    /// <p>The processing mode.</p>
  100         -
    /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
  101         -
    pub fn stream_processing_mode(mut self, input: crate::types::GuardrailStreamProcessingMode) -> Self {
  102         -
        self.stream_processing_mode = ::std::option::Option::Some(input);
  103         -
        self
  104         -
    }
  105         -
    /// <p>The processing mode.</p>
  106         -
    /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
  107         -
    pub fn set_stream_processing_mode(mut self, input: ::std::option::Option<crate::types::GuardrailStreamProcessingMode>) -> Self {
  108         -
        self.stream_processing_mode = input;
  109         -
        self
  110         -
    }
  111         -
    /// <p>The processing mode.</p>
  112         -
    /// <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.</p>
  113         -
    pub fn get_stream_processing_mode(&self) -> &::std::option::Option<crate::types::GuardrailStreamProcessingMode> {
  114         -
        &self.stream_processing_mode
  115         -
    }
  116         -
    /// Consumes the builder and constructs a [`GuardrailStreamConfiguration`](crate::types::GuardrailStreamConfiguration).
  117         -
    /// This method will fail if any of the following fields are not set:
  118         -
    /// - [`guardrail_identifier`](crate::types::builders::GuardrailStreamConfigurationBuilder::guardrail_identifier)
  119         -
    /// - [`guardrail_version`](crate::types::builders::GuardrailStreamConfigurationBuilder::guardrail_version)
  120         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailStreamConfiguration, ::aws_smithy_types::error::operation::BuildError> {
  121         -
        ::std::result::Result::Ok(crate::types::GuardrailStreamConfiguration {
  122         -
            guardrail_identifier: self.guardrail_identifier.ok_or_else(|| {
  123         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
  124         -
                    "guardrail_identifier",
  125         -
                    "guardrail_identifier was not specified but it is required when building GuardrailStreamConfiguration",
  126         -
                )
  127         -
            })?,
  128         -
            guardrail_version: self.guardrail_version.ok_or_else(|| {
  129         -
                ::aws_smithy_types::error::operation::BuildError::missing_field(
  130         -
                    "guardrail_version",
  131         -
                    "guardrail_version was not specified but it is required when building GuardrailStreamConfiguration",
  132         -
                )
  133         -
            })?,
  134         -
            trace: self.trace.unwrap_or(
  135         -
                "disabled"
  136         -
                    .parse::<crate::types::GuardrailTrace>()
  137         -
                    .expect("static value validated to member"),
  138         -
            ),
  139         -
            stream_processing_mode: self.stream_processing_mode.unwrap_or(
  140         -
                "sync"
  141         -
                    .parse::<crate::types::GuardrailStreamProcessingMode>()
  142         -
                    .expect("static value validated to member"),
  143         -
            ),
  144         -
        })
  145         -
    }
  146         -
}

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

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

@@ -1,0 +89,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// <p>The text block to be evaluated by the guardrail.</p>
    4         -
#[non_exhaustive]
    5         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub struct GuardrailTextBlock {
    7         -
    /// <p>The input text details to be evaluated by the guardrail.</p>
    8         -
    pub text: ::std::string::String,
    9         -
    /// <p>The qualifiers describing the text block.</p>
   10         -
    pub qualifiers: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentQualifier>>,
   11         -
}
   12         -
impl GuardrailTextBlock {
   13         -
    /// <p>The input text details to be evaluated by the guardrail.</p>
   14         -
    pub fn text(&self) -> &str {
   15         -
        use std::ops::Deref;
   16         -
        self.text.deref()
   17         -
    }
   18         -
    /// <p>The qualifiers describing the text block.</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::GuardrailContentQualifier] {
   22         -
        self.qualifiers.as_deref().unwrap_or_default()
   23         -
    }
   24         -
}
   25         -
impl GuardrailTextBlock {
   26         -
    /// Creates a new builder-style object to manufacture [`GuardrailTextBlock`](crate::types::GuardrailTextBlock).
   27         -
    pub fn builder() -> crate::types::builders::GuardrailTextBlockBuilder {
   28         -
        crate::types::builders::GuardrailTextBlockBuilder::default()
   29         -
    }
   30         -
}
   31         -
   32         -
/// A builder for [`GuardrailTextBlock`](crate::types::GuardrailTextBlock).
   33         -
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   34         -
#[non_exhaustive]
   35         -
pub struct GuardrailTextBlockBuilder {
   36         -
    pub(crate) text: ::std::option::Option<::std::string::String>,
   37         -
    pub(crate) qualifiers: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentQualifier>>,
   38         -
}
   39         -
impl GuardrailTextBlockBuilder {
   40         -
    /// <p>The input text details to be evaluated by the guardrail.</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 input text details to be evaluated by the guardrail.</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 input text details to be evaluated by the guardrail.</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 qualifiers describing the text block.</p>
   60         -
    pub fn qualifiers(mut self, input: crate::types::GuardrailContentQualifier) -> 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 qualifiers describing the text block.</p>
   67         -
    pub fn set_qualifiers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentQualifier>>) -> Self {
   68         -
        self.qualifiers = input;
   69         -
        self
   70         -
    }
   71         -
    /// <p>The qualifiers describing the text block.</p>
   72         -
    pub fn get_qualifiers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GuardrailContentQualifier>> {
   73         -
        &self.qualifiers
   74         -
    }
   75         -
    /// Consumes the builder and constructs a [`GuardrailTextBlock`](crate::types::GuardrailTextBlock).
   76         -
    /// This method will fail if any of the following fields are not set:
   77         -
    /// - [`text`](crate::types::builders::GuardrailTextBlockBuilder::text)
   78         -
    pub fn build(self) -> ::std::result::Result<crate::types::GuardrailTextBlock, ::aws_smithy_types::error::operation::BuildError> {
   79         -
        ::std::result::Result::Ok(crate::types::GuardrailTextBlock {
   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 GuardrailTextBlock",
   84         -
                )
   85         -
            })?,
   86         -
            qualifiers: self.qualifiers,
   87         -
        })
   88         -
    }
   89         -
}

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

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

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

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

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

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

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

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

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

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